/** 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);
       }
     }
   }
 }
 boolean isUnmodifiable(Object element) {
   if (element instanceof IVMInstall) {
     IVMInstall vm = (IVMInstall) element;
     return JavaRuntime.isContributedVMInstall(vm.getId());
   }
   return false;
 }
 /** Enables the buttons based on selected items counts in the viewer */
 private void enableButtons() {
   IStructuredSelection selection = (IStructuredSelection) fVMList.getSelection();
   int selectionCount = selection.size();
   fEditButton.setEnabled(selectionCount == 1);
   fCopyButton.setEnabled(selectionCount > 0);
   if (selectionCount > 0 && selectionCount <= fVMList.getTable().getItemCount()) {
     Iterator<IVMInstall> iterator = selection.iterator();
     while (iterator.hasNext()) {
       IVMInstall install = iterator.next();
       if (JavaRuntime.isContributedVMInstall(install.getId())) {
         fRemoveButton.setEnabled(false);
         return;
       }
     }
     fRemoveButton.setEnabled(true);
   } else {
     fRemoveButton.setEnabled(false);
   }
 }
 /** @see ITableLabelProvider#getColumnText(Object, int) */
 @Override
 public String getColumnText(Object element, int columnIndex) {
   if (element instanceof IVMInstall) {
     IVMInstall vm = (IVMInstall) element;
     switch (columnIndex) {
       case 0:
         if (JavaRuntime.isContributedVMInstall(vm.getId())) {
           return NLS.bind(JREMessages.InstalledJREsBlock_19, new String[] {vm.getName()});
         }
         if (fVMList.getChecked(element)) {
           return NLS.bind(JREMessages.InstalledJREsBlock_7, vm.getName());
         }
         return vm.getName();
       case 1:
         return vm.getInstallLocation().getAbsolutePath();
       case 2:
         return vm.getVMInstallType().getName();
     }
   }
   return element.toString();
 }