use of org.eclipse.wst.common.ui.internal.search.dialogs.ScopedComponentSearchListDialog in project webtools.sourceediting by eclipse.
the class XSDSearchListDialogDelegate method createAndOpen.
public int createAndOpen() {
Shell shell = XSDEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
int returnValue = Window.CANCEL;
ScopedComponentSearchListDialog dialog = null;
// so it's easier to see the difference between how we config for an element vs type?
if (metaName == ELEMENT_META_NAME) {
XSDComponentDescriptionProvider descriptionProvider = new XSDComponentDescriptionProvider();
final XSDElementsSearchListProvider searchListProvider = new XSDElementsSearchListProvider(currentFile, schemas);
ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration();
configuration.setDescriptionProvider(descriptionProvider);
configuration.setSearchListProvider(searchListProvider);
configuration.setFilterLabelText(Messages._UI_LABEL_NAME_SEARCH_FILTER_TEXT);
configuration.setListLabelText(Messages._UI_LABEL_ELEMENTS_COLON);
// configuration.setNewComponentHandler(new NewElementButtonHandler());
// TODO externalize string
dialog = new ScopedComponentSearchListDialog(shell, Messages._UI_LABEL_SET_ELEMENT_REFERENCE, configuration);
} else if (metaName == ATTRIBUTE_META_NAME) {
XSDComponentDescriptionProvider descriptionProvider = new XSDComponentDescriptionProvider();
final XSDAttributeSearchListProvider searchListProvider = new XSDAttributeSearchListProvider(currentFile, schemas);
ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration();
configuration.setDescriptionProvider(descriptionProvider);
configuration.setSearchListProvider(searchListProvider);
configuration.setFilterLabelText(Messages._UI_LABEL_NAME_SEARCH_FILTER_TEXT);
configuration.setListLabelText(Messages._UI_LABEL_ATTRIBUTES_COLON);
dialog = new ScopedComponentSearchListDialog(shell, Messages._UI_LABEL_SET_ATTRIBUTE_REFERENCE, configuration);
} else if (metaName == TYPE_META_NAME) {
XSDComponentDescriptionProvider descriptionProvider = new XSDComponentDescriptionProvider();
final XSDTypesSearchListProvider searchListProvider = new XSDTypesSearchListProvider(currentFile, schemas);
if (!showComplexTypes)
searchListProvider.showComplexTypes(false);
ComponentSearchListDialogConfiguration configuration = new ComponentSearchListDialogConfiguration();
configuration.setDescriptionProvider(descriptionProvider);
configuration.setSearchListProvider(searchListProvider);
// configuration.setNewComponentHandler(new NewTypeButtonHandler());
configuration.setFilterLabelText(Messages._UI_LABEL_NAME_SEARCH_FILTER_TEXT);
configuration.setListLabelText(Messages._UI_LABEL_TYPES_COLON);
// $NON-NLS-1$
dialog = new ScopedComponentSearchListDialog(shell, Messages._UI_LABEL_SET_TYPE, configuration);
}
if (dialog != null) {
dialog.setCurrentResource(currentFile);
dialog.setBlockOnOpen(true);
dialog.create();
returnValue = dialog.open();
if (returnValue == Window.OK) {
selection = dialog.getSelectedComponent();
}
}
return returnValue;
}
Aggregations