use of org.eclipse.wst.common.ui.internal.search.dialogs.ComponentSearchListDialogConfiguration 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.common.ui.internal.search.dialogs.ComponentSearchListDialogConfiguration 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