Bug 377783 - Dump for figures in connection layer needed
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorContextMenuProvider.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorContextMenuProvider.java
index 791f4ce..6097e4e 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorContextMenuProvider.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/editor/DiagramEditorContextMenuProvider.java
@@ -14,6 +14,7 @@
* mwenz - Bug 339525 - Enrich paste context with location information
* Bug 336488 - DiagramEditor API
* Benjamin Schmeling - mwenz - Bug 367483 - Support composite connections
+ * cbrand - Bug 377783 - Dump for figures in connection layer needed
*
* </copyright>
*
@@ -190,8 +191,12 @@
PictogramElement pes[] = getEditor().getSelectedPictogramElements();
ICustomContext context = new CustomContext(pes);
+ boolean diagramSelected = false;
if (pes.length == 1) {
extendCustomContext(pes[0], (CustomContext) context);
+ if (pes[0] instanceof Diagram) {
+ diagramSelected = true;
+ }
}
IToolBehaviorProvider tb = getDiagramTypeProvider().getCurrentToolBehaviorProvider();
@@ -204,6 +209,10 @@
debugEntry.setText("Debug"); //$NON-NLS-1$
debugEntry.setSubmenu(true);
debugEntry.add(new ContextMenuEntry(new DebugFeature(fp, DebugFeature.TYPE_DUMP_FIGURE_DATA), context));
+ if (diagramSelected) {
+ debugEntry.add(new ContextMenuEntry(new DebugFeature(fp,
+ DebugFeature.TYPE_DUMP_FIGURE_INCL_CONNECTION_DATA), context));
+ }
debugEntry.add(new ContextMenuEntry(new DebugFeature(fp, DebugFeature.TYPE_DUMP_PICTOGRAM_DATA), context));
debugEntry.add(new ContextMenuEntry(new DebugFeature(fp, DebugFeature.TYPE_DUMP_EDIT_PART_DATA), context));
debugEntry.add(new ContextMenuEntry(new DebugFeature(fp, DebugFeature.TYPE_DUMP_ALL), context));
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/feature/DebugFeature.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/feature/DebugFeature.java
index f6a14c6..33c2204 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/feature/DebugFeature.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/feature/DebugFeature.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* <copyright>
*
- * Copyright (c) 2005, 2010 SAP AG.
+ * Copyright (c) 2005, 2012 SAP AG.
* 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
@@ -10,6 +10,7 @@
* Contributors:
* SAP AG - initial API, implementation and documentation
* Bug 336488 - DiagramEditor API
+ * cbrand - Bug 377783 - Dump for figures in connection layer needed
*
* </copyright>
*
@@ -21,6 +22,7 @@
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.ICustomContext;
import org.eclipse.graphiti.features.custom.AbstractCustomFeature;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.ui.editor.DiagramEditor;
import org.eclipse.graphiti.ui.internal.services.GraphitiUiInternal;
@@ -33,6 +35,7 @@
private static final String NAME_DUMP_PICTOGRAM_DATA = "Dump pictogram data"; //$NON-NLS-1$
private static final String NAME_DUMP_FIGURE_DATA = "Dump figure data"; //$NON-NLS-1$
+ private static final String NAME_DUMP_FIGURE_INCL_CONNECTION_DATA = "Dump figure data incl. connections"; //$NON-NLS-1$
private static final String NAME_DUMP_EDIT_PART_DATA = "Dump editpart tree"; //$NON-NLS-1$
private static final String NAME_DUMP_ALL = "Dump all data"; //$NON-NLS-1$
private static final String NAME_REFRESH = "Refresh"; //$NON-NLS-1$
@@ -42,6 +45,7 @@
public static final int TYPE_DUMP_EDIT_PART_DATA = 2;
public static final int TYPE_DUMP_ALL = 3;
public static final int TYPE_REFRESH = 4;
+ public static final int TYPE_DUMP_FIGURE_INCL_CONNECTION_DATA = 5;
private int type;
@@ -68,10 +72,17 @@
case TYPE_DUMP_FIGURE_DATA:
GraphitiUiInternal.getTraceService().dumpFigureTree(figure);
break;
+ case TYPE_DUMP_FIGURE_INCL_CONNECTION_DATA:
+ GraphitiUiInternal.getTraceService().dumpFigureTreeWithConnectionLayer(figure);
+ break;
case TYPE_DUMP_ALL:
GraphitiUiInternal.getTraceService().dumpPictogramModelTree(pe);
GraphitiUiInternal.getTraceService().dumpEditPartTree(ep);
- GraphitiUiInternal.getTraceService().dumpFigureTree(figure);
+ if (checkIfDiagram(pe)) {
+ GraphitiUiInternal.getTraceService().dumpFigureTreeWithConnectionLayer(figure);
+ } else {
+ GraphitiUiInternal.getTraceService().dumpFigureTree(figure);
+ }
break;
case TYPE_REFRESH:
ep.refresh();
@@ -80,6 +91,10 @@
}
}
+ private boolean checkIfDiagram(PictogramElement pe) {
+ return pe instanceof Diagram;
+ }
+
@Override
public boolean canExecute(ICustomContext context) {
return true;
@@ -95,6 +110,9 @@
case TYPE_DUMP_FIGURE_DATA:
ret = NAME_DUMP_FIGURE_DATA;
break;
+ case TYPE_DUMP_FIGURE_INCL_CONNECTION_DATA:
+ ret = NAME_DUMP_FIGURE_INCL_CONNECTION_DATA;
+ break;
case TYPE_DUMP_EDIT_PART_DATA:
ret = NAME_DUMP_EDIT_PART_DATA;
break;
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/ITraceService.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/ITraceService.java
index daf0997..6f1a628 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/ITraceService.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/ITraceService.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* <copyright>
*
- * Copyright (c) 2005, 2010 SAP AG.
+ * Copyright (c) 2005, 2012 SAP AG.
* 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
@@ -9,6 +9,7 @@
*
* Contributors:
* SAP AG - initial API, implementation and documentation
+ * cbrand - Bug 377783 - Dump for figures in connection layer needed
*
* </copyright>
*
@@ -37,6 +38,8 @@
public abstract void dumpFigureTree(IFigure figure);
+ public abstract void dumpFigureTreeWithConnectionLayer(IFigure figure);
+
public abstract void dumpFigureTree(IFigure figure, int indent);
public abstract void dumpEditPartTree(EditPart editPart);
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/impl/TraceService.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/impl/TraceService.java
index b533f85..afade42 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/impl/TraceService.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/services/impl/TraceService.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* <copyright>
*
- * Copyright (c) 2005, 2010 SAP AG.
+ * Copyright (c) 2005, 2012 SAP AG.
* 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
@@ -9,6 +9,7 @@
*
* Contributors:
* SAP AG - initial API, implementation and documentation
+ * cbrand - Bug 377783 - Dump for figures in connection layer needed
*
* </copyright>
*
@@ -20,7 +21,6 @@
import java.util.Collection;
import java.util.List;
-import org.eclipse.draw2d.ConnectionLayer;
import org.eclipse.draw2d.FreeformLayeredPane;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
@@ -41,7 +41,6 @@
*/
public class TraceService implements ITraceService {
- private static final boolean CONNECTION_FIGURE_TREE = true;
private final boolean FULL_QUALIFIED = false;
private final boolean ADD_OBJECT_INFO = false;
private final boolean ADD_STYLE_INFO = false;
@@ -60,10 +59,6 @@
}
public void dumpFigureTree(IFigure figure, int indent) {
- dumpFigureTree(figure, indent, CONNECTION_FIGURE_TREE);
- }
-
- public void dumpFigureTree(IFigure figure, int indent, boolean dumpConnectionFigureTree) {
String indentString = createIndentString(indent);
String additional = ""; //$NON-NLS-1$
@@ -88,27 +83,17 @@
@SuppressWarnings("unchecked")
List<IFigure> children = figure.getChildren();
for (IFigure childFigure : children) {
- dumpFigureTree(childFigure, indent + 2, false);
- }
-
- if (dumpConnectionFigureTree) {
- dumpConnectionFigureTree(figure);
+ dumpFigureTree(childFigure, indent + 2);
}
}
- private void dumpConnectionFigureTree(IFigure figure) {
- System.out.println("\nConnection Figure Tree"); //$NON-NLS-1$
- FreeformLayeredPane fflp = findFreeformLayerdPane(figure);
- List fflpChildren = fflp.getChildren();
- ConnectionLayer connectionLayer = null;
- for (Object o : fflpChildren) {
- if (o instanceof ConnectionLayer) {
- connectionLayer = (ConnectionLayer) o;
- }
+ public void dumpFigureTreeWithConnectionLayer(IFigure figure) {
+ IFigure dumpRoot = figure;
+ FreeformLayeredPane root = findFreeformLayerdPane(dumpRoot);
+ if (root != null) {
+ dumpRoot = root;
}
- if (connectionLayer != null) {
- dumpFigureTree(fflp, 0, false);
- }
+ dumpFigureTree(dumpRoot);
}
private FreeformLayeredPane findFreeformLayerdPane(IFigure figure) {
@@ -252,5 +237,4 @@
private String getObjectInfo(Object o) {
return o.toString();
}
-
}