use of org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure in project webtools.sourceediting by eclipse.
the class XSDAttributeDragAndDropCommand method setup.
protected void setup() {
canExecute = false;
// Drop target is attribute group ref
if (target instanceof AttributeGroupDefinitionEditPart) {
parentEditPart = (AttributeGroupDefinitionEditPart) target;
if (((GenericGroupFigure) parentEditPart.getFigure()).getIconFigure().getBounds().contains(location)) {
xsdComponentToDrag = (XSDConcreteComponent) ((XSDAttributeDeclarationAdapter) itemToDrag.getModel()).getTarget();
action = new MoveXSDAttributeAction(((AttributeGroupDefinitionEditPart) parentEditPart).getXSDAttributeGroupDefinition(), xsdComponentToDrag, null, null);
canExecute = action.canMove();
}
} else if (target instanceof BaseFieldEditPart) {
targetSpacesList = new ArrayList();
// Calculate the list of all sibling field edit parts;
List targetEditPartSiblings = calculateFieldEditParts();
calculateAttributeGroupList();
// Get 'left' and 'right' siblings
doDrop(targetEditPartSiblings, itemToDrag);
}
}
use of org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure in project webtools.sourceediting by eclipse.
the class AttributeGroupDefinitionEditPart method createFigure.
protected IFigure createFigure() {
groupFigure = new GenericGroupFigure();
XSDAttributeGroupDefinitionAdapter adapter = (XSDAttributeGroupDefinitionAdapter) getModel();
groupFigure.getIconFigure().image = adapter.getImage();
Label toolTipsLabel = new Label();
toolTipsLabel.setText(XSDEditorPlugin.getXSDString("_UI_PAGE_HEADING_ATTRIBUTEGROUP_REF"));
groupFigure.setToolTip(toolTipsLabel);
return groupFigure;
}
use of org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure in project webtools.sourceediting by eclipse.
the class ModelGroupEditPart method createConnectionFigure.
public ReferenceConnection createConnectionFigure(BaseEditPart child) {
ReferenceConnection connectionFigure = new ReferenceConnection();
GenericGroupFigure modelGroupFigure = (GenericGroupFigure) getFigure();
connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(modelGroupFigure.getIconFigure(), CenteredConnectionAnchor.RIGHT, 0, 0));
if (child instanceof ModelGroupEditPart) {
connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(((ModelGroupEditPart) child).getTargetFigure(), CenteredConnectionAnchor.LEFT, 0, 0));
} else if (child instanceof TargetConnectionSpacingFigureEditPart) {
TargetConnectionSpacingFigureEditPart elem = (TargetConnectionSpacingFigureEditPart) child;
connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(elem.getFigure(), CenteredConnectionAnchor.LEFT, 0, 1));
} else if (child instanceof ModelGroupDefinitionReferenceEditPart) {
ModelGroupDefinitionReferenceEditPart elem = (ModelGroupDefinitionReferenceEditPart) child;
connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(elem.getFigure(), CenteredConnectionAnchor.LEFT, 0, 1));
}
connectionFigure.setHighlight(false);
return connectionFigure;
}
use of org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure in project webtools.sourceediting by eclipse.
the class BaseDragAndDropCommand method getFeedbackFigure.
public IFigure getFeedbackFigure() {
Figure panel = new Figure();
panel.setLayoutManager(new FreeformLayout());
panel.setOpaque(false);
Polyline feedbackFigure = new Polyline();
feedbackFigure.setLineWidth(2);
drawLines(feedbackFigure);
originalLocation = new Rectangle(feedbackFigure.getBounds());
panel.add(feedbackFigure);
polyLine = new Polyline();
polyLine.setLineStyle(Graphics.LINE_DASHDOT);
polyLine.setLineWidth(1);
panel.add(polyLine);
panel.setBounds(originalLocation);
addConnectorToParent(panel);
if (parentEditPart != null && parentEditPart.getFigure() instanceof GenericGroupFigure) {
GenericGroupFigure fig = (GenericGroupFigure) parentEditPart.getFigure();
Rectangle iconBounds = getZoomedBounds(fig.getIconFigure().getBounds());
RoundedRectangle roundedRectangle = new RoundedRectangle();
roundedRectangle.setFill(false);
roundedRectangle.setOpaque(true);
// roundedRectangle.setBounds(new Rectangle(iconBounds.x, iconBounds.y, iconBounds.width - 1, iconBounds.height - 1));
roundedRectangle.setBounds(iconBounds);
panel.add(roundedRectangle);
}
return panel;
}
Aggregations