[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: How to get the main Editor from an EditPart

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


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

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().getActivePage().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.