/** Performs the edit VM action when the Edit... button is pressed */ private void editVM() { IStructuredSelection selection = (IStructuredSelection) fVMList.getSelection(); VMStandin vm = (VMStandin) selection.getFirstElement(); if (vm == null) { return; } if (JavaRuntime.isContributedVMInstall(vm.getId())) { VMDetailsDialog dialog = new VMDetailsDialog(getShell(), vm); dialog.open(); } else { EditVMInstallWizard wizard = new EditVMInstallWizard(vm, fVMs.toArray(new IVMInstall[fVMs.size()])); WizardDialog dialog = new WizardDialog(getShell(), wizard); if (dialog.open() == Window.OK) { VMStandin result = wizard.getResult(); if (result != null) { // replace with the edited VM int index = fVMs.indexOf(vm); fVMs.remove(index); fVMs.add(index, result); fVMList.setSelection(new StructuredSelection(result)); fVMList.refresh(true); } } } }