use of org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure 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();
}
use of org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure in project webtools.sourceediting by eclipse.
the class BaseFieldEditPart method directEditNameField.
protected void directEditNameField() {
if (isFileReadOnly())
return;
Object model = getModel();
IFieldFigure fieldFigure = getFieldFigure();
if (model instanceof IField) {
IField field = (IField) model;
if (field.isReference()) {
ElementReferenceDirectEditManager manager = new ElementReferenceDirectEditManager((IField) model, this, fieldFigure.getNameLabel());
ReferenceUpdateCommand elementUpdateCommand = new ReferenceUpdateCommand();
elementUpdateCommand.setDelegate(manager);
adtDirectEditPolicy.setUpdateCommand(elementUpdateCommand);
manager.show();
} else {
LabelEditManager manager = new LabelEditManager(this, new LabelCellEditorLocator(this, null));
NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
adtDirectEditPolicy.setUpdateCommand(wrapper);
manager.show();
}
}
}
use of org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure in project webtools.sourceediting by eclipse.
the class BaseFieldEditPart method createFigure.
protected IFigure createFigure() {
IFieldFigure figure = getFigureFactory().createFieldFigure(getModel());
figure.setForegroundColor(ColorConstants.black);
return figure;
}
use of org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure in project webtools.sourceediting by eclipse.
the class BaseFieldEditPart method performRequest.
public void performRequest(Request request) {
if (((IADTObject) getModel()).isReadOnly() || isFileReadOnly()) {
return;
}
if (request.getType() == RequestConstants.REQ_DIRECT_EDIT || request.getType() == RequestConstants.REQ_OPEN) {
IFieldFigure fieldFigure = getFieldFigure();
Object model = getModel();
if (request instanceof LocationRequest) {
LocationRequest locationRequest = (LocationRequest) request;
Point p = locationRequest.getLocation();
if (hitTest(fieldFigure.getTypeLabel(), p)) {
TypeReferenceDirectEditManager manager = new TypeReferenceDirectEditManager((IField) model, this, fieldFigure.getTypeLabel());
TypeUpdateCommand typeUpdateCommand = new TypeUpdateCommand();
typeUpdateCommand.setDelegate(manager);
adtDirectEditPolicy.setUpdateCommand(typeUpdateCommand);
manager.show();
} else if (hitTest(fieldFigure.getNameLabel(), p)) {
directEditNameField();
}
} else {
directEditNameField();
}
}
}
Aggregations