mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
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)
This commit is contained in:
parent
77fbc604e7
commit
bc158cc0fb
8 changed files with 46 additions and 25 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {}
|
||||
}
|
||||
|
||||
}
|
|
@ -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">
|
||||
|
|
Loading…
Add table
Reference in a new issue