Search in sources :

Example 1 with IAnnotationProvider

use of org.eclipse.wst.xsd.ui.internal.adt.design.IAnnotationProvider in project webtools.sourceediting by eclipse.

the class XSDBaseFieldEditPart method refreshVisuals.

/*
   * (non-Javadoc)
   * 
   * @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
   */
protected void refreshVisuals() {
    IFieldFigure figure = getFieldFigure();
    IField field = (IField) getModel();
    figure.getNameLabel().setText(field.getName());
    figure.getTypeLabel().setText(field.getTypeName());
    figure.refreshVisuals(getModel());
    if (field.isReadOnly()) {
        figure.setForegroundColor(ColorConstants.darkGray);
    } else {
        if (isHighContrast) {
            figure.setForegroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
            figure.setBackgroundColor(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
        } else
            figure.setForegroundColor(ColorConstants.black);
    }
    // $NON-NLS-1$
    String occurrenceDescription = "";
    if (field instanceof IAnnotationProvider) {
        occurrenceDescription = ((IAnnotationProvider) field).getNameAnnotationString();
    }
    refreshIcon();
    figure.getNameAnnotationLabel().setText(occurrenceDescription);
    figure.recomputeLayout();
    if (getRoot() != null)
        ((GraphicalEditPart) getRoot()).getFigure().invalidateTree();
}
Also used : IAnnotationProvider(org.eclipse.wst.xsd.ui.internal.adt.design.IAnnotationProvider) IFieldFigure(org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure) IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) GraphicalEditPart(org.eclipse.gef.GraphicalEditPart)

Aggregations

GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)1 IAnnotationProvider (org.eclipse.wst.xsd.ui.internal.adt.design.IAnnotationProvider)1 IFieldFigure (org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure)1 IField (org.eclipse.wst.xsd.ui.internal.adt.facade.IField)1