Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How to access all projects at runtime
How to access all projects at runtime [message #321198] Thu, 11 October 2007 03:25 Go to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

hello guys,
can anyone tell
how to retrieve current project name from runtime workspace ,
plz give detailed code.
i hve tried with
ResourcesPlugin.getWorkspace().getRoot().getProjects()
it is not giving project names or selected project.
can anybody give another solution.
Re: How to access all projects at runtime [message #321209 is a reply to message #321198] Thu, 11 October 2007 09:16 Go to previous messageGo to next message
Eclipse UserFriend
You were told to iterate through the IProject[] array returned from
ResourcesPlugin.getWorkspace().getRoot().getProjects()

Did you? did you ask each IProject for its name?

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Re: How to access all projects at runtime [message #321240 is a reply to message #321209] Fri, 12 October 2007 01:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

thanks for this , i hve tried with
ResourcesPlugin.getWorkspace().getRoot().getProjects()

i m now able to retrieve all project names,
can u tell me how how to retrieve current (i.e selected project on right click of which i m getting wizard) project name only.
Re: How to access all projects at runtime [message #322727 is a reply to message #321198] Tue, 27 November 2007 09:36 Go to previous message
Eclipse UserFriend
Originally posted by: msinghal.in.sopragroup.com

Hi Shubh,

This code snippet worked for me


TreeSelection tselection = (TreeSelection) selection;
TreePath[] treePathArr = tselection.getPaths();
if (treePathArr != null && treePathArr.length>0) {
if (treePathArr[0].getSegment(0) instanceof JavaProject) {
JavaProject jProject = (JavaProject) treePathArr[0].getSegment(0);
IProject iProject = jProject.getProject();
System.out.println(iProject.getName());
}}
Let me know if u encounter any prob

Regards
Mohit
Previous Topic:Where is my JFrame? (was Strange behavior when trying to debug my application within eclipse)
Next Topic:Third-party JARs in a separate plugin
Goto Forum:
  


Current Time: Wed Nov 05 10:51:39 EST 2025

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

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

Back to the top