Search code examples
eclipseeclipse-pluginjfaceeclipse-pde

IContainer.findMember(IPath arg0) not working


I am trying to make an eclipse plugin for creation of a file, I was able to get some reference from the template code that is there in eclipse. however, when I use findMember function to check if the package exists, It is returning null. I am sure that the folder structure is present in the directory. I am really new to eclipse plugin development and any help would be really appreciated.

Adding code and folder structure below

String locationString="/demo_package";
IPath path = new Path(locationString);
IResource container = ResourcesPlugin.getWorkspace().getRoot().findMember(path);

Folder Structure: Folder Structure picture


Solution

  • findMember will only return things created using the Eclipse APIs, it will not find a plain folder you created some other way unless you do a IResource.refreshLocal.

    In any case only projects can be at the top level of a workspace.

    If your plugin wants to store data it should be in the plug-in "state location" returned by Platform.getStateLocation which is in the workspace metadata.