コード例 #1
0
  /**
   * Main entry point to generate UI for compiler switching
   *
   * @param compilerPage
   */
  public static Composite createCompilerSwitchBlock(Composite parent) {
    Composite compilerPage = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 3;
    layout.marginWidth = 3;
    compilerPage.setLayout(layout);

    SpecifiedVersion activeGroovyVersion = CompilerUtils.getActiveGroovyVersion();
    Label compilerVersion = new Label(compilerPage, SWT.LEFT | SWT.WRAP);
    compilerVersion.setText(
        "You are currently using Groovy Compiler version "
            + CompilerUtils.getGroovyVersion()
            + ".");

    for (SpecifiedVersion version : SpecifiedVersion.values()) {
      if (activeGroovyVersion != version) {
        switchVersion(version, compilerPage);
      }
    }

    Link moreInfoLink = new Link(compilerPage, 0);
    moreInfoLink.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    moreInfoLink.setText(
        "<a href=\"http://docs.codehaus.org/display/GROOVY/Compiler+Switching+within+Groovy-Eclipse\">See here</a> for more information "
            + "on compiler switching (opens a browser window).");
    moreInfoLink.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            openUrl(event.text);
          }
        });

    return compilerPage;
  }