Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to get the main Editor from an EditPart
How to get the main Editor from an EditPart [message #212879] Fri, 05 December 2008 19:31 Go to next message
Eclipse UserFriend
Originally posted by: nuclearpsyche.gmail.com

Hi,

I have a combined GMF/EMF editor and I would like to access my XYEditor
instance from a LinkEditPart.
How can I do that?
I don't think getParent() in the EditPart will do the job.
Thanks for your help!

Regards,

tamer

ps: my LinkEditPart object is just a diagram element that represents a
link between two nodes.
Re: How to get the main Editor from an EditPart [message #212914 is a reply to message #212879] Sun, 07 December 2008 22:57 Go to previous messageGo to next message
Ugo Sangiorgi is currently offline Ugo SangiorgiFriend
Messages: 44
Registered: July 2009
Member
I guess you cant access from an editpart..
but you can do this:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getActiveEditor()

Tamer escreveu:
> Hi,
>
> I have a combined GMF/EMF editor and I would like to access my XYEditor
> instance from a LinkEditPart.
> How can I do that?
> I don't think getParent() in the EditPart will do the job.
> Thanks for your help!
>
> Regards,
>
> tamer
>
> ps: my LinkEditPart object is just a diagram element that represents a
> link between two nodes.
Re: How to get the main Editor from an EditPart [message #212930 is a reply to message #212914] Mon, 08 December 2008 10:21 Go to previous message
Eclipse UserFriend
Originally posted by: descipar.gmail.com

You could try:
(but change to your EditParts of course)


EditPartViewer targetEditPartViewer = buildingGridEditPart.getViewer();
IEditorReference editorReferences[] =
workbench.getActiveWorkbenchWindow().getActivePage().getEdit orReferences();

for (int i = 0; i < editorReferences.length; i++) {
IEditorPart editor = editorReferences[i].getEditor(false);
if (editor instanceof GraphicalEditor) {
GraphicalEditor graphicalEditor = (GraphicalEditor) editor;
EditPartViewer anEditPartViewer = (EditPartViewer)
graphicalEditor.getAdapter(GraphicalViewer.class);
if (targetEditPartViewer.equals(anEditPartViewer)) {
gridDiagramEditor = (GridConfigurationDiagramEditor) editor;
//System.out.println("Found the editor");//$NON-NLS-1$
}
}
}


Ugo Sangiorgi wrote:
> I guess you cant access from an editpart..
> but you can do this:
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getActiveEditor()
>
>
> Tamer escreveu:
>> Hi,
>>
>> I have a combined GMF/EMF editor and I would like to access my
>> XYEditor instance from a LinkEditPart.
>> How can I do that?
>> I don't think getParent() in the EditPart will do the job.
>> Thanks for your help!
>>
>> Regards,
>>
>> tamer
>>
>> ps: my LinkEditPart object is just a diagram element that represents a
>> link between two nodes.
Previous Topic:How does code generation and custom code co-exist in a normal project?
Next Topic:many small questions
Goto Forum:
  


Current Time: Fri Apr 19 23:18:43 GMT 2024

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

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

Back to the top