[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Applied: [cdt-patch] Indexer patch
|
Here we go on what should prove to be a very interesting journey indeed...
Doug Schaefer, Senior Software Developer
IBM Rational Software, Ottawa, Ontario, Canada
Bogdan Gheorghe/Ottawa/IBM@IBMCA
Sent by: cdt-patch-admin@xxxxxxxxxxx
06/25/2003 05:04 PM
Please respond to
cdt-patch@xxxxxxxxxxx
To
cdt-patch@xxxxxxxxxxx
cc
Subject
[cdt-patch] Indexer patch
Here's the initial framework for the new indexer. I've added a checkbox to
the Indexer tab on the C/C++ Projects settings dialog to turn on the
indexing on a per project basis. Seeing how the parser really isn't hooked
up to the indexer yet, there's not much to index at this point, but stay
tuned!
Bogdan
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.105
diff -u -r1.105 ChangeLog
--- ChangeLog 24 Jun 2003 19:59:19 -0000 1.105
+++ ChangeLog 25 Jun 2003 21:02:15 -0000
@@ -1,3 +1,14 @@
+2003-06-25 Bogdan Gheorghe
+
+ * src/org/eclipse/cdt/core/CCorePlugin.java
+ Start the new indexer thread on startup
+ * src/org/eclipse/cdt/core/model/CoreModel.java
+ Added some methods to access the IndexManager
+ * src/org/eclipse/cdt/internal/core/model/CModelManager.java
+ Added some methods to access the IndexManager
+ * src/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
+ Added IndexManager member
+
2003-06-24 Alain Magloire
Patch form ando@xxxxxxxxxxxxxxx, to deal
Index: index/ChangeLog
===================================================================
RCS file: index/ChangeLog
diff -N index/ChangeLog
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/ChangeLog 25 Jun 2003 21:02:15 -0000
@@ -0,0 +1,60 @@
+2003-06-25 Bogdan Gheorghe
+
+ Added new Indexer framework:
+
+ * index/org/eclipse/cdt/internal/core/index/IDocument.java
+ * index/org/eclipse/cdt/internal/core/index/IEntryResult.java
+ * index/org/eclipse/cdt/internal/core/index/IIndex.java
+ * index/org/eclipse/cdt/internal/core/index/IIndexer.java
+ * index/org/eclipse/cdt/internal/core/index/IIndexerOutput.java
+ * index/org/eclipse/cdt/internal/core/index/IQueryResult.java
+
+ * index/org/eclipse/cdt/internal/core/index/impl/Block.java
+ * index/org/eclipse/cdt/internal/core/index/impl/BlocksIndexInput.java
+ * index/org/eclipse/cdt/internal/core/index/impl/BlocksIndexOutput.java
+ * index/org/eclipse/cdt/internal/core/index/impl/CodeByteStream.java
+ * index/org/eclipse/cdt/internal/core/index/impl/EntryResult.java
+ * index/org/eclipse/cdt/internal/core/index/impl/Field.java
+ * index/org/eclipse/cdt/internal/core/index/impl/GammaCompressedIndexBlock.java
+ * index/org/eclipse/cdt/internal/core/index/impl/IFileDocument.java
+ * index/org/eclipse/cdt/internal/core/index/impl/IIndexConstants.java
+ * index/org/eclipse/cdt/internal/core/index/impl/Index.java
+ * index/org/eclipse/cdt/internal/core/index/impl/IndexBlock.java
+ * index/org/eclipse/cdt/internal/core/index/impl/IndexedFile.java
+ * index/org/eclipse/cdt/internal/core/index/impl/IndexedFileHashedArray.java
+ * index/org/eclipse/cdt/internal/core/index/impl/IndexerOutput.java
+ * index/org/eclipse/cdt/internal/core/index/impl/IndexInput.java
+ * index/org/eclipse/cdt/internal/core/index/impl/IndexOutput.java
+ * index/org/eclipse/cdt/internal/core/index/impl/IndexSummary.java
+ * index/org/eclipse/cdt/internal/core/index/impl/InMemoryIndex.java
+ * index/org/eclipse/cdt/internal/core/index/impl/Int.java
+ * index/org/eclipse/cdt/internal/core/index/impl/MergeFactory.java
+ * index/org/eclipse/cdt/internal/core/index/impl/PropertyDocument.java
+ * index/org/eclipse/cdt/internal/core/index/impl/SafeRandomAccessFile.java
+ * index/org/eclipse/cdt/internal/core/index/impl/SimpleIndexInput.java
+ * index/org/eclipse/cdt/internal/core/index/impl/Util.java
+ * index/org/eclipse/cdt/internal/core/index/impl/WordEntry.java
+ * index/org/eclipse/cdt/internal/core/index/impl/WordEntryHashedArray.java
+
+ * index/org/eclipse/cdt/internal/core/search/CharOperation.java
+ * index/org/eclipse/cdt/internal/core/search/HashtableOfInt.java
+ * index/org/eclipse/cdt/internal/core/search/SimpleLookupTable.java
+ * index/org/eclipse/cdt/internal/core/search/Util.java
+ * index/org/eclipse/cdt/internal/core/search/message.properties
+
+ * index/org/eclipse/cdt/internal/core/search/indexing/AbstractIndexer.java
+ * index/org/eclipse/cdt/internal/core/search/indexing/AddCompilationUnitToIndex.java
+ * index/org/eclipse/cdt/internal/core/search/indexing/AddFileToIndex.java
+ * index/org/eclipse/cdt/internal/core/search/indexing/AddFolderToIndex.java
+ * index/org/eclipse/cdt/internal/core/search/indexing/IIndexConstants.java
+ * index/org/eclipse/cdt/internal/core/search/indexing/IndexAllProject.java
+ * index/org/eclipse/cdt/internal/core/search/indexing/IndexManager.java
+ * index/org/eclipse/cdt/internal/core/search/indexing/IndexRequest.java
+ * index/org/eclipse/cdt/internal/core/search/indexing/ReadWriteMonitor.java
+ * index/org/eclipse/cdt/internal/core/search/indexing/RemoveFolderFromIndex.java
+ * index/org/eclipse/cdt/internal/core/search/indexing/RemoveFromIndex.java
+ * index/org/eclipse/cdt/internal/core/search/indexing/SaveIndex.java
+ * index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java
+ * index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexerRequestor.java
+
+
\ No newline at end of file
Index: index/org/eclipse/cdt/internal/core/index/IDocument.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/IDocument.java
diff -N index/org/eclipse/cdt/internal/core/index/IDocument.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/IDocument.java 25 Jun 2003 21:02:15 -0000
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ ******************************************************************************/
+/*
+ * Created on May 30, 2003
+ */
+package org.eclipse.cdt.internal.core.index;
+
+import java.io.IOException;
+
+/**
+ * An <code>IDocument</code> represent a data source, e.g. a <code>File</code> (<code>FileDocument</code>),
+ * an <code>IFile</code> (<code>IFileDocument</code>),
+ * or other kinds of data sources (URL, ...). An <code>IIndexer</code> indexes an<code>IDocument</code>.
+ */
+
+public interface IDocument {
+ /**
+ * Returns the content of the document, in a byte array.
+ */
+ byte[] getByteContent() throws IOException;
+ /**
+ * Returns the content of the document, in a char array.
+ */
+ char[] getCharContent() throws IOException;
+ /**
+ * Returns the encoding for this document
+ */
+ String getEncoding();
+ /**
+ * returns the name of the document (e.g. its path for a <code>File</code>, or its relative path
+ * in the workbench for an <code>IFile</code>).
+ */
+ String getName();
+ /**
+ * Returns the content of the document, as a String.
+ */
+ public String getStringContent() throws IOException;
+ /**
+ * Returns the type of the document.
+ */
+ String getType();
+}
Index: index/org/eclipse/cdt/internal/core/index/IEntryResult.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/IEntryResult.java
diff -N index/org/eclipse/cdt/internal/core/index/IEntryResult.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/IEntryResult.java 25 Jun 2003 21:02:15 -0000
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ ******************************************************************************/
+/*
+ * Created on May 30, 2003
+ */
+package org.eclipse.cdt.internal.core.index;
+
+public interface IEntryResult {
+ public int[] getFileReferences();
+ public char[] getWord();
+}
+
Index: index/org/eclipse/cdt/internal/core/index/IIndex.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/IIndex.java
diff -N index/org/eclipse/cdt/internal/core/index/IIndex.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/IIndex.java 25 Jun 2003 21:02:15 -0000
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ ******************************************************************************/
+/*
+ * Created on May 30, 2003
+ */
+package org.eclipse.cdt.internal.core.index;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * An IIndex is the interface used to generate an index file, and to make queries on
+ * this index.
+ */
+
+public interface IIndex {
+ /**
+ * Adds the given document to the index.
+ */
+ void add(IDocument document, IIndexer indexer) throws IOException;
+ /**
+ * Empties the index.
+ */
+ void empty() throws IOException;
+ /**
+ * Returns the index file on the disk.
+ */
+ File getIndexFile();
+ /**
+ * Returns the number of documents indexed.
+ */
+ int getNumDocuments() throws IOException;
+ /**
+ * Returns the number of unique words indexed.
+ */
+ int getNumWords() throws IOException;
+ /**
+ * Returns the path corresponding to a given document number
+ */
+ String getPath(int documentNumber) throws IOException;
+ /**
+ * Ansers true if has some changes to save.
+ */
+ boolean hasChanged();
+ /**
+ * Returns the paths of the documents containing the given word.
+ */
+ IQueryResult[] query(String word) throws IOException;
+ /**
+ * Returns all entries for a given word.
+ */
+ IEntryResult[] queryEntries(char[] pattern) throws IOException;
+ /**
+ * Returns the paths of the documents whose names contain the given word.
+ */
+ IQueryResult[] queryInDocumentNames(String word) throws IOException;
+ /**
+ * Returns the paths of the documents containing the given word prefix.
+ */
+ IQueryResult[] queryPrefix(char[] prefix) throws IOException;
+ /**
+ * Removes the corresponding document from the index.
+ */
+ void remove(String documentName) throws IOException;
+ /**
+ * Saves the index on the disk.
+ */
+ void save() throws IOException;
+
+}
Index: index/org/eclipse/cdt/internal/core/index/IIndexer.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/IIndexer.java
diff -N index/org/eclipse/cdt/internal/core/index/IIndexer.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/IIndexer.java 25 Jun 2003 21:02:15 -0000
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ ******************************************************************************/
+/*
+ * Created on May 30, 2003
+ */
+package org.eclipse.cdt.internal.core.index;
+
+/**
+ * An <code>IIndexer</code> indexes ONE document at each time. It adds the document names and
+ * the words references to an IIndex. Each IIndexer can index certain types of document, and should
+ * not index the other files.
+ */
+public interface IIndexer {
+ /**
+ * Returns the file types the <code>IIndexer</code> handles.
+ */
+
+ String[] getFileTypes();
+ /**
+ * Indexes the given document, adding the document name and the word references
+ * to this document to the given <code>IIndex</code>.The caller should use
+ * <code>shouldIndex()</code> first to determine whether this indexer handles
+ * the given type of file, and only call this method if so.
+ */
+
+ void index(IDocument document, IIndexerOutput output) throws java.io.IOException;
+ /**
+ * Sets the document types the <code>IIndexer</code> handles.
+ */
+
+ public void setFileTypes(String[] fileTypes);
+ /**
+ * Returns whether the <code>IIndexer</code> can index the given document or not.
+ */
+
+ public boolean shouldIndex(IDocument document);
+}
Index: index/org/eclipse/cdt/internal/core/index/IIndexerOutput.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/IIndexerOutput.java
diff -N index/org/eclipse/cdt/internal/core/index/IIndexerOutput.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/IIndexerOutput.java 25 Jun 2003 21:02:15 -0000
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ ******************************************************************************/
+/*
+ * Created on May 30, 2003
+ */
+package org.eclipse.cdt.internal.core.index;
+
+/**
+ * This class represents the output from an indexer to an index
+ * for a single document.
+ */
+
+public interface IIndexerOutput {
+ public void addDocument(IDocument document);
+ public void addRef(char[] word);
+ public void addRef(String word);
+}
Index: index/org/eclipse/cdt/internal/core/index/IQueryResult.java
===================================================================
RCS file: index/org/eclipse/cdt/internal/core/index/IQueryResult.java
diff -N index/org/eclipse/cdt/internal/core/index/IQueryResult.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ index/org/eclipse/cdt/internal/core/index/IQueryResult.java 25 Jun 2003 21:02:15 -0000
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ ******************************************************************************/
+/*
+ * Created on May 30, 2003
+ */
+package org.eclipse.cdt.internal.core.index;
+
+public interface IQueryResult {
+ String getPath();
+}
Index: model/org/eclipse/cdt/core/model/CoreModel.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/CoreModel.java,v
retrieving revision 1.12
diff -u -r1.12 CoreModel.java
--- model/org/eclipse/cdt/core/model/CoreModel.java 27 May 2003 21:33:04 -0000 1.12
+++ model/org/eclipse/cdt/core/model/CoreModel.java 25 Jun 2003 21:02:15 -0000
@@ -8,6 +8,7 @@
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.internal.core.model.BatchOperation;
import org.eclipse.cdt.internal.core.model.CModelManager;
+import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -215,4 +216,14 @@
workspace.run(new BatchOperation(action), monitor);
}
}
+
+ public void startIndexing()
+ {
+ manager.getIndexManager().reset();
+ }
+
+ public IndexManager getIndexManager(){
+ return manager.getIndexManager();
+ }
+
}
Index: model/org/eclipse/cdt/internal/core/model/CModelManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java,v
retrieving revision 1.26
diff -u -r1.26 CModelManager.java
--- model/org/eclipse/cdt/internal/core/model/CModelManager.java 19 Jun 2003 17:51:36 -0000 1.26
+++ model/org/eclipse/cdt/internal/core/model/CModelManager.java 25 Jun 2003 21:02:16 -0000
@@ -41,6 +41,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
public class CModelManager implements IResourceChangeListener {
@@ -753,6 +754,10 @@
runners[i].interrupt();
}
}
+ }
+
+ public IndexManager getIndexManager() {
+ return this.fDeltaProcessor.indexManager;
}
}
Index: model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java,v
retrieving revision 1.9
diff -u -r1.9 DeltaProcessor.java
--- model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java 29 Apr 2003 17:27:58 -0000 1.9
+++ model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java 25 Jun 2003 21:02:16 -0000
@@ -19,6 +19,8 @@
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
+
/**
* This class is used by <code>CModelManager</code> to convert
* <code>IResourceDelta</code>s into <code>ICElementDelta</code>s.
@@ -31,6 +33,8 @@
* The <code>CElementDelta</code> corresponding to the <code>IResourceDelta</code> being translated.
*/
protected CElementDelta fCurrentDelta;
+
+ protected IndexManager indexManager = new IndexManager();
/* The C element that was last created (see createElement(IResource).
* This is used as a stack of C elements (using getParent() to pop it, and
@@ -333,6 +337,7 @@
// get the workspace delta, and start processing there.
IResourceDelta[] deltas = changes.getAffectedChildren();
ICElementDelta[] translatedDeltas = new CElementDelta[deltas.length];
+ System.out.println("delta.length: " + deltas.length);
for (int i = 0; i < deltas.length; i++) {
IResourceDelta delta = deltas[i];
fCurrentDelta = new CElementDelta(root);
@@ -446,9 +451,37 @@
protected void updateIndexAddResource(ICElement element, IResourceDelta delta) {
//CModelManager.getDefault().getIndexManager().addResource(delta.getResource());
+
+ if (indexManager == null)
+ return;
+
+ switch (element.getElementType()) {
+ case ICElement.C_PROJECT :
+ this.indexManager.indexAll(element.getCProject().getProject());
+ break;
+ }
+
}
protected void updateIndexRemoveResource(ICElement element, IResourceDelta delta) {
//CModelManager.getDefault().getIndexManager().removeResource(delta.getResource());
+
+ /*
+ if (indexManager == null)
+ return;
+
+ switch (element.getElementType()) {
+ case ICElement.C_PROJECT :
+ this.indexManager.removeIndexFamily(element.getCProject().getProject().getFullPath());
+ // NB: Discarding index jobs belonging to this project was done during PRE_DELETE
+ break;
+ // NB: Update of index if project is opened, closed, or its java nature is added or removed
+ // is done in updateCurrentDeltaAndIndex
+
+ }
+ */
+ }
+
+
}
-}
+
Index: search/ChangeLog
===================================================================
RCS file: search/ChangeLog
diff -N search/ChangeLog
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ search/ChangeLog 25 Jun 2003 21:02:16 -0000
@@ -0,0 +1,10 @@
+2003-06-25 Bogdan Gheorghe
+
+Modified:
+
+ * search/org/eclipse/cdt/core/search/ICSearchConstants.java
+ * search/org/eclipse/cdt/internal/core/search/Utils.java
+ - moved to index/org/eclipse/cdt/internal/core/search/Utils.java
+ * search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java
+ * search/org/eclipse/cdt/internal/core/search/processing/IJob.java
+ * search/org/eclipse/cdt/internal/core/search/processing/JobManager.java
\ No newline at end of file
Index: search/org/eclipse/cdt/core/search/ICSearchConstants.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchConstants.java,v
retrieving revision 1.1
diff -u -r1.1 ICSearchConstants.java
--- search/org/eclipse/cdt/core/search/ICSearchConstants.java 16 Jun 2003 17:35:46 -0000 1.1
+++ search/org/eclipse/cdt/core/search/ICSearchConstants.java 25 Jun 2003 21:02:16 -0000
@@ -9,15 +9,24 @@
* IBM Corp. - Rational Software - initial implementation
******************************************************************************/
/*
- * Created on Jun 11, 2003
+ * Created on May 31, 2003
*/
package org.eclipse.cdt.core.search;
/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
+ * @author bgheorgh
+ */
+import org.eclipse.cdt.internal.core.search.processing.*;
+
+
+/**
+ * <p>
+ * This interface defines the constants used by the search engine.
+ * </p>
+ * <p>
+ * This interface declares constants only; it is not intended to be implemented.
+ * </p>
+ * @see org.eclipse.cdt.core.search.SearchEngine
*/
public interface ICSearchConstants {
/**
@@ -34,37 +43,56 @@
int TYPE= 0;
/**
- * The searched element is a method.
+ * The searched element is a function.
*/
- int METHOD= 1;
+ int FUNCTION= 1;
/**
- * The searched element is a package.
- */
- //int PACKAGE= 2;
-
+ * The searched element is a namespace.
+ */
+ int NAMESPACE= 2;
+
/**
* The searched element is a constructor.
*/
- int CONSTRUCTOR= 2;
+ int CONSTRUCTOR= 3;
/**
- * The searched element is a field.
+ * The searched element is a member.
+ */
+ int MEMBER= 4;
+
+ /**
+ * The searched element is a variable.
+ * More selective than using TYPE
*/
- int FIELD= 3;
+ int VAR= 5;
/**
* The searched element is a class.
* More selective than using TYPE
*/
- int CLASS= 4;
+ int CLASS= 6;
/**
- * The searched element is an interface.
+ * The searched element is a struct.
* More selective than using TYPE
*/
- int INTERFACE= 5;
+ int STRUCT= 7;
+ /**
+ * The searched element is a enum.
+ * More selective than using TYPE
+ */
+ int ENUM= 8;
+
+ /**
+ * The searched element is a union.
+ * More selective than using TYPE
+ */
+ int UNION= 9;
+
+
/* Nature of match */
/**
@@ -81,7 +109,7 @@
* rather exclusively search for classes implementing an interface, or interfaces
* extending an interface.
*/
- int IMPLEMENTORS= 1;
+ int DEFINITIONS= 1;
/**
* The search result is a reference.
@@ -100,23 +128,6 @@
*/
int ALL_OCCURRENCES= 3;
- /**
- * When searching for field matches, it will exclusively find read accesses, as
- * opposed to write accesses. Note that some expressions are considered both
- * as field read/write accesses: for example, x++; x+= 1;
- *
- * @since 2.0
- */
- int READ_ACCESSES = 4;
-
- /**
- * When searching for field matches, it will exclusively find write accesses, as
- * opposed to read accesses. Note that some expressions are considered both
- * as field read/write accesses: for example, x++; x+= 1;
- *
- * @since 2.0
- */
- int WRITE_ACCESSES = 5;
/* Syntactic match modes */
@@ -156,17 +167,17 @@
* has not finished indexing the workspace. Results will more likely
* not contain all the matches.
*/
- //int FORCE_IMMEDIATE_SEARCH = IJob.ForceImmediate;
+ int FORCE_IMMEDIATE_SEARCH = IJob.ForceImmediate;
/**
* The search operation throws an <code>org.eclipse.core.runtime.OperationCanceledException</code>
* if the underlying indexer has not finished indexing the workspace.
*/
- //int CANCEL_IF_NOT_READY_TO_SEARCH = IJob.CancelIfNotReady;
+ int CANCEL_IF_NOT_READY_TO_SEARCH = IJob.CancelIfNotReady;
/**
* The search operation waits for the underlying indexer to finish indexing
* the workspace before starting the search.
*/
- //int WAIT_UNTIL_READY_TO_SEARCH = IJob.WaitUntilReady;
-
+ int WAIT_UNTIL_READY_TO_SEARCH = IJob.WaitUntilReady;
+
}
Index: search/org/eclipse/cdt/internal/core/search/Util.java
===================================================================
RCS file: search/org/eclipse/cdt/internal/core/search/Util.java
diff -N search/org/eclipse/cdt/internal/core/search/Util.java
--- search/org/eclipse/cdt/internal/core/search/Util.java 16 Jun 2003 17:35:46 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Corp. - Rational Software - initial implementation
- ******************************************************************************/
-/*
- * Created on Jun 13, 2003
- */
-package org.eclipse.cdt.internal.core.search;
-
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class Util {
-
- /**
- *
- */
- public Util() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param string
- * @return
- */
- public static String bind(String string) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
Index: search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java,v
retrieving revision 1.1
diff -u -r1.1 CSearchPattern.java
--- search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java 16 Jun 2003 17:35:46 -0000 1.1
+++ search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java 25 Jun 2003 21:02:16 -0000
@@ -52,15 +52,15 @@
case ICSearchConstants.TYPE:
pattern = createTypePattern( patternString, limitTo, matchMode, caseSensitive );
break;
- case ICSearchConstants.METHOD:
- pattern = createMethodPattern( patternString, limitTo, matchMode, caseSensitive );
- break;
+ //case ICSearchConstants.METHOD:
+ // pattern = createMethodPattern( patternString, limitTo, matchMode, caseSensitive );
+ // break;
case ICSearchConstants.CONSTRUCTOR:
pattern = createConstructorPattern( patternString, limitTo, matchMode, caseSensitive );
break;
- case ICSearchConstants.FIELD:
- pattern = createFieldPattern( patternString, limitTo, matchMode, caseSensitive );
- break;
+ //case ICSearchConstants.FIELD:
+ // pattern = createFieldPattern( patternString, limitTo, matchMode, caseSensitive );
+ // break;
}
return pattern;
Index: search/org/eclipse/cdt/internal/core/search/processing/IJob.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/processing/IJob.java,v
retrieving revision 1.1
diff -u -r1.1 IJob.java
--- search/org/eclipse/cdt/internal/core/search/processing/IJob.java 16 Jun 2003 17:35:46 -0000 1.1
+++ search/org/eclipse/cdt/internal/core/search/processing/IJob.java 25 Jun 2003 21:02:16 -0000
@@ -9,19 +9,17 @@
* IBM Corp. - Rational Software - initial implementation
******************************************************************************/
/*
- * Created on Jun 13, 2003
+ * Created on May 30, 2003
*/
package org.eclipse.cdt.internal.core.search.processing;
-import org.eclipse.core.runtime.IProgressMonitor;
-
/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
+ * @author bgheorgh
*/
+import org.eclipse.core.runtime.IProgressMonitor;
+
public interface IJob {
+
/* Waiting policies */
int ForceImmediate = 1;
int CancelIfNotReady = 2;
@@ -32,7 +30,7 @@
boolean COMPLETE = true;
/**
- * Answer true if the job belongs to a given family (tag)
+ * True if job belongs to the passed in jobFamily
*/
public boolean belongsTo(String jobFamily);
/**
@@ -48,4 +46,5 @@
* Answer whether the job is ready to run.
*/
public boolean isReadyToRun();
+
}
Index: search/org/eclipse/cdt/internal/core/search/processing/JobManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/processing/JobManager.java,v
retrieving revision 1.1
diff -u -r1.1 JobManager.java
--- search/org/eclipse/cdt/internal/core/search/processing/JobManager.java 16 Jun 2003 17:35:46 -0000 1.1
+++ search/org/eclipse/cdt/internal/core/search/processing/JobManager.java 25 Jun 2003 21:02:16 -0000
@@ -9,32 +9,426 @@
* IBM Corp. - Rational Software - initial implementation
******************************************************************************/
/*
- * Created on Jun 13, 2003
+ * Created on May 30, 2003
*/
package org.eclipse.cdt.internal.core.search.processing;
-/**
- * @author aniefer
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-public class JobManager implements Runnable {
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.cdt.internal.core.search.Util;
+
+public abstract class JobManager implements Runnable {
+
+ /* queue of jobs to execute */
+ protected IJob[] awaitingJobs = new IJob[10];
+ protected int jobStart = 0;
+ protected int jobEnd = -1;
+ protected boolean executing = false;
+
+ /* background processing */
+ protected Thread thread;
+
+ /* flag indicating whether job execution is enabled or not */
+ private boolean enabled = true;
+
+ public static boolean VERBOSE = false;
+ /* flag indicating that the activation has completed */
+ public boolean activated = false;
+
+ private int awaitingClients = 0;
+
+ public static void verbose(String log) {
+ System.out.println("(" + Thread.currentThread() + ") " + log); //$NON-NLS-1$//$NON-NLS-2$
+ }
/**
- *
+ * Invoked exactly once, in background, before starting processing any job
*/
- public JobManager() {
- super();
- // TODO Auto-generated constructor stub
+ public void activateProcessing() {
+ this.activated = true;
}
+ /**
+ * Answer the amount of awaiting jobs.
+ */
+ public synchronized int awaitingJobsCount() {
+
+ // pretend busy in case concurrent job attempts performing before activated
+ if (!activated)
+ return 1;
- /* (non-Javadoc)
- * @see java.lang.Runnable#run()
+ return jobEnd - jobStart + 1;
+
+ }
+ /**
+ * Answers the first job in the queue, or null if there is no job available
+ * Until the job has completed, the job manager will keep answering the same job.
+ */
+ public synchronized IJob currentJob() {
+
+ if (!enabled)
+ return null;
+
+ if (jobStart <= jobEnd) {
+ return awaitingJobs[jobStart];
+ }
+ return null;
+ }
+
+ public synchronized void disable() {
+ enabled = false;
+ if (VERBOSE)
+ JobManager.verbose("DISABLING background indexing"); //$NON-NLS-1$
+ }
+ /**
+ * Remove the index from cache for a given project.
+ * Passing null as a job family discards them all.
+ */
+ public void discardJobs(String jobFamily) {
+
+ if (VERBOSE)
+ JobManager.verbose("DISCARD background job family - " + jobFamily); //$NON-NLS-1$
+
+ boolean wasEnabled = isEnabled();
+ try {
+ IJob currentJob;
+ // cancel current job if it belongs to the given family
+ synchronized(this){
+ currentJob = this.currentJob();
+ disable();
+ }
+ if (currentJob != null
+ && (jobFamily == null || currentJob.belongsTo(jobFamily))) {
+
+ currentJob.cancel();
+
+ // wait until current active job has finished
+ while (thread != null && executing){
+ try {
+ if (VERBOSE)
+ JobManager.verbose("-> waiting end of current background job - " + currentJob); //$NON-NLS-1$ //$NON-NLS-2$
+ Thread.sleep(50);
+ } catch(InterruptedException e){
+ }
+ }
+ }
+
+ // flush and compact awaiting jobs
+ int loc = -1;
+ synchronized(this) {
+ for (int i = jobStart; i <= jobEnd; i++) {
+ currentJob = awaitingJobs[i];
+ awaitingJobs[i] = null;
+ if (!(jobFamily == null
+ || currentJob.belongsTo(jobFamily))) { // copy down, compacting
+ awaitingJobs[++loc] = currentJob;
+ } else {
+ if (VERBOSE)
+ JobManager.verbose("-> discarding background job - " + currentJob); //$NON-NLS-1$
+ currentJob.cancel();
+ }
+ }
+ jobStart = 0;
+ jobEnd = loc;
+ }
+ } finally {
+ if (wasEnabled)
+ enable();
+ }
+ if (VERBOSE)
+ JobManager.verbose("DISCARD DONE with background job family - " + jobFamily); //$NON-NLS-1$
+ }
+
+ public synchronized void enable() {
+ enabled = true;
+ if (VERBOSE)
+ JobManager.verbose("ENABLING background indexing"); //$NON-NLS-1$
+ }
+
+ public synchronized boolean isEnabled() {
+ return enabled;
+ }
+ /**
+ * Advance to the next available job, once the current one has been completed.
+ * Note: clients awaiting until the job count is zero are still waiting at this point.
+ */
+ protected synchronized void moveToNextJob() {
+
+ //if (!enabled) return;
+
+ if (jobStart <= jobEnd) {
+ awaitingJobs[jobStart++] = null;
+ if (jobStart > jobEnd) {
+ jobStart = 0;
+ jobEnd = -1;
+ }
+ }
+ }
+ /**
+ * When idle, give chance to do something
+ */
+ protected void notifyIdle(long idlingTime) {
+ }
+ /**
+ * This API is allowing to run one job in concurrence with background processing.
+ * Indeed since other jobs are performed in background, resource sharing might be
+ * an issue.Therefore, this functionality allows a given job to be run without
+ * colliding with background ones.
+ * Note: multiple thread might attempt to perform concurrent jobs at the same time,
+ * and should synchronize (it is deliberately left to clients to decide whether
+ * concurrent jobs might interfere or not. In general, multiple read jobs are ok).
+ *
+ * Waiting policy can be:
+ * IJobConstants.ForceImmediateSearch
+ * IJobConstants.CancelIfNotReadyToSearch
+ * IJobConstants.WaitUntilReadyToSearch
+ *
+ */
+ public boolean performConcurrentJob(
+ IJob searchJob,
+ int waitingPolicy,
+ IProgressMonitor progress) {
+
+ if (VERBOSE)
+ JobManager.verbose("STARTING concurrent job - " + searchJob); //$NON-NLS-1$
+ if (!searchJob.isReadyToRun()) {
+ if (VERBOSE)
+ JobManager.verbose("ABORTED concurrent job - " + searchJob); //$NON-NLS-1$
+ return IJob.FAILED;
+ }
+
+ int concurrentJobWork = 100;
+ if (progress != null)
+ progress.beginTask("", concurrentJobWork); //$NON-NLS-1$
+ boolean status = IJob.FAILED;
+ if (awaitingJobsCount() > 0) {
+ switch (waitingPolicy) {
+
+ case IJob.ForceImmediate :
+ if (VERBOSE)
+ JobManager.verbose("-> NOT READY - forcing immediate - " + searchJob);//$NON-NLS-1$
+ boolean wasEnabled = isEnabled();
+ try {
+ disable(); // pause indexing
+ status = searchJob.execute(progress == null ? null : new SubProgressMonitor(progress, concurrentJobWork));
+ } finally {
+ if (wasEnabled)
+ enable();
+ }
+ if (VERBOSE)
+ JobManager.verbose("FINISHED concurrent job - " + searchJob); //$NON-NLS-1$
+ return status;
+
+ case IJob.CancelIfNotReady :
+ if (VERBOSE)
+ JobManager.verbose("-> NOT READY - cancelling - " + searchJob); //$NON-NLS-1$
+ if (progress != null) progress.setCanceled(true);
+ if (VERBOSE)
+ JobManager.verbose("CANCELED concurrent job - " + searchJob); //$NON-NLS-1$
+ throw new OperationCanceledException();
+
+ case IJob.WaitUntilReady :
+ int awaitingWork;
+ IJob previousJob = null;
+ IJob currentJob;
+ IProgressMonitor subProgress = null;
+ int totalWork = this.awaitingJobsCount();
+ if (progress != null && totalWork > 0) {
+ subProgress = new SubProgressMonitor(progress, concurrentJobWork / 2);
+ subProgress.beginTask("", totalWork); //$NON-NLS-1$
+ concurrentJobWork = concurrentJobWork / 2;
+ }
+ int originalPriority = this.thread.getPriority();
+ try {
+ synchronized(this) {
+
+ // use local variable to avoid potential NPE (see Bug 20435 NPE when searching java method)
+ Thread t = this.thread;
+ if (t != null) {
+ t.setPriority(Thread.currentThread().getPriority());
+ }
+ this.awaitingClients++;
+ }
+ while ((awaitingWork = awaitingJobsCount()) > 0) {
+ if (subProgress != null && subProgress.isCanceled())
+ throw new OperationCanceledException();
+ currentJob = currentJob();
+ // currentJob can be null when jobs have been added to the queue but job manager is not enabled
+ if (currentJob != null && currentJob != previousJob) {
+ if (VERBOSE)
+ JobManager.verbose("-> NOT READY - waiting until ready - " + searchJob);//$NON-NLS-1$
+ if (subProgress != null) {
+ subProgress.subTask(
+ Util.bind("manager.filesToIndex", Integer.toString(awaitingWork))); //$NON-NLS-1$
+ subProgress.worked(1);
+ }
+ previousJob = currentJob;
+ }
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException e) {
+ }
+ }
+ } finally {
+ synchronized(this) {
+ this.awaitingClients--;
+
+ // use local variable to avoid potential NPE (see Bug 20435 NPE when searching java method)
+ Thread t = this.thread;
+ if (t != null) {
+ t.setPriority(originalPriority);
+ }
+ }
+ }
+ if (subProgress != null) {
+ subProgress.done();
+ }
+ }
+ }
+ status = searchJob.execute(progress == null ? null : new SubProgressMonitor(progress, concurrentJobWork));
+ if (progress != null) {
+ progress.done();
+ }
+ if (VERBOSE)
+ JobManager.verbose("FINISHED concurrent job - " + searchJob); //$NON-NLS-1$
+ return status;
+ }
+
+ public abstract String processName();
+
+ public synchronized void request(IJob job) {
+ if (!job.isReadyToRun()) {
+ if (VERBOSE)
+ JobManager.verbose("ABORTED request of background job - " + job); //$NON-NLS-1$
+ return;
+ }
+
+ // append the job to the list of ones to process later on
+ int size = awaitingJobs.length;
+ if (++jobEnd == size) { // when growing, relocate jobs starting at position 0
+ jobEnd -= jobStart;
+ System.arraycopy(
+ awaitingJobs,
+ jobStart,
+ (awaitingJobs = new IJob[size * 2]),
+ 0,
+ jobEnd);
+ jobStart = 0;
+ }
+ awaitingJobs[jobEnd] = job;
+ if (VERBOSE)
+ JobManager.verbose("REQUEST background job - " + job); //$NON-NLS-1$
+
+ }
+ /**
+ * Flush current state
+ */
+ public void reset() {
+ if (VERBOSE)
+ JobManager.verbose("Reset"); //$NON-NLS-1$
+
+ if (thread != null) {
+ discardJobs(null); // discard all jobs
+ } else {
+ /* initiate background processing */
+ thread = new Thread(this, this.processName());
+ thread.setDaemon(true);
+ // less prioritary by default, priority is raised if clients are actively waiting on it
+ thread.setPriority(Thread.NORM_PRIORITY-1);
+ thread.start();
+ }
+ }
+ /**
+ * Infinite loop performing resource indexing
*/
public void run() {
- // TODO Auto-generated method stub
+ long idlingStart = -1;
+ activateProcessing();
+ try {
+ while (this.thread != null) {
+ try {
+ IJob job;
+ if ((job = currentJob()) == null) {
+ if (idlingStart < 0)
+ idlingStart = System.currentTimeMillis();
+ notifyIdle(System.currentTimeMillis() - idlingStart);
+ Thread.sleep(500);
+ continue;
+ } else {
+ idlingStart = -1;
+ }
+ if (VERBOSE) {
+ JobManager.verbose(awaitingJobsCount() + " awaiting jobs"); //$NON-NLS-1$
+ JobManager.verbose("STARTING background job - " + job); //$NON-NLS-1$
+ }
+ try {
+ executing = true;
+ /*boolean status = */job.execute(null);
+ //if (status == FAILED) request(job);
+ } finally {
+ executing = false;
+ if (VERBOSE) {
+ JobManager.verbose("FINISHED background job - " + job); //$NON-NLS-1$
+ }
+ moveToNextJob();
+ if (this.awaitingClients == 0) {
+ Thread.sleep(50);
+ }
+ }
+ } catch (InterruptedException e) { // background indexing was interrupted
+ }
+ }
+ } catch (RuntimeException e) {
+ if (this.thread != null) { // if not shutting down
+ // log exception
+ org.eclipse.cdt.internal.core.model.Util.log(e, "Background Indexer Crash Recovery"); //$NON-NLS-1$
+
+ // keep job manager alive
+ this.discardJobs(null);
+ this.thread = null;
+ this.reset(); // this will fork a new thread with no waiting jobs, some indexes will be inconsistent
+ }
+ throw e;
+ } catch (Error e) {
+ if (this.thread != null && !(e instanceof ThreadDeath)) {
+ // log exception
+ org.eclipse.cdt.internal.core.model.Util.log(e, "Background Indexer Crash Recovery"); //$NON-NLS-1$
+
+ // keep job manager alive
+ this.discardJobs(null);
+ this.thread = null;
+ this.reset(); // this will fork a new thread with no waiting jobs, some indexes will be inconsistent
+ }
+ throw e;
+ }
+ }
+ /**
+ * Stop background processing, and wait until the current job is completed before returning
+ */
+ public void shutdown() {
+
+ disable();
+ discardJobs(null); // will wait until current executing job has completed
+ Thread thread = this.thread;
+ this.thread = null; // mark the job manager as shutting down so that the thread will stop by itself
+ try {
+ if (thread != null) { // see http://bugs.eclipse.org/bugs/show_bug.cgi?id=31858
+ thread.join();
+ }
+ } catch (InterruptedException e) {
+ }
}
+
+ public String toString() {
+ StringBuffer buffer = new StringBuffer(10);
+ buffer.append("Enabled:").append(this.enabled).append('\n'); //$NON-NLS-1$
+ int numJobs = jobEnd - jobStart + 1;
+ buffer.append("Jobs in queue:").append(numJobs).append('\n'); //$NON-NLS-1$
+ for (int i = 0; i < numJobs && i < 15; i++) {
+ buffer.append(i).append(" - job["+i+"]: ").append(awaitingJobs[jobStart+i]).append('\n'); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return buffer.toString();
+ }
}
Index: src/org/eclipse/cdt/core/CCorePlugin.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java,v
retrieving revision 1.17
diff -u -r1.17 CCorePlugin.java
--- src/org/eclipse/cdt/core/CCorePlugin.java 10 Apr 2003 01:11:35 -0000 1.17
+++ src/org/eclipse/cdt/core/CCorePlugin.java 25 Jun 2003 21:02:17 -0000
@@ -139,7 +139,10 @@
// Fired up the indexer. It should delay itself for 10 seconds
fIndexModel = IndexModel.getDefault();
fIndexModel.startup();
-
+
+ //Fired up the new indexer
+ fCoreModel.startIndexing();
+
fDescriptorManager = new CDescriptorManager();
fDescriptorManager.startup();
Attachment:
org.eclipse.cdt.core.tests.zip
Description: Zip archive
Attachment:
org.eclipse.cdt.core.index.zip
Description: Zip archive
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.109
diff -u -r1.109 ChangeLog
--- ChangeLog 24 Jun 2003 14:22:14 -0000 1.109
+++ ChangeLog 25 Jun 2003 20:57:05 -0000
@@ -1,3 +1,11 @@
+2003-06-25 Bogdan Gheorghe
+ Added a new checkbox to the Indexer tab of the C/C++ Project Settings
+ to allow the new indexer to be turned on or off.
+ * src/org/eclipse/cdt/ui/wizards/IndexerBlock.java
+
+ Modified the CSearchPage to work with the new CSearchConstants
+ * src/org/eclipse/cdt/internal/ui/search/CSearchPage.java
+
2003-06-24 Thomas Fletcher
- Proposals will now include additional help information with them
Index: src/org/eclipse/cdt/internal/ui/search/CSearchPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchPage.java,v
retrieving revision 1.1
diff -u -r1.1 CSearchPage.java
--- src/org/eclipse/cdt/internal/ui/search/CSearchPage.java 16 Jun 2003 17:35:44 -0000 1.1
+++ src/org/eclipse/cdt/internal/ui/search/CSearchPage.java 25 Jun 2003 20:57:06 -0000
@@ -161,8 +161,8 @@
};
fSearchFor[ TYPE ].addSelectionListener(cElementInitializer);
- fSearchFor[ METHOD ].addSelectionListener(cElementInitializer);
- fSearchFor[ FIELD ].addSelectionListener(cElementInitializer);
+ fSearchFor[ FUNCTION ].addSelectionListener(cElementInitializer);
+ fSearchFor[ MEMBER ].addSelectionListener(cElementInitializer);
fSearchFor[CONSTRUCTOR].addSelectionListener(cElementInitializer);
//fSearchFor[ PACKAGE ].addSelectionListener(cElementInitializer);
@@ -283,34 +283,34 @@
}
private void setLimitTo(int searchFor) {
fLimitTo[ DECLARATIONS ].setEnabled( true );
- fLimitTo[ IMPLEMENTORS ].setEnabled( false);
+ //fLimitTo[ IMPLEMENTORS ].setEnabled( false);
fLimitTo[ REFERENCES ].setEnabled( true );
fLimitTo[ ALL_OCCURRENCES ].setEnabled( true );
- fLimitTo[ READ_ACCESSES ].setEnabled( false);
- fLimitTo[ WRITE_ACCESSES ].setEnabled( false);
+ //fLimitTo[ READ_ACCESSES ].setEnabled( false);
+ //fLimitTo[ WRITE_ACCESSES ].setEnabled( false);
- if (!(searchFor == TYPE || searchFor == INTERFACE) && fLimitTo[IMPLEMENTORS].getSelection()) {
- fLimitTo[ IMPLEMENTORS ].setSelection(false);
- fLimitTo[ REFERENCES ].setSelection(true);
- }
-
- if (!(searchFor == FIELD) && (getLimitTo() == READ_ACCESSES || getLimitTo() == WRITE_ACCESSES)) {
- fLimitTo[ getLimitTo()].setSelection(false);
- fLimitTo[ REFERENCES ].setSelection(true);
- }
-
- switch (searchFor) {
- case TYPE:
- case INTERFACE:
- fLimitTo[ IMPLEMENTORS ].setEnabled(true);
- break;
- case FIELD:
- fLimitTo[ READ_ACCESSES ].setEnabled(true);
- fLimitTo[ WRITE_ACCESSES ].setEnabled(true);
- break;
- default :
- break;
- }
+// if (!(searchFor == TYPE || searchFor == INTERFACE) && fLimitTo[IMPLEMENTORS].getSelection()) {
+// fLimitTo[ IMPLEMENTORS ].setSelection(false);
+// fLimitTo[ REFERENCES ].setSelection(true);
+// }
+//
+// if (!(searchFor == FIELD) && (getLimitTo() == READ_ACCESSES || getLimitTo() == WRITE_ACCESSES)) {
+// fLimitTo[ getLimitTo()].setSelection(false);
+// fLimitTo[ REFERENCES ].setSelection(true);
+// }
+//
+// switch (searchFor) {
+// case TYPE:
+// case INTERFACE:
+// fLimitTo[ IMPLEMENTORS ].setEnabled(true);
+// break;
+// case FIELD:
+// fLimitTo[ READ_ACCESSES ].setEnabled(true);
+// fLimitTo[ WRITE_ACCESSES ].setEnabled(true);
+// break;
+// default :
+// break;
+// }
}
private Control createSearchFor(Composite parent) {
Index: src/org/eclipse/cdt/ui/wizards/IndexerBlock.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/wizards/IndexerBlock.java,v
retrieving revision 1.1
diff -u -r1.1 IndexerBlock.java
--- src/org/eclipse/cdt/ui/wizards/IndexerBlock.java 20 Nov 2002 22:10:02 -0000 1.1
+++ src/org/eclipse/cdt/ui/wizards/IndexerBlock.java 25 Jun 2003 20:57:06 -0000
@@ -7,6 +7,7 @@
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.index.IndexModel;
+import org.eclipse.cdt.internal.core.search.indexing.IndexManager;
import org.eclipse.cdt.utils.ui.swt.IValidation;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -18,6 +19,7 @@
public class IndexerBlock implements IWizardTab {
private Button indexerSwitch;
+ private Button indexerSwitch2;
IProject project;
IValidation page;
@@ -39,8 +41,13 @@
indexerSwitch = new Button(composite, SWT.CHECK | SWT.RIGHT);
indexerSwitch.setAlignment(SWT.LEFT);
- indexerSwitch.setText("Enable indexing service for this project");
+ indexerSwitch.setText("Enable CTAGS indexing service for this project");
indexerSwitch.setSelection(indexer.isEnabled(project));
+
+ indexerSwitch2 = new Button(composite, SWT.CHECK | SWT.RIGHT);
+ indexerSwitch2.setAlignment(SWT.LEFT);
+ indexerSwitch2.setText("Enable NEW indexing service for this project");
+ indexerSwitch2.setSelection(false);
return composite;
}
@@ -50,6 +57,9 @@
public void doRun(IProject project, IProgressMonitor monitor) {
IndexModel indexer = CCorePlugin.getDefault().getIndexModel();
indexer.setEnabled(project, indexerSwitch.getSelection());
+
+ IndexManager newIndexer = CCorePlugin.getDefault().getCoreModel().getIndexManager();
+ newIndexer.setEnabled(project, indexerSwitch2.getSelection());
}
@@ -79,12 +89,21 @@
*/
public void setVisible(boolean visible) {
IndexModel indexer = CCorePlugin.getDefault().getIndexModel();
-
+ IndexManager newIndexer = CCorePlugin.getDefault().getCoreModel().getIndexManager();
+
if (indexerSwitch != null) {
//indexerSwitch.setAlignment(SWT.LEFT);
//indexerSwitch.setText("Enable indexing service for this project");
indexerSwitch.setSelection(indexer.isEnabled(project));
}
+
+ if (indexerSwitch2 != null) {
+ //indexerSwitch.setAlignment(SWT.LEFT);
+ //indexerSwitch.setText("Enable indexing service for this project");
+ indexerSwitch2.setSelection(newIndexer.isEnabled(project));
+ }
+
+
}
}
Index: .classpath
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/.classpath,v
retrieving revision 1.2
diff -u -r1.2 .classpath
--- .classpath 24 Jun 2003 19:56:34 -0000 1.2
+++ .classpath 25 Jun 2003 20:54:52 -0000
@@ -2,6 +2,7 @@
<classpath>
<classpathentry kind="src" path="build/"/>
<classpathentry kind="src" path="failures/"/>
+ <classpathentry kind="src" path="indexer/"/>
<classpathentry kind="src" path="model/"/>
<classpathentry kind="src" path="parser/"/>
<classpathentry kind="src" path="resources/"/>
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.6
diff -u -r1.6 ChangeLog
--- ChangeLog 24 Jun 2003 20:18:16 -0000 1.6
+++ ChangeLog 25 Jun 2003 20:54:53 -0000
@@ -1,3 +1,6 @@
+2003-06-25 Bogdan Gheorghe
+ Added IndexManager test
+
2003-06-24 John Camelon
Updates for ISourceElementRequestor - elaborated types & enumerations.
Index: build.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/build.properties,v
retrieving revision 1.2
diff -u -r1.2 build.properties
--- build.properties 24 Jun 2003 19:56:34 -0000 1.2
+++ build.properties 25 Jun 2003 20:54:53 -0000
@@ -1,3 +1,12 @@
+source.cdtuitests.jar = src/,\
+ ui/,\
+ core/,\
+ model/,\
+ build/,\
+ parser/,\
+ failures/,\
+ indexer/,\
+ suite/
bin.includes = plugin.xml,\
about.html,\
plugin.properties,\