Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Search Patch

Patch for C++ Search to support searching for class declarations

Interface changes:
- modified search Interfaces : 
        - ICSearchConstants - changed SearchFor instantiations to more 
closely match what we can search for.
        - ICSearchPattern - added getLimitTo() 
        - ICSearchResultCollector - added createMatch(), which should 
return an object implementing the new IMatch interface, these store the 
any data needed to keep found matches.
  These interfaces are still new and its too early for anyone other than 
search and the indexer to be using them.
- added search interface IMatch.


Changes to core.search had to do with keeping track of the current scope 
during the search, as well as other modifications for matching class 
declarations, and the start of the patterns for matching other things.

Changes to ui.search had to do with creating IMatch objects to store the 
information needed by the label provider to display icons and sort the 
results.

see change logs for more details.

the attached icon file search_sortmatch.gif goes in 
org.eclipse.cdt.ui/icons/full/clcl16, it was part of an earlier patch but 
seems to have been missed.

-Andrew


Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.118
diff -u -r1.118 ChangeLog
--- ChangeLog	14 Jul 2003 15:34:57 -0000	1.118
+++ ChangeLog	14 Jul 2003 21:51:44 -0000
@@ -1,3 +1,9 @@
+2003-07-14 Andrew Niefer
+	-modified plugin.xml entry for search's PathNameSorter
+	-added src/org/eclipse/cdt/internal/ui/search/Match.java which implements IMatch to store 
+	 information used by CSearchResultLabelProvider
+	-Modified CSearchResultCollector and CSearchResultLabelProvider to use Match
+
 2003-07-11 Bogdan Gheorghe
 	Added new C/C++ Search menu item.
 	
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/plugin.xml,v
retrieving revision 1.33
diff -u -r1.33 plugin.xml
--- plugin.xml	14 Jul 2003 15:34:57 -0000	1.33
+++ plugin.xml	14 Jul 2003 21:51:44 -0000
@@ -973,8 +973,8 @@
             class="org.eclipse.cdt.internal.ui.search.ParentNameSorter"
             id="org.eclipse.search.internal.ui.ParentNameSorter">
       </sorter>
-      <sorter
-            pageId="org.eclipse.cdt.ui.JavaSearchPage"
+	<sorter
+            pageId="org.eclipse.cdt.ui.CSearchPage"
             label="%PathNameSorter.label"
             icon="icons/full/clcl16/search_sortmatch.gif"
             tooltip="%PathNameSorter.tooltip"
Index: icons/full/clcl16/search_sortmatch.gif
===================================================================
RCS file: icons/full/clcl16/search_sortmatch.gif
diff -N icons/full/clcl16/search_sortmatch.gif
Binary files /dev/null and search_sortmatch.gif differ
Index: src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties,v
retrieving revision 1.3
diff -u -r1.3 CSearchMessages.properties
--- src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties	4 Jul 2003 17:15:42 -0000	1.3
+++ src/org/eclipse/cdt/internal/ui/search/CSearchMessages.properties	14 Jul 2003 21:51:45 -0000
@@ -50,10 +50,11 @@
 
 CSearchPage.searchFor.label= Search For
 CSearchPage.searchFor.type= &Type
+CSearchPage.searchFor.namespace= N&amespace
 CSearchPage.searchFor.method= &Method
+CSearchPage.searchFor.function= F&unction
 CSearchPage.searchFor.field= &Field
-CSearchPage.searchFor.namespace= N&amespace
-CSearchPage.searchFor.constructor= Co&nstructor
+CSearchPage.searchFor.variable= &Variable
 
 CSearchPage.limitTo.label= Limit To
 CSearchPage.limitTo.declarations= Dec&larations
Index: src/org/eclipse/cdt/internal/ui/search/CSearchOperation.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchOperation.java,v
retrieving revision 1.3
diff -u -r1.3 CSearchOperation.java
--- src/org/eclipse/cdt/internal/ui/search/CSearchOperation.java	4 Jul 2003 17:15:42 -0000	1.3
+++ src/org/eclipse/cdt/internal/ui/search/CSearchOperation.java	14 Jul 2003 21:51:45 -0000
@@ -20,7 +20,9 @@
 import org.eclipse.cdt.core.search.ICSearchPattern;
 import org.eclipse.cdt.core.search.ICSearchScope;
 import org.eclipse.cdt.core.search.SearchEngine;
+import org.eclipse.cdt.internal.core.model.IWorkingCopy;
 import org.eclipse.cdt.internal.ui.CPluginImages;
+
 import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -63,7 +65,7 @@
 		throws CoreException, InvocationTargetException, InterruptedException 
 	{
 		_collector.setProgressMonitor( monitor );	
-	
+		IWorkingCopy copy = null;
 		SearchEngine engine = new SearchEngine( );
 		if( _elementPattern != null ){
 			engine.search( _workspace, _elementPattern, _limitTo, _scope, _collector );
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.4
diff -u -r1.4 CSearchPage.java
--- src/org/eclipse/cdt/internal/ui/search/CSearchPage.java	4 Jul 2003 17:15:42 -0000	1.4
+++ src/org/eclipse/cdt/internal/ui/search/CSearchPage.java	14 Jul 2003 21:51:45 -0000
@@ -25,7 +25,6 @@
 import org.eclipse.cdt.core.search.ICSearchConstants;
 import org.eclipse.cdt.core.search.ICSearchScope;
 import org.eclipse.cdt.core.search.SearchEngine;
-//import org.eclipse.cdt.core.search.SearchFor;
 import org.eclipse.cdt.ui.CUIPlugin;
 import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.runtime.IAdaptable;
@@ -271,20 +270,12 @@
 	private void setLimitTo( SearchFor searchFor ) {
 		HashSet set = new HashSet();
 		
-		if( searchFor == TYPE ){
-			set.add( DECLARATIONS );
-			set.add( REFERENCES );
-		} else if ( searchFor == FUNCTION || searchFor == CONSTRUCTOR ) {
-			set.add( DECLARATIONS );
+		if ( searchFor == FUNCTION || searchFor == METHOD ) {
 			set.add( DEFINITIONS );
-			//set.add( REFERENCES );
-		} else if( searchFor == NAMESPACE ) {
-			set.add( DECLARATIONS );
-			set.add( REFERENCES );
-		} else if( searchFor == MEMBER ) {
-			set.add( DECLARATIONS );
-			set.add( REFERENCES );
 		}
+		
+		set.add( DECLARATIONS );
+		set.add( REFERENCES );
 		set.add( ALL_OCCURRENCES );
 		
 		for( int i = 0; i < fLimitTo.length; i++ )
@@ -306,10 +297,10 @@
 		}
 
 		// Fill with dummy radio buttons
-		Button filler= new Button(result, SWT.RADIO);
-		filler.setVisible(false);
-		filler= new Button(result, SWT.RADIO);
-		filler.setVisible(false);
+		//Button filler= new Button(result, SWT.RADIO);
+		//filler.setVisible(false);
+		//filler= new Button(result, SWT.RADIO);
+		//filler.setVisible(false);
 
 		return result;		
 	}
@@ -567,13 +558,14 @@
 	private static List fgPreviousSearchPatterns = new ArrayList(20);
 
 	private Button[] fSearchFor;
-	private SearchFor[] fSearchForValues = { TYPE, FUNCTION, NAMESPACE, CONSTRUCTOR, MEMBER };
+	private SearchFor[] fSearchForValues = { TYPE, NAMESPACE, METHOD, FUNCTION, FIELD, VAR };
 	private String[] fSearchForText= {
 		CSearchMessages.getString("CSearchPage.searchFor.type"), //$NON-NLS-1$
-		CSearchMessages.getString("CSearchPage.searchFor.method"), //$NON-NLS-1$
 		CSearchMessages.getString("CSearchPage.searchFor.namespace"), //$NON-NLS-1$
-		CSearchMessages.getString("CSearchPage.searchFor.constructor"), //$NON-NLS-1$
-		CSearchMessages.getString("CSearchPage.searchFor.field")}; //$NON-NLS-1$
+		CSearchMessages.getString("CSearchPage.searchFor.method"), //$NON-NLS-1$
+		CSearchMessages.getString("CSearchPage.searchFor.function"),
+		CSearchMessages.getString("CSearchPage.searchFor.field"),
+		CSearchMessages.getString("CSearchPage.searchFor.variable") }; //$NON-NLS-1$
 		
 	private Button[] fLimitTo;
 	private LimitTo[] fLimitToValues = { DECLARATIONS, DEFINITIONS, REFERENCES, ALL_OCCURRENCES };
Index: src/org/eclipse/cdt/internal/ui/search/CSearchResultCollector.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultCollector.java,v
retrieving revision 1.3
diff -u -r1.3 CSearchResultCollector.java
--- src/org/eclipse/cdt/internal/ui/search/CSearchResultCollector.java	4 Jul 2003 17:15:42 -0000	1.3
+++ src/org/eclipse/cdt/internal/ui/search/CSearchResultCollector.java	14 Jul 2003 21:51:45 -0000
@@ -18,17 +18,28 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.parser.ast.ASTClassKind;
+import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
+import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
+import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
 import org.eclipse.cdt.core.search.ICSearchResultCollector;
+import org.eclipse.cdt.core.search.IMatch;
+import org.eclipse.cdt.internal.ui.CPluginImages;
+import org.eclipse.cdt.ui.CUIPlugin;
 import org.eclipse.core.resources.IMarker;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.search.ui.IActionGroupFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+//import org.eclipse.search.ui.IActionGroupFactory;
 import org.eclipse.search.ui.ISearchResultView;
 import org.eclipse.search.ui.SearchUI;
-import org.eclipse.ui.actions.ActionGroup;
+import org.eclipse.swt.graphics.Image;
+//import org.eclipse.ui.actions.ActionGroup;
 
 /**
  * @author aniefer
@@ -37,6 +48,9 @@
  * Window>Preferences>Java>Code Generation>Code and Comments
  */
 public class CSearchResultCollector implements ICSearchResultCollector {
+	
+	public static final String IMATCH = "IMatchObject";
+	
 	/**
 	 * 
 	 */
@@ -53,7 +67,7 @@
 		_matchCount = 0;
 		if( _view != null ){
 			_view.searchStarted(
-				new ActionGroupFactory(),
+				null,//new ActionGroupFactory(),
 				_operation.getSingularLabel(),
 				_operation.getPluralLabelPattern(),
 				_operation.getImageDescriptor(),
@@ -76,23 +90,26 @@
 		IResource resource,
 		int start,
 		int end,
-		ICElement enclosingElement,
+		IMatch enclosingObject,
 		int accuracy)
 		throws CoreException 
 	{
 		IMarker marker = resource.createMarker( SearchUI.SEARCH_MARKER );
 		
-		Object groupKey = enclosingElement;
+		Match match = (Match) enclosingObject;
+		
+		Object groupKey = match;
 		
 		HashMap markerAttributes = new HashMap( 2 );
 		
 		//we can hang any other info we want off the marker
 		markerAttributes.put( IMarker.CHAR_START, new Integer( Math.max( start, 0 ) ) );		
 		markerAttributes.put( IMarker.CHAR_END,   new Integer( Math.max( end, 0 ) ) );
+		markerAttributes.put( IMATCH, enclosingObject );
 		
 		marker.setAttributes( markerAttributes );
 		
-		_view.addMatch( enclosingElement.getElementName(), groupKey, resource, marker );
+		_view.addMatch( match.name, groupKey, resource, marker );
 		_matchCount++;
 	}
 
@@ -100,7 +117,7 @@
 		IPath path,
 		int start,
 		int end,
-		ICElement enclosingElement,
+		IMatch match,
 		int accuracy)
 		throws CoreException 
 	{
@@ -108,9 +125,49 @@
 			_matches = new HashSet();
 		}
 		
-		_matches.add( new Match( path.toString(), start, end ) );
+		_matches.add( match );
 	}
-	
+
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.search.ICSearchResultCollector#createMatch(org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement)
+	 */
+	public IMatch createMatch(IASTOffsetableNamedElement node, IASTScope parent ) {
+		String name = node.getName();
+		
+		String parentName = "";
+		if( parent instanceof IASTQualifiedNameElement ){
+			String [] names = ((IASTQualifiedNameElement)parent).getFullyQualifiedName();
+			for( int i = 0; i < names.length; i++ ){
+				if( i > 0 )
+					parentName += "::";
+					
+				parentName += names[ i ];
+			}
+		}
+		
+		ImageDescriptor imageDescriptor = null;
+		if( node instanceof IASTClassSpecifier ){
+			ASTClassKind kind = ((IASTClassSpecifier)node).getClassKind();
+			if( kind == ASTClassKind.CLASS ){
+				imageDescriptor = CPluginImages.DESC_OBJS_CLASS;
+			} else if ( kind == ASTClassKind.STRUCT ){
+				imageDescriptor = CPluginImages.DESC_OBJS_STRUCT;
+			} else if ( kind == ASTClassKind.UNION ){
+				imageDescriptor = CPluginImages.DESC_OBJS_UNION;
+			}
+		} else if ( node instanceof IASTNamespaceDefinition ){
+			imageDescriptor = CPluginImages.DESC_OBJS_CONTAINER;
+		} else if ( node instanceof IASTEnumerationSpecifier ){
+			imageDescriptor = CPluginImages.DESC_OBJS_ENUMERATION;
+		}
+		
+		Image image = CUIPlugin.getImageDescriptorRegistry().get( imageDescriptor );
+		IMatch match = new Match(name, parentName, image, node.getElementNameOffset(), name.length() );
+		
+		return match;
+	}
+		
 	/* (non-Javadoc)
 	 * @see org.eclipse.cdt.core.search.ICSearchResultCollector#done()
 	 */
@@ -153,13 +210,13 @@
 		return _matches;
 	}
 	
-	private class ActionGroupFactory implements IActionGroupFactory {
-		public ActionGroup createActionGroup( ISearchResultView part ){
-			return new CSearchViewActionGroup( part );
-		}
-	}
+	//private class ActionGroupFactory implements IActionGroupFactory {
+	//	public ActionGroup createActionGroup( ISearchResultView part ){
+	//		return new CSearchViewActionGroup( part );
+	//	}
+	//}
 	
-	public static class Match {
+	/*public static class Match impl{
 		public Match( String path, int start, int end ){
 			this.path = path;
 			this.start = start;
@@ -170,7 +227,7 @@
 		public int start;
 		public int end;
 	}
-		
+	*/	
 	private static final String SEARCHING = CSearchMessages.getString("CSearchResultCollector.searching"); //$NON-NLS-1$
 	private static final String MATCH     = CSearchMessages.getString("CSearchResultCollector.match"); //$NON-NLS-1$
 	private static final String MATCHES   = CSearchMessages.getString("CSearchResultCollector.matches"); //$NON-NLS-1$
@@ -183,4 +240,4 @@
 	private ISearchResultView 	_view;
 	private int					_matchCount;
 	private Set					_matches;
-}
+}
\ No newline at end of file
Index: src/org/eclipse/cdt/internal/ui/search/CSearchResultLabelProvider.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/CSearchResultLabelProvider.java,v
retrieving revision 1.1
diff -u -r1.1 CSearchResultLabelProvider.java
--- src/org/eclipse/cdt/internal/ui/search/CSearchResultLabelProvider.java	28 Jun 2003 19:56:52 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/search/CSearchResultLabelProvider.java	14 Jul 2003 21:51:45 -0000
@@ -13,11 +13,13 @@
  */
 package org.eclipse.cdt.internal.ui.search;
 
-import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.internal.ui.CElementImageProvider;
+import org.eclipse.cdt.ui.CElementLabelProvider;
 import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.search.ui.ISearchResultViewEntry;
-import org.eclipse.search.ui.SearchUI;
 import org.eclipse.swt.graphics.Image;
 
 /**
@@ -39,55 +41,70 @@
 	
 	public static final String POTENTIAL_MATCH = CSearchMessages.getString("CSearchResultLabelProvider.potentialMatch"); //$NON-NLS-1$
 
+	public CSearchResultLabelProvider(){
+		//_imageProvider = new CElementImageProvider();
+		//_labelProvider = new CElementLabelProvider();	
+	}
+	
 	public Image getImage( Object element ) {
-		return null;	
+		if( !( element instanceof ISearchResultViewEntry ) ){
+			return null;
+		}
+		
+		ISearchResultViewEntry viewEntry = (ISearchResultViewEntry)element;
+		IMarker marker = viewEntry.getSelectedMarker();
+		Match match = null;
+		try {
+			match = (Match) marker.getAttribute( CSearchResultCollector.IMATCH );
+		} catch (CoreException e) {
+			return null;
+		}
+	
+		return match.image;
 	}
 	
 	public String getText( Object element ) {
-		_lastMarker = null;
+		if( ! (element instanceof ISearchResultViewEntry ) ){
+			return null;
+		}
 		
-		ICElement cElement = getCElement( element );
+		ISearchResultViewEntry viewEntry = (ISearchResultViewEntry) element;
 		
-		boolean isPotentialMatch = _lastMarker != null && _lastMarker.getAttribute( SearchUI.POTENTIAL_MATCH, false );
+		IMarker marker = viewEntry.getSelectedMarker();
 		
-		if( cElement == null ){
-			if( _lastMarker != null ){
-				if( isPotentialMatch )
-					return super.getText( _lastMarker.getResource() ) + POTENTIAL_MATCH;
-				else 
-					return super.getText( _lastMarker.getResource() );
-			} else {
-				return "";
-			}
-		}
+		Match match = null;
 		
-		String text = "";
-		if( isPotentialMatch ){
-			text = CElementLabels.getTextLabel( element, _textFlags ) + POTENTIAL_MATCH;
-		} else {
-			text = CElementLabels.getTextLabel( element, _textFlags );
+		try {
+			match = (Match) marker.getAttribute(CSearchResultCollector.IMATCH);
+		} catch (CoreException e) {
+			return null;
 		}
-		//if( cElement instanceof )
 		
-		return element == null ? "" : element.toString();//$NON-NLS-1$	
-	}
-	
-	public void setOrder(int orderFlag) {
-		int flags = DEFAULT_TEXTFLAGS | CElementLabels.P_COMPRESSED;
+		IResource resource = marker.getResource();
+		
+		String result = null;
+		String path = (resource != null ) ? resource.getFullPath().toString() : "";
 		
-		switch( orderFlag ){
+		switch( getOrder() ){
 			case SHOW_ELEMENT_CONTAINER:
-				flags |= CElementLabels.ALL_POST_QUALIFIED | CElementLabels.M_PARAMETER_TYPES;
+				result = match.name + " - " + match.parent + " ( " + path + " )";
 				break;
 			case SHOW_PATH:
-				flags |= CElementLabels.PREPEND_ROOT_PATH;
-				/*fall through to SHOW_CONTAINER_ELEMENT*/
+				result = path + " - " + match.parent + "::" + match.name;
+				break;				
 			case SHOW_CONTAINER_ELEMENT:
-				flags |= CElementLabels.ALL_FULLY_QUALIFIED | CElementLabels.M_PARAMETER_TYPES;
+				result = match.parent + "::" + match.name + " ( " + path + " )";
 				break;
 		}
-			
-		_textFlags = flags;
+		
+		return result;
+	}
+	
+	public int getOrder(){
+		return _sortOrder;
+	}
+	public void setOrder(int orderFlag) {
+		_sortOrder = orderFlag;
 	}
 	
 	protected IMarker getMarker( Object o ){
@@ -98,35 +115,11 @@
 		return ( (ISearchResultViewEntry)o ).getSelectedMarker();
 	}
 	
-	private ICElement getCElement( Object o ){
-		if( o instanceof ICElement )
-			return (ICElement) o;
-
-		IMarker marker = getMarker( o );
-		if( marker == null )
-			return null;
-			
-		return getCElement( marker, (ISearchResultViewEntry) o );
-	}
-	
-	private ICElement getCElement( IMarker marker, ISearchResultViewEntry entry ) {
-		if( _lastMarker != marker ){
-			boolean canUseGroupByKey = false;
-			
-			if( canUseGroupByKey && entry.getGroupByKey() instanceof ICElement ){
-				_lastCElement = (ICElement) entry.getGroupByKey();
-			} else {
-				_lastCElement = CSearchUtil.getCElement( marker );
-			}
-			
-			_lastMarker = marker;
-		}
-		return _lastCElement;
-	}
 	
-	private IMarker _lastMarker;
-	private ICElement _lastCElement;
+	private CElementImageProvider _imageProvider;
+	private CElementLabelProvider _labelProvider;
 	
+	private int _sortOrder;
 	private int _textFlags;
 	private int _imageFlags;
 	
Index: src/org/eclipse/cdt/internal/ui/search/GroupByKeyComputer.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/GroupByKeyComputer.java,v
retrieving revision 1.1
diff -u -r1.1 GroupByKeyComputer.java
--- src/org/eclipse/cdt/internal/ui/search/GroupByKeyComputer.java	28 Jun 2003 19:56:52 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/search/GroupByKeyComputer.java	14 Jul 2003 21:51:45 -0000
@@ -13,8 +13,8 @@
  */
 package org.eclipse.cdt.internal.ui.search;
 
-import org.eclipse.cdt.core.model.ICElement;
 import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.search.ui.IGroupByKeyComputer;
 
 /**
@@ -34,37 +34,13 @@
 			return null;
 		}
 		
-	//	ICElement element = getCElement( marker );
-	//	if( element != null && element.exists() ){
-	//		return _lastHandle;
-	//	}
+		Match match = null;
 		
-		return null;
-	}
-	/*
-	private String getJavaElementHandleId(IMarker marker) {
 		try {
-			return (String)marker.getAttribute(ICSearchUIConstants.ATT_JE_HANDLE_ID);
-		} catch (CoreException ex) {
-			ExceptionHandler.handle(ex, CSearchMessages.getString("Search.Error.markerAttributeAccess.title"), CSearchMessages.getString("Search.Error.markerAttributeAccess.message")); //$NON-NLS-2$ //$NON-NLS-1$
-			return null;
+			match = (Match) marker.getAttribute(CSearchResultCollector.IMATCH);
+		} catch (CoreException e) {
 		}
+		
+		return match.parent;
 	}
-	
-	private ICElement getCElement( IMarker marker ){
-		String handle = getCElementHandleId( marker );
-		if( handle == null ){
-			_lastHandle = null;
-			_lastElement = null;
-			return null;
-		}
-		if( !handle.equals( _lastHandle ) ){
-			_lastElement = SearchUtil
-		}
-		return _lastElement;
-	}*/
-	
-	private String 	  _lastHandle = null;
-	private ICElement _lastElement = null;
-
 }
Index: src/org/eclipse/cdt/internal/ui/search/Match.java
===================================================================
RCS file: src/org/eclipse/cdt/internal/ui/search/Match.java
diff -N src/org/eclipse/cdt/internal/ui/search/Match.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/internal/ui/search/Match.java	14 Jul 2003 21:51:45 -0000
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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 Jul 10, 2003
+ */
+package org.eclipse.cdt.internal.ui.search;
+
+import org.eclipse.cdt.core.search.IMatch;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author aniefer
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class Match implements IMatch{
+
+	public String name;
+	public String parent;
+	public Image  image;
+	public int 	  start;
+	public int    end;
+	
+	public Match( String name, String parent, Image image, int start, int end ){
+		this.name = name;
+		this.parent = parent;
+		this.image = image;
+		this.start = start;
+		this.end = end;
+	}
+
+}
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.20
diff -u -r1.20 ChangeLog
--- ChangeLog	14 Jul 2003 14:04:21 -0000	1.20
+++ ChangeLog	14 Jul 2003 21:46:58 -0000
@@ -1,3 +1,9 @@
+2003-07-14 Andrew Niefer
+	Added search/ClassDeclarationPatternTests::testWildcardQualification() 
+	Added search/ClassDeclarationPatternTests::testElaboratedType() 
+	modified other ClassDeclarationPatternTests tests to use SearchEngine.createSearchPattern
+	modified contents of resources/search/classDecl.cpp
+
 2003-07-14 Victor Mozgin
 	Added failed tests that correspond to recently reported PRs.
 
Index: resources/search/classDecl.cpp
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp,v
retrieving revision 1.1
diff -u -r1.1 classDecl.cpp
--- resources/search/classDecl.cpp	4 Jul 2003 17:15:44 -0000	1.1
+++ resources/search/classDecl.cpp	14 Jul 2003 21:46:58 -0000
@@ -9,5 +9,10 @@
 	}
 	class B {
 		struct A {};
+		enum e {};
 	};
+	union u{ } ;
 }
+
+union u{
+};
\ No newline at end of file
Index: search/org/eclipse/cdt/core/search/tests/ClassDeclarationPatternTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/search/org/eclipse/cdt/core/search/tests/ClassDeclarationPatternTests.java,v
retrieving revision 1.3
diff -u -r1.3 ClassDeclarationPatternTests.java
--- search/org/eclipse/cdt/core/search/tests/ClassDeclarationPatternTests.java	7 Jul 2003 13:45:49 -0000	1.3
+++ search/org/eclipse/cdt/core/search/tests/ClassDeclarationPatternTests.java	14 Jul 2003 21:46:59 -0000
@@ -17,11 +17,14 @@
 import java.util.Set;
 
 import org.eclipse.cdt.core.search.ICSearchConstants;
+import org.eclipse.cdt.core.search.ICSearchPattern;
+import org.eclipse.cdt.core.search.SearchEngine;
 import org.eclipse.cdt.internal.core.search.CharOperation;
 import org.eclipse.cdt.internal.core.search.matching.CSearchPattern;
 import org.eclipse.cdt.internal.core.search.matching.ClassDeclarationPattern;
 import org.eclipse.cdt.internal.core.search.matching.MatchLocator;
 import org.eclipse.cdt.internal.ui.search.CSearchResultCollector;
+import org.eclipse.cdt.internal.ui.search.Match;
 import org.eclipse.core.runtime.Path;
 
 import junit.framework.TestCase;
@@ -42,7 +45,7 @@
 		super(name);
 	}
 	
-	private void initialize( CSearchPattern pattern ){
+	private void initialize( ICSearchPattern pattern ){
 		cppPath = org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile();
 		cppPath += "resources/search/classDecl.cpp";
 		
@@ -51,7 +54,7 @@
 	}
 	
 	public void testMatchSimpleDeclaration(){
-		CSearchPattern pattern = CSearchPattern.createPattern( "A", TYPE, DECLARATIONS, EXACT_MATCH, true );
+		ICSearchPattern pattern = SearchEngine.createSearchPattern( "A", TYPE, DECLARATIONS, true );
 
 		assertTrue( pattern instanceof ClassDeclarationPattern );
 		
@@ -64,7 +67,7 @@
 	}
 	
 	public void testMatchNamespaceNestedDeclaration(){
-		CSearchPattern pattern = CSearchPattern.createPattern( "NS::B", TYPE, DECLARATIONS, EXACT_MATCH, true );
+		ICSearchPattern pattern = SearchEngine.createSearchPattern( "NS::B", TYPE, DECLARATIONS, true );
 		
 		assertTrue( pattern instanceof ClassDeclarationPattern );
 		
@@ -83,7 +86,7 @@
 	}
 	
 	public void testBug39652() {
-		CSearchPattern pattern = CSearchPattern.createPattern( "A::B", TYPE, DECLARATIONS, EXACT_MATCH, true );
+		ICSearchPattern pattern = SearchEngine.createSearchPattern( "A::B", TYPE, DECLARATIONS, true );
 		
 		initialize( pattern );
 		matchLocator.locateMatches( new String[] { cppPath }, null, null );
@@ -92,21 +95,21 @@
 		assertTrue( matches != null );
 		assertTrue( matches.size() == 1 );
 				
-		pattern = CSearchPattern.createPattern( "NS::NS2::a", TYPE, DECLARATIONS, EXACT_MATCH, true );
+		pattern = SearchEngine.createSearchPattern( "NS::NS2::a", TYPE, DECLARATIONS, true );
 		initialize( pattern );
 		matchLocator.locateMatches( new String[] { cppPath }, null, null );
 		matches = resultCollector.getMatches();
 		assertTrue( matches != null );
 		
-		pattern = CSearchPattern.createPattern( "NS::B::A", TYPE, DECLARATIONS, EXACT_MATCH, true );
+		pattern = SearchEngine.createSearchPattern( "NS::B::A", TYPE, DECLARATIONS, true );
 		initialize( pattern );
 		matchLocator.locateMatches( new String[] { cppPath }, null, null );
 		matches = resultCollector.getMatches();
 		assertTrue( matches != null );
 	}
 	
-	public void failingtestMatchStruct(){
-		CSearchPattern pattern = CSearchPattern.createPattern( "A", STRUCT, DECLARATIONS, EXACT_MATCH, true );
+	public void testMatchStruct(){
+		ICSearchPattern pattern = SearchEngine.createSearchPattern( "A", STRUCT, DECLARATIONS, true );
 		
 		assertTrue( pattern instanceof ClassDeclarationPattern );
 		
@@ -119,7 +122,7 @@
 		Set matches = resultCollector.getMatches();
 		assertEquals( matches.size(), 1 );
 		
-		pattern = CSearchPattern.createPattern( "NS::B::A", TYPE, DECLARATIONS, EXACT_MATCH, true );
+		pattern = SearchEngine.createSearchPattern( "NS::B::A", TYPE, DECLARATIONS, true );
 		
 		initialize( pattern );
 		matchLocator.locateMatches( new String[] { cppPath }, null, null );
@@ -131,12 +134,48 @@
 		Iterator iter = matches.iterator();
 		Iterator iter2 = matches2.iterator();
 		
-		CSearchResultCollector.Match match = (CSearchResultCollector.Match)iter.next();
-		CSearchResultCollector.Match match2 = (CSearchResultCollector.Match)iter2.next();
+		Match match = (Match)iter.next();
+		Match match2 = (Match)iter2.next();
 		
-		assertTrue( match.path.equals( match2.path ) );
+		//assertTrue( match.path.equals( match2.path ) );
 		assertEquals( match.start, match2.start );
 		assertEquals( match.end, match2.end );
+	}
+	
+	public void testWildcardQualification() {
+		ICSearchPattern pattern = SearchEngine.createSearchPattern( "::*::A", TYPE, DECLARATIONS, true );
+		initialize( pattern );
+		matchLocator.locateMatches( new String [] { cppPath }, null, null );
+		
+		Set matches = resultCollector.getMatches();
+		assertEquals( matches, null );
+		
+		pattern = SearchEngine.createSearchPattern( "NS::*::A", TYPE, DECLARATIONS, false );
+		initialize( pattern );
+		matchLocator.locateMatches( new String [] { cppPath }, null, null );
+		
+		matches = resultCollector.getMatches();
+		assertEquals( matches.size(), 2 );
+	}
+	
+	public void testElaboratedType(){
+		ICSearchPattern pattern = SearchEngine.createSearchPattern( "struct A", TYPE, DECLARATIONS, true );
+		initialize( pattern );
+		matchLocator.locateMatches( new String [] { cppPath }, null, null );
+		Set matches = resultCollector.getMatches();
+		assertEquals( matches.size(), 1 );
+		
+		pattern = SearchEngine.createSearchPattern( "union u", TYPE, DECLARATIONS, true );
+		initialize( pattern );
+		matchLocator.locateMatches( new String [] { cppPath }, null, null );
+		matches = resultCollector.getMatches();
+		assertEquals( matches.size(), 2 );
+
+		pattern = SearchEngine.createSearchPattern( "union ::*::u", TYPE, DECLARATIONS, true );
+		initialize( pattern );
+		matchLocator.locateMatches( new String [] { cppPath }, null, null );
+		matches = resultCollector.getMatches();
+		assertEquals( matches.size(), 1 );
 	}
 	
 }
Index: search/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/ChangeLog,v
retrieving revision 1.4
diff -u -r1.4 ChangeLog
--- search/ChangeLog	11 Jul 2003 22:12:35 -0000	1.4
+++ search/ChangeLog	14 Jul 2003 21:44:13 -0000
@@ -1,3 +1,19 @@
+2003-07-14 Andrew Niefer
+	-Modified SearchFor instances in ICSearchConstants to more closely match what we are searching for
+	-added IMatch interface, it represents matches found by the search engine, implementors can store
+	 whatever information they like, see ICSearchResultCollector::createMatch
+	-added createMatch to the ICSearchResultCollector interface, the result collector is responsible for
+	 implementing IMatch to store whatever data they want out of the AST nodes.
+	-added skeleton patterns:
+		search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java
+		search/org/eclipse/cdt/internal/core/search/matching/FunctionDeclarationPattern.java
+		search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java
+		search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java
+		search/org/eclipse/cdt/internal/core/search/matching/VariableDeclarationPattern.java
+	-added beginnings of CSearchPattern::create*Pattern functions
+	-modifications to MatchLocator to keep track of current scope
+	-added CSearchPattern::matchQualifications
+	
 2003-07-10 Bogdan Gheorghe
 	Provided implementation for ICSearchScope.java, CSearchScope.java
 	
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.3
diff -u -r1.3 ICSearchConstants.java
--- search/org/eclipse/cdt/core/search/ICSearchConstants.java	4 Jul 2003 17:15:41 -0000	1.3
+++ search/org/eclipse/cdt/core/search/ICSearchConstants.java	14 Jul 2003 21:44:13 -0000
@@ -54,14 +54,14 @@
 	public static final SearchFor NAMESPACE = new SearchFor( 2 );
 	
 	/**
-	 * The searched element is a constructor.
+	 * The searched element is a method (member function).
 	 */
-	public static final SearchFor CONSTRUCTOR = new SearchFor( 3 );
+	public static final SearchFor METHOD = new SearchFor( 3 );
 
 	/**
-	 * The searched element is a member.
+	 * The searched element is a field (member variable).
      */
-	public static final SearchFor MEMBER = new SearchFor( 4 );
+	public static final SearchFor FIELD = new SearchFor( 4 );
 	
 	/**
 	 * The searched element is a variable.
Index: search/org/eclipse/cdt/core/search/ICSearchPattern.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchPattern.java,v
retrieving revision 1.2
diff -u -r1.2 ICSearchPattern.java
--- search/org/eclipse/cdt/core/search/ICSearchPattern.java	28 Jun 2003 19:56:54 -0000	1.2
+++ search/org/eclipse/cdt/core/search/ICSearchPattern.java	14 Jul 2003 21:44:13 -0000
@@ -21,7 +21,7 @@
  * To change the template for this generated type comment go to
  * Window>Preferences>Java>Code Generation>Code and Comments
  */
-public interface ICSearchPattern {
+public interface ICSearchPattern extends ICSearchConstants{
 
 	public static final int IMPOSSIBLE_MATCH = 0;
 	public static final int POSSIBLE_MATCH   = 1;
@@ -34,4 +34,5 @@
 	 */
 	int matchLevel( IASTOffsetableElement node );
 	
+	LimitTo   getLimitTo();
 }
Index: search/org/eclipse/cdt/core/search/ICSearchResultCollector.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/core/search/ICSearchResultCollector.java,v
retrieving revision 1.3
diff -u -r1.3 ICSearchResultCollector.java
--- search/org/eclipse/cdt/core/search/ICSearchResultCollector.java	4 Jul 2003 17:15:41 -0000	1.3
+++ search/org/eclipse/cdt/core/search/ICSearchResultCollector.java	14 Jul 2003 21:44:13 -0000
@@ -14,6 +14,8 @@
 package org.eclipse.cdt.core.search;
 
 import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
@@ -50,9 +52,9 @@
 	 * @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 enclosingElement the Java element that contains the character range
+	 * @param enclosingObject an object that contains the character range
 	 *	<code>[start, end]</code>; the value can be <code>null</code> indicating that
-	 *	no enclosing Java element has been found
+	 *	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
@@ -61,7 +63,7 @@
 		IResource resource,
 		int start,
 		int end,
-		ICElement enclosingElement,
+		IMatch enclosingObject,
 		int accuracy)
 		throws CoreException;
 		
@@ -85,7 +87,16 @@
 	public void accept(IPath currentPath, 
 					   int start, 
 					   int end, 
-					   ICElement enclosingElement, 
+					   IMatch enclosingObject, 
 					   int accuracyLevel) throws CoreException;
 
+	/**
+	 * returns an IMatch object that contains any information the client cared
+	 * to extract from the IAST node.  
+	 * Note that clients should not reference information in the node itself so 
+	 * that it can be garbage collected 
+	 * @param node
+	 * @return
+	 */
+	public IMatch createMatch(IASTOffsetableNamedElement node, IASTScope parent );
 }
Index: search/org/eclipse/cdt/core/search/IMatch.java
===================================================================
RCS file: search/org/eclipse/cdt/core/search/IMatch.java
diff -N search/org/eclipse/cdt/core/search/IMatch.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ search/org/eclipse/cdt/core/search/IMatch.java	14 Jul 2003 21:44:13 -0000
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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 Jul 10, 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
+ */
+public interface IMatch {
+
+}
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.7
diff -u -r1.7 CSearchPattern.java
--- search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java	11 Jul 2003 22:12:35 -0000	1.7
+++ search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java	14 Jul 2003 21:44:14 -0000
@@ -52,9 +52,14 @@
 	 * @param matchMode
 	 * @param caseSensitive
 	 */
-	public CSearchPattern(int matchMode, boolean caseSensitive) {
+	public CSearchPattern(int matchMode, boolean caseSensitive, LimitTo limitTo ) {
 		_matchMode = matchMode;
 		_caseSensitive = caseSensitive;
+		_limitTo = limitTo;
+	}
+	
+	public LimitTo getLimitTo(){
+		return _limitTo;
 	}
 
 	public CSearchPattern() {
@@ -69,14 +74,18 @@
 		CSearchPattern pattern = null;
 		if( searchFor == TYPE || searchFor == CLASS || searchFor == STRUCT || searchFor == ENUM || searchFor == UNION ){
 			pattern = createClassPattern( patternString, searchFor, limitTo, matchMode, caseSensitive );
-		} else if ( searchFor == MEMBER ){
-			//	pattern = createMethodPattern( patternString, limitTo, matchMode, caseSensitive );
-		} else if ( searchFor == CONSTRUCTOR ){
-			pattern = createConstructorPattern( patternString, limitTo, matchMode, caseSensitive );
-		}
-			//case ICSearchConstants.FIELD:
-			//	pattern = createFieldPattern( patternString, limitTo, matchMode, caseSensitive );
-			//	break;
+		} else if ( searchFor == METHOD ){
+			pattern = createMethodPattern( patternString, limitTo, matchMode, caseSensitive );
+		} else if ( searchFor == FIELD){
+			pattern = createFieldPattern( patternString, limitTo, matchMode, caseSensitive );
+		} else if ( searchFor == VAR ){
+			pattern = createVariablePattern( patternString, limitTo, matchMode, caseSensitive );
+		} else if ( searchFor == FUNCTION ){
+			pattern = createFunctionPattern( patternString, limitTo, matchMode, caseSensitive );
+		} else if ( searchFor == NAMESPACE ){
+			pattern = createNamespacePattern( patternString, limitTo, matchMode, caseSensitive );
+		}
+	
 		return pattern;
 	}
 
@@ -87,7 +96,24 @@
 	 * @param caseSensitive
 	 * @return
 	 */
-	private static CSearchPattern createFieldPattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) {
+	private static CSearchPattern createNamespacePattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) {
+		IScanner scanner = ParserFactory.createScanner( new StringReader( patternString ), "TEXT", new ScannerInfo(), ParserMode.QUICK_PARSE );
+		LinkedList list = scanForNames( scanner, null );
+		
+		char [] name = (char []) list.removeLast();
+		char [][] qualifications = new char [0][];
+		
+		return new NamespaceDeclarationPattern( name, (char[][]) list.toArray( qualifications ), matchMode, limitTo, caseSensitive );
+	}
+
+	/**
+	 * @param patternString
+	 * @param limitTo
+	 * @param matchMode
+	 * @param caseSensitive
+	 * @return
+	 */
+	private static CSearchPattern createFunctionPattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) {
 		// TODO Auto-generated method stub
 		return null;
 	}
@@ -99,7 +125,7 @@
 	 * @param caseSensitive
 	 * @return
 	 */
-	private static CSearchPattern createMethodPattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) {
+	private static CSearchPattern createVariablePattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) {
 		// TODO Auto-generated method stub
 		return null;
 	}
@@ -111,11 +137,28 @@
 	 * @param caseSensitive
 	 * @return
 	 */
-	private static CSearchPattern createConstructorPattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) {
-		// TODO Auto-generated method stub
+	private static CSearchPattern createFieldPattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) {
+		IScanner scanner = ParserFactory.createScanner( new StringReader( patternString ), "TEXT", new ScannerInfo(), ParserMode.QUICK_PARSE );
+		LinkedList list = scanForNames( scanner, null );
+		
+		char [] name = (char []) list.removeLast();
+		char [][] qualifications = new char[0][];
+		
+		return new FieldDeclarationPattern( name, (char[][]) list.toArray( qualifications ), matchMode, limitTo, caseSensitive );
+	}
+
+	/**
+	 * @param patternString
+	 * @param limitTo
+	 * @param matchMode
+	 * @param caseSensitive
+	 * @return
+	 */
+	private static CSearchPattern createMethodPattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) {
 		return null;
 	}
 
+
 	/**
 	 * @param patternString
 	 * @param limitTo
@@ -126,41 +169,81 @@
 	private static CSearchPattern createClassPattern(String patternString, SearchFor searchFor, LimitTo limitTo, int matchMode, boolean caseSensitive) {
 		IScanner scanner = ParserFactory.createScanner( new StringReader( patternString ), "TEXT", new ScannerInfo(), ParserMode.QUICK_PARSE );
 		
-		LinkedList list  = new LinkedList();
-		IToken 	   token = null;
-		String 	   name  = new String("");
+		IToken token = null;
+		ASTClassKind kind = null;
 		
 		try {
+			token = scanner.nextToken();
+		} catch (EndOfFile e) {
+		} catch (ScannerException e) {
+		}
+		
+		if( token != null ){
+			if( token.getType() == IToken.t_class ){
+				kind = ASTClassKind.CLASS;
+			} else if ( token.getType() == IToken.t_struct ){
+				kind = ASTClassKind.STRUCT;
+			} else if ( token.getType() == IToken.t_union ){
+				kind = ASTClassKind.UNION;
+			} else if ( token.getType() == IToken.t_enum ){
+				kind = ASTClassKind.ENUM;
+			}
+			if( kind != null ){
+				token = null;
+			} else {
+				if( searchFor == CLASS ){
+					kind = ASTClassKind.CLASS;
+				} else if( searchFor == STRUCT ) {
+					kind = ASTClassKind.STRUCT;
+				} else if ( searchFor == ENUM ) {
+					kind = ASTClassKind.ENUM;
+				} else if ( searchFor == UNION ) {
+					kind = ASTClassKind.UNION;
+				}		
+			}
+		}
+			
+		LinkedList list = scanForNames( scanner, token );
+		
+		char[] name = (char [])list.removeLast();
+		char [][] qualifications = new char[0][];
+		
+		return new ClassDeclarationPattern( name, (char[][])list.toArray( qualifications ), kind, matchMode, limitTo, caseSensitive );
+	}
+	
+	static private LinkedList scanForNames( IScanner scanner, IToken unusedToken ){
+		LinkedList list = new LinkedList();
+		
+		String name  = new String("");
+		
+		try {
+			IToken token = ( unusedToken != null ) ? unusedToken : scanner.nextToken();
+			
 			while( true ){
-				token = scanner.nextToken();
-				
 				switch( token.getType() ){
 					case IToken.tCOLONCOLON :
 						list.addLast( name.toCharArray() );
 						name = new String("");
 						break;
 					default:
+						if( token.getType() != IToken.tSTAR &&
+							token.getType() != IToken.tQUESTION &&
+							name.length() > 0 )
+						{
+							name += " ";
+						}
 						name += token.getImage();
 						break;
 				}
+				
+				token = scanner.nextToken();
 			}
 		} catch (EndOfFile e) {	
+			list.addLast( name.toCharArray() );
 		} catch (ScannerException e) {
 		}
 		
-		ASTClassKind kind = null;
-		if( searchFor == CLASS ){
-			kind = ASTClassKind.CLASS;
-		} else if( searchFor == STRUCT ) {
-			kind = ASTClassKind.STRUCT;
-		} else if ( searchFor == ENUM ) {
-			kind = ASTClassKind.ENUM;
-		} else if ( searchFor == UNION ) {
-			kind = ASTClassKind.UNION;
-		}
-
-		char [][] qualifications = new char[0][];
-		return new ClassDeclarationPattern( name.toCharArray(), (char[][])list.toArray( qualifications ), kind, matchMode, caseSensitive );
+		return list;	
 	}
 	
 	protected boolean matchesName( char[] pattern, char[] name ){
@@ -185,6 +268,32 @@
 		return false;
 	}
 	
+	protected boolean matchQualifications( char[][] qualifications, String [] fullyQualifiedName ){
+		
+		int qualLen = qualifications != null ? qualifications.length : 0;
+		int fullLen = fullyQualifiedName != null ? fullyQualifiedName.length : 0;
+		
+		if( qualLen == 0 ){
+			return true;
+		}
+		
+		int root = ( qualifications[0].length == 0 ) ? 1 : 0;
+		
+		if( (root == 1 && fullLen - 1 != qualLen - 1 ) ||
+			(root == 0 && fullLen - 1 < qualLen ) )
+		{
+			return false;
+		}
+		
+		for( int i = 1; i <= qualLen - root; i++ ){
+			if( !matchesName( qualifications[ qualLen - i - root ], fullyQualifiedName[ fullLen - i - 1 ].toCharArray() ) ){
+				return false;		
+			}
+		}
+		
+		return true;
+	}
+
     /**
 	* Query a given index for matching entries. 
 	*/
@@ -208,7 +317,10 @@
 	   if (progressMonitor != null && progressMonitor.isCanceled()) throw new OperationCanceledException();
 	
 	   /* narrow down a set of entries using prefix criteria */
-	   IEntryResult[] entries = input.queryEntriesPrefixedBy(indexEntryPrefix());
+		char [] prefix = indexEntryPrefix();
+		if( prefix == null ) return;
+		
+	   IEntryResult[] entries = input.queryEntriesPrefixedBy( prefix );
 	   if (entries == null) return;
 	
 	   /* only select entries which actually match the entire search pattern */
@@ -247,4 +359,5 @@
    
 	protected int 		_matchMode;
 	protected boolean 	_caseSensitive;
+	protected LimitTo   _limitTo;
 }
Index: search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java,v
retrieving revision 1.5
diff -u -r1.5 ClassDeclarationPattern.java
--- search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java	11 Jul 2003 22:12:35 -0000	1.5
+++ search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java	14 Jul 2003 21:44:14 -0000
@@ -17,7 +17,9 @@
 
 import org.eclipse.cdt.core.parser.ast.ASTClassKind;
 import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
+import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
 import org.eclipse.cdt.core.parser.ast.IASTOffsetableElement;
+import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
 import org.eclipse.cdt.core.search.ICSearchScope;
 import org.eclipse.cdt.internal.core.index.IEntryResult;
 import org.eclipse.cdt.internal.core.index.impl.IndexInput;
@@ -26,6 +28,7 @@
 import org.eclipse.cdt.internal.core.search.IIndexSearchRequestor;
 import org.eclipse.cdt.internal.core.search.indexing.AbstractIndexer;
 
+
 /**
  * @author aniefer
  */
@@ -33,11 +36,12 @@
 public class ClassDeclarationPattern extends CSearchPattern {
 
 	public ClassDeclarationPattern( int matchMode, boolean caseSensitive ){
-		super( matchMode, caseSensitive );
+		super( matchMode, caseSensitive, DECLARATIONS );
 	}
 	
-	public ClassDeclarationPattern( char[] name, char[][] containers, ASTClassKind kind, int mode, boolean caseSensitive ){
-		super( mode, caseSensitive );
+	public ClassDeclarationPattern( char[] name, char[][] containers, ASTClassKind kind, int mode, LimitTo limit, boolean caseSensitive ){
+		super( mode, caseSensitive, limit );
+		
 		simpleName = caseSensitive ? name : CharOperation.toLowerCase( name );
 		if( caseSensitive || containers == null ){
 			containingTypes = containers;
@@ -48,41 +52,45 @@
 				this.containingTypes[i] = CharOperation.toLowerCase( containers[i] );
 			}
 		} 
+		
 		classKind = kind;
+		limitTo = limit;
 	}
 	
 	public int matchLevel( IASTOffsetableElement node ){
-		if( !( node instanceof IASTClassSpecifier ) )
+		
+		if( !( node instanceof IASTClassSpecifier ) && !( node instanceof IASTEnumerationSpecifier ) )
 			return IMPOSSIBLE_MATCH;
-			
-		IASTClassSpecifier clsSpec = (IASTClassSpecifier) node;
-		String nodeName = clsSpec.getName();
+		
+		String nodeName = ((IASTOffsetableNamedElement)node).getName();
 		
 		//check name, if simpleName == null, its treated the same as "*"	
-		if( simpleName != null && !matchesName( simpleName, clsSpec.getName().toCharArray() ) ){
+		if( simpleName != null && !matchesName( simpleName, nodeName.toCharArray() ) ){
 			return IMPOSSIBLE_MATCH;
 		}
+
+		String [] fullyQualifiedName = null;
+		
+		if( node instanceof IASTClassSpecifier ){
+			IASTClassSpecifier clsSpec = (IASTClassSpecifier) node;
+			fullyQualifiedName = clsSpec.getFullyQualifiedName();		
+		} else {
+			//TODO fully qualified names for enums
+		}
 		
 		//check containing scopes
-		String [] qualifications = clsSpec.getFullyQualifiedName();
-		if( qualifications != null ){
-			
-			int size = containingTypes.length;
-			if( qualifications.length < size )
-				return IMPOSSIBLE_MATCH;
-				
-			for( int i = 0; i < containingTypes.length; i++ ){
-				if( !matchesName( containingTypes[i], qualifications[i].toCharArray() ) ){
-					return IMPOSSIBLE_MATCH;
-				}
-			}
-		} else if( containingTypes.length > 0 ) {
+		if( !matchQualifications( containingTypes, fullyQualifiedName ) ){
 			return IMPOSSIBLE_MATCH;
 		}
 		
 		//check type
-		if( classKind != null && classKind != clsSpec.getClassKind() ){
-			return IMPOSSIBLE_MATCH;
+		if( classKind != null ){
+			if( node instanceof IASTClassSpecifier ){
+				IASTClassSpecifier clsSpec = (IASTClassSpecifier) node;
+				return ( classKind == clsSpec.getClassKind() ) ? ACCURATE_MATCH : IMPOSSIBLE_MATCH;
+			} else {
+				return ( classKind == ASTClassKind.ENUM ) ? ACCURATE_MATCH : IMPOSSIBLE_MATCH;
+			}
 		}
 		
 		return ACCURATE_MATCH;
@@ -94,10 +102,14 @@
 	public char[] [] getContainingTypes () {
 		return containingTypes;
 	}
-	
+	public ASTClassKind getKind(){
+		return classKind;
+	}
+
 	private char[] 	  simpleName;
 	private char[][]  containingTypes;
 	private ASTClassKind classKind;
+	private LimitTo	  limitTo;
 	
 	protected char[] decodedSimpleName;
 	private char[][] decodedContainingTypes;
Index: search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java
===================================================================
RCS file: search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java
diff -N search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java	14 Jul 2003 21:44:14 -0000
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * 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 Jul 11, 2003
+ */
+package org.eclipse.cdt.internal.core.search.matching;
+
+
+/**
+ * @author aniefer
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class FieldDeclarationPattern extends VariableDeclarationPattern {
+
+	/**
+	 * @param name
+	 * @param cs
+	 * @param matchMode
+	 * @param limitTo
+	 * @param caseSensitive
+	 */
+	public FieldDeclarationPattern(char[] name, char[][] cs, int matchMode, LimitTo limitTo, boolean caseSensitive) {
+		super( name, matchMode, limitTo, caseSensitive );
+		// TODO Auto-generated constructor stub
+	}
+
+}
Index: search/org/eclipse/cdt/internal/core/search/matching/FunctionDeclarationPattern.java
===================================================================
RCS file: search/org/eclipse/cdt/internal/core/search/matching/FunctionDeclarationPattern.java
diff -N search/org/eclipse/cdt/internal/core/search/matching/FunctionDeclarationPattern.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ search/org/eclipse/cdt/internal/core/search/matching/FunctionDeclarationPattern.java	14 Jul 2003 21:44:14 -0000
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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 Jul 11, 2003
+ */
+package org.eclipse.cdt.internal.core.search.matching;
+
+import java.io.IOException;
+
+import org.eclipse.cdt.core.parser.ast.IASTOffsetableElement;
+import org.eclipse.cdt.core.search.ICSearchScope;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+import org.eclipse.cdt.internal.core.index.impl.IndexInput;
+import org.eclipse.cdt.internal.core.search.IIndexSearchRequestor;
+
+/**
+ * @author aniefer
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class FunctionDeclarationPattern extends CSearchPattern {
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.search.ICSearchPattern#matchLevel(org.eclipse.cdt.core.parser.ast.IASTOffsetableElement)
+	 */
+	public int matchLevel(IASTOffsetableElement node) {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#feedIndexRequestor(org.eclipse.cdt.internal.core.search.IIndexSearchRequestor, int, int[], org.eclipse.cdt.internal.core.index.impl.IndexInput, org.eclipse.cdt.core.search.ICSearchScope)
+	 */
+	public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, IndexInput input, ICSearchScope scope) throws IOException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#decodeIndexEntry(org.eclipse.cdt.internal.core.index.IEntryResult)
+	 */
+	protected void decodeIndexEntry(IEntryResult entryResult) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#indexEntryPrefix()
+	 */
+	public char[] indexEntryPrefix() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#matchIndexEntry()
+	 */
+	protected boolean matchIndexEntry() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+}
Index: search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java,v
retrieving revision 1.6
diff -u -r1.6 MatchLocator.java
--- search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java	9 Jul 2003 00:47:42 -0000	1.6
+++ search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java	14 Jul 2003 21:44:14 -0000
@@ -27,6 +27,7 @@
 import org.eclipse.cdt.core.parser.ISourceElementRequestor;
 import org.eclipse.cdt.core.parser.ParserFactory;
 import org.eclipse.cdt.core.parser.ParserMode;
+import org.eclipse.cdt.core.parser.ast.ASTClassKind;
 import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
 import org.eclipse.cdt.core.parser.ast.IASTClassReference;
 import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
@@ -42,6 +43,7 @@
 import org.eclipse.cdt.core.parser.ast.IASTMethod;
 import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
 import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
 import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
 import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
 import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
@@ -49,6 +51,7 @@
 import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
 import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
 import org.eclipse.cdt.core.parser.ast.IASTVariable;
+import org.eclipse.cdt.core.search.ICSearchConstants;
 import org.eclipse.cdt.core.search.ICSearchPattern;
 import org.eclipse.cdt.core.search.ICSearchResultCollector;
 import org.eclipse.cdt.core.search.ICSearchScope;
@@ -71,7 +74,7 @@
  * To change the template for this generated type comment go to
  * Window>Preferences>Java>Code Generation>Code and Comments
  */
-public class MatchLocator implements ISourceElementRequestor {
+public class MatchLocator implements ISourceElementRequestor, ICSearchConstants {
 
 	
 	/**
@@ -94,28 +97,79 @@
 	public void acceptASMDefinition(IASTASMDefinition asmDefinition) 			{	}
 	public void acceptTypedef(IASTTypedef typedef) 								{	}
 	public void acceptEnumerator(IASTEnumerator enumerator) 					{	}
-	public void acceptEnumerationSpecifier(IASTEnumerationSpecifier enumeration){	}
+	
+	public void acceptEnumerationSpecifier(IASTEnumerationSpecifier enumeration){
+		if( searchPattern.getLimitTo() == DECLARATIONS || searchPattern.getLimitTo() == ALL_OCCURRENCES ){
+			if( searchPattern instanceof ClassDeclarationPattern ){
+				ClassDeclarationPattern classPattern = (ClassDeclarationPattern)searchPattern;
+				if( classPattern.getKind() == null || classPattern.getKind() == ASTClassKind.ENUM ){
+					int level = searchPattern.matchLevel( enumeration ); 
+					if(  level != ICSearchPattern.IMPOSSIBLE_MATCH ){
+						report( enumeration, level );				
+					}
+				}
+			}
+		}
+	}	
+	
 	public void acceptClassReference(IASTClassReference reference) {	}
 	public void acceptElaboratedTypeSpecifier(IASTElaboratedTypeSpecifier elaboratedTypeSpec){  }
 	public void acceptMethodDeclaration(IASTMethod method) 						{	}
 	public void acceptField(IASTField field) 									{	}
-	public void enterFunctionBody(IASTFunction function) 						{	}
-	public void enterCompilationUnit(IASTCompilationUnit compilationUnit) 		{	}
-	public void enterNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) 		{	}
+	
+	public void enterFunctionBody(IASTFunction function){
+		pushScope( function );
+	}
+	
+	public void enterCompilationUnit(IASTCompilationUnit compilationUnit) {
+		pushScope( compilationUnit );
+	}
+	
+	public void enterNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) {
+		if( searchPattern.getLimitTo() == DECLARATIONS || searchPattern.getLimitTo() == ALL_OCCURRENCES ){
+			if( searchPattern instanceof NamespaceDeclarationPattern ){
+				int level = searchPattern.matchLevel( namespaceDefinition ); 
+				if(  level != ICSearchPattern.IMPOSSIBLE_MATCH ){
+					report( namespaceDefinition, level );				
+				}
+			}
+		}			
+				
+		pushScope( namespaceDefinition );
+	}
+	
 	public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) {	}
 	public void enterTemplateDeclaration(IASTTemplateDeclaration declaration) 	{	}
 	public void enterTemplateSpecialization(IASTTemplateSpecialization specialization) 		{	}
 	public void enterTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation) {	}
-	public void enterMethodBody(IASTMethod method) 								{	}
-	public void exitFunctionBody(IASTFunction function) 						{	}
-	public void exitMethodBody(IASTMethod method) 								{	}
-	public void exitTemplateDeclaration(IASTTemplateDeclaration declaration) 	{	}
+	
+	public void enterMethodBody(IASTMethod method) {
+		pushScope( method );
+	}
+	
+	public void exitFunctionBody(IASTFunction function) {
+		popScope();	
+	}
+	public void exitMethodBody(IASTMethod method) {
+		popScope();	
+	}
+	
+	public void exitTemplateDeclaration(IASTTemplateDeclaration declaration) 	{}
 	public void exitTemplateSpecialization(IASTTemplateSpecialization specialization) 		{	}
 	public void exitTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation) 	{	}
 	public void exitLinkageSpecification(IASTLinkageSpecification linkageSpec) 	{	}
-	public void exitClassSpecifier(IASTClassSpecifier classSpecification) 		{	}
-	public void exitNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) 		{	}
-	public void exitCompilationUnit(IASTCompilationUnit compilationUnit)		{	}
+	
+	public void exitClassSpecifier(IASTClassSpecifier classSpecification) {
+		popScope();
+	}
+	
+	public void exitNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) {
+		popScope();
+	}
+	
+	public void exitCompilationUnit(IASTCompilationUnit compilationUnit){
+		popScope();
+	}
 
 	public void enterInclusion(IASTInclusion inclusion) {
 		String includePath = inclusion.getFullFileName();
@@ -154,12 +208,15 @@
 	}
 		
 	public void enterClassSpecifier(IASTClassSpecifier classSpecification) {
-		if( searchPattern instanceof ClassDeclarationPattern ){
-			int level = searchPattern.matchLevel( classSpecification ); 
-			if(  level != ICSearchPattern.IMPOSSIBLE_MATCH ){
-				report( classSpecification, level );				
+		if( searchPattern.getLimitTo() == DECLARATIONS || searchPattern.getLimitTo() == ALL_OCCURRENCES ){
+			if( searchPattern instanceof ClassDeclarationPattern ){
+				int level = searchPattern.matchLevel( classSpecification ); 
+				if(  level != ICSearchPattern.IMPOSSIBLE_MATCH ){
+					report( classSpecification, level );				
+				}
 			}
-		}
+		}			
+		pushScope( classSpecification );
 	}
 
 	public void locateMatches( String [] paths, IWorkspace workspace, IWorkingCopy[] workingCopies ){
@@ -244,17 +301,30 @@
 	
 	protected void report( IASTOffsetableNamedElement node, int accuracyLevel ){
 		try {
+			if( progressMonitor != null ) {
+				if( progressMonitor.isCanceled() ) {
+					throw new OperationCanceledException();
+				} else {
+					progressMonitor.worked( 1 );
+				}
+			}
+			
+			int offset = node.getElementNameOffset();
+			if( offset == 0 )
+				offset = node.getElementStartingOffset();
+				
 			if( currentResource != null ){
+				
 				resultCollector.accept( currentResource, 
-								  node.getElementNameOffset(), 
-								  node.getElementNameOffset() + node.getName().length(), 
-								  null, 
+								  offset, 
+								  offset + node.getName().length(), 
+								  resultCollector.createMatch( node, currentScope ), 
 								  accuracyLevel );
 			} else if( currentPath != null ){
 				resultCollector.accept( currentPath, 
-										node.getElementStartingOffset(), 
-										node.getElementEndingOffset(), 
-										null, 
+										offset, 
+										offset + node.getName().length(), 
+										resultCollector.createMatch( node, currentScope ), 
 										accuracyLevel );				
 			}
 		} catch (CoreException e) {
@@ -263,12 +333,27 @@
 		}
 	}
 	
+	private void pushScope( IASTScope scope ){
+		scopeStack.addFirst( currentScope );
+		currentScope = scope;
+	}
+	
+	private IASTScope popScope(){
+		IASTScope oldScope = currentScope;
+		currentScope = (scopeStack.size() > 0 ) ? (IASTScope) scopeStack.removeFirst() : null;
+		return oldScope;
+	}
+	
 	private ICSearchPattern 		searchPattern;
 	private ICSearchResultCollector resultCollector;
 	private IProgressMonitor 		progressMonitor;
-	private IResource 				currentResource = null;
 	private IPath					currentPath 	= null;
-	private ICSearchScope 			searchScope;		
-	private LinkedList 				resourceStack = new LinkedList();
+	private ICSearchScope 			searchScope;
 	private IWorkspaceRoot 			workspaceRoot;
+	
+	private IResource 				currentResource = null;
+	private LinkedList 				resourceStack = new LinkedList();
+	
+	private IASTScope				currentScope = null;
+	private LinkedList				scopeStack = new LinkedList();
 }
Index: search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java
===================================================================
RCS file: search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java
diff -N search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java	14 Jul 2003 21:44:14 -0000
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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 Jul 11, 2003
+ */
+package org.eclipse.cdt.internal.core.search.matching;
+
+/**
+ * @author aniefer
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class MethodDeclarationPattern extends FunctionDeclarationPattern {
+
+}
Index: search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java
===================================================================
RCS file: search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java
diff -N search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java	14 Jul 2003 21:44:14 -0000
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * 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 Jul 11, 2003
+ */
+package org.eclipse.cdt.internal.core.search.matching;
+
+import java.io.IOException;
+
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTOffsetableElement;
+import org.eclipse.cdt.core.search.ICSearchScope;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+import org.eclipse.cdt.internal.core.index.impl.IndexInput;
+import org.eclipse.cdt.internal.core.search.IIndexSearchRequestor;
+
+/**
+ * @author aniefer
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class NamespaceDeclarationPattern extends CSearchPattern {
+
+
+	/**
+	 * @param name
+	 * @param cs
+	 * @param matchMode
+	 * @param limitTo
+	 * @param caseSensitive
+	 */
+	public NamespaceDeclarationPattern(char[] name, char[][] qualifications, int matchMode, LimitTo limitTo, boolean caseSensitive) {
+		super( matchMode, caseSensitive, limitTo );
+		
+		_name = name;
+		_qualifications = qualifications;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.search.ICSearchPattern#matchLevel(org.eclipse.cdt.core.parser.ast.IASTOffsetableElement)
+	 */
+	public int matchLevel(IASTOffsetableElement node) {
+		if( !( node instanceof IASTNamespaceDefinition ) )
+			return IMPOSSIBLE_MATCH;
+			
+		IASTNamespaceDefinition namespace = (IASTNamespaceDefinition)node;
+		
+		if( _name != null && !matchesName( _name, namespace.getName().toCharArray() ) ){
+			return IMPOSSIBLE_MATCH;
+		}
+
+		if( !matchQualifications( _qualifications, namespace.getFullyQualifiedName() ) ){
+			return IMPOSSIBLE_MATCH;
+		}
+
+		return ACCURATE_MATCH;
+	}
+
+	private char[][] _qualifications;
+	private char[] _name;
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#feedIndexRequestor(org.eclipse.cdt.internal.core.search.IIndexSearchRequestor, int, int[], org.eclipse.cdt.internal.core.index.impl.IndexInput, org.eclipse.cdt.core.search.ICSearchScope)
+	 */
+	public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, IndexInput input, ICSearchScope scope) throws IOException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#decodeIndexEntry(org.eclipse.cdt.internal.core.index.IEntryResult)
+	 */
+	protected void decodeIndexEntry(IEntryResult entryResult) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#indexEntryPrefix()
+	 */
+	public char[] indexEntryPrefix() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#matchIndexEntry()
+	 */
+	protected boolean matchIndexEntry() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+}
Index: search/org/eclipse/cdt/internal/core/search/matching/VariableDeclarationPattern.java
===================================================================
RCS file: search/org/eclipse/cdt/internal/core/search/matching/VariableDeclarationPattern.java
diff -N search/org/eclipse/cdt/internal/core/search/matching/VariableDeclarationPattern.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ search/org/eclipse/cdt/internal/core/search/matching/VariableDeclarationPattern.java	14 Jul 2003 21:44:14 -0000
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 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 Jul 11, 2003
+ */
+package org.eclipse.cdt.internal.core.search.matching;
+
+import java.io.IOException;
+
+import org.eclipse.cdt.core.parser.ast.IASTOffsetableElement;
+import org.eclipse.cdt.core.search.ICSearchScope;
+import org.eclipse.cdt.internal.core.index.IEntryResult;
+import org.eclipse.cdt.internal.core.index.impl.IndexInput;
+import org.eclipse.cdt.internal.core.search.IIndexSearchRequestor;
+
+/**
+ * @author aniefer
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class VariableDeclarationPattern extends CSearchPattern {
+
+	/**
+	 * @param name
+	 * @param matchMode
+	 * @param limitTo
+	 * @param caseSensitive
+	 */
+	public VariableDeclarationPattern(char[] name, int matchMode, LimitTo limitTo, boolean caseSensitive) {
+		super( matchMode, caseSensitive, limitTo );
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.search.ICSearchPattern#matchLevel(org.eclipse.cdt.core.parser.ast.IASTOffsetableElement)
+	 */
+	public int matchLevel(IASTOffsetableElement node) {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#feedIndexRequestor(org.eclipse.cdt.internal.core.search.IIndexSearchRequestor, int, int[], org.eclipse.cdt.internal.core.index.impl.IndexInput, org.eclipse.cdt.core.search.ICSearchScope)
+	 */
+	public void feedIndexRequestor(IIndexSearchRequestor requestor, int detailLevel, int[] references, IndexInput input, ICSearchScope scope) throws IOException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#decodeIndexEntry(org.eclipse.cdt.internal.core.index.IEntryResult)
+	 */
+	protected void decodeIndexEntry(IEntryResult entryResult) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#indexEntryPrefix()
+	 */
+	public char[] indexEntryPrefix() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.internal.core.search.matching.CSearchPattern#matchIndexEntry()
+	 */
+	protected boolean matchIndexEntry() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+}

Attachment: search_sortmatch.gif
Description: GIF image


Back to the top