use of org.eclipse.xsd.XSDModelGroup in project webtools.sourceediting by eclipse.
the class XSDGroupsForAnnotationEditPart method getModelChildren.
protected List getModelChildren() {
List xsdModelGroupList = new ArrayList();
List adapterList = new ArrayList();
IStructure structure = ((Annotation) getModel()).getOwner();
if (structure instanceof IComplexType) {
complexType = (IComplexType) structure;
if (complexType instanceof XSDComplexTypeDefinitionAdapter) {
XSDComplexTypeDefinitionAdapter adapter = (XSDComplexTypeDefinitionAdapter) complexType;
xsdModelGroupList = adapter.getModelGroups();
}
for (Iterator i = xsdModelGroupList.iterator(); i.hasNext(); ) {
Object obj = i.next();
if (obj instanceof XSDModelGroup) {
adapterList.add(XSDAdapterFactory.getInstance().adapt((XSDModelGroup) obj));
} else if (obj instanceof XSDModelGroupDefinition) {
adapterList.add(XSDAdapterFactory.getInstance().adapt((XSDModelGroupDefinition) obj));
}
}
} else if (structure instanceof XSDModelGroupDefinitionAdapter) {
XSDModelGroupDefinitionAdapter adapter = (XSDModelGroupDefinitionAdapter) structure;
XSDModelGroup group = adapter.getXSDModelGroupDefinition().getModelGroup();
if (group != null) {
adapterList.add(XSDAdapterFactory.getInstance().adapt(group));
}
}
return adapterList;
}
use of org.eclipse.xsd.XSDModelGroup in project webtools.sourceediting by eclipse.
the class XSDModelGroupDefinitionAdapter method getChildren.
public ITreeElement[] getChildren() {
XSDModelGroupDefinition def = (XSDModelGroupDefinition) target;
List list = new ArrayList();
// entries in the tree viewer for the same item
if (!def.isModelGroupDefinitionReference()) {
XSDModelGroup xsdModelGroup = ((XSDModelGroupDefinition) target).getResolvedModelGroupDefinition().getModelGroup();
if (xsdModelGroup != null)
list.add(xsdModelGroup);
}
List adapterList = new ArrayList();
populateAdapterList(list, adapterList);
return (ITreeElement[]) adapterList.toArray(new ITreeElement[0]);
}
use of org.eclipse.xsd.XSDModelGroup in project tmdm-studio-se by Talend.
the class ComplexTypeConfigComposite method initUIContentsInGroup.
private void initUIContentsInGroup() {
XSDParticle groupParticle = (XSDParticle) complexType.getContent();
XSDModelGroup group = (XSDModelGroup) groupParticle.getContent();
radGroupAll.setSelection(XSDCompositor.ALL_LITERAL.equals(group.getCompositor()));
radGroupSequence.setSelection(XSDCompositor.SEQUENCE_LITERAL.equals(group.getCompositor()));
radGroupChoice.setSelection(XSDCompositor.CHOICE_LITERAL.equals(group.getCompositor()));
}
use of org.eclipse.xsd.XSDModelGroup in project tmdm-studio-se by Talend.
the class DataModelMainPage method setLabelForElement.
private void setLabelForElement(XSDElementDeclaration xSDEle, boolean isAdd) {
if (xSDEle.getTypeDefinition() instanceof XSDComplexTypeDefinition) {
XSDAnnotationsStructure struc = null;
String labelValue = null;
List childrenList = Util.getComplexTypeDefinitionChildren((XSDComplexTypeDefinition) xSDEle.getTypeDefinition());
for (int j = 0; j < childrenList.size(); j++) {
List<XSDParticle> particles = new ArrayList<XSDParticle>();
if (childrenList.get(j) instanceof XSDModelGroup) {
particles = ((XSDModelGroup) childrenList.get(j)).getParticles();
}
for (int k = 0; k < particles.size(); k++) {
XSDParticle xSDCom = particles.get(k);
struc = new XSDAnnotationsStructure(xSDCom);
if (xSDCom.getContent() instanceof XSDElementDeclaration) {
labelValue = ((XSDElementDeclaration) xSDCom.getContent()).getName();
setLabel(struc, labelValue, isAdd);
setLabelForElement((XSDElementDeclaration) xSDCom.getContent(), isAdd);
}
}
}
}
}
use of org.eclipse.xsd.XSDModelGroup in project tmdm-studio-se by Talend.
the class TreeExpandHelper method getName.
private String getName(Object objA) {
if (objA instanceof XSDElementDeclaration) {
XSDElementDeclaration decl = (XSDElementDeclaration) objA;
return decl.getName();
}
if (objA instanceof XSDModelGroup) {
XSDModelGroup goup = (XSDModelGroup) objA;
XSDParticle particle = (XSDParticle) goup.getContainer();
XSDComplexTypeDefinition complexTypeDefinition = (XSDComplexTypeDefinition) particle.getContainer();
String name = complexTypeDefinition.getName();
return name;
}
if (objA instanceof XSDModelGroupDefinition) {
XSDModelGroupDefinition goupDef = (XSDModelGroupDefinition) objA;
return goupDef.getName();
}
if (objA instanceof XSDParticle) {
XSDParticle particle = (XSDParticle) objA;
if (particle.getTerm() instanceof XSDElementDeclaration) {
XSDElementDeclaration decl = (XSDElementDeclaration) particle.getTerm();
return decl.getName();
}
}
if (objA instanceof XSDAnnotation) {
return null;
}
if (objA instanceof XSDIdentityConstraintDefinition) {
XSDIdentityConstraintDefinition constraint = (XSDIdentityConstraintDefinition) objA;
return constraint.getName();
}
if (objA instanceof XSDSimpleTypeDefinition) {
XSDSimpleTypeDefinition simpleDefine = (XSDSimpleTypeDefinition) objA;
return simpleDefine.getName();
}
if (objA instanceof XSDComplexTypeDefinition) {
XSDComplexTypeDefinition complexDefine = (XSDComplexTypeDefinition) objA;
return complexDefine.getName();
}
return null;
}
Aggregations