Source:
protected Command getCommand() { final CompoundCommand doStoreFormatsCmd = new CompoundCommand(Messages.CopyFormatAction_storeFormatCommandLabel); doStoreFormatsCmd.add(new Command(Messages.CopyFormatAction_clearPreviousFormatDateCommandLabel) { @Override public boolean canUndo() { return false; } @Override public boolean canExecute() { return super.canExecute(); } @Override public void execute() { for (SiriusLayoutDataManager layoutDataManager : LayoutDataManagerRegistry.getAllSiriusLayoutDataManagers()) { layoutDataManager.clearLayoutData(); } } }); DiagramEditPart diagramEditPart = getDiagramEditPart(); if (diagramEditPart instanceof IDDiagramEditPart) { final Option<DDiagram> diagram = ((IDDiagramEditPart) diagramEditPart).resolveDDiagram(); if (diagram.some()) { List<IGraphicalEditPart> selectedEditParts = cleanSelectedObjects(getSelectedObjects()); for (final IGraphicalEditPart toStore : selectedEditParts) { doStoreFormatsCmd.add(new ICommandProxy(new CopyFormatDataCommand(toStore.getEditingDomain(), diagram.get(), toStore))); } } } doStoreFormatsCmd.add(new Command(Messages.CopyFormatAction_notifyEditors) { @Override public boolean canUndo() { return false; } @Override public boolean canExecute() { return super.canExecute(); } @Override public void execute() { IEditorReference[] editorReferences = null; IWorkbenchPage page = EclipseUIUtil.getActivePage(); if (page != null) { editorReferences = page.getEditorReferences(); } if (editorReferences != null) { for (IEditorReference ref : Lists.newArrayList(editorReferences)) { IEditorPart editor = ref.getEditor(false); if (editor instanceof DDiagramEditorImpl) { DDiagramEditorImpl diagramEditor = (DDiagramEditorImpl) editor; diagramEditor.getTabbar().reinitToolBar(diagramEditor.getDiagramGraphicalViewer().getSelection()); } } } } }); return doStoreFormatsCmd.unwrap(); }

Target:
protected Command getCommand() { final CompoundCommand doStoreFormatsCmd = new CompoundCommand(Messages.CopyFormatAction_storeFormatCommandLabel); doStoreFormatsCmd.add(new Command(Messages.CopyFormatAction_clearPreviousFormatDateCommandLabel) { @Override public boolean canUndo() { return false; } @Override public void execute() { for (SiriusLayoutDataManager layoutDataManager : LayoutDataManagerRegistry.getAllSiriusLayoutDataManagers()) { layoutDataManager.clearLayoutData(); } } }); DiagramEditPart diagramEditPart = getDiagramEditPart(); if (diagramEditPart instanceof IDDiagramEditPart) { final Option<DDiagram> diagram = ((IDDiagramEditPart) diagramEditPart).resolveDDiagram(); if (diagram.some()) { List<IGraphicalEditPart> selectedEditParts = cleanSelectedObjects(getSelectedObjects()); for (final IGraphicalEditPart toStore : selectedEditParts) { doStoreFormatsCmd.add(new ICommandProxy(new CopyFormatDataCommand(toStore.getEditingDomain(), diagram.get(), toStore))); } } } doStoreFormatsCmd.add(new Command(Messages.CopyFormatAction_notifyEditors) { @Override public boolean canUndo() { return false; } @Override public void execute() { IEditorReference[] editorReferences = null; IWorkbenchPage page = EclipseUIUtil.getActivePage(); if (page != null) { editorReferences = page.getEditorReferences(); } if (editorReferences != null) { for (IEditorReference ref : editorReferences) { IEditorPart editor = ref.getEditor(false); if (editor instanceof DDiagramEditorImpl) { DDiagramEditorImpl diagramEditor = (DDiagramEditorImpl) editor; diagramEditor.getTabbar().reinitToolBar(diagramEditor.getDiagramGraphicalViewer().getSelection()); } } } } }); return doStoreFormatsCmd.unwrap(); }