Need to get the Project name in which I am currently working in [message #196107] |
Fri, 16 September 2005 11:44 |
Eclipse User |
|
|
|
Originally posted by: seshasai.aesv.softwareag.com
I need to get the name of the Project which I am working in so that I can
save the various files which I create in the GEF application.
I tried this but :(
IWorkspace myWorkspaceRoot =
ResourcesPlugin.getWorkspace().getRoot().getWorkspace();
IProject myWebProject = myWorkspaceRoot.getProject();
Please help
Sai
|
|
|
Re: Need to get the Project name in which I am currently working in [message #196128 is a reply to message #196107] |
Fri, 16 September 2005 13:32 |
Eclipse User |
|
|
|
Originally posted by: sunil_kamath.nohotspammail.com
"Sai" <seshasai.aesv@softwareag.com> wrote in message
news:9371069b5be1bf6bc4a91239a0a3d70d$1@www.eclipse.org...
>I need to get the name of the Project which I am working in so that I can
>save the various files which I create in the GEF application.
> I tried this but :(
>
> IWorkspace myWorkspaceRoot =
> ResourcesPlugin.getWorkspace().getRoot().getWorkspace();
>
> IProject myWebProject = myWorkspaceRoot.getProject();
>
There is no such thing as "the project in which you are working".
You could have multiple projects open and be working in all of them.
What you *can* do is get the IProject of a specific IResource.
So, what you should do is determine the IFile for your GEF diagram (you can
get it from ((IFileEditorInput)getEditorInput()).getFile(), and then call
getProject().
---
Sunil
|
|
|
|
|
|
Re: Need to get the Project name in which I am currently working in [message #196348 is a reply to message #196128] |
Sun, 18 September 2005 08:39 |
Eclipse User |
|
|
|
Originally posted by: mvsteenbergen.eljakim.scratch-this.nl
Sunil Kamath wrote:
> So, what you should do is determine the IFile for your GEF diagram (you can
> get it from ((IFileEditorInput)getEditorInput()).getFile(), and then call
> getProject().
Note that this will throw a ClassCastException if you're not careful
when you open a file outside your workspace in your graphical editor.
Martijn.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03914 seconds