use of org.yakindu.sct.ui.editor.editor.StatechartDiagramEditor in project statecharts by Yakindu.
the class DocumentationMenuAction method run.
@Override
public void run() {
IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (activeEditor instanceof StatechartDiagramEditor) {
Diagram diagram = ((StatechartDiagramEditor) activeEditor).getDiagram();
List<View> result = EcoreUtil2.getAllContentsOfType(diagram, View.class);
ToggleShowDocumentationCommand.toggleDocumentation(result);
}
}
use of org.yakindu.sct.ui.editor.editor.StatechartDiagramEditor in project statecharts by Yakindu.
the class CreationWizard method openDiagram.
protected boolean openDiagram(Resource diagram) throws PartInitException {
String path = diagram.getURI().toPlatformString(true);
IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
if (workspaceResource instanceof IFile) {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
StatechartDiagramEditor editor = (StatechartDiagramEditor) page.openEditor(new FileEditorInput((IFile) workspaceResource), getEditorID());
if (editor != null) {
List<EObject> allNotationElements = EcoreUtil2.eAllContentsAsList(diagram);
for (EObject eObject : allNotationElements) {
if (eObject instanceof View && ((View) eObject).getType().equals(SemanticHints.STATE_NAME)) {
IGraphicalEditPart editPart = EditPartUtils.findEditPartForSemanticElement(editor.getDiagramGraphicalViewer().getRootEditPart(), ((View) eObject).getElement());
editPart = editPart.getChildBySemanticHint(SemanticHints.STATE_NAME);
if (editPart != null) {
final DirectEditRequest request = new DirectEditRequest();
request.setDirectEditFeature(BasePackage.Literals.NAMED_ELEMENT__NAME);
editPart.performRequest(request);
break;
}
}
}
return false;
}
}
return false;
}
use of org.yakindu.sct.ui.editor.editor.StatechartDiagramEditor in project statecharts by Yakindu.
the class DocumentationDropDownAction method run.
public void run() {
IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (activeEditor instanceof StatechartDiagramEditor) {
Diagram diagram = ((StatechartDiagramEditor) activeEditor).getDiagram();
List<View> result = EcoreUtil2.getAllContentsOfType(diagram, View.class);
show(result);
}
}
use of org.yakindu.sct.ui.editor.editor.StatechartDiagramEditor in project statecharts by Yakindu.
the class ExtractSubdiagramRefactoring method getActualBounds.
protected Rectangle getActualBounds(Node child) {
IEditorPart lastActiveEditor = ActiveEditorTracker.getLastActiveEditor();
if (lastActiveEditor instanceof StatechartDiagramEditor) {
IDiagramGraphicalViewer viewer = ((StatechartDiagramEditor) lastActiveEditor).getDiagramGraphicalViewer();
IGraphicalEditPart editPart = (IGraphicalEditPart) viewer.getEditPartRegistry().get(child);
return editPart.getFigure().getBounds();
}
return Rectangle.SINGLETON;
}
Aggregations