Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdan Gheorghe2004-05-28 18:07:10 -0400
committerBogdan Gheorghe2004-05-28 18:07:10 -0400
commit7fa8a0305ef39d11f5984b386546fd1a601b7a4b (patch)
tree303957c679233b8abcb43943de823d1e573978af
parente37b85c532f7e94988c39c4ef8277b5f878f9dad (diff)
downloadorg.eclipse.cdt-7fa8a0305ef39d11f5984b386546fd1a601b7a4b.tar.gz
org.eclipse.cdt-7fa8a0305ef39d11f5984b386546fd1a601b7a4b.tar.xz
org.eclipse.cdt-7fa8a0305ef39d11f5984b386546fd1a601b7a4b.zip
Fix for Bug 63831 - Ability to determine when the index is incomplete
Provided a way for external clients to query the index state of a project
-rw-r--r--core/org.eclipse.cdt.core/index/ChangeLog4
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/core/index/Indexer.java70
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexManager.java2
3 files changed, 75 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core/index/ChangeLog b/core/org.eclipse.cdt.core/index/ChangeLog
index 1ad4803d0e..3a683b3b55 100644
--- a/core/org.eclipse.cdt.core/index/ChangeLog
+++ b/core/org.eclipse.cdt.core/index/ChangeLog
@@ -1,4 +1,8 @@
2004-05-28 Bogdan Gheorghe
+ Fix for Bug 63831 - Ability to determine when the index is incomplete
+ Provided a way for external clients to query the index state of a project
+
+2004-05-28 Bogdan Gheorghe
Fix for Bug 60946 - [Indexer] indexer should provide notification whenever index changes
Provide a notification to the listener of index events
diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/core/index/Indexer.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/core/index/Indexer.java
new file mode 100644
index 0000000000..624567a722
--- /dev/null
+++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/core/index/Indexer.java
@@ -0,0 +1,70 @@
+/*
+ * Created on May 28, 2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.eclipse.cdt.core.index;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * @author bgheorgh
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class Indexer {
+ private static Indexer indexer = null;
+ private static IndexManager manager= CCorePlugin.getDefault().getCoreModel().getIndexManager();
+
+ public static boolean indexEnabledOnAllProjects(){
+ IProject[] projects= CCorePlugin.getWorkspace().getRoot().getProjects();
+ boolean allEnabled = true;
+ for (int i=0; i<projects.length; i++){
+ if (!indexEnabledOnProject(projects[i])){
+ allEnabled=false;
+ break;
+ }
+ }
+
+ return allEnabled;
+ }
+
+ public static boolean indexEnabledOnAnyProjects(){
+ IProject[] projects= CCorePlugin.getWorkspace().getRoot().getProjects();
+ boolean allEnabled = false;
+ for (int i=0; i<projects.length; i++){
+ if (indexEnabledOnProject(projects[i])){
+ allEnabled=true;
+ break;
+ }
+ }
+
+ return allEnabled;
+ }
+
+ public static boolean indexEnabledOnProject(IProject project){
+ boolean allEnabled = true;
+
+ try {
+ Boolean indexValue = (Boolean) project.getSessionProperty(IndexManager.activationKey);
+ if (indexValue != null){
+ if(!indexValue.booleanValue()){
+ allEnabled = false;
+ }
+ }
+ else {
+ if (!manager.isIndexEnabled(project)){
+ allEnabled=false;
+ }
+ }
+
+ } catch (CoreException e) {}
+
+ return allEnabled;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexManager.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexManager.java
index 18fe7a6957..f96f2a8bf1 100644
--- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexManager.java
+++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexManager.java
@@ -320,7 +320,7 @@ public class IndexManager extends JobManager implements IIndexConstants {
* @param project
* @return
*/
- private boolean isIndexEnabled(IProject project) {
+ public boolean isIndexEnabled(IProject project) {
Boolean indexValue = null;
try {

Back to the top