use of org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDAttributeGroupDefinitionCommand in project webtools.sourceediting by eclipse.
the class AddXSDAttributeGroupDefinitionAction method run.
public void run() {
Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
if (selection instanceof XSDBaseAdapter) {
selection = ((XSDBaseAdapter) selection).getTarget();
}
AddXSDAttributeGroupDefinitionCommand command = null;
if (selection instanceof XSDComplexTypeDefinition) {
command = new AddXSDAttributeGroupDefinitionCommand(Messages._UI_ACTION_ADD_ATTRIBUTE_GROUP_REF, (XSDComplexTypeDefinition) selection);
getCommandStack().execute(command);
} else if (selection instanceof XSDSchema) {
command = new AddXSDAttributeGroupDefinitionCommand(Messages._UI_ACTION_ADD_ATTRIBUTE_GROUP_DEFINITION, (XSDSchema) selection);
getCommandStack().execute(command);
}
if (command != null) {
addedComponent = command.getAddedComponent();
Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
selectAddedComponent(adapter);
}
}
Aggregations