user2035039
user2035039

Reputation: 971

Gef: How to access GraphicalEditor instance from EditPart?

Inside an EditPart class, I need the instance of the GraphicalEditor this EditPart belongs to. What is the easiest way to do this without passing the required object to the EditPartFactories and on to the EditParts?

Upvotes: 0

Views: 154

Answers (1)

user2035039
user2035039

Reputation: 971

I found a solution to my problem: I can just access the EditPart via

Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().getActiveEditor();

This works because I can assume that the EditPart has focus when this code is executed, which I forgot to mention in my question.

Upvotes: 1

Related Questions