void editSelectedWorkingSet() {
IWorkingSetManager manager = WorkbenchPlugin.getDefault()
.getWorkingSetManager();
IWorkingSet editWorkingSet = (IWorkingSet) getSelectedWorkingSets()
.get(0);
IWorkingSetEditWizard wizard = manager
.createWorkingSetEditWizard(editWorkingSet);
WizardDialog dialog = new WizardDialog(getShell(), wizard);
IWorkingSet originalWorkingSet = (IWorkingSet) editedWorkingSets
.get(editWorkingSet);
boolean firstEdit = originalWorkingSet == null;
// save the original working set values for restoration when selection
// dialog is cancelled.
if (firstEdit) {
originalWorkingSet = new WorkingSet(editWorkingSet.getName(),
editWorkingSet.getLabel(), editWorkingSet.getElements());
} else {
editedWorkingSets.remove(editWorkingSet);
}
dialog.create();
PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(),
IWorkbenchHelpContextIds.WORKING_SET_EDIT_WIZARD);
if (dialog.open() == Window.OK) {
editWorkingSet = wizard.getSelection();
availableWorkingSetsChanged();
// make sure ok button is enabled when the selected working set
// is edited. Fixes bug 33386.
updateButtonAvailability();
}