Search in sources :

Example 1 with AttributeReferenceDirectEditManager

use of org.eclipse.wst.xsd.ui.internal.adt.design.directedit.AttributeReferenceDirectEditManager 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)

Aggregations

XSDAttributeDeclarationAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDAttributeDeclarationAdapter)1 XSDElementDeclarationAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDElementDeclarationAdapter)1 AttributeReferenceDirectEditManager (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.AttributeReferenceDirectEditManager)1 ElementReferenceDirectEditManager (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ElementReferenceDirectEditManager)1 LabelCellEditorLocator (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelCellEditorLocator)1 LabelEditManager (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.LabelEditManager)1 ReferenceDirectEditManager (org.eclipse.wst.xsd.ui.internal.adt.design.directedit.ReferenceDirectEditManager)1 IFieldFigure (org.eclipse.wst.xsd.ui.internal.adt.design.figures.IFieldFigure)1 IField (org.eclipse.wst.xsd.ui.internal.adt.facade.IField)1