use of org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter in project webtools.sourceediting by eclipse.
the class InternalXSDMultiPageEditor method openOnGlobalReference.
/**
* Method openOnGlobalReference. The comp argument is a resolved xsd schema
* object from another file. This is created and called from another schema
* model to allow F3 navigation to open a new editor and choose the referenced
* object within that editor context
*
* @param comp
*/
public void openOnGlobalReference(XSDConcreteComponent comp) {
XSDConcreteComponent namedComponent = openOnSelectionHelper.openOnGlobalReference(comp);
if (namedComponent == null) {
namedComponent = getXSDSchema();
}
XSDBaseAdapter adapter = (XSDBaseAdapter) XSDAdapterFactory.getInstance().adapt(namedComponent);
getSelectionManager().setSelection(new StructuredSelection(adapter));
IAction action = getActionRegistry().getAction(SetInputToGraphView.ID);
if (action != null) {
action.run();
}
}
use of org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter in project webtools.sourceediting by eclipse.
the class XSDEditPartFactory method createStructureFigure.
public IStructureFigure createStructureFigure(Object model) {
IStructureFigure figure = delegate.createStructureFigure(model);
if (model instanceof XSDBaseAdapter) {
XSDConcreteComponent comp = (XSDConcreteComponent) ((XSDBaseAdapter) model).getTarget();
boolean isReadOnly = ((XSDBaseAdapter) model).isReadOnly();
figure.getNameLabel().setIcon(XSDCommonUIUtils.getUpdatedImage(comp, ((XSDBaseAdapter) model).getImage(), isReadOnly));
}
return figure;
}
use of org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter in project webtools.sourceediting by eclipse.
the class AddXSDModelGroupAction method run.
public void run() {
Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
if (selection instanceof XSDBaseAdapter) {
XSDConcreteComponent xsdComponent = (XSDConcreteComponent) ((XSDBaseAdapter) selection).getTarget();
AddXSDModelGroupCommand command = null;
if (xsdComponent instanceof XSDElementDeclaration) {
XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration) xsdComponent;
command = new AddXSDModelGroupCommand(getLabel(xsdCompositor), xsdElementDeclaration, xsdCompositor);
getCommandStack().execute(command);
} else if (xsdComponent instanceof XSDModelGroup) {
XSDModelGroup xsdModelGroup = (XSDModelGroup) xsdComponent;
command = new AddXSDModelGroupCommand(getLabel(xsdCompositor), xsdModelGroup, xsdCompositor);
getCommandStack().execute(command);
} else if (xsdComponent instanceof XSDComplexTypeDefinition || xsdComponent instanceof XSDModelGroupDefinition) {
command = new AddXSDModelGroupCommand(getLabel(xsdCompositor), xsdComponent, xsdCompositor);
getCommandStack().execute(command);
}
if (command != null) {
Adapter adapter = XSDAdapterFactory.getInstance().adapt(command.getAddedComponent());
if (adapter != null)
provider.setSelection(new StructuredSelection(adapter));
}
}
}
use of org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter in project webtools.sourceediting by eclipse.
the class AddXSDRedefinableContentAction method run.
public void run() {
Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
if (selection instanceof XSDBaseAdapter) {
selection = ((XSDBaseAdapter) selection).getTarget();
}
if (selection instanceof XSDRedefine) {
ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration();
configuration.setDescriptionProvider(new RedefineDescriptor());
configuration.setSearchListProvider(new RedefineSearchListProvider((XSDRedefine) selection, this));
ComponentSearchListDialog dialog = new ComponentSearchListDialog(Display.getDefault().getActiveShell(), Messages._UI_LABEL_REDEFINE_COMPONENT, configuration) {
protected Control createDialogArea(Composite parent) {
// Adjust the dialog's initial size.
Composite mainComposite = (Composite) super.createDialogArea(parent);
GridData gridData = (GridData) mainComposite.getLayoutData();
gridData.heightHint = 500;
gridData.widthHint = 350;
return mainComposite;
}
};
dialog.create();
dialog.setBlockOnOpen(true);
int result = dialog.open();
if (result == Window.OK) {
ComponentSpecification selectedComponent = dialog.getSelectedComponent();
buildRedefine((XSDRedefine) selection, selectedComponent);
}
}
}
use of org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter in project webtools.sourceediting by eclipse.
the class SetMultiplicityAction method getXSDInput.
private XSDConcreteComponent getXSDInput() {
Object selection = ((IStructuredSelection) getSelection()).getFirstElement();
XSDConcreteComponent xsdConcreteComponent = null;
if (selection instanceof XSDBaseAdapter) {
xsdConcreteComponent = (XSDConcreteComponent) ((XSDBaseAdapter) selection).getTarget();
}
return xsdConcreteComponent;
}
Aggregations