コード例 #1
0
  /** {@inheritDoc} */
  public Object execute(CommandLine commandLine) throws Exception {
    String name = commandLine.getValue(Options.PROJECT_OPTION);
    IProject project = ProjectUtils.getProject(name);
    String[] aliases = StringUtils.split(commandLine.getValue(Options.NATURE_OPTION), ',');

    IProjectDescription desc = project.getDescription();
    String[] natureIds = desc.getNatureIds();
    ArrayList<String> modified = new ArrayList<String>();
    ArrayList<String> newNatures = new ArrayList<String>();
    CollectionUtils.addAll(modified, natureIds);
    for (String alias : aliases) {
      String natureId = ProjectNatureFactory.getNatureForAlias(alias);
      if (natureId != null && !modified.contains(natureId)) {
        modified.add(natureId);
        newNatures.add(natureId);
      }
    }

    desc.setNatureIds((String[]) modified.toArray(new String[modified.size()]));
    project.setDescription(desc, new NullProgressMonitor());

    for (String nature : newNatures) {
      ProjectManager manager = ProjectManagement.getProjectManager(nature);
      if (manager != null) {
        manager.create(project, commandLine);
      }
    }

    return Services.getMessage("project.nature.added");
  }
コード例 #2
0
  /** {@inheritDoc} */
  public Object execute(CommandLine commandLine) throws Exception {
    String name = commandLine.getValue(Options.PROJECT_OPTION);

    IProject project = ProjectUtils.getProject(name, true);
    ProjectManagement.refresh(project, commandLine);

    return Services.getMessage("project.refreshed", name);
  }
コード例 #3
0
  /** {@inheritDoc} */
  public Object execute(CommandLine commandLine) throws Exception {
    String name = commandLine.getValue(Options.PROJECT_OPTION);
    IProject project = ProjectUtils.getProject(name, true);
    String setting = commandLine.getValue(Options.SETTING_OPTION);

    Preferences preferences = getPreferences();

    if (commandLine.hasOption(Options.VALUE_OPTION)) {
      String value = commandLine.getValue(Options.VALUE_OPTION);
      preferences.setValue(project, setting, value);
      return null;
    }

    return preferences.getValue(project, setting);
  }
コード例 #4
0
ファイル: JavaUtils.java プロジェクト: alvaroc1/eclim
 /**
  * Gets a java project by name.
  *
  * @param project The name of the project.
  * @return The project.
  */
 public static IJavaProject getJavaProject(String project) throws Exception {
   return getJavaProject(ProjectUtils.getProject(project, true));
 }