use of org.eclipse.xsd.XSDModelGroupDefinition in project webtools.sourceediting by eclipse.
the class TypesHelper method getModelGroups.
public java.util.List getModelGroups() {
Vector items = new Vector();
if (xsdSchema != null) {
updateExternalImportGlobals();
if (xsdSchema.getModelGroupDefinitions() != null) {
Iterator i = xsdSchema.getModelGroupDefinitions().iterator();
while (i.hasNext()) {
XSDModelGroupDefinition modelGroupDefinition = (XSDModelGroupDefinition) i.next();
String name = modelGroupDefinition.getQName(xsdSchema);
if (name != null) {
items.add(name);
}
}
}
// items = addExternalImportedGroups(items);
items = (Vector) sortList(items);
}
return items;
}
use of org.eclipse.xsd.XSDModelGroupDefinition in project webtools.sourceediting by eclipse.
the class ModelGroupDefinitionReferenceEditPart method getModelChildren.
protected List getModelChildren() {
List list = new ArrayList();
XSDModelGroupDefinitionAdapter adapter = (XSDModelGroupDefinitionAdapter) getModel();
XSDModelGroupDefinition groupDef = ((XSDModelGroupDefinition) adapter.getTarget());
XSDModelGroupDefinition resolvedGroupDef = groupDef.getResolvedModelGroupDefinition();
XSDModelGroup xsdModelGroup = resolvedGroupDef.getModelGroup();
ArrayList listOfVisibleGroupRefs = new ArrayList();
for (EditPart ep = getParent(); ep != null; ) {
Object object = ep.getModel();
if (object instanceof XSDModelGroupDefinitionAdapter) {
Object model = ((XSDModelGroupDefinitionAdapter) object).getTarget();
if (model instanceof XSDModelGroupDefinition) {
listOfVisibleGroupRefs.add(((XSDModelGroupDefinition) model).getResolvedModelGroupDefinition());
}
}
ep = ep.getParent();
}
boolean isCyclic = (listOfVisibleGroupRefs.contains(resolvedGroupDef));
if (xsdModelGroup != null && !isCyclic)
list.add(XSDAdapterFactory.getInstance().adapt(xsdModelGroup));
if (isCyclic)
list.add(new TargetConnectionSpaceFiller(null));
return list;
}
use of org.eclipse.xsd.XSDModelGroupDefinition in project webtools.sourceediting by eclipse.
the class AddXSDRedefinedModelGroupAction method buildComponentsList.
protected void buildComponentsList(XSDRedefine xsdRedefine, Set redefinedComponentsNames, IComponentList componentList) {
List modelGroupList = xsdRedefine.getIncorporatedSchema().getModelGroupDefinitions();
Iterator iterator = modelGroupList.iterator();
while (iterator.hasNext()) {
XSDModelGroupDefinition modelGroupDefinition = (XSDModelGroupDefinition) iterator.next();
String modelGroupDefinitionName = modelGroupDefinition.getName();
if (!redefinedComponentsNames.contains(modelGroupDefinitionName)) {
componentList.add(modelGroupDefinition);
}
}
}
use of org.eclipse.xsd.XSDModelGroupDefinition in project webtools.sourceediting by eclipse.
the class XSDModelGroupSection method refresh.
public void refresh() {
super.refresh();
if (isReadOnly) {
composite.setEnabled(false);
} else {
composite.setEnabled(true);
}
setListenerEnabled(false);
if (input != null) {
if (input instanceof XSDModelGroup) {
XSDModelGroup particle = (XSDModelGroup) input;
String modelType = particle.getCompositor().getName();
modelGroupCombo.setText(modelType);
minCombo.setEnabled(!(particle.eContainer() instanceof XSDModelGroupDefinition));
maxCombo.setEnabled(!(particle.eContainer() instanceof XSDModelGroupDefinition));
}
}
refreshMinMax();
setListenerEnabled(true);
}
use of org.eclipse.xsd.XSDModelGroupDefinition in project webtools.sourceediting by eclipse.
the class AddXSDElementCommand method getModelGroup.
// PORT
public XSDModelGroup getModelGroup(XSDComplexTypeDefinition cType) {
XSDParticle particle = null;
XSDComplexTypeContent xsdComplexTypeContent = cType.getContent();
if (xsdComplexTypeContent instanceof XSDParticle) {
particle = (XSDParticle) xsdComplexTypeContent;
}
if (particle == null) {
return null;
}
Object particleContent = particle.getContent();
XSDModelGroup group = null;
if (particleContent instanceof XSDModelGroupDefinition) {
group = ((XSDModelGroupDefinition) particleContent).getResolvedModelGroupDefinition().getModelGroup();
} else if (particleContent instanceof XSDModelGroup) {
group = (XSDModelGroup) particleContent;
}
if (group == null) {
return null;
}
return group;
}
Aggregations