Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Accessing Underlying Objects from outside the Canvas
Accessing Underlying Objects from outside the Canvas [message #198142] Mon, 21 July 2008 17:19 Go to next message
Eclipse UserFriend
Originally posted by: wayneage.gmail.com

Hi,
I am wondering if it is possible to access the model objects from say a
menu, or even a button on the pallete.
I know you can do this from the canvas with edit policys and such, this
makes sense becasue the request origninates from the graphical element and
you can access it's model part, and therefore the other model objects.

But can this be done outside the canvas?

Any help is appreciated,
Wayne
Re: Accessing Underlying Objects from outside the Canvas [message #198191 is a reply to message #198142] Tue, 22 July 2008 02:14 Go to previous message
Eclipse UserFriend
Originally posted by: lifesting.gmail.com

wayneage wrote:
> Hi,
> I am wondering if it is possible to access the model objects from say a
> menu, or even a button on the pallete.
> I know you can do this from the canvas with edit policys and such, this
> makes sense becasue the request origninates from the graphical element
> and you can access it's model part, and therefore the other model objects.
>
> But can this be done outside the canvas?
>
> Any help is appreciated,
> Wayne
>
maybe you can do it like the method below:

in a view:

IEditorPart editor = getSite().getPage.getActiveEditor();

in a delegate action (org.eclipse.ui.actionSet/popmenu):

IEditorPart editor = workbenchWindow.getActivePage().getActiveEditor();

if (editor instanceof DiagramDocumentEditor)
{
GraphicalViewer gviewer = ((GraphicalEditor)editor).getGraphicalViewer();
List selection = gviewer.getSelectedEditParts();
for (Iterator ite = selection.iterator(); ite.hasNext();)
{
View notation = ite.next(); //must be View in a GMF editor.
EObject biz_model = motation.getElement();
anyReadOnlyActionOnModel(biz_model);
}
}
Previous Topic:href of elements changes when saving GMF editor
Next Topic:Fixed size Diagram Editor
Goto Forum:
  


Current Time: Mon May 25 05:22:19 GMT 2020

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

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

Back to the top