Skip to content
Snippets Groups Projects
Commit ed8fb5b2 authored by Christoph Döbber's avatar Christoph Döbber
Browse files

fixed editpart creation

parent db1cadb1
No related branches found
No related tags found
No related merge requests found
......@@ -152,7 +152,7 @@ public abstract class DiagramEditPartBase<T extends EObject> extends
/** {@inheritDoc} */
@Override
public IFigure getContentPane() {
return getLayer(ExtendedLayerRootEditPart.NODE_LAYER);
return super.getContentPane(); // getLayer(ExtendedLayerRootEditPart.NODE_LAYER);
}
/** Adds all nodes and connectors as children. */
......
......@@ -23,6 +23,7 @@ import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Layer;
import org.eclipse.draw2d.LayeredPane;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.LayerConstants;
import org.eclipse.gef.editparts.ScalableRootEditPart;
......@@ -102,7 +103,7 @@ public class ExtendedLayerRootEditPart extends ScalableRootEditPart {
/** {@inheritDoc} */
@Override
public IFigure getContentPane() {
return getLayer(NODE_LAYER);
return super.getContentPane();// getLayer(NODE_LAYER);
}
/** {@inheritDoc} */
......@@ -123,6 +124,16 @@ public class ExtendedLayerRootEditPart extends ScalableRootEditPart {
return super.getLayer(key);
}
/** {@inheritDoc} */
@Override
protected void removeChildVisual(EditPart childEditPart) {
super.removeChildVisual(childEditPart);
if (childEditPart instanceof GraphicalEditPartBase<?>) {
GraphicalEditPartBase<?> gep = (GraphicalEditPartBase<?>) childEditPart;
gep.removeVisuals();
}
}
/** Creates the default layer with XYLayout. */
private Layer createDefaultLayer() {
Layer l = new FreeformLayer();
......
......@@ -100,4 +100,17 @@ public abstract class GraphicalEditPartBase<T extends EObject> extends
}
return super.getAdapter(key);
}
/**
* Called when the edit part is removed and should remove its visual
* children from layers. Sub-classes may override, but must call super
* implementation.
*/
public void removeVisuals() {
for (Object ep : getChildren()) {
if (ep instanceof GraphicalEditPartBase<?>) {
((GraphicalEditPartBase<?>) ep).removeVisuals();
}
}
}
}
......@@ -253,4 +253,21 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement>
}
return null;
}
/** {@inheritDoc} */
@Override
public void removeVisuals() {
super.removeVisuals();
// if (baseFigure != null) {
// getLayer(ExtendedLayerRootEditPart.NODE_LAYER).remove(baseFigure);
// }
if (labelFigure != null) {
getLayer(ExtendedLayerRootEditPart.LABEL_LAYER).remove(labelFigure);
}
if (decorationFigure != null) {
getLayer(ExtendedLayerRootEditPart.DECORATION_LAYER).remove(
decorationFigure);
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment