mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
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
This commit is contained in:
parent
e37b85c532
commit
7fa8a0305e
3 changed files with 75 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
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
|
2004-05-28 Bogdan Gheorghe
|
||||||
Fix for Bug 60946 - [Indexer] indexer should provide notification whenever index changes
|
Fix for Bug 60946 - [Indexer] indexer should provide notification whenever index changes
|
||||||
Provide a notification to the listener of index events
|
Provide a notification to the listener of index events
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -320,7 +320,7 @@ public class IndexManager extends JobManager implements IIndexConstants {
|
||||||
* @param project
|
* @param project
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean isIndexEnabled(IProject project) {
|
public boolean isIndexEnabled(IProject project) {
|
||||||
Boolean indexValue = null;
|
Boolean indexValue = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Reference in a new issue