use of org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure in project webtools.sourceediting by eclipse.
the class AttributeGroupDefinitionEditPart method createConnectionFigure.
public ReferenceConnection createConnectionFigure(BaseEditPart child) {
ReferenceConnection connectionFigure = new ReferenceConnection();
connectionFigure.setSourceAnchor(new CenteredConnectionAnchor(((GenericGroupFigure) getFigure()).getIconFigure(), CenteredConnectionAnchor.RIGHT, 0, 0));
if (child instanceof AttributeGroupDefinitionEditPart) {
connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(((AttributeGroupDefinitionEditPart) child).getTargetFigure(), CenteredConnectionAnchor.LEFT, 0, 0));
} else if (child instanceof TargetConnectionSpacingFigureEditPart) {
// TargetConnectionSpacingFigureEditPart elem = (TargetConnectionSpacingFigureEditPart) child;
connectionFigure.setTargetAnchor(new CenteredConnectionAnchor(((TargetConnectionSpacingFigureEditPart) child).getFigure(), CenteredConnectionAnchor.LEFT, 0, 0));
}
connectionFigure.setHighlight(false);
figure = connectionFigure;
return connectionFigure;
}
use of org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure in project webtools.sourceediting by eclipse.
the class ConnectableEditPart method addFeedback.
public void addFeedback() {
ReferenceConnection connectionFigure;
if (connectionFigures != null && !connectionFigures.isEmpty()) {
for (Iterator i = connectionFigures.iterator(); i.hasNext(); ) {
connectionFigure = (ReferenceConnection) i.next();
connectionFigure.setHighlight(true);
}
}
GenericGroupFigure figure = (GenericGroupFigure) getFigure();
figure.getIconFigure().setMode(CenteredIconFigure.SELECTED);
figure.getIconFigure().refresh();
}
use of org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure in project webtools.sourceediting by eclipse.
the class ConnectableEditPart method refreshVisuals.
protected void refreshVisuals() {
super.refreshVisuals();
GenericGroupFigure figure = (GenericGroupFigure) getFigure();
figure.getIconFigure().refresh();
}
use of org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure in project webtools.sourceediting by eclipse.
the class ConnectableEditPart method removeFeedback.
public void removeFeedback() {
ReferenceConnection connectionFigure;
if (connectionFigures != null && !connectionFigures.isEmpty()) {
for (Iterator i = connectionFigures.iterator(); i.hasNext(); ) {
connectionFigure = (ReferenceConnection) i.next();
connectionFigure.setHighlight(false);
}
}
GenericGroupFigure figure = (GenericGroupFigure) getFigure();
figure.getIconFigure().setMode(CenteredIconFigure.NORMAL);
figure.getIconFigure().refresh();
}
use of org.eclipse.wst.xsd.ui.internal.design.figures.GenericGroupFigure in project webtools.sourceediting by eclipse.
the class ModelGroupEditPart method refreshVisuals.
protected void refreshVisuals() {
boolean isReadOnly = false;
GenericGroupFigure modelGroupFigure = (GenericGroupFigure) getFigure();
XSDModelGroupAdapter adapter = (XSDModelGroupAdapter) getModel();
isReadOnly = adapter.isReadOnly();
String nodeName = "";
Image image;
switch(getXSDModelGroup().getCompositor().getValue()) {
case XSDCompositor.ALL:
{
image = isReadOnly ? ModelGroupFigure.ALL_ICON_DISABLED_IMAGE : ModelGroupFigure.ALL_ICON_IMAGE;
modelGroupFigure.getIconFigure().image = XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent) adapter.getTarget(), image, isReadOnly);
nodeName = XSDConstants.ALL_ELEMENT_TAG;
break;
}
case XSDCompositor.CHOICE:
{
image = isReadOnly ? ModelGroupFigure.CHOICE_ICON_DISABLED_IMAGE : ModelGroupFigure.CHOICE_ICON_IMAGE;
modelGroupFigure.getIconFigure().image = XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent) adapter.getTarget(), image, isReadOnly);
nodeName = XSDConstants.CHOICE_ELEMENT_TAG;
break;
}
case XSDCompositor.SEQUENCE:
{
image = isReadOnly ? ModelGroupFigure.SEQUENCE_ICON_DISABLED_IMAGE : ModelGroupFigure.SEQUENCE_ICON_IMAGE;
modelGroupFigure.getIconFigure().image = XSDCommonUIUtils.getUpdatedImage((XSDConcreteComponent) adapter.getTarget(), image, isReadOnly);
nodeName = XSDConstants.SEQUENCE_ELEMENT_TAG;
break;
}
}
// String occurenceDescription = adapter.getNameAnnotationToolTipString();
// modelGroupFigure.getIconFigure().setToolTip(occurenceDescription);
// TODO: commmon this up with XSDParticleAdapter's code
// -2 means the user didn't specify (so the default is 1)
int minOccurs = adapter.getMinOccurs();
int maxOccurs = adapter.getMaxOccurs();
// $NON-NLS-1$
String occurenceDescription = "";
if (minOccurs == -3 && maxOccurs == -3) {
occurenceDescription = nodeName;
modelGroupFigure.setText(null);
} else if (minOccurs == 0 && (maxOccurs == -2 || maxOccurs == 1)) {
// $NON-NLS-1$
occurenceDescription = nodeName + " [0..1]";
modelGroupFigure.setText("0..1");
} else if ((minOccurs == 1 && maxOccurs == 1) || (minOccurs == -2 && maxOccurs == 1) || (minOccurs == 1 && maxOccurs == -2)) {
// $NON-NLS-1$
occurenceDescription = nodeName + " [1..1]";
modelGroupFigure.setText("1..1");
} else if (minOccurs == -2 && maxOccurs == -2) {
occurenceDescription = nodeName;
modelGroupFigure.setText(null);
} else {
if (maxOccurs == -2)
maxOccurs = 1;
// $NON-NLS-1$ //$NON-NLS-2$
String maxSymbol = maxOccurs == -1 ? "*" : "" + maxOccurs;
// $NON-NLS-1$ //$NON-NLS-2$
String minSymbol = minOccurs == -2 ? "1" : "" + minOccurs;
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
occurenceDescription = nodeName + " [" + minSymbol + ".." + maxSymbol + "]";
modelGroupFigure.setText(minSymbol + ".." + maxSymbol);
}
modelGroupFigure.getIconFigure().setToolTipText(occurenceDescription);
modelGroupFigure.getIconFigure().repaint();
refreshConnection();
}
Aggregations