Java Code Examples for org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart#getDiagramView()
The following examples show how to use
org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart#getDiagramView() .
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: CrossflowDiagramEditorUtil.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ public static View findView(DiagramEditPart diagramEditPart, EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) { boolean hasStructuralURI = false; if (targetElement.eResource() instanceof XMLResource) { hasStructuralURI = ((XMLResource) targetElement.eResource()).getID(targetElement) == null; } View view = null; LinkedList<EditPart> editPartHolder = new LinkedList<EditPart>(); if (hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) { view = lazyElement2ViewMap.getElement2ViewMap().get(targetElement); } else if (findElementsInDiagramByID(diagramEditPart, targetElement, editPartHolder) > 0) { EditPart editPart = editPartHolder.get(0); view = editPart.getModel() instanceof View ? (View) editPart.getModel() : null; } return (view == null) ? diagramEditPart.getDiagramView() : view; }
Example 2
Source File: ValidateAction.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ private static void createMarkers(IFile target, IStatus validationStatus, DiagramEditPart diagramEditPart) { if (validationStatus.isOK()) { return; } final IStatus rootStatus = validationStatus; List allStatuses = new ArrayList(); CrossflowDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new CrossflowDiagramEditorUtil.LazyElement2ViewMap( diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<EObject>(), allStatuses)); for (Iterator it = allStatuses.iterator(); it.hasNext();) { IConstraintStatus nextStatus = (IConstraintStatus) it.next(); View view = CrossflowDiagramEditorUtil.findView(diagramEditPart, nextStatus.getTarget(), element2ViewMap); addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true), nextStatus.getMessage(), nextStatus.getSeverity()); } }
Example 3
Source File: ValidateAction.java From scava with Eclipse Public License 2.0 | 6 votes |
/** * @generated */ private static void createMarkers(IFile target, Diagnostic emfValidationStatus, DiagramEditPart diagramEditPart) { if (emfValidationStatus.getSeverity() == Diagnostic.OK) { return; } final Diagnostic rootStatus = emfValidationStatus; List allDiagnostics = new ArrayList(); CrossflowDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new CrossflowDiagramEditorUtil.LazyElement2ViewMap( diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<EObject>(), allDiagnostics)); for (Iterator it = emfValidationStatus.getChildren().iterator(); it.hasNext();) { Diagnostic nextDiagnostic = (Diagnostic) it.next(); List data = nextDiagnostic.getData(); if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) { EObject element = (EObject) data.get(0); View view = CrossflowDiagramEditorUtil.findView(diagramEditPart, element, element2ViewMap); addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(element, true), nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity())); } } }
Example 4
Source File: ValidationMarkerProvider.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public void createMarkers(final IFile target, final Diagnostic emfValidationStatus, final DiagramEditPart diagramEditPart) { if (emfValidationStatus.getSeverity() == Diagnostic.OK) { return; } final Diagnostic rootStatus = emfValidationStatus; final List allDiagnostics = new ArrayList(); final ProcessDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new ProcessDiagramEditorUtil.LazyElement2ViewMap( diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<EObject>(), allDiagnostics)); for (final Iterator it = emfValidationStatus.getChildren().iterator(); it.hasNext();) { final Diagnostic nextDiagnostic = (Diagnostic) it.next(); final List data = nextDiagnostic.getData(); if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) { final EObject element = (EObject) data.get(0); final View view = ProcessDiagramEditorUtil.findView( diagramEditPart, element, element2ViewMap); addMarker(diagramEditPart, null, diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(element, true), nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity())); } } }
Example 5
Source File: ValidateAction.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @generated */ private static void createMarkers(IFile target, IStatus validationStatus, DiagramEditPart diagramEditPart) { if (validationStatus.isOK()) { return; } final IStatus rootStatus = validationStatus; List allStatuses = new ArrayList(); ProcessDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new ProcessDiagramEditorUtil.LazyElement2ViewMap( diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<EObject>(), allStatuses)); for (Iterator it = allStatuses.iterator(); it.hasNext();) { IConstraintStatus nextStatus = (IConstraintStatus) it.next(); View view = ProcessDiagramEditorUtil.findView(diagramEditPart, nextStatus.getTarget(), element2ViewMap); addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true), nextStatus.getMessage(), nextStatus.getSeverity()); } }
Example 6
Source File: ValidateAction.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @generated */ private static void createMarkers(IFile target, Diagnostic emfValidationStatus, DiagramEditPart diagramEditPart) { if (emfValidationStatus.getSeverity() == Diagnostic.OK) { return; } final Diagnostic rootStatus = emfValidationStatus; List allDiagnostics = new ArrayList(); ProcessDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new ProcessDiagramEditorUtil.LazyElement2ViewMap( diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<EObject>(), allDiagnostics)); for (Iterator it = emfValidationStatus.getChildren().iterator(); it.hasNext();) { Diagnostic nextDiagnostic = (Diagnostic) it.next(); List data = nextDiagnostic.getData(); if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) { EObject element = (EObject) data.get(0); View view = ProcessDiagramEditorUtil.findView(diagramEditPart, element, element2ViewMap); addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(element, true), nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity())); } } }
Example 7
Source File: ProcessDiagramEditorUtil.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @generated */ public static View findView(DiagramEditPart diagramEditPart, EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) { boolean hasStructuralURI = false; if (targetElement.eResource() instanceof XMLResource) { hasStructuralURI = ((XMLResource) targetElement.eResource()).getID(targetElement) == null; } View view = null; LinkedList<EditPart> editPartHolder = new LinkedList<EditPart>(); if (hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) { view = lazyElement2ViewMap.getElement2ViewMap().get(targetElement); } else if (findElementsInDiagramByID(diagramEditPart, targetElement, editPartHolder) > 0) { EditPart editPart = editPartHolder.get(0); view = editPart.getModel() instanceof View ? (View) editPart.getModel() : null; } return (view == null) ? diagramEditPart.getDiagramView() : view; }
Example 8
Source File: ValidationMarkerProvider.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public void createMarkers(final IFile target, final IStatus validationStatus, final DiagramEditPart diagramEditPart) { if (validationStatus.isOK()) { return; } final IStatus rootStatus = validationStatus; final List allStatuses = new ArrayList(); final ProcessDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new ProcessDiagramEditorUtil.LazyElement2ViewMap( diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet<EObject>(), allStatuses)); final List<Triple<String, String, String>> createdMarkers = new ArrayList<Triple<String, String, String>>(); for (final Iterator it = allStatuses.iterator(); it.hasNext();) { final IConstraintStatus nextStatus = (IConstraintStatus) it.next(); final String constraintId = nextStatus.getConstraint().getDescriptor().getId(); final View view = ProcessDiagramEditorUtil.findView( diagramEditPart, nextStatus.getTarget(), element2ViewMap); final Triple<String, String, String> triple = new Triple<String, String, String>(constraintId, nextStatus.getMessage(), view.eResource() .getURIFragment(view)); if (!createdMarkers.contains(triple)) { addMarker(diagramEditPart, constraintId, diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true), nextStatus.getMessage(), nextStatus.getSeverity()); createdMarkers.add(triple); } } }