use of org.eclipse.xsd.XSDNotationDeclaration in project webtools.sourceediting by eclipse.
the class XSDCommonUIUtils method getInputXSDAnnotation.
public static XSDAnnotation getInputXSDAnnotation(XSDConcreteComponent input, boolean createIfNotExist) {
XSDAnnotation xsdAnnotation = null;
XSDFactory factory = XSDFactory.eINSTANCE;
if (input instanceof XSDAttributeDeclaration) {
XSDAttributeDeclaration xsdComp = (XSDAttributeDeclaration) input;
xsdAnnotation = xsdComp.getAnnotation();
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
xsdComp.setAnnotation(xsdAnnotation);
}
} else if (input instanceof XSDAttributeGroupDefinition) {
XSDAttributeGroupDefinition xsdComp = (XSDAttributeGroupDefinition) input;
xsdAnnotation = xsdComp.getAnnotation();
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
xsdComp.setAnnotation(xsdAnnotation);
}
} else if (input instanceof XSDElementDeclaration) {
XSDElementDeclaration xsdComp = (XSDElementDeclaration) input;
xsdAnnotation = xsdComp.getAnnotation();
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
xsdComp.setAnnotation(xsdAnnotation);
}
} else if (input instanceof XSDNotationDeclaration) {
XSDNotationDeclaration xsdComp = (XSDNotationDeclaration) input;
xsdAnnotation = xsdComp.getAnnotation();
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
xsdComp.setAnnotation(xsdAnnotation);
}
} else if (input instanceof XSDXPathDefinition) {
XSDXPathDefinition xsdComp = (XSDXPathDefinition) input;
xsdAnnotation = xsdComp.getAnnotation();
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
xsdComp.setAnnotation(xsdAnnotation);
}
} else if (input instanceof XSDModelGroup) {
XSDModelGroup xsdComp = (XSDModelGroup) input;
xsdAnnotation = xsdComp.getAnnotation();
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
xsdComp.setAnnotation(xsdAnnotation);
}
} else if (input instanceof XSDModelGroupDefinition) {
XSDModelGroupDefinition xsdComp = (XSDModelGroupDefinition) input;
xsdAnnotation = xsdComp.getAnnotation();
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
xsdComp.setAnnotation(xsdAnnotation);
}
} else if (input instanceof XSDIdentityConstraintDefinition) {
XSDIdentityConstraintDefinition xsdComp = (XSDIdentityConstraintDefinition) input;
xsdAnnotation = xsdComp.getAnnotation();
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
xsdComp.setAnnotation(xsdAnnotation);
}
} else if (input instanceof XSDWildcard) {
XSDWildcard xsdComp = (XSDWildcard) input;
xsdAnnotation = xsdComp.getAnnotation();
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
xsdComp.setAnnotation(xsdAnnotation);
}
} else if (input instanceof XSDSchema) {
XSDSchema xsdComp = (XSDSchema) input;
List list = xsdComp.getAnnotations();
if (list.size() > 0) {
xsdAnnotation = (XSDAnnotation) list.get(0);
} else {
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
if (xsdComp.getContents() != null) {
xsdComp.getContents().add(0, xsdAnnotation);
}
}
}
return xsdAnnotation;
} else if (input instanceof XSDFacet) {
XSDFacet xsdComp = (XSDFacet) input;
xsdAnnotation = xsdComp.getAnnotation();
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
xsdComp.setAnnotation(xsdAnnotation);
}
} else if (input instanceof XSDTypeDefinition) {
XSDTypeDefinition xsdComp = (XSDTypeDefinition) input;
xsdAnnotation = xsdComp.getAnnotation();
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
xsdComp.setAnnotation(xsdAnnotation);
}
} else if (input instanceof XSDInclude) {
XSDInclude xsdComp = (XSDInclude) input;
xsdAnnotation = xsdComp.getAnnotation();
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
xsdComp.setAnnotation(xsdAnnotation);
}
} else if (input instanceof XSDImport) {
XSDImport xsdComp = (XSDImport) input;
xsdAnnotation = xsdComp.getAnnotation();
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
xsdComp.setAnnotation(xsdAnnotation);
}
} else if (input instanceof XSDRedefine) {
XSDRedefine xsdComp = (XSDRedefine) input;
List contents = xsdComp.getContents();
for (int i = 0; i < contents.size(); i++) {
Object content = contents.get(i);
if (content instanceof XSDAnnotation) {
xsdAnnotation = (XSDAnnotation) content;
break;
}
}
if (createIfNotExist && xsdAnnotation == null) {
xsdAnnotation = factory.createXSDAnnotation();
contents.add(0, xsdAnnotation);
}
return xsdAnnotation;
} else if (input instanceof XSDAnnotation) {
xsdAnnotation = (XSDAnnotation) input;
}
if (createIfNotExist) {
formatAnnotation(xsdAnnotation);
}
return xsdAnnotation;
}
use of org.eclipse.xsd.XSDNotationDeclaration in project webtools.sourceediting by eclipse.
the class XSDVisitor method visitSchema.
public void visitSchema(XSDSchema schema) {
this.schema = schema;
for (Iterator iterator = schema.getAttributeDeclarations().iterator(); iterator.hasNext(); ) {
XSDAttributeDeclaration attr = (XSDAttributeDeclaration) iterator.next();
visitAttributeDeclaration(attr);
}
for (Iterator iterator = schema.getTypeDefinitions().iterator(); iterator.hasNext(); ) {
XSDTypeDefinition type = (XSDTypeDefinition) iterator.next();
visitTypeDefinition(type);
}
for (Iterator iterator = schema.getElementDeclarations().iterator(); iterator.hasNext(); ) {
XSDElementDeclaration element = (XSDElementDeclaration) iterator.next();
visitElementDeclaration(element);
}
for (Iterator iterator = schema.getIdentityConstraintDefinitions().iterator(); iterator.hasNext(); ) {
XSDIdentityConstraintDefinition identityConstraint = (XSDIdentityConstraintDefinition) iterator.next();
visitIdentityConstraintDefinition(identityConstraint);
}
for (Iterator iterator = schema.getModelGroupDefinitions().iterator(); iterator.hasNext(); ) {
XSDModelGroupDefinition modelGroup = (XSDModelGroupDefinition) iterator.next();
visitModelGroupDefinition(modelGroup);
}
for (Iterator iterator = schema.getAttributeGroupDefinitions().iterator(); iterator.hasNext(); ) {
XSDAttributeGroupDefinition attributeGroup = (XSDAttributeGroupDefinition) iterator.next();
visitAttributeGroupDefinition(attributeGroup);
}
for (Iterator iterator = schema.getNotationDeclarations().iterator(); iterator.hasNext(); ) {
XSDNotationDeclaration element = (XSDNotationDeclaration) iterator.next();
visitNotationDeclaration(element);
}
}
use of org.eclipse.xsd.XSDNotationDeclaration in project webtools.sourceediting by eclipse.
the class XSDVisitor method visitSchema.
public void visitSchema(XSDSchema schema) {
this.schema = schema;
for (Iterator iterator = schema.getAttributeDeclarations().iterator(); iterator.hasNext(); ) {
XSDAttributeDeclaration attr = (XSDAttributeDeclaration) iterator.next();
visitAttributeDeclaration(attr);
}
for (Iterator iterator = schema.getTypeDefinitions().iterator(); iterator.hasNext(); ) {
XSDTypeDefinition type = (XSDTypeDefinition) iterator.next();
visitTypeDefinition(type);
}
for (Iterator iterator = schema.getElementDeclarations().iterator(); iterator.hasNext(); ) {
XSDElementDeclaration element = (XSDElementDeclaration) iterator.next();
visitElementDeclaration(element);
}
for (Iterator iterator = schema.getIdentityConstraintDefinitions().iterator(); iterator.hasNext(); ) {
XSDIdentityConstraintDefinition identityConstraint = (XSDIdentityConstraintDefinition) iterator.next();
visitIdentityConstraintDefinition(identityConstraint);
}
for (Iterator iterator = schema.getModelGroupDefinitions().iterator(); iterator.hasNext(); ) {
XSDModelGroupDefinition modelGroup = (XSDModelGroupDefinition) iterator.next();
visitModelGroupDefinition(modelGroup);
}
for (Iterator iterator = schema.getAttributeGroupDefinitions().iterator(); iterator.hasNext(); ) {
XSDAttributeGroupDefinition attributeGroup = (XSDAttributeGroupDefinition) iterator.next();
visitAttributeGroupDefinition(attributeGroup);
}
for (Iterator iterator = schema.getNotationDeclarations().iterator(); iterator.hasNext(); ) {
XSDNotationDeclaration element = (XSDNotationDeclaration) iterator.next();
visitNotationDeclaration(element);
}
}
use of org.eclipse.xsd.XSDNotationDeclaration in project webtools.sourceediting by eclipse.
the class XSDVisitor method visitSchema.
public void visitSchema(XSDSchema schema) {
this.schema = schema;
for (Iterator iterator = schema.getAttributeDeclarations().iterator(); iterator.hasNext(); ) {
XSDAttributeDeclaration attr = (XSDAttributeDeclaration) iterator.next();
visitAttributeDeclaration(attr);
}
for (Iterator iterator = schema.getTypeDefinitions().iterator(); iterator.hasNext(); ) {
XSDTypeDefinition type = (XSDTypeDefinition) iterator.next();
visitTypeDefinition(type);
}
for (Iterator iterator = schema.getElementDeclarations().iterator(); iterator.hasNext(); ) {
XSDElementDeclaration element = (XSDElementDeclaration) iterator.next();
visitElementDeclaration(element);
}
for (Iterator iterator = schema.getIdentityConstraintDefinitions().iterator(); iterator.hasNext(); ) {
XSDIdentityConstraintDefinition identityConstraint = (XSDIdentityConstraintDefinition) iterator.next();
visitIdentityConstraintDefinition(identityConstraint);
}
for (Iterator iterator = schema.getModelGroupDefinitions().iterator(); iterator.hasNext(); ) {
XSDModelGroupDefinition modelGroup = (XSDModelGroupDefinition) iterator.next();
visitModelGroupDefinition(modelGroup);
}
for (Iterator iterator = schema.getAttributeGroupDefinitions().iterator(); iterator.hasNext(); ) {
XSDAttributeGroupDefinition attributeGroup = (XSDAttributeGroupDefinition) iterator.next();
visitAttributeGroupDefinition(attributeGroup);
}
for (Iterator iterator = schema.getNotationDeclarations().iterator(); iterator.hasNext(); ) {
XSDNotationDeclaration element = (XSDNotationDeclaration) iterator.next();
visitNotationDeclaration(element);
}
}
Aggregations