Search in sources :

Example 21 with IADTObject

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject 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)

Example 22 with IADTObject

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.

the class BaseEditPart method activate.

public void activate() {
    super.activate();
    Object model = getModel();
    if (model instanceof IADTObject) {
        IADTObject object = (IADTObject) model;
        object.registerListener(this);
    }
    if (getZoomManager() != null)
        getZoomManager().addZoomListener(zoomListener);
}
Also used : IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)

Example 23 with IADTObject

use of org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject in project webtools.sourceediting by eclipse.

the class RootContentEditPart method getModelChildren.

protected List getModelChildren() {
    collections = new ArrayList();
    if (getModel() != null) {
        Object obj = getModel();
        IADTObject focusObject = null;
        if (obj instanceof IStructure) {
            if (obj instanceof IGraphElement) {
                if (((IGraphElement) obj).isFocusAllowed())
                    focusObject = (IStructure) obj;
            }
        } else if (obj instanceof IField) {
            focusObject = (IField) obj;
        } else if (obj instanceof IModel) {
            focusObject = (IModel) obj;
            collections.add(focusObject);
            return collections;
        } else if (obj instanceof IType) {
            if (obj instanceof IGraphElement) {
                if (((IGraphElement) obj).isFocusAllowed()) {
                    focusObject = (IType) obj;
                }
            }
        } else if (obj instanceof IGraphElement) {
            if (((IGraphElement) obj).isFocusAllowed()) {
                focusObject = (IADTObject) obj;
                collections.add(focusObject);
                return collections;
            }
        }
        if (focusObject != null) {
            RootHolder holder = new RootHolder(focusObject);
            collections.add(holder);
            return collections;
        }
    }
    return collections;
}
Also used : IModel(org.eclipse.wst.xsd.ui.internal.adt.facade.IModel) IGraphElement(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) ArrayList(java.util.ArrayList) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) IStructure(org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure) IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) RootHolder(org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder) IType(org.eclipse.wst.xsd.ui.internal.adt.facade.IType)

Aggregations

IADTObject (org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)23 Adapter (org.eclipse.emf.common.notify.Adapter)9 Iterator (java.util.Iterator)7 ArrayList (java.util.ArrayList)5 DesignViewGraphicalViewer (org.eclipse.wst.xsd.ui.internal.adt.design.DesignViewGraphicalViewer)4 IModel (org.eclipse.wst.xsd.ui.internal.adt.facade.IModel)4 IGraphElement (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.IGraphElement)3 XSDConcreteComponent (org.eclipse.xsd.XSDConcreteComponent)3 List (java.util.List)2 EditPart (org.eclipse.gef.EditPart)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 IWorkbench (org.eclipse.ui.IWorkbench)2 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)2 RootContentEditPart (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.RootContentEditPart)2 RootHolder (org.eclipse.wst.xsd.ui.internal.adt.design.editparts.model.RootHolder)2 IField (org.eclipse.wst.xsd.ui.internal.adt.facade.IField)2 IStructure (org.eclipse.wst.xsd.ui.internal.adt.facade.IStructure)2 ADTContentOutlinePage (org.eclipse.wst.xsd.ui.internal.adt.outline.ADTContentOutlinePage)2 XSDComplexTypeDefinition (org.eclipse.xsd.XSDComplexTypeDefinition)2