예제 #1
0
 private ChangeMindSourcePathPropVarJob(MindProjectImpl mp) {
   super(
       "Change the "
           + Messages.CDTUtil_SourcePath
           + " properties variable for "
           + mp.getProject().getName());
   _mp = mp;
   setRule(mp.getProject());
 }
예제 #2
0
 private ChangeMindCOMPVarJob(MindProjectImpl mp) {
   super(
       "Change the "
           + Messages.CDTUtil_TargetComponent
           + " and "
           + Messages.CDTUtil_BinaryName
           + " properties variables for "
           + mp.getProject().getName());
   _mp = mp;
   setRule(mp.getProject());
 }
예제 #3
0
    @Override
    protected IStatus run(IProgressMonitor monitor) {
      try {
        StringBuilder incVar = new StringBuilder();

        boolean isFirst = true;
        for (MindPathEntry currEntry : _mp.getMindpathentries()) {
          if (currEntry.getEntryKind() == MindPathKind.INCLUDE_PATH) {
            // Handle differently workspace paths and absolute file system paths
            // Note: Name MAY NOT be the best attribute...
            IPath p = new Path(currEntry.getName());
            // does the folder exist in the workspace ?
            IFolder f = ResourcesPlugin.getWorkspace().getRoot().getFolder(p);
            if ((f == null) || !f.exists()) {
              // Try to find it on the hard drive
              File file = p.toFile();
              // should be
              if (file.exists() && file.isDirectory()) {

                if (isFirst) isFirst = false; // for next values
                else incVar.append(":");

                incVar.append(currEntry.getName());
              }
            } else {
              /*
               * Only keep values internal to the current project, skip others
               * maybe one day we should modify it to serialize inferred paths
               * from project dependencies.
               */
              if (!f.isLinked() && f.getProject() == _mp.getProject()) {
                if (isFirst) isFirst = false; // for next values
                else incVar.append(":");

                incVar.append(f.getProjectRelativePath().toPortableString());
              }
            }
          }
        }

        MindProperties mp = new MindProperties(_mp.getProject());
        mp.setVarAndSave(Messages.CDTUtil_IncludePath, incVar.toString());
      } catch (CoreException e) {
        MindActivator.log(new Status(Status.ERROR, MindActivator.ID, getName(), e));
      }
      return Status.OK_STATUS;
    }
예제 #4
0
    @Override
    protected IStatus run(IProgressMonitor monitor) {
      try {
        ArrayList<String> appli = new ArrayList<String>();
        for (MindPathEntry mpe : _mp.getRawMinpath()) {
          if (mpe.getEntryKind() == MindPathKind.APPLI) {
            String mpename = mpe.getName();
            appli.add(mpename);
          }
        }
        StringBuilder srcVar = new StringBuilder();
        for (String a : appli) {
          srcVar.append(a);
          srcVar.append(" ");
        }
        if (srcVar.length() != 0)
          srcVar.setLength(srcVar.length() - 2); // remove last collon if length > 0

        // TODO: enable multi-target + robustness
        MindProperties mp = new MindProperties(_mp.getProject());
        if (!appli.isEmpty()) {
          // Nowadays since our properties file format only can define ONE target/binary
          // combination, we take field 0 only
          // and skip the other ones
          String appli0 = appli.get(0);
          String[] appli0Split = appli0.split(":");
          mp.setVarAndSave(
              Messages.CDTUtil_TargetComponent, appli0Split[0] != null ? appli0Split[0] : "");
          mp.setVarAndSave(
              Messages.CDTUtil_BinaryName, appli0Split[1] != null ? appli0Split[1] : "");
        } else {
          mp.setVarAndSave(Messages.CDTUtil_TargetComponent, "");
          mp.setVarAndSave(Messages.CDTUtil_BinaryName, "");
        }

        MindIdeCore.rebuild(_mp);
      } catch (CoreException e) {
        MindActivator.log(new Status(Status.ERROR, MindActivator.ID, getName(), e));
      }
      return Status.OK_STATUS;
    }