コード例 #1
0
  private void createJREGroup(Composite container) {
    Group group =
        SWTFactory.createGroup(
            container, PDEUIMessages.EnvironmentBlock_jreTitle, 2, 1, GridData.FILL_HORIZONTAL);

    initializeJREValues();

    SWTFactory.createWrapLabel(group, PDEUIMessages.JRESection_description, 2);

    fDefaultJREButton = SWTFactory.createRadioButton(group, PDEUIMessages.JRESection_defaultJRE, 2);
    fDefaultJREButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            updateJREWidgets();
            getTargetDefinition().setJREContainer(JavaRuntime.newDefaultJREContainerPath());
          }
        });

    fNamedJREButton = SWTFactory.createRadioButton(group, PDEUIMessages.JRESection_JREName);
    fNamedJREButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            updateJREWidgets();
            getTargetDefinition()
                .setJREContainer(
                    JavaRuntime.newJREContainerPath(
                        VMUtil.getVMInstall(fNamedJREsCombo.getText())));
          }
        });

    fNamedJREsCombo =
        SWTFactory.createCombo(
            group, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY, 1, VMUtil.getVMInstallNames());
    fNamedJREsCombo.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            getTargetDefinition()
                .setJREContainer(
                    JavaRuntime.newJREContainerPath(
                        VMUtil.getVMInstall(fNamedJREsCombo.getText())));
          }
        });

    fExecEnvButton = SWTFactory.createRadioButton(group, PDEUIMessages.JRESection_ExecutionEnv);
    fExecEnvButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            updateJREWidgets();
            getTargetDefinition()
                .setJREContainer(
                    JavaRuntime.newJREContainerPath(
                        VMUtil.getExecutionEnvironment(fExecEnvsCombo.getText())));
          }
        });

    fExecEnvsCombo =
        SWTFactory.createCombo(
            group,
            SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY,
            1,
            fExecEnvChoices.toArray(new String[fExecEnvChoices.size()]));
    fExecEnvsCombo.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            getTargetDefinition()
                .setJREContainer(
                    JavaRuntime.newJREContainerPath(
                        VMUtil.getExecutionEnvironment(fExecEnvsCombo.getText())));
          }
        });
  }
コード例 #2
0
  private void createTargetEnvironmentGroup(Composite container) {
    Group group =
        SWTFactory.createGroup(
            container, PDEUIMessages.EnvironmentBlock_targetEnv, 2, 1, GridData.FILL_HORIZONTAL);

    initializeChoices();

    SWTFactory.createWrapLabel(group, PDEUIMessages.EnvironmentSection_description, 2);

    SWTFactory.createLabel(group, PDEUIMessages.Preferences_TargetEnvironmentPage_os, 1);

    fOSCombo =
        SWTFactory.createCombo(
            group, SWT.SINGLE | SWT.BORDER, 1, fOSChoices.toArray(new String[fOSChoices.size()]));
    fOSCombo.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            getTargetDefinition().setOS(getModelValue(fOSCombo.getText()));
          }
        });

    SWTFactory.createLabel(group, PDEUIMessages.Preferences_TargetEnvironmentPage_ws, 1);

    fWSCombo =
        SWTFactory.createCombo(
            group, SWT.SINGLE | SWT.BORDER, 1, fWSChoices.toArray(new String[fWSChoices.size()]));
    fWSCombo.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            getTargetDefinition().setWS(getModelValue(fWSCombo.getText()));
          }
        });

    SWTFactory.createLabel(group, PDEUIMessages.Preferences_TargetEnvironmentPage_arch, 1);

    fArchCombo =
        SWTFactory.createCombo(
            group,
            SWT.SINGLE | SWT.BORDER,
            1,
            fArchChoices.toArray(new String[fArchChoices.size()]));
    fArchCombo.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            getTargetDefinition().setArch(getModelValue(fArchCombo.getText()));
          }
        });

    SWTFactory.createLabel(group, PDEUIMessages.Preferences_TargetEnvironmentPage_nl, 1);

    fNLCombo =
        SWTFactory.createCombo(
            group, SWT.SINGLE | SWT.BORDER, 1, fNLChoices.toArray(new String[fNLChoices.size()]));
    fNLCombo.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            String value = fNLCombo.getText();
            int index = value.indexOf("-"); // $NON-NLS-1$
            if (index > 0) value = value.substring(0, index);
            getTargetDefinition().setNL(getModelValue(value));
          }
        });
  }