Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Get EditPart from Impl
Get EditPart from Impl [message #717190] Fri, 19 August 2011 14:47 Go to next message
vincent988923 is currently offline vincent988923Friend
Messages: 29
Registered: June 2011
Junior Member
Hi. Do you guys know how can I get the EditPart from its correspondent Impl model? Actually, I should change some attributes in run time, so I create a request. But in the code below, I should at first create "selection" which is a EditPart element.
        IGraphicalEditPart editpart = (IGraphicalEditPart) selection;
        SetRequest requestTirerTransition = new SetRequest(
                editpart.getEditingDomain(),
                ViewUtil.resolveSemanticElement((View) editpart.getModel()),//The semantic model 
                RdpPackage.Literals.TRANSITION__TIRER,//Name feature of activity      
                1);//New name value

        SetValueCommand command = new SetValueCommand(requestTirerTransition);
        editpart.getDiagramEditDomain().getDiagramCommandStack().execute(new ICommandProxy(command));


Do you have any ideas?
Thanks

Vincent

[Updated on: Fri, 19 August 2011 14:48]

Report message to a moderator

Re: Get EditPart from Impl [message #717758 is a reply to message #717190] Mon, 22 August 2011 09:07 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

do I understand right that selection is null and this is your problem? If yes where do you want to execute the code from? What do you mean by Impl model?

Ralph
Re: Get EditPart from Impl [message #717860 is a reply to message #717758] Mon, 22 August 2011 14:46 Go to previous message
vincent988923 is currently offline vincent988923Friend
Messages: 29
Registered: June 2011
Junior Member
Hi, Ralph.

Thank you for you answers. I have resolved it. Because I want to change the color of a node in run time, so that I create a request. But it need a EditPart class rather than a Impl class. Using the code below, I can get all the EditParts in my model.

IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        if (page != null) {
            IEditorPart editor = page.getActiveEditor();
            if (editor instanceof GraphicalEditor) {
                GraphicalEditor graphicalEditor = (GraphicalEditor) editor;
                rootEditPart[0] = (RootEditPart) graphicalEditor.getAdapter(EditPart.class);
            }
        }


Previous Topic:where to set up sort order for a listcompartment?
Next Topic:How Can I Add and Delete a Compartment in Run Time
Goto Forum:
  


Current Time: Fri Apr 26 16:24:25 GMT 2024

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

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

Back to the top