SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


Get an IFile for a Workspace relative path

    Path path = new Path(filename);
    IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);

    // retrieve the full system path:
    String osfile = file.getRawLocation().toOSString();

Modifying a resource

java.lang.illegalargumentexception: Attempted to beginRule: R/, does not match outer scope rule: project open

ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(project);

VM Shutdown Hook

Run after a System.exit(..) call or the termination of the program (when no non-deamon thread is running anymore).

      Runtime.getRuntime().addShutdownHook(new Thread() {
        public void run() {
          System.out.println("System is shutting down");
        }
      };

Ant Eclipse integration: project relative path, refresh local, incremental build

Converts a file system path to a resource path or vice-versa. The resulting value is assigned to the given property.

<eclipse.convertPath resourcePath="MyProject/MyFile" property="myPath"/>

More on Eclipse Ant tasks: ant eclipse tasks, e.g. eclipse.refreshLocal, eclipse.incrementalBuild

service/knowhow/eclipse/ifile.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2024