From a8037dbc3a352a483451927a5c74dc45c3980081 Mon Sep 17 00:00:00 2001 From: Bogdan Gheorghe Date: Tue, 18 May 2004 02:29:20 +0000 Subject: [PATCH] Fix for 62512 Added matching routine to IncludePattern --- core/org.eclipse.cdt.core/search/ChangeLog | 3 +++ .../core/search/matching/IncludePattern.java | 18 ++++++++++++++++-- .../core/search/processing/IndexingJob.java | 10 +++++----- .../core/search/processing/JobManager.java | 8 ++++---- core/org.eclipse.cdt.ui/plugin.properties | 2 +- .../internal/ui/CPluginResources.properties | 4 ++-- 6 files changed, 31 insertions(+), 14 deletions(-) diff --git a/core/org.eclipse.cdt.core/search/ChangeLog b/core/org.eclipse.cdt.core/search/ChangeLog index 41f360d590a..88a54545666 100644 --- a/core/org.eclipse.cdt.core/search/ChangeLog +++ b/core/org.eclipse.cdt.core/search/ChangeLog @@ -1,3 +1,6 @@ +2004-05-17 Bogdan Gheorghe + Added matching routine to IncludePattern + 2004-05-17 Andrew Niefer bug 61044 - report search matches at the end of each compilation unit diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/IncludePattern.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/IncludePattern.java index 2431316d753..cedd57a1b48 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/IncludePattern.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/IncludePattern.java @@ -12,8 +12,8 @@ package org.eclipse.cdt.internal.core.search.matching; import java.io.IOException; - import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate; +import org.eclipse.cdt.core.parser.ast.IASTInclusion; import org.eclipse.cdt.core.search.ICSearchScope; import org.eclipse.cdt.internal.core.CharOperation; import org.eclipse.cdt.internal.core.index.IEntryResult; @@ -98,7 +98,21 @@ public class IncludePattern extends CSearchPattern { */ public int matchLevel(ISourceElementCallbackDelegate node, LimitTo limit) { // TODO Auto-generated method stub - return 0; + if (!( node instanceof IASTInclusion )) { + return IMPOSSIBLE_MATCH; + } + + if( ! canAccept( limit ) ) + return IMPOSSIBLE_MATCH; + + IASTInclusion inc = (IASTInclusion) node; + String fileName = inc.getFullFileName(); + + if(CharOperation.equals(simpleName,fileName.toCharArray(),_caseSensitive)){ + return ACCURATE_MATCH; + } + + return IMPOSSIBLE_MATCH; } } diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/processing/IndexingJob.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/processing/IndexingJob.java index 1b379f64d32..12d819a8ef7 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/processing/IndexingJob.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/processing/IndexingJob.java @@ -35,7 +35,7 @@ public class IndexingJob extends Job { public IndexingJob( Thread thread, JobManager manager ) { - super( "Indexer" ); + super( "C/C++ Indexer" ); //$NON-NLS-1$ jobManager = manager; indexThread = thread; setPriority( LONG ); @@ -46,7 +46,7 @@ public class IndexingJob extends Job { protected IStatus run(IProgressMonitor monitor) { progressMonitor = monitor; setThread( indexThread ); - progressMonitor.beginTask( "", 100 ); + progressMonitor.beginTask( "", 100 ); //$NON-NLS-1$ return ASYNC_FINISH; } @@ -58,7 +58,7 @@ public class IndexingJob extends Job { ticks++; if( ticks > maxTicks ) maxTicks = ticks; - updateRemainingCount( "" ); + updateRemainingCount( "" ); //$NON-NLS-1$ } public void setTicks( int n ){ @@ -67,7 +67,7 @@ public class IndexingJob extends Job { maxTicks = ticks; updatePercentage(); - updateRemainingCount( "" ); + updateRemainingCount( "" ); //$NON-NLS-1$ } public int tickDown( String str ){ @@ -86,7 +86,7 @@ public class IndexingJob extends Job { if( progressMonitor == null ) return; - String taskString = Util.bind("manager.filesToIndex", Integer.toString(ticks)); + String taskString = Util.bind("manager.filesToIndex", Integer.toString(ticks)); //$NON-NLS-1$ taskString += str; progressMonitor.subTask( taskString ); } diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/processing/JobManager.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/processing/JobManager.java index 5dc25b4dc12..2a0f537099e 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/processing/JobManager.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/processing/JobManager.java @@ -51,8 +51,8 @@ public abstract class JobManager implements Runnable { protected IndexingJob indexJob = null; - static private final IStatus OK_STATUS = new Status( IStatus.OK, "org.eclipse.cdt.core", IStatus.OK, "", null ); - static private final IStatus ERROR_STATUS = new Status( IStatus.ERROR, "org.eclipse.cdt.core", IStatus.ERROR, "", null ); + static private final IStatus OK_STATUS = new Status( IStatus.OK, "org.eclipse.cdt.core", IStatus.OK, "", null ); //$NON-NLS-1$//$NON-NLS-2$ + static private final IStatus ERROR_STATUS = new Status( IStatus.ERROR, "org.eclipse.cdt.core", IStatus.ERROR, "", null ); //$NON-NLS-1$//$NON-NLS-2$ public static void verbose(String log) { System.out.println("(" + Thread.currentThread() + ") " + log); //$NON-NLS-1$//$NON-NLS-2$ @@ -194,9 +194,9 @@ public abstract class JobManager implements Runnable { String progressString = null; IJob job = currentJob(); if( job instanceof IndexRequest ){ - progressString = " ("; + progressString = " ("; //$NON-NLS-1$ progressString += job.toString(); - progressString += ")"; + progressString += ")"; //$NON-NLS-1$ } if( indexJob.tickDown( progressString ) == 0 ){ indexJob.done( OK_STATUS ); diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties index 91ffb3cd2eb..a4e6e220f39 100644 --- a/core/org.eclipse.cdt.ui/plugin.properties +++ b/core/org.eclipse.cdt.ui/plugin.properties @@ -153,7 +153,7 @@ HideHeaderFiles.description= Hides all Header files WorkInProgress.name=Work In Progress -CDTIndexerProperty.name=CDT Indexer +CDTIndexerProperty.name=C/C++ Indexer cDocumentFactory=C Document Factory cDocumentSetupParticipant=C Document Setup Participant diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginResources.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginResources.properties index 22859a1318f..ec9980c77c4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginResources.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginResources.properties @@ -43,8 +43,8 @@ ErrorParserBlock.desc=Set the error parsers for this project BinaryParserBlock.label=Binary Parser BinaryParserBlock.desc=Set required binary parser for this project -IndexerBlock.label=Indexer -IndexerBlock.desc=Indexer setting for this project. The indexer is required for search and other related features. +IndexerBlock.label=C/C++ Indexer +IndexerBlock.desc=C/C++ Indexer setting for this project. The C/C++ indexer is required for C/C++ search and other related features. ReferenceBlock.label= Projects ReferenceBlock.desc= Referenced C/C++ Projects