use of org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDAnyElementCommand in project webtools.sourceediting by eclipse.
the class AddXSDAnyElementAction method run.
public void run() {
Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
if (selection instanceof XSDBaseAdapter) {
selection = ((XSDBaseAdapter) selection).getTarget();
}
XSDModelGroup modelGroup = getModelGroup(selection);
AddXSDAnyElementCommand command = new AddXSDAnyElementCommand(getText(), modelGroup);
if (selection instanceof XSDComplexTypeDefinition) {
command.setComplexType((XSDComplexTypeDefinition) selection);
}
command.setDoCreateModelGroupForComplexType(modelGroup == null);
getCommandStack().execute(command);
addedComponent = command.getAddedComponent();
Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
selectAddedComponent(adapter);
}
Aggregations