Java Code Examples for org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor#getDiagramEditPart()
The following examples show how to use
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor#getDiagramEditPart() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DiagramFileStore.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public Resource getEMFResource() { final DiagramEditor editor = getOpenedEditor(); if (editor != null) { final DiagramEditPart diagramEditPart = editor.getDiagramEditPart(); if (diagramEditPart != null) { final EObject resolveSemanticElement = diagramEditPart.resolveSemanticElement(); if (resolveSemanticElement != null && resolveSemanticElement.eResource() != null) { return resolveSemanticElement.eResource(); } } } final URI uri = getResourceURI(); final EditingDomain editingDomain = getParentStore().getEditingDomain(uri); final ResourceSet resourceSet = editingDomain.getResourceSet(); if (getResource().exists()) { Resource resource = resourceSet.getResource(uri, false); if (resource == null) { resource = resourceSet.createResource(uri); } return resource; } return super.getEMFResource(); }
Example 2
Source File: DiagramFileStore.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public List<AbstractProcess> getProcesses() { MainProcess diagram = null; final DiagramEditor editor = getOpenedEditor(); if (editor != null && editor.getDiagramEditPart() != null) { diagram = (MainProcess) editor.getDiagramEditPart().resolveSemanticElement(); } if (diagram == null) { diagram = getContent(); } final List<AbstractProcess> allProcesses = ModelHelper.getAllProcesses(diagram); final List<AbstractProcess> processes = new ArrayList<>(); for (final AbstractProcess abstractProcess : allProcesses) { if (abstractProcess instanceof Pool) { processes.add(abstractProcess); } } return processes; }
Example 3
Source File: DiagramFileStore.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public void setReadOnly(final boolean readOnly) { super.setReadOnly(readOnly); final DiagramEditor openedEditor = getOpenedEditor(); if (openedEditor != null) { if (openedEditor.getDiagramEditPart() != null) { if (readOnly) { openedEditor.getDiagramEditPart().disableEditMode(); } else { openedEditor.getDiagramEditPart().enableEditMode(); } } if (openedEditor instanceof ProcessDiagramEditor) { ((ProcessDiagramEditor) openedEditor).setReadOnly(readOnly); } } }
Example 4
Source File: BPMNTestUtil.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public static MainProcessEditPart getMainProcessEditPart(final Diagram diag) { /* * need to get the URI after save because the name can change as it is * synchronized with the MainProcess name */ final URI uri = EcoreUtil.getURI(diag); /* open the process editor */ final DiagramEditor processEditor = (DiagramEditor) EditorService.getInstance() .openEditor(new URIEditorInput(uri, diag.getName())); return (MainProcessEditPart) processEditor.getDiagramEditPart(); }