Search in sources :

Example 1 with UpdateMinOccursCommand

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

the class MultiplicitySection method updateMinAttribute.

protected void updateMinAttribute() {
    setErrorMessage(null);
    XSDParticle particle = null;
    if (input instanceof XSDParticleContent) {
        particle = getAssociatedParticle((XSDParticleContent) input);
    }
    if (particle != null) {
        String newValue = minCombo.getText();
        if (newValue.length() == 0) {
            particle.unsetMinOccurs();
        }
        try {
            int newMin = 1;
            if (// $NON-NLS-1$ //$NON-NLS-2$
            newValue.equals("unbounded") || newValue.equals("*")) {
                newMin = XSDParticle.UNBOUNDED;
            } else {
                newMin = Integer.parseInt(newValue);
            }
            UpdateMinOccursCommand command = new UpdateMinOccursCommand(Messages._UI_ACTION_CHANGE_MINIMUM_OCCURRENCE, particle, newMin);
            getCommandStack().execute(command);
        } catch (NumberFormatException e) {
        }
    }
}
Also used : XSDParticleContent(org.eclipse.xsd.XSDParticleContent) XSDParticle(org.eclipse.xsd.XSDParticle) UpdateMinOccursCommand(org.eclipse.wst.xsd.ui.internal.common.commands.UpdateMinOccursCommand)

Aggregations

UpdateMinOccursCommand (org.eclipse.wst.xsd.ui.internal.common.commands.UpdateMinOccursCommand)1 XSDParticle (org.eclipse.xsd.XSDParticle)1 XSDParticleContent (org.eclipse.xsd.XSDParticleContent)1