Skip to content
Snippets Groups Projects
Commit 111983dc authored by Dongyue Mou's avatar Dongyue Mou
Browse files

improved sub diagram edit part

parent 71b79760
No related branches found
No related tags found
No related merge requests found
......@@ -20,13 +20,16 @@ package org.fortiss.tooling.base.ui.editpart;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Rectangle;
import org.fortiss.tooling.base.layout.DefaultLayoutConstants;
import org.fortiss.tooling.base.model.layout.ILayoutedModelElement;
import org.fortiss.tooling.base.ui.editpart.figure.TransparentLabel;
import org.fortiss.tooling.base.ui.utils.LayoutDataUtils;
import org.fortiss.tooling.kernel.model.INamedCommentedElement;
import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
/**
* The base class for graphical edit parts which encapsulate nodes (i.e. the
......@@ -83,9 +86,28 @@ public abstract class SubDiagramEditPartBase<T extends ILayoutedModelElement & I
/** {@inheritDoc} */
@Override
public Label createLabelFigure() {
Label label = super.createLabelFigure();
label.setIconAlignment(PositionConstants.TOP | PositionConstants.LEFT);
return label;
Label nameLabel = new TransparentLabel() {
/** {@inheritDoc} */
@Override
protected boolean useLocalCoordinates() {
return true;
}
/** {@inheritDoc} */
@Override
public void add(IFigure figure, Object constraint, int index) {
// TODO Auto-generated method stub
super.add(figure, constraint, index);
}
};
nameLabel.setForegroundColor(getForegroundColor());
nameLabel.setFont(DEFAULT_TITLE_FONT);
nameLabel.setTextAlignment(PositionConstants.LEFT | PositionConstants.TOP);
nameLabel.setTextPlacement(PositionConstants.EAST);
nameLabel.setIcon(IModelElementHandlerService.INSTANCE.getModelElementHandler(getModel())
.getIcon(getModel()));
nameLabel.setIconAlignment(PositionConstants.TOP | PositionConstants.LEFT);
return nameLabel;
}
/** {@inheritDoc} */
......
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