private static List<IResource> createProject(String projectName) {
   IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
   if (!GroovyNature.hasGroovyNature(project)) {
     throw new IllegalArgumentException("Invalid project: " + projectName);
   }
   return Collections.<IResource>singletonList(project);
 }
  @SuppressWarnings("unchecked")
  public void applyPreferences() {
    if (!hasChanges) {
      return;
    }
    hasChanges = false;
    // must do the store before setting the preference
    // to ensure that the store is flushed
    disableButton.store();

    List<String> elts = patternList.getElements();
    List<String> result = new ArrayList<String>(elts.size() * 2);
    for (String elt : elts) {
      result.add(elt);
      result.add(patternList.isChecked(elt) ? "y" : "n");
    }
    Activator.getDefault().setPreference(preferences, Activator.GROOVY_SCRIPT_FILTERS, result);

    boolean yesNo =
        MessageDialog.openQuestion(
            parent.getShell(),
            "Do full build?",
            "Script folder preferences have changed.\n"
                + "Must do a full build before they come completely into effect.  Do you want to do a full build now?");
    if (yesNo) {
      if (project != null) {
        new BuildJob(project).schedule();
      } else {
        new BuildJob(GroovyNature.getAllAccessibleGroovyProjects().toArray(new IProject[0]))
            .schedule();
      }
    }
  }
 public static SpecifiedVersion getCompilerLevel(IProject project) {
   SpecifiedVersion version = UNSPECIFIED;
   if (GroovyNature.hasGroovyNature(project)) {
     String groovyCompilerLevelStr = Activator.getDefault().getGroovyCompilerLevel(project);
     if (groovyCompilerLevelStr != null) {
       version = SpecifiedVersion.findVersionFromString(groovyCompilerLevelStr);
     }
   }
   return version;
 }