コード例 #1
0
 /** Ensure configuration is extracted for master project. */
 public void ensureConf() {
   try {
     if (ProjectUtil.hasFile(project(), Conf.PROJ_PATH)) {
       return;
     }
     ProjectUtil.copyFromClasspathIntoProject(
         Project.class, Conf.KLAZ_PATH, project(), Conf.PROJ_PATH);
   } catch (final Throwable e) {
     Plugin.logErrr("Project#ensureConf: failure", e);
   }
 }
コード例 #2
0
    /** Create worker-specific fileinstall.cfg file for the master. */
    public void confCreate(final String worker) {
      ensureConf();
      final Conf conf = conf();

      if (!ResourceUtil.hasProject(worker)) {
        Plugin.logWarn("Project#confCreate: missing project: " + worker);
        return;
      }

      final Map<String, String> variables = //
          Conf.variables(ResourceUtil.workspacePath(), worker, ResourceUtil.projectPath(worker));

      final String path =
          ConfUtil.replace( //
              conf.fileinstallPath(), variables);

      final String tempalte =
          ConfUtil.replace( //
              conf.fileinstallTemplate(), variables);

      final File file = ProjectUtil.file(project(), path);

      try {
        FileUtil.writeTextFile(file, tempalte);
        Plugin.logOK("Project#confCreate file: " + file);
      } catch (final Throwable e) {
        Plugin.logErrr("Project#confCreate failure", e);
      }
    }
コード例 #3
0
 @Override
 Change next() {
   return ProjectUtil.severity(project()) //
           != IMarker.SEVERITY_ERROR
       ? Change.POSITIVE
       : Change.NEGATIVE;
 }
コード例 #4
0
 @Override
 Change next() {
   return ProjectUtil.manifest(project())
           . //
           exists()
       ? Change.POSITIVE
       : Change.NEGATIVE;
 }
コード例 #5
0
    /** Delete worker-specific fileinstall.cfg file for the master. */
    public void confDelete(final String worker) {

      if (!ResourceUtil.hasProject(worker)) {
        Plugin.logWarn("Project#confDelete: missing project: " + worker);
        return;
      }

      ensureConf();
      final Conf conf = conf();

      final Map<String, String> variables = //
          Conf.variables(ResourceUtil.workspacePath(), worker, ResourceUtil.projectPath(worker));

      final String path =
          ConfUtil.replace( //
              conf.fileinstallPath(), variables);

      final File file = ProjectUtil.file(project(), path);

      file.delete();

      Plugin.logOK("Project#confDelete file: " + file);
    }