Search in sources :

Example 1 with SetXSDFacetValueCommand

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

the class SpecificConstraintsWidget method doModify.

public void doModify(Object element, String property, Object value) {
    setButtonStates(this.kind);
    if (element instanceof TableItem && (value != null)) {
        TableItem item = (TableItem) element;
        if (item.getData() instanceof XSDPatternFacet) {
            XSDPatternFacet patternFacet = (XSDPatternFacet) item.getData();
            patternFacet.setLexicalValue((String) value);
            item.setData(patternFacet);
            item.setText((String) value);
        } else if (item.getData() instanceof XSDEnumerationFacet) {
            XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) item.getData();
            SetXSDFacetValueCommand command = new SetXSDFacetValueCommand(Messages._UI_ACTION_SET_ENUMERATION_VALUE, enumFacet);
            command.setValue((String) value);
            commandStack.execute(command);
            item.setData(enumFacet);
            item.setText((String) value);
        }
    }
}
Also used : XSDPatternFacet(org.eclipse.xsd.XSDPatternFacet) XSDEnumerationFacet(org.eclipse.xsd.XSDEnumerationFacet) TableItem(org.eclipse.swt.widgets.TableItem) SetXSDFacetValueCommand(org.eclipse.wst.xsd.ui.internal.common.commands.SetXSDFacetValueCommand)

Example 2 with SetXSDFacetValueCommand

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

the class XSDEnumerationFacetSection method doHandleEvent.

public void doHandleEvent(Event event) {
    if (event.widget == valueText) {
        if (!valueText.getEditable())
            return;
        String value = valueText.getText();
        if (input instanceof XSDEnumerationFacet) {
            XSDEnumerationFacet xsdEnumeration = (XSDEnumerationFacet) input;
            Command command = null;
            command = new SetXSDFacetValueCommand(Messages._UI_ACTION_CHANGE_ENUMERATION_VALUE, xsdEnumeration, value);
            if (command != null && getCommandStack() != null) {
                getCommandStack().execute(command);
                valueText.setText(value);
            }
        }
    }
}
Also used : XSDEnumerationFacet(org.eclipse.xsd.XSDEnumerationFacet) SetXSDFacetValueCommand(org.eclipse.wst.xsd.ui.internal.common.commands.SetXSDFacetValueCommand) Command(org.eclipse.gef.commands.Command) SetXSDFacetValueCommand(org.eclipse.wst.xsd.ui.internal.common.commands.SetXSDFacetValueCommand)

Aggregations

SetXSDFacetValueCommand (org.eclipse.wst.xsd.ui.internal.common.commands.SetXSDFacetValueCommand)2 XSDEnumerationFacet (org.eclipse.xsd.XSDEnumerationFacet)2 Command (org.eclipse.gef.commands.Command)1 TableItem (org.eclipse.swt.widgets.TableItem)1 XSDPatternFacet (org.eclipse.xsd.XSDPatternFacet)1