public void refresh() {
   IGrailsInstall defaultInstall =
       GrailsCoreActivator.getDefault().getInstallManager().getDefaultGrailsInstall();
   if (defaultInstall != null) {
     useDefault.setText(
         org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages
                 .NewGrailsProjectWizardPageOne_useDefaultGrailsInstallation
             + defaultInstall.getName()
             + "')");
   } else {
     setErrorMessage(
         org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages
             .NewGrailsProjectWizardPageOne_noGrailsInstallation);
     setPageComplete(false);
     useDefault.setText(
         org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages
             .NewGrailsProjectWizardPageOne_useDefaultGrailsInstallationNoCurrent);
   }
   grailsInstallCombo.setItems(
       GrailsCoreActivator.getDefault().getInstallManager().getAllInstallNames());
   String[] names = grailsInstallCombo.getItems();
   for (int i = 0; i < names.length; i++) {
     if (GrailsCoreActivator.getDefault()
         .getInstallManager()
         .getGrailsInstall(names[i])
         .isDefault()) {
       grailsInstallCombo.select(i);
       break;
     }
   }
   setChanged();
   notifyObservers();
 }
  /**
   * Creates a new {@link NewGrailsProjectWizardPageOne}.
   *
   * @param isPluginWizard TODO
   */
  public NewGrailsProjectWizardPageOne(String title, String desc, boolean isPluginWizard) {
    super(PAGE_NAME);
    setPageComplete(false);
    setTitle(title);
    setDescription(desc);

    fNameGroup = new NameGroup();
    fLocationGroup = new LocationGroup();
    fWorkingSetGroup = new WorkingSetGroup();
    grailsInstallGroup = new GrailsInstallGroup();
    listener = new InstallChangeListener();
    GrailsCoreActivator.getDefault().getInstallManager().addGrailsInstallListener(listener);

    // establish connections
    fNameGroup.addObserver(fLocationGroup);

    // initialize all elements
    fNameGroup.notifyObservers();

    // create and connect validator
    fValidator = new Validator();
    fNameGroup.addObserver(fValidator);
    fLocationGroup.addObserver(fValidator);
    grailsInstallGroup.addObserver(fValidator);

    // initialize defaults
    setProjectName(""); // $NON-NLS-1$
    setProjectLocationURI(null);
    setWorkingSets(new IWorkingSet[0]);
    this.isPluginWizard = isPluginWizard;
  }
 public void testUpgrade() throws Exception {
   project = ensureProject("bork");
   GrailsCommand cmd =
       GrailsCommandFactory.upgrade(
           project,
           GrailsCoreActivator.getDefault().getInstallManager().getGrailsInstall(project));
   assertEquals("upgrade --non-interactive", cmd.getCommand());
 }
示例#4
0
  public void testOutputLimit() throws Exception {
    IProject proj = ensureProject(TEST_PROJECT_NAME);
    ensureDefaultGrailsVersion(GrailsVersion.getGrailsVersion(proj));

    GrailsCommand cmd = GrailsCommand.forTest("help");
    ILaunchResult result = cmd.synchExec();
    //		String allOutput = result.getOutput();

    int orgLimit = GrailsCoreActivator.getDefault().getGrailsCommandOutputLimit();
    try {
      GrailsCoreActivator.getDefault().setGrailsCommandOutputLimit(100);
      result = cmd.synchExec();
      assertEquals(100, result.getOutput().length());

    } finally {
      GrailsCoreActivator.getDefault().setGrailsCommandOutputLimit(orgLimit);
    }
  }
示例#5
0
  /**
   * Do a few simple checks to see if the contents of a generated dependency file looks ok. These
   * checks are by no means comprehensive, but it is better than nothing.
   *
   * @throws IOException
   */
  protected void checkDependencyFile(IProject project, File file) throws IOException {
    // ///////////////////////////////////////
    // Check the generated file...
    assertTrue(file.exists());

    DependencyData depData = DependencyFileFormat.read(file);

    String dotGrailsFolder =
        new File(
                GrailsCoreActivator.getDefault().getUserHome() + "/" + ".grails/" + grailsVersion())
            .getCanonicalPath();

    // Check plugins directory points where it should
    String pluginsDirectory = depData.getPluginsDirectory();
    if (GrailsVersion.V_2_3_.compareTo(GrailsVersion.MOST_RECENT) <= 0) {
      // Grails 2.3 has moved the plugin area into the project area. It's no longer inside
      // the .grails folder.
      assertEquals(project.getLocation() + "/target/work/plugins", pluginsDirectory);
    } else {
      assertEquals(
          dotGrailsFolder + "/projects/" + TEST_PROJECT_NAME + "/plugins", pluginsDirectory);
    }

    Set<String> sources = depData.getSources();
    for (String string : sources) {
      System.out.println(string);
    }
    String[] expectedPlugins = new String[] {"tomcat", "hibernate"};
    // Checkinf for these makes the tests unstable? No real way to know what is expected here
    // It varies depending on plugins and grails version.

    //		for (String pluginName : expectedPlugins) {
    //			for (String javaGroovy : new String[] { "java", "groovy" }) {
    //				String expect = pluginsDirectory + "/" + pluginName + "-"
    //						+ grailsVersion() + "/src/" + javaGroovy;
    //				assertTrue("Missing source entry: " + expect,
    //						sources.contains(expect));
    //			}
    //		}

    Set<String> pluginsXmls = depData.getPluginDescriptors();
    for (String string : pluginsXmls) {
      System.out.println(string);
    }
    for (String pluginName : expectedPlugins) {
      assertPluginXml(pluginName, pluginsXmls);
    }

    // TODO: KDV: (depend) add some more checks of the contents of the file
    // (i.e. check for a few basic jar dependencies that should always be
    // there.)
  }
 public static void setScript(ILaunchConfigurationWorkingCopy wc, String script) {
   wc.setAttribute(SCRIPT_ATTR, script);
   try {
     String orgScript = wc.getAttribute(ORG_SCRIPT_ATTR, (String) null);
     if (orgScript == null) {
       // org sript should be set same value as script, but only the first time that script value
       // is set.
       wc.setAttribute(ORG_SCRIPT_ATTR, script);
     }
   } catch (CoreException e) {
     GrailsCoreActivator.log(e);
   }
 }
 public void setOrderingConfig(OrderingConfig config) {
   orderingConfig = config;
   if (config == null) {
     store.remove(ORDERING_CONFIG);
   } else {
     store.put(ORDERING_CONFIG, config.toSaveString());
   }
   try {
     store.flush();
   } catch (BackingStoreException e) {
     GrailsCoreActivator.log(e);
   }
   notifyListeners(config);
 }
 /**
  * Add a system property arg to set killport for Grails 2.3 and higher.
  *
  * @param project
  * @return An array of kill ports to try in order to ask Grails forked process to terminate.
  */
 private ArrayList<Integer> addKillPortArg(IProject project, List<String> vmArgs) {
   ArrayList<Integer> ports = null;
   if (project != null) {
     if (GrailsVersion.V_2_3_.compareTo(GrailsVersion.getEclipseGrailsVersion(project)) <= 0) {
       ports = new ArrayList<Integer>(2); // Will have 1 or two elements not more.
       int serverPort = GrailsWorkspace.get().create(project).getServerPort();
       if (serverPort != DependencyData.UNKNOWN_PORT) {
         ports.add(serverPort + 1);
       }
       // The next bit really only expected to work in in Grails 2.3
       try {
         int allocatedKillPort = portFinder.findUniqueFreePort();
         vmArgs.add("-Dgrails.forked.kill.port=" + allocatedKillPort);
         ports.add(allocatedKillPort);
       } catch (IOException e) {
         // non fatal... log and proceed
         GrailsCoreActivator.log(e);
       }
     }
   }
   return ports;
 }
  public static ILaunchConfiguration getLaunchConfiguration(
      IProject project, String script, boolean persist) throws CoreException {

    ILaunchConfigurationType configType = getLaunchConfigurationType();
    IGrailsInstall install =
        GrailsCoreActivator.getDefault().getInstallManager().getGrailsInstall(project);
    if (install == null) {
      return null;
    }
    String nameAndScript = (script != null ? "(" + script + ")" : "");
    if (project != null) {
      nameAndScript = project.getName() + " " + nameAndScript;
    }
    nameAndScript = sanitize(nameAndScript);
    ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, nameAndScript);
    GrailsLaunchArgumentUtils.prepareLaunchConfiguration(
        project, script, install, GrailsBuildSettingsHelper.getBaseDir(project), wc);
    if (persist) {
      return wc.doSave();
    } else {
      return wc;
    }
  }
 private void terminateForked() {
   if (killPorts != null) {
     for (int killPort : killPorts) {
       try {
         URI killUrl = new URI("http://localhost:" + killPort);
         HttpUtil.ping(killUrl);
       } catch (Throwable e) {
       }
     }
   }
   if (processes != null && processes.length > 1) {
     // Make sure all processes are terminated
     for (IProcess process : processes) {
       try {
         if (process.canTerminate() && !process.isTerminated()) {
           process.terminate();
         }
       } catch (Throwable e) {
         GrailsCoreActivator.log(e);
       }
     }
     processes = null;
   }
 }
  @SuppressWarnings("unchecked")
  public void launch(
      ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
      throws CoreException {

    try {

      GrailsVersion version = GrailsLaunchArgumentUtils.getGrailsVersion(configuration);
      IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 5);
      checkCancelled(subMonitor);
      subMonitor.beginTask("Starting Grails", 5);
      subMonitor.worked(1);
      checkCancelled(subMonitor);
      subMonitor.subTask("Configuring launch parameters...");

      // FIXKDV FIXADE Copies of this code exist in
      // GrailsLaunchArgumentUtils.prepareClasspath()
      // and GrailsLaunchConfigurationDelegate.launch()
      // consider refactoring to combine

      IVMRunner runner;
      IVMInstall vm = verifyVMInstall(configuration);
      if (GrailsVersion.V_2_3_.compareTo(version) <= 0) {
        // We'll be debugging the forked process, not the run-app command.
        runner = vm.getVMRunner(ILaunchManager.RUN_MODE);
      } else {
        runner = vm.getVMRunner(mode);
      }
      if (runner == null) {
        runner = vm.getVMRunner(ILaunchManager.RUN_MODE);
      }

      String projectName =
          configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
      IProject project = null;
      if (!"".equals(projectName)) {
        project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
      }

      String grailsHome = GrailsLaunchArgumentUtils.getGrailsHome(configuration);
      String baseDir =
          configuration.getAttribute(GrailsLaunchArgumentUtils.PROJECT_DIR_LAUNCH_ATTR, "");
      if (baseDir.equals("")) {
        baseDir = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
      }
      String script = getScript(configuration);

      File workingDir = verifyWorkingDirectory(configuration);
      String workingDirName = null;
      if (workingDir != null) {
        workingDirName = workingDir.getAbsolutePath();
      } else {
        workingDirName = baseDir;
      }

      List<String> programArguments = new ArrayList<String>();
      programArguments.add("--conf");
      programArguments.add(grailsHome + "conf" + File.separatorChar + "groovy-starter.conf");
      programArguments.add("--main");
      programArguments.add("org.codehaus.groovy.grails.cli.GrailsScriptRunner");

      StringBuilder grailsCommand = new StringBuilder();
      String grailsWorkDir =
          configuration.getAttribute(GrailsLaunchArgumentUtils.GRAILS_WORK_DIR_LAUNCH_ATTR, "");
      if (!grailsWorkDir.equals("")) {
        grailsCommand.append("-Dgrails.work.dir=" + grailsWorkDir + " ");
      }
      grailsCommand.append(script + " ");
      programArguments.add(grailsCommand.toString().trim());

      List<String> vmArgs = new ArrayList<String>();
      // vmArgs.add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8123");

      // add manual configured vm options to the argument list
      String existingVmArgs = getVMArguments(configuration);
      boolean launchConfHasVMArgs = false;
      if (existingVmArgs != null && existingVmArgs.length() > 0) {
        launchConfHasVMArgs = true;
        StringTokenizer additionalArguments = new StringTokenizer(existingVmArgs, " ");
        while (additionalArguments.hasMoreTokens()) {
          vmArgs.add(additionalArguments.nextToken());
        }
      }

      Map<String, String> systemProps =
          GrailsCoreActivator.getDefault().getLaunchSystemProperties();
      GrailsLaunchArgumentUtils.setMaybe(systemProps, "base.dir", baseDir);
      GrailsLaunchArgumentUtils.setMaybe(systemProps, "grails.home", grailsHome);
      for (Map.Entry<String, String> prop : systemProps.entrySet()) {
        vmArgs.add("-D" + prop.getKey() + "=" + prop.getValue());
      }
      int forkedProcessDebugPort = addForkedModeDebuggingArgs(configuration, mode, vmArgs);
      ArrayList<Integer> killPorts = addKillPortArg(project, vmArgs);

      if (!launchConfHasVMArgs) {
        // If the user added their own vmargs to the launch config then the 'default' from global
        // prefs should
        // not be used.
        GrailsLaunchArgumentUtils.addUserDefinedJVMArgs(vmArgs);
      }
      // Grails uses some default memory settings that we want to use as well if no others have been
      // configured
      vmArgs = GrailsLaunchArgumentUtils.addMemorySettings(vmArgs);
      vmArgs = GrailsLaunchArgumentUtils.addSpringLoadedArgs(configuration, vmArgs);

      String[] envp = getEnvironment(configuration);
      Map<String, String> extra = new HashMap<String, String>();
      extra.put("JAVA_HOME", vm.getInstallLocation().getAbsolutePath());
      extra.put(
          "GROOVY_PAGE_ADD_LINE_NUMBERS", "true"); // Enables line number info for GSP debugging
      envp = GrailsLaunchArgumentUtils.addToEnvMaybe(envp, extra);

      Map<String, Object> vmAttributesMap = getVMSpecificAttributesMap(configuration);

      String[] classpath = getClasspath(configuration);
      String mainTypeName = verifyMainTypeName(configuration);

      VMRunnerConfiguration runConfiguration = new VMRunnerConfiguration(mainTypeName, classpath);
      runConfiguration.setProgramArguments(
          programArguments.toArray(new String[programArguments.size()]));
      runConfiguration.setVMArguments(vmArgs.toArray(new String[vmArgs.size()]));
      runConfiguration.setWorkingDirectory(workingDirName);
      runConfiguration.setEnvironment(envp);
      runConfiguration.setVMSpecificAttributesMap(vmAttributesMap);

      String[] bootpath = getBootpath(configuration);
      if (bootpath != null && bootpath.length > 0) {
        runConfiguration.setBootClassPath(bootpath);
      }

      subMonitor.worked(1);
      checkCancelled(subMonitor);

      subMonitor.subTask("Setting up source locator...");
      setDefaultSourceLocator(launch, configuration);
      subMonitor.worked(1);
      checkCancelled(subMonitor);

      subMonitor.worked(1);
      checkCancelled(subMonitor);

      subMonitor.subTask("Launching Grails...");

      if (ILaunchManager.DEBUG_MODE.equals(mode)) {
        launchRemote(forkedProcessDebugPort, configuration, mode, launch, subMonitor);
      }
      GrailsCoreActivator.getDefault().notifyCommandStart(project);
      runner.run(runConfiguration, launch, monitor);
      AbstractLaunchProcessListener listener = getLaunchListener(configuration);
      if (listener != null) {
        listener.init(launch.getProcesses()[0]);
      }
      DebugPlugin.getDefault()
          .addDebugEventListener(
              new GrailsProcessListener(launch.getProcesses(), project, killPorts));
      subMonitor.worked(1);
    } catch (Exception e) {
      GrailsCoreActivator.log(e);
    }
  }
 public void testCreatePlugin2() throws Exception {
   GrailsCommand cmd =
       GrailsCommandFactory.createPlugin(
           GrailsCoreActivator.getDefault().getInstallManager().getDefaultGrailsInstall(), "foo");
   assertEquals("create-plugin foo", cmd.getCommand());
 }
示例#13
0
 public void recordError(String msg) {
   GrailsCoreActivator.log(msg);
 }
 @Override
 public void finish() {
   GrailsCoreActivator.getDefault().removeGrailsCommandResourceListener(this);
 }
 @Override
 public void dispose() {
   GrailsCoreActivator.getDefault().getInstallManager().removeGrailsInstallListener(listener);
   super.dispose();
 }
    public void update(Observable o, Object arg) {

      final IWorkspace workspace = JavaPlugin.getWorkspace();

      final String name = fNameGroup.getName();

      // check whether the project name field is empty
      if (name.length() == 0) {
        setErrorMessage(null);
        setMessage(NewWizardMessages.NewJavaProjectWizardPageOne_Message_enterProjectName);
        setPageComplete(false);
        return;
      }

      // check whether the project name is valid
      IStatus nameStatus = workspace.validateName(name, IResource.PROJECT);
      if (nameStatus.isOK()) {
        // there are further restrictions on Grails project names
        nameStatus = validateProjectName(name);
      }
      if (!nameStatus.isOK()) {
        setErrorMessage(nameStatus.getMessage());
        setPageComplete(false);
        return;
      }

      // check whether project already exists
      final IProject handle = workspace.getRoot().getProject(name);
      if (handle.exists()) {
        setErrorMessage(NewWizardMessages.NewJavaProjectWizardPageOne_Message_projectAlreadyExists);
        setPageComplete(false);
        return;
      }

      IPath projectLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(name);
      if (projectLocation.toFile().exists()) {
        try {
          // correct casing
          String canonicalPath = projectLocation.toFile().getCanonicalPath();
          projectLocation = new Path(canonicalPath);
        } catch (IOException e) {
          JavaPlugin.log(e);
        }

        String existingName = projectLocation.lastSegment();
        if (!existingName.equals(fNameGroup.getName())) {
          setErrorMessage(
              Messages.format(
                  NewWizardMessages
                      .NewJavaProjectWizardPageOne_Message_invalidProjectNameForWorkspaceRoot,
                  BasicElementLabels.getResourceName(existingName)));
          setPageComplete(false);
          return;
        }
      }

      final String location = fLocationGroup.getLocation().toOSString();

      // check whether location is empty
      if (location.length() == 0) {
        setErrorMessage(null);
        setMessage(NewWizardMessages.NewJavaProjectWizardPageOne_Message_enterLocation);
        setPageComplete(false);
        return;
      }

      // check whether the location is a syntactically correct path
      if (!Path.EMPTY.isValidPath(location)) {
        setErrorMessage(NewWizardMessages.NewJavaProjectWizardPageOne_Message_invalidDirectory);
        setPageComplete(false);
        return;
      }

      IPath projectPath = Path.fromOSString(location);

      if (fLocationGroup.isWorkspaceRadioSelected())
        projectPath = projectPath.append(fNameGroup.getName());

      boolean importing = false;
      if (projectPath.toFile().exists()) { // create from existing source
        if (Platform.getLocation()
            .isPrefixOf(projectPath)) { // create from existing source in workspace
          if (!projectPath.toFile().exists()) {
            setErrorMessage(
                org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages
                    .NewGrailsProjectWizardPageOne_notExisingProjectOnWorkspaceRoot);
            setPageComplete(false);
            return;
          }
        }
        importing = true;
      } else if (!fLocationGroup
          .isWorkspaceRadioSelected()) { // create at non existing external location
        if (!canCreate(projectPath.toFile())) {
          setErrorMessage(
              NewWizardMessages.NewJavaProjectWizardPageOne_Message_cannotCreateAtExternalLocation);
          setPageComplete(false);
          return;
        }

        // If we do not place the contents in the workspace validate the
        // location.
        final IStatus locationStatus = workspace.validateProjectLocation(handle, projectPath);
        if (!locationStatus.isOK()) {
          setErrorMessage(locationStatus.getMessage());
          setPageComplete(false);
          return;
        }
      }

      // Let other checks perform before this one.
      // If a location was specified, the project name must match the last segment of the location
      if (!projectPath.isEmpty()) {
        String expectedProjectName = projectPath.lastSegment();
        if ((name == null) || !name.equals(expectedProjectName)) {
          setErrorMessage(
              NewGrailsWizardMessages
                  .NewGrailsProjectWizardPageOne_invalidProjectNameForExternalLocation);
          setPageComplete(false);
          return;
        }
      }

      if (GrailsCoreActivator.getDefault().getInstallManager().getDefaultGrailsInstall() == null) {
        setErrorMessage(
            org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages
                .NewGrailsProjectWizardPageOne_noGrailsInstallationInWorkspacePreferences);
        setPageComplete(false);
        return;
      }

      setPageComplete(true);
      setErrorMessage(null);
      if (importing) {
        // Project exists, but is not in workspace therefore import it.
        setMessage(
            Messages.format(
                org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages
                    .NewGrailsProjectWizardPageOne_importingExistingProject,
                BasicElementLabels.getResourceName(projectPath.lastSegment())));
      } else {
        setMessage(null);
      }
    }
示例#17
0
 /** What's the default grails version that we expect new projects to be created with. */
 private String grailsVersion() {
   return GrailsCoreActivator.getDefault()
       .getInstallManager()
       .getDefaultGrailsInstall()
       .getVersionString();
 }
    public Control createControl(Composite composite) {
      Group grailsHomeGroup = new Group(composite, SWT.NONE);
      grailsHomeGroup.setFont(composite.getFont());
      grailsHomeGroup.setText("Grails Installation");
      grailsHomeGroup.setLayout(initGridLayout(new GridLayout(1, false), true));

      useDefault = new Button(grailsHomeGroup, SWT.RADIO);

      IGrailsInstall defaultInstall =
          GrailsCoreActivator.getDefault().getInstallManager().getDefaultGrailsInstall();
      if (defaultInstall != null) {
        useDefault.setText(
            org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages
                    .NewGrailsProjectWizardPageOne_useDefaultGrailsInstallation
                + defaultInstall.getName()
                + "')");
      } else {
        setErrorMessage(
            org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages
                .NewGrailsProjectWizardPageOne_noGrailsInstallation);
        setPageComplete(false);
        useDefault.setText(
            org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages
                .NewGrailsProjectWizardPageOne_useDefaultGrailsInstallationNoCurrent);
      }
      useDefault.setSelection(true);
      useDefault.addSelectionListener(
          new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
              grailsInstallCombo.setEnabled(false);
            }
          });

      useSpecific = new Button(grailsHomeGroup, SWT.RADIO);
      useSpecific.setText("Use project specific Grails installation:");
      useSpecific.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              grailsInstallCombo.setEnabled(true);
            }
          });

      final Composite installComposite = new Composite(grailsHomeGroup, SWT.NULL);
      installComposite.setFont(composite.getFont());
      installComposite.setLayout(new GridLayout(3, false));
      installComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      Label options = new Label(installComposite, SWT.WRAP);
      options.setText("Install: ");
      options.setLayoutData(new GridData(GridData.BEGINNING));

      grailsInstallCombo = new Combo(installComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
      grailsInstallCombo.setItems(
          GrailsCoreActivator.getDefault().getInstallManager().getAllInstallNames());
      grailsInstallCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      String[] names = grailsInstallCombo.getItems();
      for (int i = 0; i < names.length; i++) {
        if (GrailsCoreActivator.getDefault()
            .getInstallManager()
            .getGrailsInstall(names[i])
            .isDefault()) {
          grailsInstallCombo.select(i);
          break;
        }
      }
      grailsInstallCombo.setEnabled(false);
      grailsHomeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      Link link = new Link(installComposite, SWT.NONE);
      link.setFont(composite.getFont());
      link.setText("<A>Configure Grails Installations....</A>"); // $NON-NLS-1$//$NON-NLS-2$
      link.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
      link.addSelectionListener(
          new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
              openPreferences();
            }

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

      return grailsHomeGroup;
    }