Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Open an editor from an action
Open an editor from an action [message #158855] Thu, 08 November 2007 11:29 Go to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

Hi all!

What would be the correct way to initialize an editor from an action
(ex. a popup action)


Best Regards,

Tomas Zijdemans
Re: Open an editor from an action [message #158903 is a reply to message #158855] Thu, 08 November 2007 11:59 Go to previous messageGo to next message
Boris Blajer is currently offline Boris BlajerFriend
Messages: 217
Registered: July 2009
Senior Member
Hi Tomas,

Take a look at the generated XYZDiagramEditorUtil.openDiagram(Resource)
method.

Best regards,
Boris

Tomas Zijdemans wrote:
> Hi all!
>
> What would be the correct way to initialize an editor from an action
> (ex. a popup action)
>
>
> Best Regards,
>
> Tomas Zijdemans
Re: Open an editor from an action [message #158925 is a reply to message #158903] Thu, 08 November 2007 12:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

Thanks Boris.

Though I am a bit confused. The method looks like this:

IWorkbenchPage page = PlatformUI.getWorkbench()
..getActiveWorkbenchWindow().getActivePage();
page.openEditor(new URIEditorInput(diagram.getURI()), XYZDiagramEditor.ID);

Should it be called with a valid resource, or should I mimic it's
behaviour (copy/paste).

Thanks,

Tomas Zijdemans


Boris Blajer wrote:
> Hi Tomas,
>
> Take a look at the generated XYZDiagramEditorUtil.openDiagram(Resource)
> method.
>
> Best regards,
> Boris
>
> Tomas Zijdemans wrote:
>> Hi all!
>>
>> What would be the correct way to initialize an editor from an action
>> (ex. a popup action)
>>
>>
>> Best Regards,
>>
>> Tomas Zijdemans
Re: Open an editor from an action [message #158933 is a reply to message #158925] Thu, 08 November 2007 12:35 Go to previous messageGo to next message
Boris Blajer is currently offline Boris BlajerFriend
Messages: 217
Registered: July 2009
Senior Member
Hi Tomas,

Probably, I have misunderstood you. I have assumed that you have a
resource or at least URI thereof (in the latter case, you should create
a new editing domain and load the resource with this URI into its
resource set). Was my assumption correct?

Best regards,
Boris


Tomas Zijdemans wrote:
> Thanks Boris.
>
> Though I am a bit confused. The method looks like this:
>
> IWorkbenchPage page = PlatformUI.getWorkbench()
> ..getActiveWorkbenchWindow().getActivePage();
> page.openEditor(new URIEditorInput(diagram.getURI()), XYZDiagramEditor.ID);
>
> Should it be called with a valid resource, or should I mimic it's
> behaviour (copy/paste).
>
> Thanks,
>
> Tomas Zijdemans
>
>
> Boris Blajer wrote:
>> Hi Tomas,
>>
>> Take a look at the generated
>> XYZDiagramEditorUtil.openDiagram(Resource) method.
>>
>> Best regards,
>> Boris
>>
>> Tomas Zijdemans wrote:
>>> Hi all!
>>>
>>> What would be the correct way to initialize an editor from an action
>>> (ex. a popup action)
>>>
>>>
>>> Best Regards,
>>>
>>> Tomas Zijdemans
Re: Open an editor from an action [message #158962 is a reply to message #158933] Thu, 08 November 2007 13:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

Well basically what I want to do, is add a new action to a model
elements popup that initializes a new diagram of some type. The best
thing would be if it just executed the code that gets executed when one
creates a new diagram from the file menu.

That should be pretty straight forward? (Initializing it with no
questions asked would be even better)

I found this, but I am unsure about the procedure:

http://wiki.eclipse.org/index.php/GMF_Archived_Newsgroup_Q&a mp;A#How_can_I_open_an_editor_by_double-clicking_a_compartme nt.3F



Boris Blajer wrote:
> Hi Tomas,
>
> Probably, I have misunderstood you. I have assumed that you have a
> resource or at least URI thereof (in the latter case, you should create
> a new editing domain and load the resource with this URI into its
> resource set). Was my assumption correct?
>
> Best regards,
> Boris
>
>
> Tomas Zijdemans wrote:
>> Thanks Boris.
>>
>> Though I am a bit confused. The method looks like this:
>>
>> IWorkbenchPage page = PlatformUI.getWorkbench()
>> ..getActiveWorkbenchWindow().getActivePage();
>> page.openEditor(new URIEditorInput(diagram.getURI()),
>> XYZDiagramEditor.ID);
>>
>> Should it be called with a valid resource, or should I mimic it's
>> behaviour (copy/paste).
>>
>> Thanks,
>>
>> Tomas Zijdemans
>>
>>
>> Boris Blajer wrote:
>>> Hi Tomas,
>>>
>>> Take a look at the generated
>>> XYZDiagramEditorUtil.openDiagram(Resource) method.
>>>
>>> Best regards,
>>> Boris
>>>
>>> Tomas Zijdemans wrote:
>>>> Hi all!
>>>>
>>>> What would be the correct way to initialize an editor from an action
>>>> (ex. a popup action)
>>>>
>>>>
>>>> Best Regards,
>>>>
>>>> Tomas Zijdemans
Re: Open an editor from an action [message #158985 is a reply to message #158962] Thu, 08 November 2007 14:07 Go to previous messageGo to next message
Boris Blajer is currently offline Boris BlajerFriend
Messages: 217
Registered: July 2009
Senior Member
Hi Tomas,

This is a common task that is supported by GMF with no need for
hand-written code. Please search for "OpenDiagramBehavior" in the
newsgroup, since this topic is not discussed in details in the wiki.

Best regards,
Boris


Tomas Zijdemans wrote:
> Well basically what I want to do, is add a new action to a model
> elements popup that initializes a new diagram of some type. The best
> thing would be if it just executed the code that gets executed when one
> creates a new diagram from the file menu.
>
> That should be pretty straight forward? (Initializing it with no
> questions asked would be even better)
>
> I found this, but I am unsure about the procedure:
>
> http://wiki.eclipse.org/index.php/GMF_Archived_Newsgroup_Q&a mp;A#How_can_I_open_an_editor_by_double-clicking_a_compartme nt.3F
>
>
>
>
> Boris Blajer wrote:
>> Hi Tomas,
>>
>> Probably, I have misunderstood you. I have assumed that you have a
>> resource or at least URI thereof (in the latter case, you should
>> create a new editing domain and load the resource with this URI into
>> its resource set). Was my assumption correct?
>>
>> Best regards,
>> Boris
>>
>>
>> Tomas Zijdemans wrote:
>>> Thanks Boris.
>>>
>>> Though I am a bit confused. The method looks like this:
>>>
>>> IWorkbenchPage page = PlatformUI.getWorkbench()
>>> ..getActiveWorkbenchWindow().getActivePage();
>>> page.openEditor(new URIEditorInput(diagram.getURI()),
>>> XYZDiagramEditor.ID);
>>>
>>> Should it be called with a valid resource, or should I mimic it's
>>> behaviour (copy/paste).
>>>
>>> Thanks,
>>>
>>> Tomas Zijdemans
>>>
>>>
>>> Boris Blajer wrote:
>>>> Hi Tomas,
>>>>
>>>> Take a look at the generated
>>>> XYZDiagramEditorUtil.openDiagram(Resource) method.
>>>>
>>>> Best regards,
>>>> Boris
>>>>
>>>> Tomas Zijdemans wrote:
>>>>> Hi all!
>>>>>
>>>>> What would be the correct way to initialize an editor from an
>>>>> action (ex. a popup action)
>>>>>
>>>>>
>>>>> Best Regards,
>>>>>
>>>>> Tomas Zijdemans
Re: Open an editor from an action [message #164367 is a reply to message #158985] Wed, 05 December 2007 13:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: trommas.yahoo.com

I've implemented OpenDiagram behavior (using double click behavior from
diagram partitioning). I also need to start up an editor from a popup
action. Is it possible to do this?

Any help, and especially code snippets, appreciated :)

Best Regards,

Tomas Zijdemans


Boris Blajer wrote:
> Hi Tomas,
>
> This is a common task that is supported by GMF with no need for
> hand-written code. Please search for "OpenDiagramBehavior" in the
> newsgroup, since this topic is not discussed in details in the wiki.
>
> Best regards,
> Boris
>
>
> Tomas Zijdemans wrote:
>> Well basically what I want to do, is add a new action to a model
>> elements popup that initializes a new diagram of some type. The best
>> thing would be if it just executed the code that gets executed when
>> one creates a new diagram from the file menu.
>>
>> That should be pretty straight forward? (Initializing it with no
>> questions asked would be even better)
>>
>> I found this, but I am unsure about the procedure:
>>
>> http://wiki.eclipse.org/index.php/GMF_Archived_Newsgroup_Q&a mp;A#How_can_I_open_an_editor_by_double-clicking_a_compartme nt.3F
>>
>>
>>
>>
>> Boris Blajer wrote:
>>> Hi Tomas,
>>>
>>> Probably, I have misunderstood you. I have assumed that you have a
>>> resource or at least URI thereof (in the latter case, you should
>>> create a new editing domain and load the resource with this URI into
>>> its resource set). Was my assumption correct?
>>>
>>> Best regards,
>>> Boris
>>>
>>>
>>> Tomas Zijdemans wrote:
>>>> Thanks Boris.
>>>>
>>>> Though I am a bit confused. The method looks like this:
>>>>
>>>> IWorkbenchPage page = PlatformUI.getWorkbench()
>>>> ..getActiveWorkbenchWindow().getActivePage();
>>>> page.openEditor(new URIEditorInput(diagram.getURI()),
>>>> XYZDiagramEditor.ID);
>>>>
>>>> Should it be called with a valid resource, or should I mimic it's
>>>> behaviour (copy/paste).
>>>>
>>>> Thanks,
>>>>
>>>> Tomas Zijdemans
>>>>
>>>>
>>>> Boris Blajer wrote:
>>>>> Hi Tomas,
>>>>>
>>>>> Take a look at the generated
>>>>> XYZDiagramEditorUtil.openDiagram(Resource) method.
>>>>>
>>>>> Best regards,
>>>>> Boris
>>>>>
>>>>> Tomas Zijdemans wrote:
>>>>>> Hi all!
>>>>>>
>>>>>> What would be the correct way to initialize an editor from an
>>>>>> action (ex. a popup action)
>>>>>>
>>>>>>
>>>>>> Best Regards,
>>>>>>
>>>>>> Tomas Zijdemans
Re: Open an editor from an action [message #164913 is a reply to message #164367] Mon, 10 December 2007 17:38 Go to previous message
Boris Blajer is currently offline Boris BlajerFriend
Messages: 217
Registered: July 2009
Senior Member
Hi Tomas,

If your node has the OpenDiagram behavior installed, and the action
should be invocable on the EditPart, you may simply obtain an instance
of the edit part (e.g., from IStructuredSelection) and execute
editPart.performRequest(new Request(RequestConstants.REQ_OPEN)) on it.

Best regards,
Boris


Tomas Zijdemans wrote:
> I've implemented OpenDiagram behavior (using double click behavior from
> diagram partitioning). I also need to start up an editor from a popup
> action. Is it possible to do this?
>
> Any help, and especially code snippets, appreciated :)
>
> Best Regards,
>
> Tomas Zijdemans
>
>
> Boris Blajer wrote:
>> Hi Tomas,
>>
>> This is a common task that is supported by GMF with no need for
>> hand-written code. Please search for "OpenDiagramBehavior" in the
>> newsgroup, since this topic is not discussed in details in the wiki.
>>
>> Best regards,
>> Boris
>>
>>
>> Tomas Zijdemans wrote:
>>> Well basically what I want to do, is add a new action to a model
>>> elements popup that initializes a new diagram of some type. The best
>>> thing would be if it just executed the code that gets executed when
>>> one creates a new diagram from the file menu.
>>>
>>> That should be pretty straight forward? (Initializing it with no
>>> questions asked would be even better)
>>>
>>> I found this, but I am unsure about the procedure:
>>>
>>> http://wiki.eclipse.org/index.php/GMF_Archived_Newsgroup_Q&a mp;A#How_can_I_open_an_editor_by_double-clicking_a_compartme nt.3F
>>>
>>>
>>>
>>>
>>> Boris Blajer wrote:
>>>> Hi Tomas,
>>>>
>>>> Probably, I have misunderstood you. I have assumed that you have a
>>>> resource or at least URI thereof (in the latter case, you should
>>>> create a new editing domain and load the resource with this URI into
>>>> its resource set). Was my assumption correct?
>>>>
>>>> Best regards,
>>>> Boris
>>>>
>>>>
>>>> Tomas Zijdemans wrote:
>>>>> Thanks Boris.
>>>>>
>>>>> Though I am a bit confused. The method looks like this:
>>>>>
>>>>> IWorkbenchPage page = PlatformUI.getWorkbench()
>>>>> ..getActiveWorkbenchWindow().getActivePage();
>>>>> page.openEditor(new URIEditorInput(diagram.getURI()),
>>>>> XYZDiagramEditor.ID);
>>>>>
>>>>> Should it be called with a valid resource, or should I mimic it's
>>>>> behaviour (copy/paste).
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Tomas Zijdemans
>>>>>
>>>>>
>>>>> Boris Blajer wrote:
>>>>>> Hi Tomas,
>>>>>>
>>>>>> Take a look at the generated
>>>>>> XYZDiagramEditorUtil.openDiagram(Resource) method.
>>>>>>
>>>>>> Best regards,
>>>>>> Boris
>>>>>>
>>>>>> Tomas Zijdemans wrote:
>>>>>>> Hi all!
>>>>>>>
>>>>>>> What would be the correct way to initialize an editor from an
>>>>>>> action (ex. a popup action)
>>>>>>>
>>>>>>>
>>>>>>> Best Regards,
>>>>>>>
>>>>>>> Tomas Zijdemans
Previous Topic:RCP problem
Next Topic:Create child view without serialization of the correspondant Element
Goto Forum:
  


Current Time: Thu Sep 19 07:37:47 GMT 2024

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

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

Back to the top