use of org.eclipse.xsd.XSDAttributeGroupDefinition in project webtools.sourceediting by eclipse.
the class XSDAttributeGroupDefinitionAdapter method getActions.
public String[] getActions(Object object) {
List list = new ArrayList();
list.add(AddXSDAttributeDeclarationAction.ID);
list.add(AddXSDAnyAttributeAction.ID);
list.add(BaseSelectionAction.SEPARATOR_ID);
list.add(DeleteAction.ID);
list.add(BaseSelectionAction.SEPARATOR_ID);
Object schema = getEditorSchema();
XSDAttributeGroupDefinition attributeGroupDefinition = getXSDAttributeGroupDefinition();
if (attributeGroupDefinition.getSchema() == schema) {
XSDConcreteComponent container = attributeGroupDefinition.getContainer();
if (container == schema || container instanceof XSDRedefine) {
list.add(SetInputToGraphView.ID);
}
} else {
list.add(OpenInNewEditor.ID);
}
list.add(BaseSelectionAction.SEPARATOR_ID);
list.add(ShowPropertiesViewAction.ID);
return (String[]) list.toArray(new String[0]);
}
use of org.eclipse.xsd.XSDAttributeGroupDefinition in project webtools.sourceediting by eclipse.
the class XSDAttributeGroupDefinitionAdapter method getText.
public String getText() {
XSDAttributeGroupDefinition xsdAttributeGroupDefinition = (XSDAttributeGroupDefinition) target;
String result = xsdAttributeGroupDefinition.isAttributeGroupDefinitionReference() ? xsdAttributeGroupDefinition.getQName() : xsdAttributeGroupDefinition.getName();
return result == null ? Messages._UI_LABEL_ABSENT : result;
}
use of org.eclipse.xsd.XSDAttributeGroupDefinition in project webtools.sourceediting by eclipse.
the class XSDRedefineAdapter method notifyChanged.
public void notifyChanged(final Notification msg) {
class CategoryNotification extends NotificationImpl {
protected Object category;
public CategoryNotification(Object category) {
super(msg.getEventType(), msg.getOldValue(), msg.getNewValue(), msg.getPosition());
this.category = category;
}
public Object getNotifier() {
return category;
}
public Object getFeature() {
return msg.getFeature();
}
}
if (children == null) {
getChildren();
}
Object newValue = msg.getNewValue();
Object oldValue = msg.getOldValue();
if (XSDPackage.eINSTANCE.getXSDRedefine_Contents() == msg.getFeature()) {
if ((newValue instanceof XSDAttributeGroupDefinition) || oldValue instanceof XSDAttributeGroupDefinition) {
CategoryAdapter adapter = getCategory(CategoryAdapter.ATTRIBUTES);
Assert.isTrue(adapter != null);
List list = getCategoryChildren(CategoryAdapter.ATTRIBUTES);
adapter.setChildren(list);
adapter.setAllChildren(list);
if (adapter.getModel() instanceof XSDSchemaAdapter) {
XSDSchemaAdapter schemaAdapter = (XSDSchemaAdapter) adapter.getModel();
schemaAdapter.notifyChanged(msg);
}
notifyListeners(new CategoryNotification(adapter), adapter.getText());
return;
} else if ((newValue instanceof XSDComplexTypeDefinition || newValue instanceof XSDSimpleTypeDefinition) || (oldValue instanceof XSDComplexTypeDefinition || oldValue instanceof XSDSimpleTypeDefinition)) {
CategoryAdapter adapter = getCategory(CategoryAdapter.TYPES);
Assert.isTrue(adapter != null);
List types = getCategoryChildren(CategoryAdapter.TYPES);
adapter.setChildren(types);
adapter.setAllChildren(types);
if (adapter.getModel() instanceof XSDSchemaAdapter) {
XSDSchemaAdapter schemaAdapter = (XSDSchemaAdapter) adapter.getModel();
schemaAdapter.notifyChanged(msg);
}
notifyListeners(new CategoryNotification(adapter), adapter.getText());
return;
} else if (newValue instanceof XSDModelGroupDefinition || oldValue instanceof XSDModelGroupDefinition) {
CategoryAdapter adapter = getCategory(CategoryAdapter.GROUPS);
Assert.isTrue(adapter != null);
List list = getCategoryChildren(CategoryAdapter.GROUPS);
adapter.setChildren(list);
adapter.setAllChildren(list);
if (adapter.getModel() instanceof XSDSchemaAdapter) {
XSDSchemaAdapter schemaAdapter = (XSDSchemaAdapter) adapter.getModel();
schemaAdapter.notifyChanged(msg);
}
notifyListeners(new CategoryNotification(adapter), adapter.getText());
return;
} else if (msg.getFeature() == XSDPackage.eINSTANCE.getXSDSchema_Annotations()) {
return;
}
}
super.notifyChanged(msg);
}
use of org.eclipse.xsd.XSDAttributeGroupDefinition 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.XSDAttributeGroupDefinition in project webtools.sourceediting by eclipse.
the class XSDComplexTypeDefinitionAdapter method getAttributeGroupContent.
public List getAttributeGroupContent() {
EList attrContent = getXSDComplexTypeDefinition().getAttributeContents();
List attrUses = new ArrayList();
List list = new ArrayList();
for (Iterator it = attrContent.iterator(); it.hasNext(); ) {
XSDAttributeGroupContent attrGroupContent = (XSDAttributeGroupContent) it.next();
if (attrGroupContent instanceof XSDAttributeGroupDefinition) {
XSDAttributeGroupDefinition attributeGroupDefinition = (XSDAttributeGroupDefinition) attrGroupContent;
list.add(XSDAdapterFactory.getInstance().adapt(attributeGroupDefinition));
getAttributeUses(attributeGroupDefinition, attrUses);
} else {
attrUses.add(attrGroupContent);
list.add(new TargetConnectionSpaceFiller(this));
}
}
return list;
}
Aggregations