Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2014-01-22 09:29:56 +0000
committervlorenzo2014-01-22 09:29:56 +0000
commitfa43556ffdda0201f92a4db5501864b6120320e9 (patch)
treeaae402f97bbece3b94669940140a43ba444dcbf3
parente22498da9368936542b7c7e522b7d88e1de50331 (diff)
downloadorg.eclipse.papyrus-fa43556ffdda0201f92a4db5501864b6120320e9.tar.gz
org.eclipse.papyrus-fa43556ffdda0201f92a4db5501864b6120320e9.tar.xz
org.eclipse.papyrus-fa43556ffdda0201f92a4db5501864b6120320e9.zip
424099: [Diagram] Papyrus must provide a way to draw connections points0.10.2_RC1
(big bendpoints) https://bugs.eclipse.org/bugs/show_bug.cgi?id=424099
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/edge/PapyrusEdgeFigure.java30
1 files changed, 29 insertions, 1 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/edge/PapyrusEdgeFigure.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/edge/PapyrusEdgeFigure.java
index a34311e02cb..011a7184d54 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/edge/PapyrusEdgeFigure.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/edge/PapyrusEdgeFigure.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.infra.gmfdiag.common.figure.edge;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -31,11 +32,16 @@ import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalViewer;
import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gmf.runtime.common.ui.services.editor.EditorService;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor;
import org.eclipse.papyrus.infra.tools.util.EditorHelper;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
/**
*
@@ -205,7 +211,7 @@ public abstract class PapyrusEdgeFigure extends PolylineConnectionEx {
* the visual part map for this figure or <code>null</code> if not found
*/
protected Map<?, ?> getVisualPartMap(final IFigure figure) {
- final IEditorPart part = EditorHelper.getCurrentEditor();
+ IEditorPart part = EditorHelper.getCurrentEditor();
if(part instanceof CoreMultiDiagramEditor) {
final List<IEditorPart> visibleEditors = ((CoreMultiDiagramEditor)part).getISashWindowsContainer().getVisibleIEditorParts();
for(final IEditorPart current : visibleEditors) {
@@ -215,6 +221,28 @@ public abstract class PapyrusEdgeFigure extends PolylineConnectionEx {
return visualPartMap;
}
}
+ } else {
+ //used when papyrus has been "unsashified"
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ if(workbench != null) {
+ final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ if(window != null) {
+ final List<?> editors = EditorService.getInstance().getRegisteredEditorParts();
+ for(Iterator<?> j = editors.iterator(); j.hasNext();) {
+ final IEditorPart editor = (IEditorPart)j.next();
+ if(editor.getEditorSite().getWorkbenchWindow() == window) {
+ if(editor instanceof IDiagramWorkbenchPart) {
+ final IDiagramWorkbenchPart de = (IDiagramWorkbenchPart)editor;
+ final GraphicalViewer viewer = de.getDiagramGraphicalViewer();
+ final Map<?, ?> visualPartMap = viewer.getVisualPartMap();
+ if(visualPartMap.containsKey(figure)) {
+ return visualPartMap;
+ }
+ }
+ }
+ }
+ }
+ }
}
return null;
}

Back to the top