How to get projects in workspace [message #4084] |
Tue, 22 April 2003 18:19 |
Eclipse User |
|
|
|
Originally posted by: berman.namreb.com
I am working on a plugin which needs to know the projects in the
workspace. I've found what I thought were the correct methods, but I'm
not having any luck. I also can't find an example which does what I'm
after.
I've been trying variations on
org.eclipse.core.resources.ResourcesPlugin.getWorkspace().ge tRoot().getProjects()
but it always ends up returning an array with no elements.
Any help or pointers would be greatly appreciated.
Thanks.
--Len
|
|
|
Re: How to get projects in workspace [message #4510 is a reply to message #4084] |
Tue, 22 April 2003 19:35 |
Eclipse User |
|
|
|
Originally posted by: amiramb.us.ibm.com
Hey, Len
This piece of code actually gets me all the names of projects which are
currently on the workbench. If I'm not mistaken I believe that I tryed it
your way some time ago and it didn't work either. After I devided the code
that you have into two, I was able to get the projects.
IWorkspace root = ResourcesPlugin.getWorkspace();
IProject[] projects = root.getRoot().getProjects();
String[] nameOfProjects = new String[projects.length];
for( int i =0; i < projects.length; i++)
{
nameOfProjects[i] = projects[i].getName();
}
projectsOnWorkbench = nameOfProjects;
}
Alfredo
Len Berman wrote:
> I am working on a plugin which needs to know the projects in the
> workspace. I've found what I thought were the correct methods, but I'm
> not having any luck. I also can't find an example which does what I'm
> after.
> I've been trying variations on
>
org.eclipse.core.resources.ResourcesPlugin.getWorkspace().ge tRoot().getProjects()
> but it always ends up returning an array with no elements.
> Any help or pointers would be greatly appreciated.
> Thanks.
> --Len
|
|
|
Re: How to get projects in workspace [message #33609 is a reply to message #4084] |
Thu, 15 May 2003 16:59 |
Eclipse User |
|
|
|
Originally posted by: chaves.nospam_inf.ufsc.br
Are you running your plug-in using Run->Run-time Workbench? If so, you
must beware that the workspace where you are running the new Eclipse
instance is not the same where you are developing your plug-ins. Are you
sure you have projects defined in the workspace configured in the Runtime
Workbench launch configuration?
Rafael
|
|
|
Powered by
FUDForum. Page generated in 0.02910 seconds