Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Connecting Editor to Nature (or IWorkspace)?
Connecting Editor to Nature (or IWorkspace)? [message #148468] Thu, 23 October 2003 11:03 Go to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.Rigidsoftware.com

What is the best way to connect my Editor to the Project Nature? It seems
as if my only connection is through the IEditorInput? And only when that
IEditorInput contains an IResource? (The IResource gets me the IWorkspace
which then gets me eventually to the IProjectNature)

This being true, is it OK to then store a reference to my Project nature
that I retrieve through the IResource, in my Editor for later use?

I noticed that the logic example hinted that the workspace for an editor
is never changed!? If this is true, is their another way to get at the
workspace? Perhaps the Editor already knows its workspace?


thanks for the tips!


CL
Re: Connecting Editor to Nature (or IWorkspace)? [message #148661 is a reply to message #148468] Thu, 23 October 2003 14:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: John_Arthorne.oti.com_

A nature instance is valid until the project is closed, deleted, or the
nature is removed from the project. So, you can maintain a reference to
a nature, and assume it is valid if none of the above events occur. As
for accessing the workspace, there is only ever one workspace, and you
can access it using ResourcesPlugin.getWorkspace(). Not much need to
cache it yourself.
--

CL [dnoyeB] Gilbert wrote:
> What is the best way to connect my Editor to the Project Nature? It seems
> as if my only connection is through the IEditorInput? And only when that
> IEditorInput contains an IResource? (The IResource gets me the IWorkspace
> which then gets me eventually to the IProjectNature)
>
> This being true, is it OK to then store a reference to my Project nature
> that I retrieve through the IResource, in my Editor for later use?
>
> I noticed that the logic example hinted that the workspace for an editor
> is never changed!? If this is true, is their another way to get at the
> workspace? Perhaps the Editor already knows its workspace?
>
>
> thanks for the tips!
>
>
> CL
Re: Connecting Editor to Nature (or IWorkspace)? [message #148848 is a reply to message #148661] Thu, 23 October 2003 18:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.Rigidsoftware.com

On Thu, 23 Oct 2003 14:09:00 -0400, John Arthorne wrote:

> A nature instance is valid until the project is closed, deleted, or the
> nature is removed from the project. So, you can maintain a reference to a
> nature, and assume it is valid if none of the above events occur. As for
> accessing the workspace, there is only ever one workspace, and you can
> access it using ResourcesPlugin.getWorkspace(). Not much need to cache it
> yourself.
> --
>
> CL [dnoyeB] Gilbert wrote:
>> What is the best way to connect my Editor to the Project Nature? It
>> seems as if my only connection is through the IEditorInput? And only
>> when that IEditorInput contains an IResource? (The IResource gets me the
>> IWorkspace which then gets me eventually to the IProjectNature)
>>
>> This being true, is it OK to then store a reference to my Project nature
>> that I retrieve through the IResource, in my Editor for later use?
>>
>> I noticed that the logic example hinted that the workspace for an editor
>> is never changed!? If this is true, is their another way to get at the
>> workspace? Perhaps the Editor already knows its workspace?
>>
>>
>> thanks for the tips!
>>
>>
>> CL


Great! I assume that the views close when the project is closed? or do I
have to listen and close them myself?


CL
Re: Connecting Editor to Nature (or IWorkspace)? [message #148856 is a reply to message #148661] Thu, 23 October 2003 19:40 Go to previous message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.Rigidsoftware.com

On Thu, 23 Oct 2003 14:09:00 -0400, John Arthorne wrote:

> A nature instance is valid until the project is closed, deleted, or the
> nature is removed from the project. So, you can maintain a reference to
> a nature, and assume it is valid if none of the above events occur. As
> for accessing the workspace, there is only ever one workspace, and you
> can access it using ResourcesPlugin.getWorkspace(). Not much need to
> cache it yourself.
> --
>
>
Unfortunately since I am trying to get at my nature, I will need a
resource from the actual project. Using the static method the only
resource I can get is the workspaceroot, and that will always return null
for the project.

So I have to use the IEditorInput and grab the file from it, and using
that file I can get at the project.

So Im good now!


Thanks!


CL
Previous Topic:Default settings for new Projects
Next Topic:How can I make my gef editor to an end-user version?
Goto Forum:
  


Current Time: Mon Jun 02 16:08:58 EDT 2025

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

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

Back to the top