use of org.eclipse.wst.xsd.ui.internal.common.commands.UpdateComplexTypeDerivationBy in project webtools.sourceediting by eclipse.
the class XSDComplexTypeSection method handleWidgetSelection.
private void handleWidgetSelection(SelectionEvent e) {
if (e.widget == baseTypeCombo) {
IEditorPart editor = getActiveEditor();
if (editor == null)
return;
ComponentReferenceEditManager manager = (ComponentReferenceEditManager) editor.getAdapter(XSDComplexTypeBaseTypeEditManager.class);
String selection = baseTypeCombo.getText();
ComponentSpecification newValue;
IComponentDialog dialog = null;
if (selection.equals(Messages._UI_COMBO_BROWSE)) {
dialog = manager.getBrowseDialog();
} else if (selection.equals(Messages._UI_COMBO_NEW)) {
dialog = manager.getNewDialog();
}
if (dialog != null) {
if (dialog.createAndOpen() == Window.OK) {
newValue = dialog.getSelectedComponent();
manager.modifyComponentReference(input, newValue);
} else {
refresh();
}
}
} else if (e.widget == derivedByCombo) {
XSDComplexTypeDefinition complexType = (XSDComplexTypeDefinition) input;
String value = derivedByCombo.getText();
Command command = new UpdateComplexTypeDerivationBy(complexType, value);
if (getCommandStack() != null) {
getCommandStack().execute(command);
}
}
super.doWidgetSelected(e);
}
Aggregations