Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Add a new project to an empty eclipse workspace programatically (Again...)
Add a new project to an empty eclipse workspace programatically (Again...) [message #444277] Mon, 13 February 2006 12:44 Go to next message
Eclipse UserFriend
Originally posted by: droll.mail.telepac.pt

Hello!

I am doing an integration with eclipse. I have a .NET program that needs to
be integrated with eclipse.
I need to open a new eclipse workspace (in a specified path). When this
workspace is opened it has to have a specific project in the resources tree.
The difficult part is opening a workspace with a project in it, that doesn't
yet have metadata for it, and as so the project doesn't appear in the
resources tree...
To open eclipse in a new workspace I am using the "-data path" command, but
I don't know how to add the specified project (already inside the workspace
path) to the resources tree inside eclipse. The problem is that the metadata
for that workspace still doesn't contain the information regarding the new
project... So basically I want to open a new eclipse workspace with a
specified project in it (in the workspace path), programmatically. Anyone
knows how to do this?

Thanks!
Pedro
Re: Add a new project to an empty eclipse workspace programatically (Again...) [message #444319 is a reply to message #444277] Mon, 13 February 2006 17:48 Go to previous message
Aleksey Aristov is currently offline Aleksey AristovFriend
Messages: 17
Registered: July 2009
Junior Member
Hello!

Pedro Carrilho wrote:

> project... So basically I want to open a new eclipse workspace with a
> specified project in it (in the workspace path), programmatically. Anyone
> knows how to do this?
>
> Thanks!
> Pedro
>

If I understand you right - you must create required workspace resources. Here is a small code snippet,
that may give you a hint.


---
PlatformUI.getWorkbench().getProgressService().busyCursorWhi le(new IRunnableWithProgress()
{
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
{
try
{
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IProject project = root.getProject("project_name");

if (!project.exists())
project.create(monitor);

if (!project.isOpen())
project.open(monitor);
} catch (CoreException aEx)
{
throw new InvocationTargetException(aEx);
}
}
});
---



Aleksey Aristov

---
www.imedic.de
www.rcp-training.com
Previous Topic:How to get html from Browser widget?
Next Topic:Complete Skeleton for Newbie
Goto Forum:
  


Current Time: Tue Dec 10 19:17:50 GMT 2024

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

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

Back to the top