public Map<String, String> getMacros() {
    Map<String, String> macros = new LinkedHashMap<String, String>();

    for (ICLanguageSetting ls : languageSettings) {
      for (ICLanguageSettingEntry ms : ls.getSettingEntries(ICSettingEntry.MACRO)) {
        if (ms.isBuiltIn()) {
          continue;
        }
        macros.put(ms.getName(), ms.getValue());
      }
    }

    return macros;
  }
  public Collection<File> getIncludes() {
    Collection<File> paths = new LinkedList<File>();
    String workspacePath = getWorkspacePath();

    for (ICLanguageSetting languageSetting : languageSettings) {
      ICLanguageSettingEntry[] includePathSettings =
          languageSetting.getSettingEntries(ICSettingEntry.INCLUDE_PATH);

      for (ICLanguageSettingEntry e : includePathSettings) {
        if (!e.isBuiltIn()) {
          appendFile(paths, workspacePath, e);
        }
      }
    }
    return paths;
  }
  private void appendFile(
      Collection<File> paths, String workspacePath, ICLanguageSettingEntry includePath) {
    File path = new File(includePath.getValue());

    if ((includePath.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH)
        == ICSettingEntry.VALUE_WORKSPACE_PATH) {
      path = new File(workspacePath, path.toString());
    }

    IFile file = root.getFileForLocation(new Path(path.toString()));

    if (file != null) {
      path = file.getLocation().toFile();
    }

    paths.add(path);
  }
Esempio n. 4
0
 @Override
 public ICLanguageSettingEntry doEdit(ICLanguageSettingEntry ent) {
   IncludeDialog dlg =
       new IncludeDialog(
           usercomp.getShell(),
           IncludeDialog.OLD_DIR,
           Messages.IncludeTab_2,
           ent.getValue(),
           getResDesc().getConfiguration(),
           (ent.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH));
   if (dlg.open()) {
     int flags = 0;
     if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
     return CDataUtil.createCIncludePathEntry(dlg.text1, flags);
   }
   return null;
 }