use of org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.AddExtensionsComponentDialog in project webtools.sourceediting by eclipse.
the class AbstractExtensionsSection method widgetSelected.
public void widgetSelected(SelectionEvent event) {
if (event.widget == addButton) {
ExtensionsSchemasRegistry registry = getExtensionsSchemasRegistry();
AddExtensionsComponentDialog dialog = createAddExtensionsComponentDialog();
List properties = registry.getAllExtensionsSchemasContribution();
dialog.setInput(properties);
dialog.setBlockOnOpen(true);
dialog.setPrefStore(getPrefStore());
if (prevCategory != null)
dialog.setInitialCategorySelection(prevCategory);
if (dialog.open() == Window.OK) {
Object newSelection = null;
Object[] result = dialog.getResult();
if (result != null) {
SpecificationForExtensionsSchema extensionsSchemaSpec = (SpecificationForExtensionsSchema) result[1];
AddExtensionCommand addExtensionCommand = getAddExtensionCommand(result[0]);
if (addExtensionCommand != null) {
addExtensionCommand.setSchemaProperties(extensionsSchemaSpec);
if (getCommandStack() != null) {
getCommandStack().execute(addExtensionCommand);
newSelection = addExtensionCommand.getNewObject();
}
}
}
// refresh();
if (newSelection != null) {
extensionTreeViewer.setSelection(new StructuredSelection(newSelection));
}
}
prevCategory = dialog.getSelectedCategory();
} else if (event.widget == removeButton) {
ISelection selection = extensionTreeViewer.getSelection();
if (selection instanceof StructuredSelection) {
Object o = ((StructuredSelection) selection).getFirstElement();
Command command = getRemoveExtensionCommand(o);
if (getCommandStack() != null) {
getCommandStack().execute(command);
}
}
} else if (event.widget == extensionTreeViewer.getTree()) {
}
}
use of org.eclipse.wst.xsd.ui.internal.common.properties.sections.appinfo.AddExtensionsComponentDialog in project webtools.sourceediting by eclipse.
the class ExtensionsSection method createAddExtensionsComponentDialog.
protected AddExtensionsComponentDialog createAddExtensionsComponentDialog() {
AddExtensionsComponentDialog dialog = new AddExtensionsComponentDialog(composite.getShell(), getExtensionsSchemasRegistry()) {
protected IStructuredContentProvider getCategoryContentProvider() {
return new XSDCategoryContentProvider();
}
};
dialog.addElementsTableFilter(new AddExtensionsComponentDialogFilter(input, dialog));
return dialog;
}
Aggregations