How to get the main Editor from an EditPart [message #212879] |
Fri, 05 December 2008 19:31 |
Eclipse User |
|
|
|
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 #212930 is a reply to message #212914] |
Mon, 08 December 2008 10:21 |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.02570 seconds