Search in sources :

Example 1 with XSDCompositor

use of org.eclipse.xsd.XSDCompositor in project tmdm-studio-se by Talend.

the class ConceptComposite method updateElementGroup.

private void updateElementGroup(XSDComplexTypeDefinition type) {
    if (type != null) {
        XSDParticleImpl partCnt = (XSDParticleImpl) type.getContent();
        if (partCnt != null) {
            XSDModelGroupImpl mdlGrp = (XSDModelGroupImpl) partCnt.getTerm();
            XSDCompositor typeComposite = mdlGrp.getCompositor();
            if (typeComposite.equals(XSDCompositor.SEQUENCE_LITERAL)) {
                setSequence();
            } else if (typeComposite.equals(XSDCompositor.ALL_LITERAL)) {
                setAll();
            } else if (typeComposite.equals(XSDCompositor.CHOICE_LITERAL)) {
                setChoice();
            }
            enableRadioButtons(false);
        }
    }
}
Also used : XSDParticleImpl(org.eclipse.xsd.impl.XSDParticleImpl) XSDCompositor(org.eclipse.xsd.XSDCompositor) XSDModelGroupImpl(org.eclipse.xsd.impl.XSDModelGroupImpl)

Example 2 with XSDCompositor

use of org.eclipse.xsd.XSDCompositor in project webtools.sourceediting by eclipse.

the class XSDModelGroupSection method doWidgetSelected.

public void doWidgetSelected(SelectionEvent e) {
    XSDModelGroup particle = (XSDModelGroup) input;
    if (e.widget == modelGroupCombo) {
        XSDCompositor newValue = XSDCompositor.get(modelGroupCombo.getText());
        UpdateContentModelCommand command = new UpdateContentModelCommand(org.eclipse.wst.xsd.ui.internal.common.util.Messages._UI_ACTION_CHANGE_CONTENT_MODEL, particle, newValue);
        getCommandStack().execute(command);
    }
    super.doWidgetSelected(e);
}
Also used : XSDModelGroup(org.eclipse.xsd.XSDModelGroup) XSDCompositor(org.eclipse.xsd.XSDCompositor) UpdateContentModelCommand(org.eclipse.wst.xsd.ui.internal.common.commands.UpdateContentModelCommand)

Example 3 with XSDCompositor

use of org.eclipse.xsd.XSDCompositor in project tmdm-studio-se by Talend.

the class ComplexTypeGroupTypeCommitHandler method validateCommit.

@Override
protected void validateCommit() throws CommitValidationException {
    if (getCommitedObj().getNewExtends() != null && getCommitedObj().getNewExtends().equals(getCommitedObj().getCurComplexType()))
        throw new CommitValidationException(Messages.ComplexTypeXXHandler_CBaseTypeCannotbeItself);
    if (Util.getParentTypes(getCommitedObj().getNewExtends()).contains(getCommitedObj().getCurComplexType()))
        throw new CommitValidationException(Messages.bind(Messages.ComplexTypeXXHandler_ValidExceptionInfo, getCommitedObj().getNewExtends().getName(), getCommitedObj().getCurComplexType().getName()));
    if (!getCommitedObj().isDefaultExtends()) {
        XSDCompositor newBaseGroupType = Util.getComplexTypeGroupType(getCommitedObj().getNewExtends());
        XSDCompositor newGroupType = getCommitedObj().getNewGroupType();
        if (newBaseGroupType != null && newBaseGroupType.equals(XSDCompositor.ALL_LITERAL))
            throw new CommitValidationException(Messages.bind(Messages.ComplexTypeXXHandler_ValidExceptionInfo1, getCommitedObj().getNewExtends().getName()));
        if (newGroupType != null && newGroupType.equals(XSDCompositor.ALL_LITERAL))
            throw new CommitValidationException(Messages.ComplexTypeXXHandler_ValidExceptionInfo2);
        if (newBaseGroupType != null && !newBaseGroupType.equals(newGroupType))
            throw new CommitValidationException(Messages.bind(Messages.ComplexTypeXXHandler_ValidExceptionInfo3, getCommitedObj().getNewExtends().getName()));
    }
}
Also used : CommitValidationException(com.amalto.workbench.detailtabs.exception.CommitValidationException) XSDCompositor(org.eclipse.xsd.XSDCompositor)

Example 4 with XSDCompositor

use of org.eclipse.xsd.XSDCompositor in project tmdm-studio-se by Talend.

the class UtilTest method testGetComplexTypeGroupType.

@Test
public void testGetComplexTypeGroupType() {
    XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) schema.getElementDeclarations().get(0).getTypeDefinition();
    XSDCompositor compositor = Util.getComplexTypeGroupType(complexType);
    // $NON-NLS-1$
    assertEquals(compositor.getName(), "all");
}
Also used : XSDCompositor(org.eclipse.xsd.XSDCompositor) XSDComplexTypeDefinition(org.eclipse.xsd.XSDComplexTypeDefinition) Test(org.junit.Test)

Aggregations

XSDCompositor (org.eclipse.xsd.XSDCompositor)4 CommitValidationException (com.amalto.workbench.detailtabs.exception.CommitValidationException)1 UpdateContentModelCommand (org.eclipse.wst.xsd.ui.internal.common.commands.UpdateContentModelCommand)1 XSDComplexTypeDefinition (org.eclipse.xsd.XSDComplexTypeDefinition)1 XSDModelGroup (org.eclipse.xsd.XSDModelGroup)1 XSDModelGroupImpl (org.eclipse.xsd.impl.XSDModelGroupImpl)1 XSDParticleImpl (org.eclipse.xsd.impl.XSDParticleImpl)1 Test (org.junit.Test)1