1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Patch for Andrew Niefer.

Core:
For bug42815
- Modified ICSearchResultCollector.createMatch to not take a parent 
parameter
- modified BasicSearchResultCollector to create the parent string from the 
fully qualified name of the node
- modified MatchLocator to keep track of most recent declaration for 
reporting purposes
- modified MatchLocator.report to use the most recent declaration

Core.Tests:
- Created search/SearchTestSuite
- Added SearchTestSuite to AutomatedIntegrationSuite and removed the 
individual search tests
- Added testReferencesInFunction to ClassDeclarationPatternTests
- Modified resources/search/classDecl.cpp
- Modified testNamespaceReferenceInClassBaseClause, testMacroPattern, 
testEnumerators, 
  and testEnumeratorReferences in OtherPatternTests to test the Match 
result strings

UI:
- bug42837 - fixed populating search dialog on function declarations
- bug42829 - prepopulated search dialog to any element declarations
- bug42815 - group together search results with same label
- modified CSearchResultLabelProvider to not display the "-" in the search 
label
  while sorting by name if there is no parent.
This commit is contained in:
John Camelon 2003-09-12 13:13:58 +00:00
parent 3f2ec4d44c
commit ceca2f6558
16 changed files with 230 additions and 83 deletions

View file

@ -1,3 +1,11 @@
2003-09-11 Andrew Niefer
Created search/SearchTestSuite
Added SearchTestSuite to AutomatedIntegrationSuite and removed the individual search tests
Added testReferencesInFunction to ClassDeclarationPatternTests
Modified resources/search/classDecl.cpp
Modified testNamespaceReferenceInClassBaseClause, testMacroPattern, testEnumerators,
testEnumeratorReferences in OtherPatternTests to test the Match result strings
2003-09-11 John Camelon
Added CompleteParseASTTest::testBug42840() & testBug42872().
Moved testBug39504B(), testBug39505A() & testBug39505B() from failed to QuickParse tests.

View file

@ -45,3 +45,10 @@ NS::B b2;
union u{
};
class AClassForFoo {};
AClassForFoo foo( AClassForFoo ){
AClassForFoo b;
return b;
}

View file

@ -257,4 +257,22 @@ public class ClassDeclarationPatternTests extends BaseSearchTest implements ICSe
assertEquals( matches.size(), 7 );
}
public void testReferencesInFunction(){
ICSearchPattern pattern = SearchEngine.createSearchPattern( "AClassForFoo", CLASS, REFERENCES, true );
search( workspace, pattern, scope, resultCollector );
Set matches = resultCollector.getSearchResults();
assertEquals( matches.size(), 3 );
Iterator iter = matches.iterator();
while( iter.hasNext() ){
IMatch match = (IMatch) iter.next();
assertTrue( match.getName().equals("foo(AClassForFoo)") );
assertTrue( match.getParentName().equals("") );
}
}
}

View file

@ -13,6 +13,7 @@
*/
package org.eclipse.cdt.core.search.tests;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.cdt.core.search.ICSearchPattern;
@ -120,6 +121,21 @@ public class OtherPatternTests extends BaseSearchTest {
Set matches = resultCollector.getSearchResults();
assertEquals( matches.size(), 2 );
Iterator iter = matches.iterator();
IMatch match = (IMatch) iter.next();
if( match.getName().equals("b2") ){
assertTrue( match.getParentName().equals("") );
match = (IMatch) iter.next();
assertTrue( match.getName().equals( "C" ) );
assertTrue( match.getParentName().equals( "NS3" ));
} else {
assertTrue( match.getName().equals( "C" ) );
assertTrue( match.getParentName().equals( "NS3" ));
match = (IMatch) iter.next();
assertTrue( match.getName().equals( "b2" ) );
assertTrue( match.getParentName().equals( "" ));
}
}
public void testFieldDeclaration(){
@ -175,6 +191,10 @@ public class OtherPatternTests extends BaseSearchTest {
Set matches = resultCollector.getSearchResults();
assertEquals( matches.size(), 1 );
IMatch match = (IMatch) matches.iterator().next();
assertTrue( match.getName().equals( "FOO" ) );
assertTrue( match.getParentName().equals( "" ));
}
public void testEnumerators(){
@ -184,6 +204,9 @@ public class OtherPatternTests extends BaseSearchTest {
Set matches = resultCollector.getSearchResults();
assertEquals( matches.size(), 1 );
IMatch match = (IMatch) matches.iterator().next();
assertTrue( match.getName().equals( "One" ) );
assertTrue( match.getParentName().equals( "NS::B" ));
pattern = SearchEngine.createSearchPattern( "NS::B::Two", FIELD, DECLARATIONS, true );
@ -191,6 +214,9 @@ public class OtherPatternTests extends BaseSearchTest {
matches = resultCollector.getSearchResults();
assertEquals( matches.size(), 1 );
match = (IMatch) matches.iterator().next();
assertTrue( match.getName().equals( "Two" ) );
assertTrue( match.getParentName().equals( "NS::B" ) );
}
public void testEnumeratorReferences(){
@ -200,6 +226,9 @@ public class OtherPatternTests extends BaseSearchTest {
Set matches = resultCollector.getSearchResults();
assertEquals( matches.size(), 1 );
}
IMatch match = (IMatch) matches.iterator().next();
assertTrue( match.getName().equals( "eE" ) );
assertTrue( match.getParentName().equals( "NS3::C" ));
}
}

View file

@ -0,0 +1,34 @@
/*******************************************************************************
* 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
******************************************************************************/
package org.eclipse.cdt.core.search.tests;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* @author aniefer
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class SearchTestSuite extends TestCase {
public static Test suite() {
TestSuite suite= new TestSuite(SearchTestSuite.class.getName());
suite.addTestSuite(ClassDeclarationPatternTests.class);
suite.addTestSuite(FunctionMethodPatternTests.class);
suite.addTestSuite(OtherPatternTests.class);
suite.addTestSuite(ParseTestOnSearchFiles.class);
return suite;
}
}

View file

@ -30,10 +30,7 @@ import org.eclipse.cdt.core.parser.failedTests.ASTFailedTests;
import org.eclipse.cdt.core.parser.failedTests.LokiFailures;
import org.eclipse.cdt.core.parser.failedTests.STLFailedTests;
import org.eclipse.cdt.core.parser.tests.ParserTestSuite;
import org.eclipse.cdt.core.search.tests.ClassDeclarationPatternTests;
import org.eclipse.cdt.core.search.tests.FunctionMethodPatternTests;
import org.eclipse.cdt.core.search.tests.OtherPatternTests;
import org.eclipse.cdt.core.search.tests.ParseTestOnSearchFiles;
import org.eclipse.cdt.core.search.tests.SearchTestSuite;
import org.eclipse.core.boot.IPlatformRunnable;
/**
@ -86,10 +83,7 @@ public class AutomatedIntegrationSuite extends TestSuite
suite.addTest(BinaryTests.suite());
suite.addTest(ElementDeltaTests.suite());
suite.addTest(WorkingCopyTests.suite());
suite.addTestSuite(ClassDeclarationPatternTests.class );
suite.addTestSuite(FunctionMethodPatternTests.class );
suite.addTestSuite(OtherPatternTests.class );
suite.addTestSuite( ParseTestOnSearchFiles.class);
suite.addTest(SearchTestSuite.suite());
suite.addTestSuite( CompletionProposalsTest.class);
//Indexer Tests need to be run after any indexer client tests
//as the last test shuts down the indexing thread

View file

@ -1,3 +1,9 @@
2003-09-11 Andrew Niefer
- Modified ICSearchResultCollector.createMatch to not take a parent parameter
- modified BasicSearchResultCollector to create the parent string from the fully qualified name of the node
- modified MatchLocator to keep track of most recent declaration for reporting purposes
- modified MatchLocator.report to use the most recent declaration
2003-09-09 Andrew Niefer
pattern matching on function parameters:
- modified scanForParameters in CSearchPattern

View file

@ -36,7 +36,6 @@ import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement;
import org.eclipse.cdt.core.parser.ast.IASTReference;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
@ -64,13 +63,13 @@ public class BasicSearchResultCollector implements ICSearchResultCollector {
return null;
}
public IMatch createMatch(Object fileResource, int start, int end, ISourceElementCallbackDelegate node, IASTScope parent) throws CoreException
public IMatch createMatch(Object fileResource, int start, int end, ISourceElementCallbackDelegate node ) throws CoreException
{
BasicSearchMatch result = new BasicSearchMatch();
return createMatch( result, fileResource, start, end, node, parent );
return createMatch( result, fileResource, start, end, node );
}
public IMatch createMatch( BasicSearchMatch result, Object fileResource, int start, int end, ISourceElementCallbackDelegate node, IASTScope parent) throws CoreException {
public IMatch createMatch( BasicSearchMatch result, Object fileResource, int start, int end, ISourceElementCallbackDelegate node ) throws CoreException {
if( fileResource instanceof IResource )
result.resource = (IResource) fileResource;
else if( fileResource instanceof IPath )
@ -78,17 +77,7 @@ public class BasicSearchResultCollector implements ICSearchResultCollector {
result.startOffset = start;
result.endOffset = end;
result.parentName = "";
if( parent instanceof IASTQualifiedNameElement ){
String [] names = ((IASTQualifiedNameElement)parent).getFullyQualifiedName();
for( int i = 0; i < names.length; i++ ){
if( i > 0 )
result.parentName += "::";
result.parentName += names[ i ];
}
}
IASTOffsetableNamedElement offsetable = null;
@ -100,6 +89,24 @@ public class BasicSearchResultCollector implements ICSearchResultCollector {
result.name = offsetable.getName();
}
result.parentName = "";
String [] names = null;
if( offsetable instanceof IASTEnumerator ){
IASTEnumerator enumerator = (IASTEnumerator) offsetable;
names = enumerator.getOwnerEnumerationSpecifier().getFullyQualifiedName();
} else if( offsetable instanceof IASTQualifiedNameElement ) {
names = ((IASTQualifiedNameElement) offsetable).getFullyQualifiedName();
}
if( names != null ){
for( int i = 0; i < names.length - 1; i++ ){
if( i > 0 )
result.parentName += "::";
result.parentName += names[ i ];
}
}
if( offsetable instanceof IASTFunction ){
result.name += getParameterString( (IASTFunction) offsetable );
}

View file

@ -14,7 +14,6 @@
package org.eclipse.cdt.core.search;
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@ -47,23 +46,8 @@ public interface ICSearchResultCollector {
*/
public void done();
/**
* Accepts the given search result.
*
* @param resource the resource in which the match has been found
* @param start the start position of the match, -1 if it is unknown
* @param end the end position of the match, -1 if it is unknown;
* the ending offset is exclusive, meaning that the actual range of characters
* covered is <code>[start, end]</code>
* @param enclosingObject an object that contains the character range
* <code>[start, end]</code>; the value can be <code>null</code> indicating that
* no enclosing object has been found
* @param accuracy the level of accuracy the search result has; either
* <code>EXACT_MATCH</code> or <code>POTENTIAL_MATCH</code>
* @exception CoreException if this collector had a problem accepting the search result
*/
public IMatch createMatch( Object fileResource, int start, int end,
ISourceElementCallbackDelegate node, IASTScope parent) throws CoreException;
ISourceElementCallbackDelegate node ) throws CoreException;
//return whether or not the match was accepted
public boolean acceptMatch( IMatch match ) throws CoreException;

View file

@ -44,6 +44,7 @@ import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
import org.eclipse.cdt.core.parser.ast.IASTEnumeratorReference;
import org.eclipse.cdt.core.parser.ast.IASTField;
import org.eclipse.cdt.core.parser.ast.IASTFieldReference;
@ -141,26 +142,33 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
}
public void acceptVariable(IASTVariable variable){
lastDeclaration = variable;
check( DECLARATIONS, variable );
}
public void acceptField(IASTField field){
lastDeclaration = field;
check( DECLARATIONS, field );
}
public void acceptEnumerationSpecifier(IASTEnumerationSpecifier enumeration){
lastDeclaration = enumeration;
check( DECLARATIONS, enumeration );
Iterator iter = enumeration.getEnumerators();
while( iter.hasNext() ){
check ( DECLARATIONS, (ISourceElementCallbackDelegate) iter.next() );
IASTEnumerator enumerator = (IASTEnumerator) iter.next();
lastDeclaration = enumerator;
check ( DECLARATIONS, enumerator );
}
}
public void acceptFunctionDeclaration(IASTFunction function){
lastDeclaration = function;
check( DECLARATIONS, function );
}
public void acceptMethodDeclaration(IASTMethod method){
lastDeclaration = method;
check( DECLARATIONS, method );
}
@ -193,11 +201,14 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
}
public void enterFunctionBody(IASTFunction function){
lastDeclaration = function;
check( DECLARATIONS, function );
check( DEFINITIONS, function );
pushScope( function );
}
public void enterMethodBody(IASTMethod method) {
lastDeclaration = method;
check( DEFINITIONS, method );
pushScope( method );
}
@ -207,11 +218,13 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
}
public void enterNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) {
lastDeclaration = namespaceDefinition;
check( DECLARATIONS, namespaceDefinition );
pushScope( namespaceDefinition );
}
public void enterClassSpecifier(IASTClassSpecifier classSpecification) {
lastDeclaration = classSpecification;
check( DECLARATIONS, classSpecification );
pushScope( classSpecification );
}
@ -407,12 +420,27 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
MatchLocator.verbose("Report Match: " + offsetableElement.getName());
}
IMatch match = null;
ISourceElementCallbackDelegate object = null;
if( node instanceof IASTReference ){
if( currentScope instanceof IASTFunction || currentScope instanceof IASTMethod ){
object = (ISourceElementCallbackDelegate) currentScope;
} else {
object = lastDeclaration;
}
} else {
if( currentScope instanceof IASTFunction || currentScope instanceof IASTMethod ){
object = (ISourceElementCallbackDelegate) currentScope;
} else {
object = node;
}
}
if( currentResource != null ){
match = resultCollector.createMatch( currentResource, offset, offset + length, node, currentScope );
match = resultCollector.createMatch( currentResource, offset, offset + length, object );
} else if( currentPath != null ){
match = resultCollector.createMatch( currentPath, offset, offset + length, node, currentScope );
match = resultCollector.createMatch( currentPath, offset, offset + length, object );
}
if( match != null ){
resultCollector.acceptMatch( match );
@ -451,6 +479,8 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
return oldScope;
}
private ISourceElementCallbackDelegate lastDeclaration;
private ICSearchPattern searchPattern;
private ICSearchResultCollector resultCollector;
private IProgressMonitor progressMonitor;

View file

@ -1,3 +1,14 @@
2003-09-11 Andrew Niefer
- bug42837 - fixed populating search dialog on function declarations
- modified determineInitValuesFrom in CSearchPage
- bug42829 - prepopulated search dialog to any element declarations
- modified trySimpleTextSelection in CSearchPage
- bug42815 - group together search results with same label
- modified GroupByKeyComputer to use Name, ParentName & Path in the group key
- modified CSearchResultCollector to properly use the GroupByKeyComputer
- modified CSearchResultLabelProvider to not display the "-" in the search label
while sorting by name if there is no parent.
2003-09-11 David Inglis
Deprecated

View file

@ -143,7 +143,7 @@ CSearchOperation.pluralReferencesPostfix={0} - {1} References in {2}
CSearchOperation.pluralReadReferencesPostfix={0} - {1} Read References in {2}
CSearchOperation.pluralWriteReferencesPostfix={0} - {1} Write References in {2}
CSearchOperation.pluralImplementorsPostfix={0} - {1} Implementors in {2}
CSearchOperation.pluralOccurencesPostfix={0} - {1} Occurrences in {2}
CSearchOperation.pluralOccurrencesPostfix={0} - {1} Occurrences in {2}
# The first argument will be replaced by the element name and the second one by the file name

View file

@ -102,16 +102,24 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
CSearchUtil.updateLRUWorkingSets(getContainer().getSelectedWorkingSets());
}
CSearchResultCollector collector= new CSearchResultCollector();
CSearchOperation op = null;
// if (data.cElement != null && getPattern().equals(fInitialData.pattern)) {
// op = new CSearchOperation(workspace, data.cElement, data.limitTo, scope, scopeDescription, collector);
// if (data.limitTo == ICSearchConstants.REFERENCES)
// CSearchUtil.warnIfBinaryConstant(data.cElement, getShell());
// } else {
data.cElement= null;
op = new CSearchOperation(workspace, data.pattern, data.isCaseSensitive, data.searchFor, data.limitTo, scope, scopeDescription, collector);
//}
CSearchResultCollector collector= new CSearchResultCollector();
List searching = null;
if( data.searchFor.contains( UNKNOWN_SEARCH_FOR ) ){
//UNKNOWN_SEARCH_FOR means search for anything, make a list with everything
searching = new LinkedList();
for( int i = 0; i < fSearchFor.length - 1; i++ ){
searching.add( fSearchForValues[ i ] );
}
} else {
searching = data.searchFor;
}
CSearchOperation op = new CSearchOperation(workspace, data.pattern, data.isCaseSensitive, searching, data.limitTo, scope, scopeDescription, collector);
try {
getContainer().getRunnableContext().run(true, true, op);
@ -320,10 +328,10 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
private List getSearchFor() {
List search = new LinkedList( );
boolean all = fSearchFor[ fSearchFor.length - 1 ].getSelection();
// boolean all = fSearchFor[ fSearchFor.length - 1 ].getSelection();
for (int i= 0; i < fSearchFor.length - 1; i++) {
if( fSearchFor[i].getSelection() || all )
for (int i= 0; i < fSearchFor.length; i++) {
if( fSearchFor[i].getSelection() /*|| all */)
search.add( fSearchForValues[i] );
}
@ -409,6 +417,9 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
fSearchFor[i].setEnabled( enabled );
}
if( !enabled )
fSearchFor[ fSearchFor.length - 1 ].setEnabled( true );
setLimitTo( fInitialData.searchFor );
for (int i = 0; i < fLimitTo.length; i++)
@ -438,8 +449,8 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
IWorkbenchAdapter adapter= (IWorkbenchAdapter)((IAdaptable)o).getAdapter( IWorkbenchAdapter.class );
if( adapter != null ){
List searchFor = new LinkedList();
searchFor.add( CLASS_STRUCT );
return new SearchPatternData( searchFor, REFERENCES, fIsCaseSensitive, adapter.getLabel(o), null );
searchFor.add( UNKNOWN_SEARCH_FOR );
return new SearchPatternData( searchFor, DECLARATIONS, fIsCaseSensitive, adapter.getLabel(o), null );
}
}
}
@ -465,8 +476,8 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
}
List searchFor = new LinkedList();
searchFor.add( CLASS_STRUCT );
result= new SearchPatternData( searchFor, REFERENCES, fIsCaseSensitive, text, null);
searchFor.add( UNKNOWN_SEARCH_FOR );
result= new SearchPatternData( searchFor, DECLARATIONS, fIsCaseSensitive, text, null);
}
return result;
}
@ -474,7 +485,7 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
private SearchPatternData getDefaultInitValues() {
List searchFor = new LinkedList();
searchFor.add( CLASS_STRUCT );
return new SearchPatternData( searchFor, REFERENCES, fIsCaseSensitive, "", null); //$NON-NLS-1$
return new SearchPatternData( searchFor, DECLARATIONS, fIsCaseSensitive, "", null); //$NON-NLS-1$
}
private String[] getPreviousSearchPatterns() {
@ -518,6 +529,7 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
boolean forceMethod = ( pattern.indexOf("::") != -1 );
switch ( element.getElementType() ){
case ICElement.C_FUNCTION_DECLARATION: /*fall through to function */
case ICElement.C_FUNCTION: if( forceMethod ) searchFor.add( METHOD );
else searchFor.add( FUNCTION );
break;
@ -527,6 +539,7 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
case ICElement.C_UNION: searchFor.add( UNION ); break;
case ICElement.C_ENUMERATOR: /* fall through to FIELD */
case ICElement.C_FIELD: searchFor.add( FIELD ); break;
case ICElement.C_METHOD_DECLARATION : /*fall through to METHOD */
case ICElement.C_METHOD: searchFor.add( METHOD ); break;
case ICElement.C_NAMESPACE: searchFor.add( NAMESPACE ); break;
}
@ -600,7 +613,7 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
private static List fgPreviousSearchPatterns = new ArrayList(20);
private Button[] fSearchFor;
private SearchFor[] fSearchForValues = { CLASS_STRUCT, FUNCTION, VAR, UNION, METHOD, FIELD, ENUM, NAMESPACE, null };
private SearchFor[] fSearchForValues = { CLASS_STRUCT, FUNCTION, VAR, UNION, METHOD, FIELD, ENUM, NAMESPACE, UNKNOWN_SEARCH_FOR };
private String[] fSearchForText= {
CSearchMessages.getString("CSearchPage.searchFor.classStruct"), //$NON-NLS-1$

View file

@ -23,6 +23,7 @@ import org.eclipse.cdt.ui.*;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.search.ui.IGroupByKeyComputer;
import org.eclipse.search.ui.ISearchResultView;
import org.eclipse.search.ui.SearchUI;
@ -57,6 +58,8 @@ public class CSearchResultCollector extends BasicSearchResultCollector{
CSearchResultLabelProvider labelProvider = new CSearchResultLabelProvider();
labelProvider.setOrder( CSearchResultLabelProvider.SHOW_PATH );
_computer = new GroupByKeyComputer();
if( _view != null ){
_view.searchStarted(
null,//new ActionGroupFactory(),
@ -66,7 +69,7 @@ public class CSearchResultCollector extends BasicSearchResultCollector{
CSearchPage.EXTENSION_POINT_ID,
labelProvider,
new GotoMarkerAction(),
new GroupByKeyComputer(),
_computer,
_operation
);
}
@ -87,8 +90,6 @@ public class CSearchResultCollector extends BasicSearchResultCollector{
IMarker marker = searchMatch.resource.createMarker( SearchUI.SEARCH_MARKER );
Object groupKey = match;
HashMap markerAttributes = new HashMap( 2 );
//we can hang any other info we want off the marker
@ -98,8 +99,9 @@ public class CSearchResultCollector extends BasicSearchResultCollector{
marker.setAttributes( markerAttributes );
if( _view != null )
_view.addMatch( searchMatch.name, groupKey, searchMatch.resource, marker );
if( _view != null ){
_view.addMatch( searchMatch.name, _computer.computeGroupByKey( marker ), searchMatch.resource, marker );
}
_matchCount++;
@ -152,5 +154,6 @@ public class CSearchResultCollector extends BasicSearchResultCollector{
private IProgressMonitor _monitor;
private CSearchOperation _operation;
private ISearchResultView _view;
private IGroupByKeyComputer _computer;
private int _matchCount;
}

View file

@ -42,6 +42,5 @@ public class GroupByKeyComputer implements IGroupByKeyComputer {
} catch (CoreException e) {
}
return match.getParentName();
}
return match.getParentName() + "::" + match.getName() + " - " + match.getLocation(); }
}

View file

@ -137,7 +137,11 @@ public class CSearchResultLabelProvider extends LabelProvider {
case SHOW_NAME_ONLY:
result = match.getName();
case SHOW_ELEMENT_CONTAINER:
if( !match.getParentName().equals("") )
result = match.getName() + " - " + match.getParentName() + " ( " + path + " )";
else
result = match.getName() + " ( " + path + " )";
break;
case SHOW_PATH:
result = path + " - " + match.getParentName()+ "::" + match.getName();