Search in sources :

Example 1 with ComponentSearchListDialog

use of org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSearchListDialog 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);
        }
    }
}
Also used : XSDRedefine(org.eclipse.xsd.XSDRedefine) ComponentSearchListDialog(org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSearchListDialog) Composite(org.eclipse.swt.widgets.Composite) ComponentSpecification(org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification) GridData(org.eclipse.swt.layout.GridData) XSDBaseAdapter(org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ComponentSearchListDialogConfiguration(org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSearchListDialogConfiguration)

Aggregations

IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 GridData (org.eclipse.swt.layout.GridData)1 Composite (org.eclipse.swt.widgets.Composite)1 ComponentSearchListDialog (org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSearchListDialog)1 ComponentSearchListDialogConfiguration (org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSearchListDialogConfiguration)1 ComponentSpecification (org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSpecification)1 XSDBaseAdapter (org.eclipse.wst.xsd.ui.internal.adapters.XSDBaseAdapter)1 XSDRedefine (org.eclipse.xsd.XSDRedefine)1