Get EditPart from Impl [message #717190] |
Fri, 19 August 2011 10:47  |
Eclipse User |
|
|
|
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 10:48] by Moderator
|
|
|
|
Re: Get EditPart from Impl [message #717860 is a reply to message #717758] |
Mon, 22 August 2011 10:46  |
Eclipse User |
|
|
|
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);
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.05454 seconds