Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to get projects in workspace
How to get projects in workspace [message #4084] Tue, 22 April 2003 18:19 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
Previous Topic:Custom projects
Next Topic:Newbie Plugin Builder
Goto Forum:
  


Current Time: Wed Jul 24 13:15:18 GMT 2024

Powered by FUDForum. Page generated in 0.04208 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top