Search in sources :

Example 1 with LabelCellEditorLocator

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

the class XSDBaseFieldEditPart method directEditNameField.

protected void directEditNameField() {
    Object model = getModel();
    IFieldFigure fieldFigure = getFieldFigure();
    if (model instanceof IField) {
        IField field = (IField) model;
        if (field.isReference()) {
            ReferenceDirectEditManager manager = null;
            if (field instanceof XSDElementDeclarationAdapter) {
                manager = new ElementReferenceDirectEditManager((IField) model, this, fieldFigure.getNameLabel());
            } else if (field instanceof XSDAttributeDeclarationAdapter) {
                manager = new AttributeReferenceDirectEditManager((IField) model, this, fieldFigure.getNameLabel());
            }
            if (manager != null) {
                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();
        }
    }
}
Also used : ElementReferenceDirectEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ElementReferenceDirectEditManager) LabelEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelEditManager) XSDAttributeDeclarationAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeDeclarationAdapter) LabelCellEditorLocator(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator) IFieldFigure(org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure) IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField) AttributeReferenceDirectEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.AttributeReferenceDirectEditManager) XSDElementDeclarationAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDElementDeclarationAdapter) AttributeReferenceDirectEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.AttributeReferenceDirectEditManager) ReferenceDirectEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ReferenceDirectEditManager) ElementReferenceDirectEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ElementReferenceDirectEditManager)

Example 2 with LabelCellEditorLocator

use of org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator 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();
        }
    }
}
Also used : ElementReferenceDirectEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ElementReferenceDirectEditManager) LabelEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelEditManager) LabelCellEditorLocator(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) IFieldFigure(org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure) IField(org.eclipse.wst.xsd.ui.internal.adt.facade.IField)

Example 3 with LabelCellEditorLocator

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

the class BaseFieldEditPart method doEditName.

public void doEditName(boolean addFromDesign) {
    if (!addFromDesign)
        return;
    // removeFeedback();
    Runnable runnable = new Runnable() {

        public void run() {
            Object object = ((XSDBaseAdapter) getModel()).getTarget();
            if (object instanceof XSDNamedComponent) {
                Point p = getNameLabelFigure().getLocation();
                LabelEditManager manager = new LabelEditManager(BaseFieldEditPart.this, new LabelCellEditorLocator(BaseFieldEditPart.this, p));
                NameUpdateCommandWrapper wrapper = new NameUpdateCommandWrapper();
                adtDirectEditPolicy.setUpdateCommand(wrapper);
                manager.show();
            }
        }
    };
    Display.getCurrent().asyncExec(runnable);
}
Also used : XSDNamedComponent(org.eclipse.xsd.XSDNamedComponent) LabelEditManager(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelEditManager) LabelCellEditorLocator(org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator) XSDBaseAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter) IADTObject(org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

LabelCellEditorLocator (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator)3 LabelEditManager (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelEditManager)3 ElementReferenceDirectEditManager (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ElementReferenceDirectEditManager)2 IFieldFigure (org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure)2 IADTObject (org.eclipse.wst.xsd.ui.internal.adt.facade.IADTObject)2 IField (org.eclipse.wst.xsd.ui.internal.adt.facade.IField)2 Point (org.eclipse.draw2d.geometry.Point)1 XSDAttributeDeclarationAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeDeclarationAdapter)1 XSDBaseAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter)1 XSDElementDeclarationAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDElementDeclarationAdapter)1 AttributeReferenceDirectEditManager (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.AttributeReferenceDirectEditManager)1 ReferenceDirectEditManager (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ReferenceDirectEditManager)1 XSDNamedComponent (org.eclipse.xsd.XSDNamedComponent)1