Search in sources :

Example 6 with UpdateAttributeValueCommand

use of org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand in project webtools.sourceediting by eclipse.

the class XSDComplexTypeAdvancedSection method doWidgetSelected.

public void doWidgetSelected(SelectionEvent e) {
    XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) input;
    if (e.widget == blockCombo) {
        String value = blockCombo.getText();
        UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.BLOCK_ATTRIBUTE, value, Messages._UI_LABEL_BLOCK);
        command.setDeleteIfEmpty(true);
        getCommandStack().execute(command);
    } else if (e.widget == finalCombo) {
        String value = finalCombo.getText();
        UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.FINAL_ATTRIBUTE, value, Messages._UI_LABEL_FINAL);
        command.setDeleteIfEmpty(true);
        getCommandStack().execute(command);
    } else if (e.widget == abstractCombo) {
        String value = abstractCombo.getText();
        UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.ABSTRACT_ATTRIBUTE, value, Messages._UI_LABEL_ABSTRACT);
        command.setDeleteIfEmpty(true);
        getCommandStack().execute(command);
    } else if (e.widget == mixedCombo) {
        String value = mixedCombo.getText();
        UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(complexType.getElement(), XSDConstants.MIXED_ATTRIBUTE, value, Messages._UI_LABEL_MIXED);
        command.setDeleteIfEmpty(true);
        getCommandStack().execute(command);
    }
}
Also used : UpdateAttributeValueCommand(org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand) XSDComplexTypeDefinition(org.eclipse.xsd.XSDComplexTypeDefinition)

Example 7 with UpdateAttributeValueCommand

use of org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand in project webtools.sourceediting by eclipse.

the class XSDSimpleTypeAdvancedSection method doWidgetSelected.

public void doWidgetSelected(SelectionEvent e) {
    if (e.widget == finalCombo && input != null && input instanceof XSDSimpleTypeDefinition) {
        XSDSimpleTypeDefinition simpleType = (XSDSimpleTypeDefinition) input;
        String value = finalCombo.getText();
        UpdateAttributeValueCommand command = new UpdateAttributeValueCommand(simpleType.getElement(), XSDConstants.FINAL_ATTRIBUTE, value, Messages._UI_LABEL_FINAL);
        command.setDeleteIfEmpty(true);
        getCommandStack().execute(command);
    }
}
Also used : UpdateAttributeValueCommand(org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand) XSDSimpleTypeDefinition(org.eclipse.xsd.XSDSimpleTypeDefinition)

Aggregations

UpdateAttributeValueCommand (org.eclipse.wst.xsd.ui.internal.common.commands.UpdateAttributeValueCommand)7 XSDElementDeclaration (org.eclipse.xsd.XSDElementDeclaration)3 Command (org.eclipse.gef.commands.Command)2 Adapter (org.eclipse.emf.common.notify.Adapter)1 IEditorPart (org.eclipse.ui.IEditorPart)1 ComponentSpecification (org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification)1 ComponentReferenceEditManager (org.eclipse.wst.xsd.ui.internal.adt.edit.ComponentReferenceEditManager)1 IComponentDialog (org.eclipse.wst.xsd.ui.internal.adt.edit.IComponentDialog)1 AddXSDElementCommand (org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDElementCommand)1 BaseCommand (org.eclipse.wst.xsd.ui.internal.common.commands.BaseCommand)1 UpdateNameCommand (org.eclipse.wst.xsd.ui.internal.common.commands.UpdateNameCommand)1 XSDAttributeDeclaration (org.eclipse.xsd.XSDAttributeDeclaration)1 XSDComplexTypeDefinition (org.eclipse.xsd.XSDComplexTypeDefinition)1 XSDConcreteComponent (org.eclipse.xsd.XSDConcreteComponent)1 XSDSimpleTypeDefinition (org.eclipse.xsd.XSDSimpleTypeDefinition)1 Element (org.w3c.dom.Element)1