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