diff options
| author | Maxime Porhel | 2016-03-31 13:48:08 +0000 |
|---|---|---|
| committer | Maxime Porhel | 2016-04-22 16:21:49 +0000 |
| commit | 10f8085f4ed9b5ed09262e44a2e7b292767d5069 (patch) | |
| tree | 6046a608fb77292e226b7b6a948fc70533298676 | |
| parent | 05d393f16858b6da2ff9e668bc7d087812ec262d (diff) | |
| download | org.eclipse.sirius-10f8085f4ed9b5ed09262e44a2e7b292767d5069.tar.gz org.eclipse.sirius-10f8085f4ed9b5ed09262e44a2e7b292767d5069.tar.xz org.eclipse.sirius-10f8085f4ed9b5ed09262e44a2e7b292767d5069.zip | |
[490907] Retrieve validation marker on main aird resource
This allows to also support the cases when the marked diagram belongs to
a referenced DAnalysis or any other cases in which the the current
resource if not the main aird but a sub aird.
Bug: 490907
Cherry-picked-from: 461740
Change-Id: I162e59eb47a2dc249b47e9c46db8a2dd424dd154
Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
| -rw-r--r-- | plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/providers/SiriusValidationDecoratorProvider.java | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/providers/SiriusValidationDecoratorProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/providers/SiriusValidationDecoratorProvider.java index 3f3846ce4c..1e69d0ad60 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/providers/SiriusValidationDecoratorProvider.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/providers/SiriusValidationDecoratorProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2007, 2016 THALES GLOBAL SERVICES and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,6 +23,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.draw2d.FlowLayout; import org.eclipse.draw2d.Label; import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.transaction.util.TransactionUtil; import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; import org.eclipse.gef.EditDomain; @@ -45,6 +46,8 @@ import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.Edge; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.sirius.business.api.session.Session; +import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.sirius.common.ui.tools.api.util.EclipseUIUtil; import org.eclipse.sirius.diagram.DiagramPlugin; import org.eclipse.sirius.diagram.ui.business.api.view.SiriusGMFHelper; @@ -210,9 +213,21 @@ public class SiriusValidationDecoratorProvider extends AbstractProvider implemen if (elementId == null) { return; } - int severity = IMarker.SEVERITY_INFO; - IMarker foundMarker = null; - IResource resource = WorkspaceSynchronizer.getFile(viewResource); + + // Directly retrieve the main Session resource + // (session.getSessionResource()) as we know we put the marker on + // it. + Session currentSession = null; + ResourceSet currentRs = viewResource.getResourceSet(); + for (Session session : SessionManager.INSTANCE.getSessions()) { + if (currentRs == session.getTransactionalEditingDomain().getResourceSet()) { + currentSession = session; + break; + } + } + Resource markedResource = currentSession == null ? null : currentSession.getSessionResource(); + IResource resource = WorkspaceSynchronizer.getFile(markedResource); + if (resource == null || !resource.exists()) { return; } @@ -225,6 +240,9 @@ public class SiriusValidationDecoratorProvider extends AbstractProvider implemen if (markers == null || markers.length == 0) { return; } + + int severity = IMarker.SEVERITY_INFO; + IMarker foundMarker = null; Label toolTip = null; for (int i = 0; i < markers.length; i++) { IMarker marker = markers[i]; |
