Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java29
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java10
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java11
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java6
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java46
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java64
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java8
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java37
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java31
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SCDOptionsEnum.java8
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java93
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java45
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java163
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveryOptionsBlock.java3
14 files changed, 304 insertions, 250 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java
index f370f012cd6..3070870424f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IDiscoveredPathManager.java
@@ -32,11 +32,27 @@ public interface IDiscoveredPathManager {
*/
Map getSymbols();
+ IDiscoveredScannerInfoSerializable getSerializable();
+ }
+
+ interface IPerProjectDiscoveredPathInfo extends IDiscoveredPathInfo {
+ void setIncludeMap(LinkedHashMap map);
+ void setSymbolMap(LinkedHashMap map);
+
+ LinkedHashMap getIncludeMap();
+ LinkedHashMap getSymbolMap();
+ }
+
+ interface IPerFileDiscoveredPathInfo extends IDiscoveredPathInfo {
/**
* Get include paths for the specific path (file)
*/
IPath[] getIncludePaths(IPath path);
/**
+ * Get quote include paths (for #include "...") for the specific path (file)
+ */
+ IPath[] getQuoteIncludePaths(IPath path);
+ /**
* Get defined symbols for the specific path (file)
*/
Map getSymbols(IPath path);
@@ -49,17 +65,8 @@ public interface IDiscoveredPathManager {
* Get macro files (gcc option -imacros) for the specific path (file)
*/
IPath[] getMacroFiles(IPath path);
-
- IDiscoveredScannerInfoSerializable getSerializable();
- ScannerConfigScope getScope();
-
- void setIncludeMap(LinkedHashMap map);
- void setSymbolMap(LinkedHashMap map);
-
- LinkedHashMap getIncludeMap();
- LinkedHashMap getSymbolMap();
- }
-
+ }
+
interface IDiscoveredScannerInfoSerializable {
/**
* Serialize discovered scanner info to an XML element
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java
index 7373366a436..1153f80544b 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/IScannerInfoCollectorCleaner.java
@@ -19,14 +19,14 @@ import org.eclipse.core.resources.IResource;
*/
public interface IScannerInfoCollectorCleaner {
/**
- * Delete all discovered paths for a resource
+ * Delete all discovered paths for the resource
*
* @param project
*/
public void deleteAllPaths(IResource resource);
/**
- * Delete all discovered symbols for a resource
+ * Delete all discovered symbols for the resource
*
* @param project
*/
@@ -48,4 +48,10 @@ public interface IScannerInfoCollectorCleaner {
*/
public void deleteSymbol(IResource resource, String symbol);
+ /**
+ * Delete all discovered scanner info for the resource
+ *
+ * @param resource
+ */
+ public void deleteAll(IResource resource);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java
index 00f5f60fbdf..4f4c37002ba 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/core/scannerconfig/ScannerInfoTypes.java
@@ -16,11 +16,12 @@ package org.eclipse.cdt.make.core.scannerconfig;
* @author vhirsl
*/
public class ScannerInfoTypes {
- public static final ScannerInfoTypes INCLUDE_PATHS = new ScannerInfoTypes(1);
- public static final ScannerInfoTypes SYMBOL_DEFINITIONS = new ScannerInfoTypes(2);
- public static final ScannerInfoTypes TARGET_SPECIFIC_OPTION = new ScannerInfoTypes(3) ;
- public static final ScannerInfoTypes COMPILER_VERSION_INFO = new ScannerInfoTypes(4);
- public static final ScannerInfoTypes COMPILER_COMMAND = new ScannerInfoTypes(5); // CCommandDSC
+ public static final ScannerInfoTypes COMPILER_COMMAND = new ScannerInfoTypes(1); // CCommandDSC
+ public static final ScannerInfoTypes INCLUDE_PATHS = new ScannerInfoTypes(2);
+ public static final ScannerInfoTypes QUOTE_INCLUDE_PATHS = new ScannerInfoTypes(3);
+ public static final ScannerInfoTypes SYMBOL_DEFINITIONS = new ScannerInfoTypes(4);
+ public static final ScannerInfoTypes TARGET_SPECIFIC_OPTION = new ScannerInfoTypes(5) ;
+ public static final ScannerInfoTypes COMPILER_VERSION_INFO = new ScannerInfoTypes(6);
private final int _enum;
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java
index 0d1f37626f6..a0b2ef4c190 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathContainer.java
@@ -12,9 +12,9 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigScope;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredInfoListener;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
import org.eclipse.core.resources.IProject;
public class DiscoveredPathContainer extends AbstractDiscoveredPathContainer {
@@ -33,14 +33,14 @@ public class DiscoveredPathContainer extends AbstractDiscoveredPathContainer {
public void infoRemoved(IDiscoveredPathInfo info) {
if (info != null &&
- ScannerConfigScope.PROJECT_SCOPE.equals(info.getScope())) {
+ info instanceof IPerProjectDiscoveredPathInfo) {
fgPathEntries.remove(info.getProject());
}
}
public void infoChanged(IDiscoveredPathInfo info) {
if (info != null &&
- ScannerConfigScope.PROJECT_SCOPE.equals(info.getScope())) {
+ info instanceof IPerProjectDiscoveredPathInfo) {
fgPathEntries.remove(info.getProject());
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
index 5fcc75adcaf..66807689441 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInfo.java
@@ -15,9 +15,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigScope;
-import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
import org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector;
import org.eclipse.core.resources.IProject;
@@ -28,7 +27,7 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
-public class DiscoveredPathInfo implements IDiscoveredPathInfo, IDiscoveredScannerInfoSerializable {
+public class DiscoveredPathInfo implements IPerProjectDiscoveredPathInfo, IDiscoveredScannerInfoSerializable {
public static final String INCLUDE_PATH = "includePath"; //$NON-NLS-1$
public static final String PATH = "path"; //$NON-NLS-1$
public static final String DEFINED_SYMBOL = "definedSymbol"; //$NON-NLS-1$
@@ -199,51 +198,10 @@ public class DiscoveredPathInfo implements IDiscoveredPathInfo, IDiscoveredScann
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths(org.eclipse.core.runtime.IPath)
- */
- public IPath[] getIncludePaths(IPath path) {
- if (project.getFile(path) != null) {
- return getIncludePaths();
- }
- return new IPath[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbols(org.eclipse.core.runtime.IPath)
- */
- public Map getSymbols(IPath path) {
- if (project.getFile(path) != null) {
- return getSymbols();
- }
- return new HashMap(0);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludeFiles(org.eclipse.core.runtime.IPath)
- */
- public IPath[] getIncludeFiles(IPath path) {
- return new IPath[0];
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getMacroFiles(org.eclipse.core.runtime.IPath)
- */
- public IPath[] getMacroFiles(IPath path) {
- return new IPath[0];
- }
-
- /* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSerializable()
*/
public IDiscoveredScannerInfoSerializable getSerializable() {
return this;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getScope()
- */
- public ScannerConfigScope getScope() {
- return ScannerConfigScope.PROJECT_SCOPE;
- }
-
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java
index 5a2949ea070..cdbe949a98b 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/PerFileDiscoveredPathContainer.java
@@ -20,9 +20,9 @@ import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.model.IPathEntryContainerExtension;
import org.eclipse.cdt.make.core.MakeCorePlugin;
-import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigScope;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredInfoListener;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -46,14 +46,14 @@ public class PerFileDiscoveredPathContainer extends AbstractDiscoveredPathContai
public void infoRemoved(IDiscoveredPathInfo info) {
if (info != null &&
- ScannerConfigScope.FILE_SCOPE.equals(info.getScope())) {
+ info instanceof IPerFileDiscoveredPathInfo) {
fgPathEntries.remove(info.getProject());
}
}
public void infoChanged(IDiscoveredPathInfo info) {
if (info != null &&
- ScannerConfigScope.FILE_SCOPE.equals(info.getScope())) {
+ info instanceof IPerFileDiscoveredPathInfo) {
fgPathEntries.remove(info.getProject());
}
}
@@ -67,34 +67,42 @@ public class PerFileDiscoveredPathContainer extends AbstractDiscoveredPathContai
* @see org.eclipse.cdt.core.model.IPathEntryContainerExtension#getPathEntries(org.eclipse.core.runtime.IPath, int)
*/
public IPathEntry[] getPathEntries(IPath path, int mask) {
- IDiscoveredPathInfo info;
ArrayList entries = new ArrayList();
try {
- info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject);
- if ((mask & IPathEntry.CDT_INCLUDE) != 0) {
- // TODO: Vlad how do we differentiate local includes from system includes
- IPath[] includes = info.getIncludePaths(path);
- for (int i = 0; i < includes.length; i++) {
- entries.add(CoreModel.newIncludeEntry(path, Path.EMPTY, includes[i], true));
- }
- }
- if ((mask & IPathEntry.CDT_MACRO) != 0) {
- Map syms = info.getSymbols(path);
- for (Iterator iter = syms.entrySet().iterator(); iter.hasNext(); ) {
- Entry entry = (Entry)iter.next();
- entries.add(CoreModel.newMacroEntry(path, (String)entry.getKey(), (String)entry.getValue())); //$NON-NLS-1$
- }
- }
- if ((mask & IPathEntry.CDT_INCLUDE_FILE) != 0) {
- IPath[] includeFiles = info.getIncludeFiles(path);
- for (int i = 0; i < includeFiles.length; i++) {
- entries.add(CoreModel.newIncludeFileEntry(path, includeFiles[i]));
+ IDiscoveredPathInfo info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fProject);
+ if (info instanceof IPerFileDiscoveredPathInfo) {
+ IPerFileDiscoveredPathInfo filePathInfo = (IPerFileDiscoveredPathInfo) info;
+
+ if ((mask & IPathEntry.CDT_INCLUDE) != 0) {
+ IPath[] includes = filePathInfo.getIncludePaths(path);
+ for (int i = 0; i < includes.length; i++) {
+ // add as a system include path
+ entries.add(CoreModel.newIncludeEntry(path, Path.EMPTY, includes[i], true));
+ }
+ includes = filePathInfo.getQuoteIncludePaths(path);
+ for (int i = 0; i < includes.length; i++) {
+ // add as a local include path
+ entries.add(CoreModel.newIncludeEntry(path, Path.EMPTY, includes[i], false));
+ }
+ }
+ if ((mask & IPathEntry.CDT_MACRO) != 0) {
+ Map syms = filePathInfo.getSymbols(path);
+ for (Iterator iter = syms.entrySet().iterator(); iter.hasNext(); ) {
+ Entry entry = (Entry)iter.next();
+ entries.add(CoreModel.newMacroEntry(path, (String)entry.getKey(), (String)entry.getValue())); //$NON-NLS-1$
+ }
+ }
+ if ((mask & IPathEntry.CDT_INCLUDE_FILE) != 0) {
+ IPath[] includeFiles = filePathInfo.getIncludeFiles(path);
+ for (int i = 0; i < includeFiles.length; i++) {
+ entries.add(CoreModel.newIncludeFileEntry(path, includeFiles[i]));
+ }
}
- }
- if ((mask & IPathEntry.CDT_MACRO_FILE) != 0) {
- IPath[] imacrosFiles = info.getMacroFiles(path);
- for (int i = 0; i < imacrosFiles.length; i++) {
- entries.add(CoreModel.newMacroFileEntry(path, imacrosFiles[i]));
+ if ((mask & IPathEntry.CDT_MACRO_FILE) != 0) {
+ IPath[] imacrosFiles = filePathInfo.getMacroFiles(path);
+ for (int i = 0; i < imacrosFiles.length; i++) {
+ entries.add(CoreModel.newMacroFileEntry(path, imacrosFiles[i]));
+ }
}
}
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java
index 7a264b33a27..ed7bb8cfde7 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileBOPConsoleParserUtility.java
@@ -140,6 +140,9 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
if (option.length() > 0) {
// ex. -I/dir
}
+ else if (SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.IDASH)) {
+ // -I- has no parameter
+ }
else {
// ex. -I /dir
// take a next token
@@ -149,11 +152,12 @@ public class GCCPerFileBOPConsoleParserUtility extends AbstractGCCBOPConsolePars
}
else break;
}
- if (SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.INCLUDE) ||
+ if (option.length() > 0 && (
+ SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.INCLUDE) ||
SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.INCLUDE_FILE) ||
SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.IMACROS_FILE) ||
SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.IDIRAFTER) ||
- SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.ISYSTEM)) {
+ SCDOptionsEnum.getSCDOptionsEnum(j).equals(SCDOptionsEnum.ISYSTEM))) {
option = (getAbsolutePath(option)).toString();
}
// add the pair
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java
index 89f2721aec0..642e041db39 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCPerFileSIPConsoleParser.java
@@ -29,17 +29,23 @@ import org.eclipse.core.runtime.IPath;
* @author vhirsl
*/
public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
- private final String INCLUDE = "#include"; //$NON-NLS-1$
- private final String DEFINE = "#define"; //$NON-NLS-1$
- private final String COMMAND_ID_BEGIN = "begin generating scanner info for scd_cmd_"; //$NON-NLS-1$
- private final String COMMAND_ID_END = "end generating scanner info for scd_cmd_"; //$NON-NLS-1$
+ private final static String INCLUDE_PREAMBLE = "#include <...>"; //$NON-NLS-1$
+ private final static String QUOTE_INCLUDE_PREAMBLE = "#include \"...\""; //$NON-NLS-1$
+ private final static String DEFINE_PREAMBLE = "#define"; //$NON-NLS-1$
+ private final static String COMMAND_ID_BEGIN = "begin generating scanner info for scd_cmd_"; //$NON-NLS-1$
+ private final static String COMMAND_ID_END = "end generating scanner info for scd_cmd_"; //$NON-NLS-1$
+ private final static int NO_INCLUDES = 0;
+ private final static int QUOTE_INCLUDES = 1;
+ private final static int INCLUDES = 2;
+
private IProject fProject = null;
private IScannerInfoCollector fCollector = null;
- private boolean expectingIncludes = false;
+ private int expectingIncludes = NO_INCLUDES;
private List symbols;
private List includes;
+ private List quoteIncludes;
private int commandId = -1;
/* (non-Javadoc)
@@ -61,19 +67,21 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
commandId = Integer.parseInt(line.substring(COMMAND_ID_BEGIN.length()));
symbols = new ArrayList();
includes = new ArrayList();
+ quoteIncludes = new ArrayList();
}
else if (line.startsWith(COMMAND_ID_END)) {
Map scannerInfo = new HashMap();
scannerInfo.put(ScannerInfoTypes.INCLUDE_PATHS, includes);
+ scannerInfo.put(ScannerInfoTypes.QUOTE_INCLUDE_PATHS, quoteIncludes);
scannerInfo.put(ScannerInfoTypes.SYMBOL_DEFINITIONS, symbols);
fCollector.contributeToScannerConfig(new Integer(commandId), scannerInfo);
commandId = -1;
rc = true;
}
// contribution of -dD option
- else if (line.startsWith(DEFINE)) {
+ else if (line.startsWith(DEFINE_PREAMBLE)) {
String[] defineParts = line.split("\\s+", 3); //$NON-NLS-1$
- if (defineParts[0].equals(DEFINE)) {
+ if (defineParts[0].equals(DEFINE_PREAMBLE)) {
String symbol = null;
switch (defineParts.length) {
case 2:
@@ -89,13 +97,20 @@ public class GCCPerFileSIPConsoleParser implements IScannerInfoConsoleParser {
}
}
// now get all the includes
- else if (line.startsWith(INCLUDE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
- expectingIncludes = true;
+ else if (line.startsWith(QUOTE_INCLUDE_PREAMBLE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
+ expectingIncludes = QUOTE_INCLUDES;
+ }
+ else if (line.startsWith(INCLUDE_PREAMBLE) && line.endsWith("search starts here:")) { //$NON-NLS-1$
+ expectingIncludes = INCLUDES;
}
else if (line.startsWith("End of search list.")) { //$NON-NLS-1$
- expectingIncludes = false;
+ expectingIncludes = NO_INCLUDES;
+ }
+ else if (expectingIncludes == QUOTE_INCLUDES) {
+ if (!quoteIncludes.contains(line))
+ quoteIncludes.add(line);
}
- else if (expectingIncludes) {
+ else if (expectingIncludes == INCLUDES) {
if (!includes.contains(line))
includes.add(line);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
index 71f4db7c2bd..2f576fa349e 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/CCommandDSC.java
@@ -33,6 +33,7 @@ public class CCommandDSC {
private final static String SI_ITEM_ELEM = "siItem"; //$NON-NLS-1$
private final static String KEY_ATTR = "key"; //$NON-NLS-1$
private final static String VALUE_ATTR = "value"; //$NON-NLS-1$
+ private final static String QUOTE_INCLUDE_ATTR = "quote"; //$NON-NLS-1$
private final static String KIND_ATTR = "kind"; //$NON-NLS-1$
private int commandId;
@@ -42,6 +43,7 @@ public class CCommandDSC {
private List symbols;
private List includes;
+ private List quoteIncludes;
/**
* @param cppFileType2
@@ -53,6 +55,7 @@ public class CCommandDSC {
symbols = new ArrayList();
includes = new ArrayList();
+ quoteIncludes = new ArrayList();
}
public boolean appliesToCPPFileType() {
@@ -176,6 +179,18 @@ public class CCommandDSC {
this.includes = includes;
}
/**
+ * @return Returns the quote include paths (for #include "...")
+ */
+ public List getQuoteIncludes() {
+ return quoteIncludes;
+ }
+ /**
+ * @param includes. Quaote include paths (for #include "...")
+ */
+ public void setQuoteIncludes(List includes) {
+ quoteIncludes = includes;
+ }
+ /**
* @return Returns the symbols.
*/
public List getSymbols() {
@@ -217,6 +232,13 @@ public class CCommandDSC {
cmdElem.appendChild(cmdDescElem);
// serialize includes and symbols
Element siElem = doc.createElement(CMD_SI_ELEM);
+ for (Iterator j = quoteIncludes.iterator(); j.hasNext(); ) {
+ Element siItem = doc.createElement(SI_ITEM_ELEM);
+ siItem.setAttribute(KIND_ATTR, "INCLUDE_PATH"); //$NON-NLS-1$
+ siItem.setAttribute(VALUE_ATTR, (String) j.next());
+ siItem.setAttribute(QUOTE_INCLUDE_ATTR, "true"); //$NON-NLS-1$
+ siElem.appendChild(siItem);
+ }
for (Iterator j = includes.iterator(); j.hasNext(); ) {
Element siItem = doc.createElement(SI_ITEM_ELEM);
siItem.setAttribute(KIND_ATTR, "INCLUDE_PATH"); //$NON-NLS-1$
@@ -258,8 +280,14 @@ public class CCommandDSC {
Element siItemElem = (Element) siItemList.item(i);
String kind = siItemElem.getAttribute(KIND_ATTR);
String value = siItemElem.getAttribute(VALUE_ATTR);
+ String quote = siItemElem.getAttribute(QUOTE_INCLUDE_ATTR);
if (kind.equals("INCLUDE_PATH")) { //$NON-NLS-1$
- includes.add(value);
+ if (quote.equals("true")) { //$NON-NLS-1$
+ quoteIncludes.add(value);
+ }
+ else {
+ includes.add(value);
+ }
}
else if (kind.equals("SYMBOL_DEFINITION")) { //$NON-NLS-1$
symbols.add(value);
@@ -268,4 +296,5 @@ public class CCommandDSC {
setDiscovered(true);
}
}
+
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SCDOptionsEnum.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SCDOptionsEnum.java
index 3d4ef44d65b..d1a3848f81f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SCDOptionsEnum.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/util/SCDOptionsEnum.java
@@ -21,8 +21,8 @@ public final class SCDOptionsEnum {
public static final int MIN = 1;
public static final SCDOptionsEnum DEFINE = new SCDOptionsEnum(1); // -D name
public static final SCDOptionsEnum UNDEFINE = new SCDOptionsEnum(2); // -U name
- public static final SCDOptionsEnum INCLUDE = new SCDOptionsEnum(3); // -I dir
- public static final SCDOptionsEnum IDASH = new SCDOptionsEnum(4); // -I-
+ public static final SCDOptionsEnum IDASH = new SCDOptionsEnum(3); // -I-
+ public static final SCDOptionsEnum INCLUDE = new SCDOptionsEnum(4); // -I dir
public static final SCDOptionsEnum NOSTDINC = new SCDOptionsEnum(5); // -nostdinc
public static final SCDOptionsEnum NOSTDINCPP = new SCDOptionsEnum(6); // -nostdinc++
public static final SCDOptionsEnum INCLUDE_FILE = new SCDOptionsEnum(7); // -include file
@@ -38,8 +38,8 @@ public final class SCDOptionsEnum {
"cc", //$NON-NLS-1$
"-D", //$NON-NLS-1$
"-U", //$NON-NLS-1$
- "-I", //$NON-NLS-1$
"-I-", //$NON-NLS-1$
+ "-I", //$NON-NLS-1$
"-nostdinc", //$NON-NLS-1$
"-nostdinc++", //$NON-NLS-1$
"-include", //$NON-NLS-1$
@@ -51,7 +51,7 @@ public final class SCDOptionsEnum {
"-iwithprefixbefore" //$NON-NLS-1$
};
private static final SCDOptionsEnum SCDOPTIONS[] = {
- COMMAND, DEFINE, UNDEFINE, INCLUDE, IDASH, NOSTDINC, NOSTDINCPP, INCLUDE_FILE, IMACROS_FILE,
+ COMMAND, DEFINE, UNDEFINE, IDASH, INCLUDE, NOSTDINC, NOSTDINCPP, INCLUDE_FILE, IMACROS_FILE,
IDIRAFTER, ISYSTEM, IPREFIX, IWITHPREFIX, IWITHPREFIXBEFORE
};
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
index 6f1a0d54b21..c4bbd1269ff 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerFileSICollector.java
@@ -26,10 +26,10 @@ import java.util.Map.Entry;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner;
-import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigScope;
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo;
import org.eclipse.cdt.make.internal.core.MakeMessages;
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore;
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
@@ -145,8 +145,6 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
private static final String FILE_ELEM = "file"; //$NON-NLS-1$
private static final String PATH_ATTR = "path"; //$NON-NLS-1$
- private static final LinkedHashMap EMPTY_LHM = new LinkedHashMap(0);
-
private IProject project;
private ScannerInfoData sid; // scanner info data
@@ -235,10 +233,13 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
private void addScannerInfo(Integer commandId, Map scannerInfo) {
CCommandDSC cmd = (CCommandDSC) sid.commandIdCommandMap.get(commandId);
if (cmd != null) {
- List symbols = (List) scannerInfo.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
- List includes = (List) scannerInfo.get(ScannerInfoTypes.INCLUDE_PATHS);
- cmd.setSymbols(symbols);
- cmd.setIncludes(CygpathTranslator.translateIncludePaths(includes));
+ List siItem = (List) scannerInfo.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
+ cmd.setSymbols(siItem);
+ siItem = (List) scannerInfo.get(ScannerInfoTypes.INCLUDE_PATHS);
+ cmd.setIncludes(CygpathTranslator.translateIncludePaths(siItem));
+ siItem = (List) scannerInfo.get(ScannerInfoTypes.QUOTE_INCLUDE_PATHS);
+ cmd.setQuoteIncludes(siItem);
+
cmd.setDiscovered(true);
}
}
@@ -438,12 +439,32 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner#deleteAll(org.eclipse.core.resources.IResource)
+ */
+ public void deleteAll(IResource resource) {
+ if (resource.equals(project)) {
+ siChangedForFileList = new ArrayList();
+ Set changedFiles = sid.fileToCommandIdMap.keySet();
+ for (Iterator i = changedFiles.iterator(); i.hasNext(); ) {
+ IFile file = (IFile) i.next();
+ IPath path = file.getFullPath();
+ siChangedForFileList.add(path);
+ }
+
+ sid = new ScannerInfoData();
+
+ freeCommandIdPool = new TreeSet();
+ siAvailable = false;
+ }
+ }
+
/**
* Per file DPI object
*
* @author vhirsl
*/
- public class PerFileDiscoveredPathInfo implements IDiscoveredPathInfo {
+ public class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo {
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getProject()
*/
@@ -516,43 +537,30 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#setIncludeMap(java.util.LinkedHashMap)
- */
- public void setIncludeMap(LinkedHashMap map) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#setSymbolMap(java.util.LinkedHashMap)
- */
- public void setSymbolMap(LinkedHashMap map) {
- // TODO Auto-generated method stub
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludeMap()
- */
- public LinkedHashMap getIncludeMap() {
- return EMPTY_LHM;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSymbolMap()
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths(org.eclipse.core.runtime.IPath)
*/
- public LinkedHashMap getSymbolMap() {
- return EMPTY_LHM;
+ public IPath[] getIncludePaths(IPath path) {
+ // get the command
+ CCommandDSC cmd = getCommand(path);
+ if (cmd != null && cmd.isDiscovered()) {
+ List includes = cmd.getIncludes();
+ List includePaths = new ArrayList(includes.size());
+ for (Iterator i = includes.iterator(); i.hasNext(); ) {
+ includePaths.add(new Path((String) i.next()));
+ }
+ return (IPath[])includePaths.toArray(new IPath[includePaths.size()]);
+ }
+ return new IPath[0];
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getIncludePaths(org.eclipse.core.runtime.IPath)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getQuoteIncludePaths(org.eclipse.core.runtime.IPath)
*/
- public IPath[] getIncludePaths(IPath path) {
+ public IPath[] getQuoteIncludePaths(IPath path) {
// get the command
CCommandDSC cmd = getCommand(path);
if (cmd != null && cmd.isDiscovered()) {
- List includes = cmd.getIncludes();
+ List includes = cmd.getQuoteIncludes();
List includePaths = new ArrayList(includes.size());
for (Iterator i = includes.iterator(); i.hasNext(); ) {
includePaths.add(new Path((String) i.next()));
@@ -595,7 +603,7 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getMacroFiles(org.eclipse.core.runtime.IPath)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getMacroFiles(org.eclipse.core.runtime.IPath)
*/
public IPath[] getMacroFiles(IPath path) {
// get the command
@@ -607,19 +615,12 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getSerializable()
+ * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo#getSerializable()
*/
public IDiscoveredScannerInfoSerializable getSerializable() {
return sid;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getScope()
- */
- public ScannerConfigScope getScope() {
- return ScannerConfigScope.FILE_SCOPE;
- }
-
/**
* @param path
* @return
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java
index f91fd21f579..29e49384b90 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/PerProjectSICollector.java
@@ -25,6 +25,7 @@ import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner;
import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
import org.eclipse.cdt.make.internal.core.MakeMessages;
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathInfo;
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore;
@@ -177,23 +178,27 @@ public class PerProjectSICollector implements IScannerInfoCollector2, IScannerIn
monitor = new NullProgressMonitor();
}
IDiscoveredPathInfo pathInfo = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(project);
- monitor.beginTask(MakeMessages.getString("ScannerInfoCollector.Processing"), 100); //$NON-NLS-1$
- if (pathInfo != null) {
- monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Processing")); //$NON-NLS-1$
- if (scannerConfigNeedsUpdate(pathInfo)) {
- monitor.worked(50);
- monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Updating") + project.getName()); //$NON-NLS-1$
- try {
- // update scanner configuration
- MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(pathInfo, null);
+ if (pathInfo instanceof IPerProjectDiscoveredPathInfo) {
+ IPerProjectDiscoveredPathInfo projectPathInfo = (IPerProjectDiscoveredPathInfo) pathInfo;
+
+ monitor.beginTask(MakeMessages.getString("ScannerInfoCollector.Processing"), 100); //$NON-NLS-1$
+ if (pathInfo != null) {
+ monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Processing")); //$NON-NLS-1$
+ if (scannerConfigNeedsUpdate(projectPathInfo)) {
monitor.worked(50);
- } catch (CoreException e) {
- MakeCorePlugin.log(e);
+ monitor.subTask(MakeMessages.getString("ScannerInfoCollector.Updating") + project.getName()); //$NON-NLS-1$
+ try {
+ // update scanner configuration
+ MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(pathInfo, null);
+ monitor.worked(50);
+ } catch (CoreException e) {
+ MakeCorePlugin.log(e);
+ }
}
}
+ monitor.done();
+ scPersisted = true;
}
- monitor.done();
- scPersisted = true;
}
/**
@@ -202,7 +207,7 @@ public class PerProjectSICollector implements IScannerInfoCollector2, IScannerIn
* @param scanInfo
* @return
*/
- private boolean scannerConfigNeedsUpdate(IDiscoveredPathInfo discPathInfo) {
+ private boolean scannerConfigNeedsUpdate(IPerProjectDiscoveredPathInfo discPathInfo) {
boolean addedIncludes = includePathsNeedUpdate(discPathInfo);
boolean addedSymbols = definedSymbolsNeedUpdate(discPathInfo);
@@ -216,7 +221,7 @@ public class PerProjectSICollector implements IScannerInfoCollector2, IScannerIn
* @param includes
* @return
*/
- private boolean includePathsNeedUpdate(IDiscoveredPathInfo discPathInfo) {
+ private boolean includePathsNeedUpdate(IPerProjectDiscoveredPathInfo discPathInfo) {
boolean addedIncludes = false;
List discoveredIncludes = (List) discoveredSI.get(ScannerInfoTypes.INCLUDE_PATHS);
if (discoveredIncludes != null) {
@@ -274,7 +279,7 @@ public class PerProjectSICollector implements IScannerInfoCollector2, IScannerIn
* @param symbols
* @return
*/
- private boolean definedSymbolsNeedUpdate(IDiscoveredPathInfo discPathInfo) {
+ private boolean definedSymbolsNeedUpdate(IPerProjectDiscoveredPathInfo discPathInfo) {
boolean addedSymbols = false;
List discoveredSymbols = (List) discoveredSI.get(ScannerInfoTypes.SYMBOL_DEFINITIONS);
if (discoveredSymbols != null) {
@@ -398,6 +403,14 @@ public class PerProjectSICollector implements IScannerInfoCollector2, IScannerIn
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner#deleteAll(org.eclipse.core.resources.IResource)
+ */
+ public void deleteAll(IResource resource) {
+ deleteAllPaths(resource);
+ deleteAllSymbols(resource);
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2#createPathInfoObject()
*/
public IDiscoveredPathInfo createPathInfoObject() {
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java
index 1d711b6917e..a8e647c4e05 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveredPathContainerPage.java
@@ -33,6 +33,7 @@ import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner;
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
+import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathContainer;
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
import org.eclipse.cdt.make.internal.core.scannerconfig.util.SymbolEntry;
@@ -159,50 +160,52 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
if (!dirty) {
return true;
}
- IDiscoveredPathInfo info;
try {
- info = MakeCorePlugin.getDefault().
+ IDiscoveredPathInfo info = MakeCorePlugin.getDefault().
getDiscoveryManager().getDiscoveredInfo(fCProject.getProject());
+ if (info instanceof IPerProjectDiscoveredPathInfo) {
+ IPerProjectDiscoveredPathInfo projetcPathInfo = (IPerProjectDiscoveredPathInfo) info;
- LinkedHashMap includes = new LinkedHashMap();
- LinkedHashMap symbols = new LinkedHashMap();
-
- DiscoveredElement container = (DiscoveredElement) fDiscoveredContainerList.getElement(0);
- if (container != null && container.getEntryKind() == DiscoveredElement.CONTAINER) {
- Object[] cChildren = container.getChildren();
- if (cChildren != null) {
- for (int i = 0; i < cChildren.length; ++i) {
- DiscoveredElement group = (DiscoveredElement) cChildren[i];
- switch (group.getEntryKind()) {
- case DiscoveredElement.PATHS_GROUP: {
- // get the include paths
- Object[] gChildren = group.getChildren();
- if (gChildren != null) {
- for (int j = 0; j < gChildren.length; ++j) {
- DiscoveredElement include = (DiscoveredElement) gChildren[j];
- includes.put(include.getEntry(), Boolean.valueOf(include.isRemoved()));
- }
- }
- }
- break;
- case DiscoveredElement.SYMBOLS_GROUP: {
- // get the symbol definitions
- Object[] gChildren = group.getChildren();
- if (gChildren != null) {
- for (int j = 0; j < gChildren.length; ++j) {
- DiscoveredElement symbol = (DiscoveredElement) gChildren[j];
- ScannerConfigUtil.scAddSymbolString2SymbolEntryMap(symbols, symbol.getEntry(), !symbol.isRemoved());
- }
- }
- }
- break;
- }
- }
- }
- }
- info.setIncludeMap(includes);
- info.setSymbolMap(symbols);
-
+ LinkedHashMap includes = new LinkedHashMap();
+ LinkedHashMap symbols = new LinkedHashMap();
+
+ DiscoveredElement container = (DiscoveredElement) fDiscoveredContainerList.getElement(0);
+ if (container != null && container.getEntryKind() == DiscoveredElement.CONTAINER) {
+ Object[] cChildren = container.getChildren();
+ if (cChildren != null) {
+ for (int i = 0; i < cChildren.length; ++i) {
+ DiscoveredElement group = (DiscoveredElement) cChildren[i];
+ switch (group.getEntryKind()) {
+ case DiscoveredElement.PATHS_GROUP: {
+ // get the include paths
+ Object[] gChildren = group.getChildren();
+ if (gChildren != null) {
+ for (int j = 0; j < gChildren.length; ++j) {
+ DiscoveredElement include = (DiscoveredElement) gChildren[j];
+ includes.put(include.getEntry(), Boolean.valueOf(include.isRemoved()));
+ }
+ }
+ }
+ break;
+ case DiscoveredElement.SYMBOLS_GROUP: {
+ // get the symbol definitions
+ Object[] gChildren = group.getChildren();
+ if (gChildren != null) {
+ for (int j = 0; j < gChildren.length; ++j) {
+ DiscoveredElement symbol = (DiscoveredElement) gChildren[j];
+ ScannerConfigUtil.scAddSymbolString2SymbolEntryMap(symbols, symbol.getEntry(), !symbol.isRemoved());
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ projetcPathInfo.setIncludeMap(includes);
+ projetcPathInfo.setSymbolMap(symbols);
+ }
+
try {
// update scanner configuration
MakeCorePlugin.getDefault().getDiscoveryManager().updateDiscoveredInfo(info, null);
@@ -249,40 +252,43 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
IDiscoveredPathInfo info;
DiscoveredElement container = null;
try {
+ container = DiscoveredElement.createNew(null, fCProject.getProject(), null,
+ DiscoveredElement.CONTAINER, false, false);
info = MakeCorePlugin.getDefault().
getDiscoveryManager().getDiscoveredInfo(fCProject.getProject());
- container = DiscoveredElement.createNew(null, fCProject.getProject(), null,
- DiscoveredElement.CONTAINER, false, false);
try {
IPathEntryContainer peContainer = CoreModel.getPathEntryContainer(pathEntry.getPath(), fCProject);
if (peContainer != null) {
container.setEntry(peContainer.getDescription());
}
- // get include paths
- LinkedHashMap paths = info.getIncludeMap();
- for (Iterator i = paths.keySet().iterator(); i.hasNext(); ) {
- String include = (String) i.next();
- Boolean removed = (Boolean) paths.get(include);
- removed = (removed == null) ? Boolean.FALSE : removed;
- DiscoveredElement.createNew(container, fCProject.getProject(), include,
- DiscoveredElement.INCLUDE_PATH, removed.booleanValue(), false);
- }
- // get defined symbols
- LinkedHashMap symbols = info.getSymbolMap();
- for (Iterator i = symbols.keySet().iterator(); i.hasNext(); ) {
- String symbol = (String) i.next();
- SymbolEntry se = (SymbolEntry) symbols.get(symbol);
- for (Iterator j = se.getActiveRaw().iterator(); j.hasNext();) {
- String value = (String) j.next();
- DiscoveredElement.createNew(container, fCProject.getProject(), value,
- DiscoveredElement.SYMBOL_DEFINITION, false, false);
- }
- for (Iterator j = se.getRemovedRaw().iterator(); j.hasNext();) {
- String value = (String) j.next();
- DiscoveredElement.createNew(container, fCProject.getProject(), value,
- DiscoveredElement.SYMBOL_DEFINITION, true, false);
- }
- }
+ if (info instanceof IPerProjectDiscoveredPathInfo) {
+ IPerProjectDiscoveredPathInfo projetcPathInfo = (IPerProjectDiscoveredPathInfo) info;
+ // get include paths
+ LinkedHashMap paths = projetcPathInfo.getIncludeMap();
+ for (Iterator i = paths.keySet().iterator(); i.hasNext(); ) {
+ String include = (String) i.next();
+ Boolean removed = (Boolean) paths.get(include);
+ removed = (removed == null) ? Boolean.FALSE : removed;
+ DiscoveredElement.createNew(container, fCProject.getProject(), include,
+ DiscoveredElement.INCLUDE_PATH, removed.booleanValue(), false);
+ }
+ // get defined symbols
+ LinkedHashMap symbols = projetcPathInfo.getSymbolMap();
+ for (Iterator i = symbols.keySet().iterator(); i.hasNext(); ) {
+ String symbol = (String) i.next();
+ SymbolEntry se = (SymbolEntry) symbols.get(symbol);
+ for (Iterator j = se.getActiveRaw().iterator(); j.hasNext();) {
+ String value = (String) j.next();
+ DiscoveredElement.createNew(container, fCProject.getProject(), value,
+ DiscoveredElement.SYMBOL_DEFINITION, false, false);
+ }
+ for (Iterator j = se.getRemovedRaw().iterator(); j.hasNext();) {
+ String value = (String) j.next();
+ DiscoveredElement.createNew(container, fCProject.getProject(), value,
+ DiscoveredElement.SYMBOL_DEFINITION, true, false);
+ }
+ }
+ }
} catch (CModelException e) {
MakeUIPlugin.log(e.getStatus());
}
@@ -569,7 +575,20 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
List selElements = fDiscoveredContainerList.getSelectedElements();
for (int i = 0; i < selElements.size(); ++i) {
DiscoveredElement elem = (DiscoveredElement) selElements.get(i);
- if (elem.getEntryKind() != DiscoveredElement.CONTAINER) {
+ if (elem.getEntryKind() == DiscoveredElement.CONTAINER) {
+ collectorUtil.deleteAll(project);
+ Object[] children = elem.getChildren();
+ for (int j = 0; j < children.length; j++) {
+ if (children[j] instanceof DiscoveredElement) {
+ DiscoveredElement child = (DiscoveredElement) children[j];
+ child.delete();
+ }
+ }
+ newSelection.add(elem);
+ rc = true;
+ break;
+ }
+ else {
DiscoveredElement parent = elem.getParent();
if (parent != null) {
Object[] children = parent.getChildren();
@@ -688,12 +707,6 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
if (selElements.size() == 0) {
return false;
}
- for (int i = 0; i < selElements.size(); i++) {
- DiscoveredElement elem = (DiscoveredElement) selElements.get(i);
- if (elem.getEntryKind() == DiscoveredElement.CONTAINER) {
- return false;
- }
- }
return true;
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveryOptionsBlock.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveryOptionsBlock.java
index 63af2db24cd..be65c13154d 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveryOptionsBlock.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/dialogs/DiscoveryOptionsBlock.java
@@ -46,7 +46,6 @@ import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.help.WorkbenchHelp;
/**
* A dialog to set scanner config discovery options.
@@ -109,7 +108,7 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
composite.setFont(font);
setControl(composite);
- WorkbenchHelp.setHelp(getControl(), IMakeHelpContextIds.SCANNER_CONFIG_DISCOVERY_OPTIONS);
+ MakeUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(getControl(), IMakeHelpContextIds.SCANNER_CONFIG_DISCOVERY_OPTIONS);
// create a composite for general scanner config discovery options
Composite scComp = ControlFactory.createComposite(composite, 1);

Back to the top