Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kucera2009-07-16 14:49:32 -0400
committerMike Kucera2009-07-16 14:49:32 -0400
commit60bf3e9bd36c5accb3d58ce3258de56389d871b3 (patch)
treea7999cb3f1228a3f3bbebd0fd94dc2537c194e0c
parente106e552683c0b005e515a0c6db6bb0be788b801 (diff)
downloadorg.eclipse.cdt-60bf3e9bd36c5accb3d58ce3258de56389d871b3.tar.gz
org.eclipse.cdt-60bf3e9bd36c5accb3d58ce3258de56389d871b3.tar.xz
org.eclipse.cdt-60bf3e9bd36c5accb3d58ce3258de56389d871b3.zip
[245708] indexer preferences not passed to remote indexerv200907221434v200907161559
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/IStandaloneScannerInfoProvider.java17
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexer.java34
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerTask.java15
3 files changed, 59 insertions, 7 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/IStandaloneScannerInfoProvider.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/IStandaloneScannerInfoProvider.java
index 0e33a448c1..7ac5697dfb 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/IStandaloneScannerInfoProvider.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/IStandaloneScannerInfoProvider.java
@@ -15,8 +15,6 @@ import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
/**
- * Returns a IScannerInfo for the given file by a path.
- *
* Similar to IScannerInfoProvider but computes the IScannerInfo
* based on a String path instead of IResource.
*
@@ -24,5 +22,20 @@ import org.eclipse.cdt.core.parser.IScannerInfoProvider;
*/
public interface IStandaloneScannerInfoProvider {
+ /**
+ * Returns an IScannerInfo for the given file path,
+ * or an empty IScannerInfo object if the file path is invalid.
+ */
IScannerInfo getScannerInformation(String path);
+
+ /**
+ * Returns an IScannerInfo when you don't necessary have access to a path.
+ *
+ * This is used by the "parse up front" feature. Since we are parsing
+ * files outside of the project a "default" IScannerInfo object
+ * is needed to get the minimal amount of available info in order
+ * to parse the file.
+ * @param linkageID
+ */
+ IScannerInfo getDefaultScannerInformation(int linkageID);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexer.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexer.java
index 21c3e937b9..dc0f3a16cc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexer.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexer.java
@@ -25,6 +25,7 @@ import org.eclipse.cdt.core.parser.IParserLogService;
import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.internal.core.index.IWritableIndex;
import org.eclipse.cdt.internal.core.pdom.IndexerProgress;
+import org.eclipse.cdt.internal.core.pdom.PDOMWriter;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -47,17 +48,17 @@ public abstract class StandaloneIndexer {
/**
* Parser should not skip any references.
*/
- public static final int SKIP_NO_REFERENCES= 0;
+ public static final int SKIP_NO_REFERENCES = PDOMWriter.SKIP_NO_REFERENCES;
/**
* Parser to skip all references.
*/
- public static final int SKIP_ALL_REFERENCES= 1;
+ public static final int SKIP_ALL_REFERENCES = PDOMWriter.SKIP_ALL_REFERENCES;
/**
- * Parser to skp type references.
+ * Parser to skip type references.
*/
- public static final int SKIP_TYPE_REFERENCES= 2;
+ public static final int SKIP_TYPE_REFERENCES = PDOMWriter.SKIP_TYPE_REFERENCES;
/**
* Constant for indicating to update all translation units.
@@ -98,6 +99,7 @@ public abstract class StandaloneIndexer {
* be provided, but not both. If a single IScannerInfo object is provided
* it will always be used. Otherwise the provider will be used.
*/
+ @Deprecated
protected IScannerInfo fScanner;
/**
@@ -158,6 +160,10 @@ public abstract class StandaloneIndexer {
}
};
+ /**
+ * @deprecated Its better to provide a scanner info provider instead.
+ */
+ @Deprecated
public StandaloneIndexer(IWritableIndex index, boolean indexAllFiles,
ILanguageMapper mapper, IParserLogService log, IScannerInfo scanner) {
fIndex = index;
@@ -202,6 +208,13 @@ public abstract class StandaloneIndexer {
}
/**
+ * If true then all files will be indexed.
+ */
+ public void setIndexAllFiles(boolean indexAllFiles) {
+ fIndexAllFiles = indexAllFiles;
+ }
+
+ /**
* Returns the collection of valid file extensions for C/C++ source.
*/
public Set<String> getValidSourceUnitNames() {
@@ -217,7 +230,10 @@ public abstract class StandaloneIndexer {
/**
* Returns the IScannerInfo that provides include paths and defined symbols.
+ * @deprecated Should probably be using a IStandaloneScannerInfoProvider instead and
+ * calling getScannerInfo(String).
*/
+ @Deprecated
public IScannerInfo getScannerInfo() {
return fScanner;
}
@@ -235,7 +251,14 @@ public abstract class StandaloneIndexer {
return fScannerInfoProvider.getScannerInformation(path);
}
-
+
+
+ /**
+ * Returns the IStandaloneScannerInfoProvider or null if one was not provided.
+ */
+ public IStandaloneScannerInfoProvider getScannerInfoProvider() {
+ return fScannerInfoProvider;
+ }
/**
* Returns the ILanguageMapper that determines the ILanguage for a file.
@@ -355,6 +378,7 @@ public abstract class StandaloneIndexer {
clearIndex();
fDelegate= createTask(getFilesAdded(tus), NO_TUS, NO_TUS);
fDelegate.setUpdateFlags(fUpdateOptions);
+ fDelegate.setParseUpFront();
if (fDelegate != null) {
fDelegate.run(monitor);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerTask.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerTask.java
index f5dab80fbb..b7f302371d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerTask.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/indexer/StandaloneIndexerTask.java
@@ -21,6 +21,7 @@ import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.model.AbstractLanguage;
import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.parser.IParserLogService;
+import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.internal.core.index.IWritableIndex;
import org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask;
import org.eclipse.cdt.internal.core.pdom.IndexerProgress;
@@ -224,6 +225,20 @@ public abstract class StandaloneIndexerTask extends AbstractIndexerTask {
getLogService().traceLog(s.getMessage());
}
+ @SuppressWarnings("deprecation")
+ @Override
+ protected IScannerInfo createDefaultScannerConfig(int linkageID) {
+ IStandaloneScannerInfoProvider provider = fIndexer.getScannerInfoProvider();
+ if(provider != null)
+ return provider.getDefaultScannerInformation(linkageID);
+
+ IScannerInfo scannerInfo = fIndexer.getScannerInfo();
+ if(scannerInfo != null)
+ return scannerInfo;
+
+ return super.createDefaultScannerConfig(linkageID);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.pdom.AbstractIndexerTask#getLinkagesToParse()
*/

Back to the top