public void refresh() {
   IRooInstall defaultInstall =
       RooCoreActivator.getDefault().getInstallManager().getDefaultRooInstall();
   if (defaultInstall != null) {
     useDefault.setText(
         NewRooWizardMessages.bind(
             NewRooWizardMessages.NewRooProjectWizardPageOne_useDefaultRooInstallation,
             defaultInstall.getName()));
   } else {
     setErrorMessage(
         NewRooWizardMessages.NewRooProjectWizardPageOne_noRooInstallationConfigured);
     setPageComplete(false);
     useDefault.setText(
         NewRooWizardMessages.NewRooProjectWizardPageOne_useDefaultRooInstallationNoCurrent);
   }
   rooInstallCombo.setItems(
       RooCoreActivator.getDefault().getInstallManager().getAllInstallNames());
   String[] names = rooInstallCombo.getItems();
   for (int i = 0; i < names.length; i++) {
     if (RooCoreActivator.getDefault().getInstallManager().getRooInstall(names[i]).isDefault()) {
       rooInstallCombo.select(i);
       break;
     }
   }
   fireEvent();
 }
    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
      final IStatus nameStatus = workspace.validateName(name, IResource.PROJECT);
      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;
      }

      // check whether package name is valid
      final String packageName = fNameGroup.getPackageName();
      if (packageName.length() == 0) {
        setErrorMessage(null);
        setMessage("Enter a top level package name.");
        setPageComplete(false);
        return;
      }
      if (JavaConventions.validatePackageName(
                  packageName, JavaCore.VERSION_1_3, JavaCore.VERSION_1_3)
              .getSeverity()
          == IStatus.ERROR) {
        setErrorMessage(null);
        setMessage("The entered top level package name is not valid.");
        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;
        }

        setErrorMessage("A project at specified location already exists.");
        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());

      if (projectPath.toFile().exists()) { // create from existing source
        if (Platform.getLocation().isPrefixOf(projectPath)) { // create
          // from
          // existing
          // source
          // in
          // workspace
          if (!Platform.getLocation().equals(projectPath.removeLastSegments(1))) {
            setErrorMessage(
                NewRooWizardMessages.NewRooProjectWizardPageOne_Message_notOnWorkspaceRoot);
            setPageComplete(false);
            return;
          }

          if (!projectPath.toFile().exists()) {
            setErrorMessage(
                NewRooWizardMessages.NewRooProjectWizardPageOne_notExisingProjectOnWorkspaceRoot);
            setPageComplete(false);
            return;
          }
        }
      } 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;
        }
      }

      if (firstValidation) {
        firstValidation = false;
        if (RooCoreActivator.getDefault().getInstallManager().getDefaultRooInstall() == null) {
          setErrorMessage("No Roo installation configured in workspace preferences.");
          setPageComplete(false);
          return;
        }
      } else {
        IRooInstall install = null;
        if (useDefaultRooInstall()) {
          install = RooCoreActivator.getDefault().getInstallManager().getDefaultRooInstall();
        } else {
          String installName = getRooInstallName();
          if (installName != null) {
            install = RooCoreActivator.getDefault().getInstallManager().getRooInstall(installName);
          }
        }
        if (install == null) {
          setErrorMessage("No Roo installation configured in workspace preferences.");
          setPageComplete(false);
          return;
        } else {
          installError = install.validate();
          if (installError != null && !installError.isOK()) {
            setErrorMessage(installError.getMessage());
            setPageComplete(false);
            return;
          }
        }
      }

      setPageComplete(true);
      setErrorMessage(null);
      setMessage(null);
    }
    public Control createControl(Composite composite) {
      Group rooHomeGroup = new Group(composite, SWT.NONE);
      rooHomeGroup.setFont(composite.getFont());
      rooHomeGroup.setText("Roo Installation");
      rooHomeGroup.setLayout(initGridLayout(new GridLayout(1, false), true));

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

      IRooInstall defaultInstall =
          RooCoreActivator.getDefault().getInstallManager().getDefaultRooInstall();
      if (defaultInstall != null) {
        useDefault.setText(
            NewRooWizardMessages.bind(
                NewRooWizardMessages.NewRooProjectWizardPageOne_useDefaultRooInstallation,
                defaultInstall.getName()));
      } else {
        setErrorMessage(
            NewRooWizardMessages.NewRooProjectWizardPageOne_noRooInstallationConfigured);
        setPageComplete(false);
        useDefault.setText(
            NewRooWizardMessages.NewRooProjectWizardPageOne_useDefaultRooInstallationNoCurrent);
      }
      useDefault.setSelection(true);
      useDefault.addSelectionListener(
          new SelectionAdapter() {

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

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

      final Composite installComposite = new Composite(rooHomeGroup, 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(NewRooWizardMessages.NewRooProjectWizardPageOne_Install);
      options.setLayoutData(new GridData(GridData.BEGINNING));

      rooInstallCombo = new Combo(installComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
      rooInstallCombo.setItems(
          RooCoreActivator.getDefault().getInstallManager().getAllInstallNames());
      rooInstallCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      rooInstallCombo.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetDefaultSelected(SelectionEvent e) {
              fireEvent();
            }

            @Override
            public void widgetSelected(SelectionEvent e) {
              fireEvent();
            }
          });

      String[] names = rooInstallCombo.getItems();
      for (int i = 0; i < names.length; i++) {
        if (RooCoreActivator.getDefault().getInstallManager().getRooInstall(names[i]).isDefault()) {
          rooInstallCombo.select(i);
          break;
        }
      }
      rooInstallCombo.setEnabled(false);
      rooHomeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      Link link = new Link(installComposite, SWT.NONE);
      link.setFont(composite.getFont());
      link.setText("<A>Configure Roo 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 rooHomeGroup;
    }