Search in sources :

Example 1 with TypeReferenceDirectEditManager

use of org.eclipse.wst.xsd.ui.internal.adt.design.directedit.TypeReferenceDirectEditManager 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();
        }
    }
}
Also used : TypeReferenceDirectEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.TypeReferenceDirectEditManager) LocationRequest(org.eclipse.gef.requests.LocationRequest) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) Point(org.eclipse.draw2d.geometry.Point) IFieldFigure(org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure)

Aggregations

Point (org.eclipse.draw2d.geometry.Point)1 LocationRequest (org.eclipse.gef.requests.LocationRequest)1 TypeReferenceDirectEditManager (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.TypeReferenceDirectEditManager)1 IFieldFigure (org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure)1 IADTObject (org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)1