Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How to get the project name in workspace in eclipse?(How to get the project name in workspace in eclipse?)
icon1.gif  How to get the project name in workspace in eclipse? [message #644976] Tue, 14 December 2010 21:46 Go to next message
Eclipse UserFriend
Hi,
I want to get the file in the project in the workspace when eclipse is run time.
But I don't know how to get?

Thanks in advance!
Re: How to get the project name in workspace in eclipse? [message #644986 is a reply to message #644976] Wed, 15 December 2010 00:49 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
It is a plug-in project.
I open two eclipse environments.
one is main environment.
the other is run time eclipse environment.
In run time eclipse environment, I have a project.
In the main environment, I want to access the file in the project in run time eclipse environment.
How to do it?

Thanks!
Re: How to get the project name in workspace in eclipse? [message #644987 is a reply to message #644976] Wed, 15 December 2010 01:10 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
It is a plug-in project.
I open two eclipse environments.
one is main environment.
the other is run time eclipse environment.
In run time eclipse environment, I have a project.
In the main environment, I want to access the file in the project in run time eclipse environment.
How to do it?

Thanks!
Re: How to get the project name in workspace in eclipse? [message #645050 is a reply to message #644987] Wed, 15 December 2010 06:41 Go to previous messageGo to next message
Eclipse UserFriend
Use the following code in your plug-in project:

Quote:
// Get the root of the workspace
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();

// Get the project (in the workspace) we want
IProject project = root.getProject( projectName);


For more information, these two tutorials are just what you need:

Eclipse Corner Articles: Abstract Syntax Tree
Eclipse JDT - Abstract Syntax Tree (AST) and the Java Model - Tutorial

[Updated on: Wed, 15 December 2010 06:42] by Moderator

Re: How to get the project name in workspace in eclipse? [message #645219 is a reply to message #645050] Wed, 15 December 2010 20:39 Go to previous messageGo to next message
Eclipse UserFriend
Thanks!
what you say is correct!
But I want to get the file in the project when the project is in run status in eclipse!
So how to get the project object in run status?
Re: How to get the project name in workspace in eclipse? [message #645394 is a reply to message #645219] Thu, 16 December 2010 20:46 Go to previous messageGo to next message
Eclipse UserFriend
The problem is resolved! Laughing
Re: How to get the project name in workspace in eclipse? [message #645554 is a reply to message #645394] Fri, 17 December 2010 16:42 Go to previous message
Eclipse UserFriend
The plugin you program, will only be integrated in the new "Run" instance of Eclipse, so, you will actually be accessing the projects in the "Run" instance.
Previous Topic:Getting an error when trying to create a java project programmatically
Next Topic:What is inner class emulation?
Goto Forum:
  


Current Time: Tue Nov 04 00:38:08 EST 2025

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

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

Back to the top