use of org.eclipse.xsd.XSDAttributeDeclaration 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.XSDAttributeDeclaration in project webtools.sourceediting by eclipse.
the class XSDAttributeDragAndDropCommand method getElement.
/*
* (non-Javadoc)
* @see org.eclipse.wst.xsd.ui.internal.commands.BaseDragAndDropCommand#getElement()
*/
protected Element getElement() {
XSDAttributeDeclarationAdapter adapter = (XSDAttributeDeclarationAdapter) itemToDrag.getModel();
XSDAttributeDeclaration target = (XSDAttributeDeclaration) adapter.getTarget();
XSDConcreteComponent parent = (XSDConcreteComponent) target.eContainer();
return parent.getElement();
}
use of org.eclipse.xsd.XSDAttributeDeclaration 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.XSDAttributeDeclaration in project webtools.sourceediting by eclipse.
the class XSDSchemaAdapter method getAttributeList.
public List getAttributeList(XSDSchema xsdSchema, boolean showFromIncludes) {
List attributesList = new ArrayList();
for (Iterator iter = xsdSchema.getAttributeDeclarations().iterator(); iter.hasNext(); ) {
Object o = iter.next();
if (o instanceof XSDAttributeDeclaration) {
XSDAttributeDeclaration attr = (XSDAttributeDeclaration) o;
if (attr != null) {
if (attr.getTargetNamespace() != null) {
if (!(attr.getTargetNamespace().equals(XSDConstants.SCHEMA_INSTANCE_URI_2001))) {
if (shouldShowComponent(attr, xsdSchema, showFromIncludes)) {
attributesList.add(attr);
}
}
} else {
if (shouldShowComponent(attr, xsdSchema, showFromIncludes)) {
attributesList.add(attr);
}
}
}
}
}
attributesList.addAll(getAttributeGroupList(xsdSchema, showFromIncludes));
List adapterList = new ArrayList();
populateAdapterList(attributesList, adapterList);
return adapterList;
}
use of org.eclipse.xsd.XSDAttributeDeclaration in project webtools.sourceediting by eclipse.
the class XSDAttributeReferenceEditManager method modifyComponentReference.
public void modifyComponentReference(Object referencingObject, ComponentSpecification referencedComponent) {
XSDAttributeDeclaration concreteComponent = null;
if (referencingObject instanceof Adapter) {
Adapter adapter = (Adapter) referencingObject;
if (adapter.getTarget() instanceof XSDAttributeDeclaration) {
concreteComponent = (XSDAttributeDeclaration) adapter.getTarget();
}
} else if (referencingObject instanceof XSDConcreteComponent) {
concreteComponent = (XSDAttributeDeclaration) referencingObject;
}
if (concreteComponent != null) {
if (referencedComponent.isNew()) {
XSDAttributeDeclaration attributeDec = null;
if (referencedComponent.getMetaName() == IXSDSearchConstants.ATTRIBUTE_META_NAME) {
AddXSDAttributeDeclarationCommand command = new AddXSDAttributeDeclarationCommand(Messages._UI_ACTION_ADD_ATTRIBUTE, concreteComponent.getSchema());
command.setNameToAdd(referencedComponent.getName());
command.execute();
attributeDec = (XSDAttributeDeclaration) command.getAddedComponent();
}
if (attributeDec != null) {
Command command = new UpdateAttributeReferenceCommand(Messages._UI_ACTION_UPDATE_ATTRIBUTE_REFERENCE, concreteComponent, attributeDec);
command.execute();
}
XSDDirectivesManager.removeUnusedXSDImports(concreteComponent.getSchema());
} else {
Command command = new UpdateAttributeReferenceAndManagerDirectivesCommand(concreteComponent, referencedComponent.getName(), referencedComponent.getQualifier(), referencedComponent.getFile());
command.setLabel(Messages._UI_ACTION_UPDATE_ATTRIBUTE_REFERENCE);
command.execute();
}
}
}
Aggregations