Search in sources :

Example 1 with AddXSDModelGroupDefinitionCommand

use of org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDModelGroupDefinitionCommand in project webtools.sourceediting by eclipse.

the class AddXSDModelGroupDefinitionAction method run.

public void run() {
    Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
    XSDConcreteComponent xsdConcreteComponent = null;
    if (selection instanceof XSDBaseAdapter) {
        xsdConcreteComponent = (XSDConcreteComponent) ((XSDBaseAdapter) selection).getTarget();
    }
    if (xsdConcreteComponent != null) {
        AddXSDModelGroupDefinitionCommand command = new AddXSDModelGroupDefinitionCommand(getText(), xsdConcreteComponent, isReference);
        getCommandStack().execute(command);
        addedComponent = command.getAddedComponent();
        Adapter adapter = XSDAdapterFactory.getInstance().adapt(addedComponent);
        selectAddedComponent(adapter);
    }
}
Also used : XSDConcreteComponent(org.eclipse.xsd.XSDConcreteComponent) AddXSDModelGroupDefinitionCommand(org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDModelGroupDefinitionCommand) XSDBaseAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter) XSDBaseAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter) Adapter(org.eclipse.emf.common.notify.Adapter) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

Adapter (org.eclipse.emf.common.notify.Adapter)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 XSDBaseAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter)1 AddXSDModelGroupDefinitionCommand (org.eclipse.wst.xsd.ui.internal.common.commands.AddXSDModelGroupDefinitionCommand)1 XSDConcreteComponent (org.eclipse.xsd.XSDConcreteComponent)1