コード例 #1
0
  /**
   * Creates the widgets for specifying a agent name.
   *
   * @param parent - the parent composite.
   * @param text - the label of the group.
   */
  protected void createAgentNameEditor(Composite parent, String text) {
    final Group group = SWTFactory.createGroup(parent, text, 2, 1, GridData.FILL_HORIZONTAL);
    this.agentNameTextField = SWTFactory.createSingleText(group, 1);
    this.agentNameTextField.addModifyListener(
        new ModifyListener() {
          @SuppressWarnings("synthetic-access")
          @Override
          public void modifyText(ModifyEvent event) {
            SARLMainLaunchConfigurationTab.this.lastAgentNameError = null;
            updateLaunchConfigurationDialog();
          }
        });
    ControlAccessibleListener.addListener(this.agentNameTextField, group.getText());
    this.agentNameSearchButton =
        createPushButton(group, Messages.MainLaunchConfigurationTab_1, null);
    this.agentNameSearchButton.addSelectionListener(
        new SelectionListener() {
          @Override
          public void widgetDefaultSelected(SelectionEvent event) {
            //
          }

          @Override
          public void widgetSelected(SelectionEvent event) {
            handleAgentNameSearchButtonSelected();
          }
        });
  }
コード例 #2
0
  /**
   * Creates the encoding component
   *
   * @param parent the parent to add this composite to
   */
  private void createEncodingComponent(Composite parent) {
    Group group =
        SWTFactory.createGroup(
            parent, LaunchConfigurationsMessages.CommonTab_1, 2, 1, GridData.FILL_BOTH);

    fDefaultEncodingButton = createRadioButton(group, IInternalDebugCoreConstants.EMPTY_STRING);
    GridData gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false);
    gd.horizontalSpan = 2;
    fDefaultEncodingButton.setLayoutData(gd);

    fAltEncodingButton = createRadioButton(group, LaunchConfigurationsMessages.CommonTab_3);
    fAltEncodingButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));

    fEncodingCombo = new Combo(group, SWT.NONE);
    fEncodingCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fEncodingCombo.setFont(parent.getFont());
    List allEncodings = IDEEncoding.getIDEEncodings();
    String[] encodingArray = (String[]) allEncodings.toArray(new String[0]);
    fEncodingCombo.setItems(encodingArray);
    if (encodingArray.length > 0) {
      fEncodingCombo.select(0);
    }
    fEncodingCombo
        .getAccessible()
        .addAccessibleListener(
            new AccessibleAdapter() {
              public void getName(AccessibleEvent e) {
                e.result = LaunchConfigurationsMessages.CommonTab_3;
              }
            });
    SelectionListener listener =
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (e.getSource() instanceof Button) {
              Button button = (Button) e.getSource();
              if (button.getSelection()) {
                updateLaunchConfigurationDialog();
                fEncodingCombo.setEnabled(fAltEncodingButton.getSelection() == true);
              }
            } else {
              updateLaunchConfigurationDialog();
            }
          }
        };
    fAltEncodingButton.addSelectionListener(listener);
    fDefaultEncodingButton.addSelectionListener(listener);
    fEncodingCombo.addSelectionListener(listener);
    fEncodingCombo.addKeyListener(
        new KeyAdapter() {
          /*
           * (non-Javadoc)
           *
           * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
           */
          public void keyReleased(KeyEvent e) {
            scheduleUpdateJob();
          }
        });
  }
コード例 #3
0
 /* (non-Javadoc)
  * @see org.eclipse.jdt.internal.debug.ui.breakpoints.AbstractJavaBreakpointEditor#createControl(org.eclipse.swt.widgets.Composite)
  */
 public Control createControl(Composite parent) {
   Composite comp =
       SWTFactory.createComposite(parent, parent.getFont(), 1, 1, GridData.FILL_BOTH, 0, 0);
   for (int i = 0; i < fEditors.length; i++) {
     fEditors[i].createControl(comp);
   }
   return comp;
 }
コード例 #4
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
  */
 @Override
 protected Control createDialogArea(Composite parent) {
   setTitle(
       NLS.bind(
           SnippetMessages.getString(
               "SelectImportsDialog.Manage_the_Java_Snippet_Editor_Imports_for___{0}__1"),
           new String[] {fEditor.getEditorInput().getName()})); // $NON-NLS-1$
   setMessage(
       NLS.bind(
           SnippetMessages.getString("SelectImportsDialog.add_remove_imports"),
           new String[] {fEditor.getEditorInput().getName()})); // $NON-NLS-1$
   Composite outer = SWTFactory.createComposite(parent, 2, 1, GridData.FILL_BOTH);
   GridLayout gl = (GridLayout) outer.getLayout();
   gl.marginLeft = 7;
   gl.marginTop = 0;
   gl.marginBottom = 0;
   SWTFactory.createLabel(
       outer, SnippetMessages.getString("SelectImportsDialog.imports_heading"), 2); // $NON-NLS-1$
   fImportsTable = new Table(outer, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
   GridData gd = new GridData(GridData.FILL_HORIZONTAL);
   gd.heightHint = 150;
   fImportsTable.setLayoutData(gd);
   fImportsViewer = new TableViewer(fImportsTable);
   fImportsViewer.setLabelProvider(new FilterLabelProvider());
   fImportsViewer.setComparator(new FilterViewerComparator());
   fImportContentProvider = new ImportsContentProvider(fImportsViewer);
   fImportsViewer.setContentProvider(fImportContentProvider);
   // input just needs to be non-null
   fImportsViewer.setInput(this);
   fImportsViewer.addSelectionChangedListener(
       new ISelectionChangedListener() {
         @Override
         public void selectionChanged(SelectionChangedEvent event) {
           ISelection selection = event.getSelection();
           if (selection.isEmpty()) {
             fRemoveImportsButton.setEnabled(false);
           } else {
             fRemoveImportsButton.setEnabled(true);
           }
         }
       });
   createImportButtons(outer);
   applyDialogFont(outer);
   return parent;
 }
コード例 #5
0
 /**
  * Creates the widgets for configuring the launch options.
  *
  * @param parent - the parent composite.
  * @param text - the label of the group.
  */
 protected void createLaunchOptionEditor(Composite parent, String text) {
   final Group group = SWTFactory.createGroup(parent, text, 1, 1, GridData.FILL_HORIZONTAL);
   this.showLogoOptionButton = createCheckButton(group, Messages.MainLaunchConfigurationTab_14);
   this.showLogoOptionButton.addSelectionListener(this.defaultListener);
   this.showLogInfoButton = createCheckButton(group, Messages.MainLaunchConfigurationTab_15);
   this.showLogInfoButton.addSelectionListener(this.defaultListener);
   this.offlineButton = createCheckButton(group, Messages.MainLaunchConfigurationTab_16);
   this.offlineButton.addSelectionListener(this.defaultListener);
 }
コード例 #6
0
 /**
  * Creates the widgets for configuring the context identifier.
  *
  * @param parent - the parent composite.
  * @param text - the label of the group.
  */
 protected void createContextIdentifierTypeEditor(Composite parent, String text) {
   final Group group = SWTFactory.createGroup(parent, text, 1, 1, GridData.FILL_HORIZONTAL);
   this.defaultContextIdentifierButton =
       createRadioButton(group, Messages.MainLaunchConfigurationTab_11);
   this.defaultContextIdentifierButton.addSelectionListener(this.defaultListener);
   this.randomContextIdentifierButton =
       createRadioButton(group, Messages.MainLaunchConfigurationTab_12);
   this.randomContextIdentifierButton.addSelectionListener(this.defaultListener);
   this.bootContextIdentifierButton =
       createRadioButton(group, Messages.MainLaunchConfigurationTab_13);
   this.bootContextIdentifierButton.addSelectionListener(this.defaultListener);
 }
コード例 #7
0
  /**
   * Creates the shared config component
   *
   * @param parent the parent composite to add this component to
   * @since 3.2
   */
  private void createSharedConfigComponent(Composite parent) {
    Group group =
        SWTFactory.createGroup(
            parent, LaunchConfigurationsMessages.CommonTab_0, 3, 2, GridData.FILL_HORIZONTAL);
    Composite comp =
        SWTFactory.createComposite(group, parent.getFont(), 3, 3, GridData.FILL_BOTH, 0, 0);
    fLocalRadioButton = createRadioButton(comp, LaunchConfigurationsMessages.CommonTab_L_ocal_3);
    GridData gd = new GridData();
    gd.horizontalSpan = 3;
    fLocalRadioButton.setLayoutData(gd);
    fSharedRadioButton = createRadioButton(comp, LaunchConfigurationsMessages.CommonTab_S_hared_4);
    fSharedRadioButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent evt) {
            handleSharedRadioButtonSelected();
          }
        });
    fSharedLocationText = SWTFactory.createSingleText(comp, 1);
    fSharedLocationText
        .getAccessible()
        .addAccessibleListener(
            new AccessibleAdapter() {
              public void getName(AccessibleEvent e) {
                e.result = LaunchConfigurationsMessages.CommonTab_S_hared_4;
              }
            });
    fSharedLocationText.addModifyListener(fBasicModifyListener);
    fSharedLocationButton =
        createPushButton(comp, LaunchConfigurationsMessages.CommonTab__Browse_6, null);
    fSharedLocationButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent evt) {
            handleSharedLocationButtonSelected();
          }
        });

    fLocalRadioButton.setSelection(true);
    setSharedEnabled(false);
  }
コード例 #8
0
 @Override
 public void createControl(Composite parent) {
   final Composite comp =
       SWTFactory.createComposite(parent, parent.getFont(), 1, 1, GridData.FILL_BOTH);
   ((GridLayout) comp.getLayout()).verticalSpacing = 0;
   createProjectEditor(comp);
   createVerticalSpacer(comp, 1);
   createAgentNameEditor(comp, Messages.MainLaunchConfigurationTab_0);
   createVerticalSpacer(comp, 1);
   createContextIdentifierTypeEditor(comp, Messages.MainLaunchConfigurationTab_9);
   createVerticalSpacer(comp, 1);
   createLaunchOptionEditor(comp, Messages.MainLaunchConfigurationTab_10);
   setControl(comp);
 }
コード例 #9
0
 /**
  * Creates the favorites control
  *
  * @param parent the parent composite to add this one to
  * @since 3.2
  */
 private void createFavoritesComponent(Composite parent) {
   Group favComp =
       SWTFactory.createGroup(
           parent,
           LaunchConfigurationsMessages.CommonTab_Display_in_favorites_menu__10,
           1,
           1,
           GridData.FILL_BOTH);
   fFavoritesTable =
       CheckboxTableViewer.newCheckList(
           favComp, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
   Control table = fFavoritesTable.getControl();
   GridData gd = new GridData(GridData.FILL_BOTH);
   table.setLayoutData(gd);
   table.setFont(parent.getFont());
   fFavoritesTable.setContentProvider(new FavoritesContentProvider());
   fFavoritesTable.setLabelProvider(new FavoritesLabelProvider());
   fFavoritesTable.addCheckStateListener(
       new ICheckStateListener() {
         public void checkStateChanged(CheckStateChangedEvent event) {
           updateLaunchConfigurationDialog();
         }
       });
 }
コード例 #10
0
  private void createImportButtons(Composite container) {
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(container, IJavaDebugHelpContextIds.SNIPPET_IMPORTS_DIALOG);
    Composite bcomp =
        SWTFactory.createComposite(
            container,
            container.getFont(),
            1,
            1,
            GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL,
            0,
            0);
    GridLayout gl = (GridLayout) bcomp.getLayout();
    gl.verticalSpacing = 0;
    // Add type button
    fAddTypeButton =
        SWTFactory.createPushButton(
            bcomp,
            SnippetMessages.getString("SelectImportsDialog.Add_&Type_1"), // $NON-NLS-1$
            SnippetMessages.getString(
                "SelectImportsDialog.Choose_a_Type_to_Add_as_an_Import_2"), //$NON-NLS-1$
            null);
    fAddTypeButton.addSelectionListener(
        new SelectionListener() {
          @Override
          public void widgetSelected(SelectionEvent se) {
            addType();
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent se) {}
        });

    // Add package button
    fAddPackageButton =
        SWTFactory.createPushButton(
            bcomp,
            SnippetMessages.getString("SelectImportsDialog.Add_&Package_3"), // $NON-NLS-1$
            SnippetMessages.getString(
                "SelectImportsDialog.Choose_a_Package_to_Add_as_an_Import_4"), //$NON-NLS-1$
            null);
    fAddPackageButton.addSelectionListener(
        new SelectionListener() {
          @Override
          public void widgetSelected(SelectionEvent se) {
            addPackage();
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent se) {}
        });

    // Remove button
    fRemoveImportsButton =
        SWTFactory.createPushButton(
            bcomp,
            SnippetMessages.getString("SelectImportsDialog.&Remove_5"), // $NON-NLS-1$
            SnippetMessages.getString(
                "SelectImportsDialog.Remove_All_Selected_Imports_6"), //$NON-NLS-1$
            null);
    fRemoveImportsButton.addSelectionListener(
        new SelectionListener() {
          @Override
          public void widgetSelected(SelectionEvent se) {
            removeImports();
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent se) {}
        });
    fRemoveImportsButton.setEnabled(false);
  }
コード例 #11
0
    @Override
    protected void createContent(Composite parent) {
      fSashForm = new SashForm(parent, parent.getStyle());
      fSashForm.setOrientation(SWT.VERTICAL);

      // update presentation context
      AbstractDebugView view = getViewToEmulate();
      fContext = new PresentationContext(TCFModel.ID_EXPRESSION_HOVER);
      if (view != null) {
        // copy over properties
        IPresentationContext copy = ((TreeModelViewer) view.getViewer()).getPresentationContext();
        try {
          String[] properties = copy.getProperties();
          for (int i = 0; i < properties.length; i++) {
            String key = properties[i];
            fContext.setProperty(key, copy.getProperty(key));
          }
        } catch (NoSuchMethodError e) {
          // ignore
        }
      }

      fViewer =
          new TreeModelViewer(fSashForm, SWT.MULTI | SWT.VIRTUAL | SWT.FULL_SELECTION, fContext);
      fViewer.setAutoExpandLevel(fExpansionLevel);

      if (view != null) {
        // copy over filters
        StructuredViewer structuredViewer = (StructuredViewer) view.getViewer();
        if (structuredViewer != null) {
          ViewerFilter[] filters = structuredViewer.getFilters();
          for (int i = 0; i < filters.length; i++) {
            fViewer.addFilter(filters[i]);
          }
        }
      }
      fInputService = new ViewerInputService(fViewer, this);
      fTree = fViewer.getTree();

      if (fShowDetailPane) {
        fDetailPaneComposite = SWTFactory.createComposite(fSashForm, 1, 1, GridData.FILL_BOTH);
        Layout layout = fDetailPaneComposite.getLayout();
        if (layout instanceof GridLayout) {
          GridLayout gl = (GridLayout) layout;
          gl.marginHeight = 0;
          gl.marginWidth = 0;
        }

        fDetailPane = new DetailPaneProxy(new DetailPaneContainer());
        fDetailPane.display(null); // Bring up the default pane so the
        // user doesn't see an empty
        // composite

        fTree.addSelectionListener(
            new SelectionListener() {
              public void widgetSelected(SelectionEvent e) {
                fDetailPane.display((IStructuredSelection) fViewer.getSelection());
              }

              public void widgetDefaultSelected(SelectionEvent e) {}
            });
      }

      initSashWeights();

      // add update listener to auto-select and display details of root
      // expression
      fViewer.addViewerUpdateListener(
          new IViewerUpdateListener() {
            public void viewerUpdatesComplete() {
              fViewer
                  .getDisplay()
                  .timerExec(
                      100,
                      new Runnable() {
                        public void run() {
                          if (fViewer.getControl().isDisposed()) return;
                          TreeSelection selection = (TreeSelection) fViewer.getSelection();
                          if (selection.isEmpty())
                            selection = new TreeSelection(fViewer.getTopElementPath());
                          fViewer.setSelection(selection);
                          if (fDetailPane != null) fDetailPane.display(selection);
                        }
                      });
            }

            public void viewerUpdatesBegin() {}

            public void updateStarted(IViewerUpdate update) {}

            public void updateComplete(IViewerUpdate update) {}
          });

      setBackgroundColor(getShell().getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
    }
コード例 #12
0
  /**
   * Creates the component set for the capture output composite
   *
   * @param parent the parent to add this component to
   */
  private void createOutputCaptureComponent(Composite parent) {
    Group group =
        SWTFactory.createGroup(
            parent, LaunchConfigurationsMessages.CommonTab_4, 5, 2, GridData.FILL_HORIZONTAL);
    Composite comp = SWTFactory.createComposite(group, 5, 5, GridData.FILL_BOTH);
    GridLayout ld = (GridLayout) comp.getLayout();
    ld.marginWidth = 1;
    ld.marginHeight = 1;
    fConsoleOutput = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_5);
    GridData gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false);
    gd.horizontalSpan = 5;
    fConsoleOutput.setLayoutData(gd);
    fConsoleOutput.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            updateLaunchConfigurationDialog();
          }
        });

    fFileOutput = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_6);
    fFileOutput.setLayoutData(new GridData(SWT.BEGINNING, SWT.NORMAL, false, false));
    fFileOutput.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            enableOuputCaptureWidgets(fFileOutput.getSelection());
            updateLaunchConfigurationDialog();
          }
        });
    fFileText = SWTFactory.createSingleText(comp, 4);
    fFileText
        .getAccessible()
        .addAccessibleListener(
            new AccessibleAdapter() {
              public void getName(AccessibleEvent e) {
                e.result = LaunchConfigurationsMessages.CommonTab_6;
              }
            });
    fFileText.addModifyListener(fBasicModifyListener);

    Composite bcomp = SWTFactory.createComposite(comp, 3, 5, GridData.HORIZONTAL_ALIGN_END);
    ld = (GridLayout) bcomp.getLayout();
    ld.marginHeight = 1;
    ld.marginWidth = 0;
    fWorkspaceBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_12, null);
    fWorkspaceBrowse.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            ElementTreeSelectionDialog dialog =
                new ElementTreeSelectionDialog(
                    getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
            dialog.setTitle(LaunchConfigurationsMessages.CommonTab_13);
            dialog.setMessage(LaunchConfigurationsMessages.CommonTab_14);
            dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
            dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
            dialog.setDialogBoundsSettings(
                getDialogBoundsSettings(WORKSPACE_SELECTION_DIALOG), Dialog.DIALOG_PERSISTSIZE);
            if (dialog.open() == IDialogConstants.OK_ID) {
              IResource resource = (IResource) dialog.getFirstResult();
              if (resource != null) {
                String arg = resource.getFullPath().toString();
                String fileLoc =
                    VariablesPlugin.getDefault()
                        .getStringVariableManager()
                        .generateVariableExpression("workspace_loc", arg); // $NON-NLS-1$
                fFileText.setText(fileLoc);
              }
            }
          }
        });
    fFileBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_7, null);
    fFileBrowse.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            String filePath = fFileText.getText();
            FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
            filePath = dialog.open();
            if (filePath != null) {
              fFileText.setText(filePath);
            }
          }
        });
    fVariables = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_9, null);
    fVariables.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell());
            dialog.open();
            String variable = dialog.getVariableExpression();
            if (variable != null) {
              fFileText.insert(variable);
            }
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });
    fAppend = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_11);
    gd = new GridData(SWT.LEFT, SWT.TOP, true, false);
    gd.horizontalSpan = 4;
    fAppend.setLayoutData(gd);
    fAppend.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            updateLaunchConfigurationDialog();
          }
        });
  }
コード例 #13
0
  /**
   * Creates this block's control in the given control.
   *
   * @param ancestor containing control
   * @param useManageButton whether to present a single 'manage...' button to the user that opens
   *     the installed JREs pref page for JRE management, or to provide 'add, remove, edit, and
   *     search' buttons.
   */
  public void createControl(Composite ancestor) {
    Font font = ancestor.getFont();
    Composite parent = SWTFactory.createComposite(ancestor, font, 2, 1, GridData.FILL_BOTH);
    fControl = parent;

    SWTFactory.createLabel(parent, JREMessages.InstalledJREsBlock_15, 2);

    fTable = new Table(parent, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 250;
    gd.widthHint = 350;
    fTable.setLayoutData(gd);
    fTable.setFont(font);
    fTable.setHeaderVisible(true);
    fTable.setLinesVisible(true);

    TableColumn column = new TableColumn(fTable, SWT.NULL);
    column.setText(JREMessages.InstalledJREsBlock_0);
    column.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            sortByName();
            fVMList.refresh(true);
          }
        });
    int defaultwidth = 350 / 3 + 1;
    column.setWidth(defaultwidth);

    column = new TableColumn(fTable, SWT.NULL);
    column.setText(JREMessages.InstalledJREsBlock_1);
    column.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            sortByLocation();
            fVMList.refresh(true);
          }
        });
    column.setWidth(defaultwidth);

    column = new TableColumn(fTable, SWT.NULL);
    column.setText(JREMessages.InstalledJREsBlock_2);
    column.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            sortByType();
            fVMList.refresh(true);
          }
        });
    column.setWidth(defaultwidth);

    fVMList = new CheckboxTableViewer(fTable);
    fVMList.setLabelProvider(new VMLabelProvider());
    fVMList.setContentProvider(new JREsContentProvider());
    fVMList.setUseHashlookup(true);
    // by default, sort by name
    sortByName();

    fVMList.addSelectionChangedListener(
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent evt) {
            enableButtons();
          }
        });

    fVMList.addCheckStateListener(
        new ICheckStateListener() {
          @Override
          public void checkStateChanged(CheckStateChangedEvent event) {
            if (event.getChecked()) {
              setCheckedJRE((IVMInstall) event.getElement());
            } else {
              setCheckedJRE(null);
            }
          }
        });

    fVMList.addDoubleClickListener(
        new IDoubleClickListener() {
          @Override
          public void doubleClick(DoubleClickEvent e) {
            if (!fVMList.getSelection().isEmpty()) {
              editVM();
            }
          }
        });
    fTable.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent event) {
            if (event.character == SWT.DEL && event.stateMask == 0) {
              if (fRemoveButton.isEnabled()) {
                removeVMs();
              }
            }
          }
        });

    Composite buttons =
        SWTFactory.createComposite(parent, font, 1, 1, GridData.VERTICAL_ALIGN_BEGINNING, 0, 0);

    fAddButton = SWTFactory.createPushButton(buttons, JREMessages.InstalledJREsBlock_3, null);
    fAddButton.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event evt) {
            addVM();
          }
        });

    fEditButton = SWTFactory.createPushButton(buttons, JREMessages.InstalledJREsBlock_4, null);
    fEditButton.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event evt) {
            editVM();
          }
        });

    fCopyButton = SWTFactory.createPushButton(buttons, JREMessages.InstalledJREsBlock_16, null);
    fCopyButton.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event evt) {
            copyVM();
          }
        });

    fRemoveButton = SWTFactory.createPushButton(buttons, JREMessages.InstalledJREsBlock_5, null);
    fRemoveButton.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event evt) {
            removeVMs();
          }
        });

    SWTFactory.createVerticalSpacer(parent, 1);

    fSearchButton = SWTFactory.createPushButton(buttons, JREMessages.InstalledJREsBlock_6, null);
    fSearchButton.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event evt) {
            search();
          }
        });

    fillWithWorkspaceJREs();
    enableButtons();
    fAddButton.setEnabled(JavaRuntime.getVMInstallTypes().length > 0);

    JavaRuntime.addVMInstallChangedListener(fListener);
  }