Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Camelon2003-10-01 18:15:38 -0400
committerJohn Camelon2003-10-01 18:15:38 -0400
commitbc158cc0fbf0c59db03f590a41a2e20e9a8d1a9d (patch)
tree709f810ec926627fa530b1df541bd1a864bd3906
parent77fbc604e7f8a8c6569e31c12b04c4e4fc7b7bf3 (diff)
downloadorg.eclipse.cdt-bc158cc0fbf0c59db03f590a41a2e20e9a8d1a9d.tar.gz
org.eclipse.cdt-bc158cc0fbf0c59db03f590a41a2e20e9a8d1a9d.tar.xz
org.eclipse.cdt-bc158cc0fbf0c59db03f590a41a2e20e9a8d1a9d.zip
Patch for Bogdan Gheorghe
This patch: - changes the indexer to use whatever source/header extensions are defined in CModelManager - updated the search shortcut so that Ctrl + H will bring up the C/C++ search in a source/header extension file - flushes the CDT log file after each index merge (ie. each time the indexer completes an index)
-rw-r--r--core/org.eclipse.cdt.core/ChangeLog7
-rw-r--r--core/org.eclipse.cdt.core/index/ChangeLog6
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/Index.java3
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/AddFileToIndex.java2
-rw-r--r--core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java32
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java13
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDTLogWriter.java6
-rw-r--r--core/org.eclipse.cdt.ui/plugin.xml2
8 files changed, 46 insertions, 25 deletions
diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog
index 56c4b54b92..722130cfaf 100644
--- a/core/org.eclipse.cdt.core/ChangeLog
+++ b/core/org.eclipse.cdt.core/ChangeLog
@@ -1,7 +1,10 @@
2003-10-01 Bogdan Gheorghe
-
+
+ Changed DeltaProcessor.updateDependencies to use the CModelManager
+ header file definitions
+
Modified CDTLogWriter: increased max log file size to 10MB; got rid of
- the stack dumps/
+ the stack dumps; added flush to CDTLogWriter
* src/org/eclipse/cdt/internal/core/CDTLogWriter.java
diff --git a/core/org.eclipse.cdt.core/index/ChangeLog b/core/org.eclipse.cdt.core/index/ChangeLog
index e77ddcb936..a05a6deb20 100644
--- a/core/org.eclipse.cdt.core/index/ChangeLog
+++ b/core/org.eclipse.cdt.core/index/ChangeLog
@@ -1,6 +1,10 @@
2003-10-01 Bogdan Gheorghe
- Modified BlockIndexOutput.addInclude to properly flush an
+ - Modified BlockIndexOutput.addInclude to properly flush an
include block once it's full.
+ - Flushing the CDT log after every merge
+ - Logging I/O Exceptions in AddFileToIndex
+ - Changed valid source file extensions in SourceIndexer to
+ use CModelManager file extensions
2003-09-30 Bogdan Gheorghe
Changed logging for SourceIndexer to log file in cdt.core
diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/Index.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/Index.java
index b2ac5af28f..5724f318b5 100644
--- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/Index.java
+++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/Index.java
@@ -17,6 +17,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.internal.core.index.IDocument;
import org.eclipse.cdt.internal.core.index.IEntryResult;
import org.eclipse.cdt.internal.core.index.IIndex;
@@ -272,6 +273,8 @@ public class Index implements IIndex {
addsIndex.init();
addsIndexInput= new SimpleIndexInput(addsIndex);
state= MERGED;
+ //flush the CDT log
+ CCorePlugin.getDefault().cdtLog.flushLog();
}
}
/**
diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/AddFileToIndex.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/AddFileToIndex.java
index 4a3c494b4d..82245a2fa5 100644
--- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/AddFileToIndex.java
+++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/AddFileToIndex.java
@@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.core.search.indexing;
import java.io.IOException;
+import org.eclipse.cdt.core.ICLogConstants;
import org.eclipse.cdt.internal.core.index.IIndex;
import org.eclipse.cdt.internal.core.search.processing.JobManager;
import org.eclipse.core.resources.IFile;
@@ -37,6 +38,7 @@ public abstract class AddFileToIndex extends IndexRequest {
monitor.enterWrite(); // ask permission to write
if (!indexDocument(index)) return false;
} catch (IOException e) {
+ org.eclipse.cdt.internal.core.model.Util.log(null, "Index I/O Exception: " + e.getMessage() + " on File: " + resource.getName(), ICLogConstants.CDT);
if (IndexManager.VERBOSE) {
JobManager.verbose("-> failed to index " + this.resource + " because of the following exception:"); //$NON-NLS-1$ //$NON-NLS-2$
e.printStackTrace();
diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java
index 6d8e8c3698..e03f595f7c 100644
--- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java
+++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java
@@ -28,6 +28,7 @@ import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.core.parser.ParserFactory;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.internal.core.index.IDocument;
+import org.eclipse.cdt.internal.core.model.CModelManager;
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -47,7 +48,8 @@ public class SourceIndexer extends AbstractIndexer {
//TODO: Indexer, add additional file types
//Header files: "h" , "hh", "hpp"
- public static final String[] FILE_TYPES= new String[] {"cpp","c", "cc", "cxx"}; //$NON-NLS-1$
+ //Use the CModelManager defined file types
+ //public static final String[] FILE_TYPES= new String[] {"cpp","c", "cc", "cxx"}; //$NON-NLS-1$
//protected DefaultProblemFactory problemFactory= new DefaultProblemFactory(Locale.getDefault());
IFile resourceFile;
@@ -59,7 +61,7 @@ public class SourceIndexer extends AbstractIndexer {
* Returns the file types the <code>IIndexer</code> handles.
*/
public String[] getFileTypes(){
- return FILE_TYPES;
+ return CModelManager.sourceExtensions;
}
protected void indexFile(IDocument document) throws IOException {
@@ -86,23 +88,17 @@ public class SourceIndexer extends AbstractIndexer {
ParserFactory.createScanner( new StringReader( document.getStringContent() ), resourceFile.getLocation().toOSString(), scanInfo, ParserMode.COMPLETE_PARSE, language, requestor ),
requestor, ParserMode.COMPLETE_PARSE, language );
- try{
- boolean retVal = parser.parse();
-
+ boolean retVal = parser.parse();
+
+ if (!retVal)
+ org.eclipse.cdt.internal.core.model.Util.log(null, "Failed to index " + resourceFile.getFullPath(), ICLogConstants.CDT);
+
+ if (AbstractIndexer.VERBOSE){
if (!retVal)
- org.eclipse.cdt.internal.core.model.Util.log(null, "Failed to index " + resourceFile.getFullPath(), ICLogConstants.CDT);
-
- if (AbstractIndexer.VERBOSE){
- if (!retVal)
- AbstractIndexer.verbose("PARSE FAILED " + resourceFile.getName().toString());
- else
- AbstractIndexer.verbose("PARSE SUCCEEDED " + resourceFile.getName().toString());
- }
- }
- catch( Exception e ){
- System.out.println( "Parse Exception in SourceIndexer" );
- e.printStackTrace();
- }
+ AbstractIndexer.verbose("PARSE FAILED " + resourceFile.getName().toString());
+ else
+ AbstractIndexer.verbose("PARSE SUCCEEDED " + resourceFile.getName().toString());
+ }
}
/**
* Sets the document types the <code>IIndexer</code> handles.
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
index 4ba91e1bb3..0ccf44f125 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/DeltaProcessor.java
@@ -511,9 +511,7 @@ public class DeltaProcessor {
String fileExtension = resource.getFileExtension();
if ((fileExtension != null) &&
- (fileExtension.equals("h") ||
- fileExtension.equals("hh") ||
- fileExtension.equals("hpp")))
+ (isValidHeader(fileExtension)))
{
PathCollector pathCollector = new PathCollector();
//SubProgressMonitor subMonitor = (progressMonitor == null ) ? null : new SubProgressMonitor( progressMonitor, 5 );
@@ -544,4 +542,13 @@ public class DeltaProcessor {
}
}
}
+
+ private boolean isValidHeader(String fileExtension) {
+ String[] supportedTypes = CModelManager.headerExtensions;
+ for (int i = 0; i < supportedTypes.length; ++i) {
+ if (supportedTypes[i].equals(fileExtension))
+ return true;
+ }
+ return false;
+ }
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDTLogWriter.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDTLogWriter.java
index dbef18b5f1..bdd26f2cb2 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDTLogWriter.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CDTLogWriter.java
@@ -206,5 +206,11 @@ public class CDTLogWriter {
protected void writeSpace() throws IOException {
write(" ");//$NON-NLS-1$
}
+
+ public synchronized void flushLog(){
+ try {
+ log.flush();
+ } catch (IOException e) {}
+ }
} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml
index 77742ce7f9..536cbb149b 100644
--- a/core/org.eclipse.cdt.ui/plugin.xml
+++ b/core/org.eclipse.cdt.ui/plugin.xml
@@ -407,7 +407,7 @@
showScopeSection="true"
label="%CSearchPage.label"
icon="icons/full/obj16/csearch_obj.gif"
- extensions="c:90,cpp:90, cxx:90, cc:90, h:90, hh:90, hpp:90"
+ extensions="c:90,cpp:90, cxx:90, cc:90,C:90, h:90, hh:90, hpp:90, H:90"
class="org.eclipse.cdt.internal.ui.search.CSearchPage"
sizeHint="460, 160"
id="org.eclipse.cdt.ui.CSearchPage">

Back to the top