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

Fix for 102066: macro definitions should be found via Search with Declarations

This commit is contained in:
Bogdan Gheorghe 2005-07-07 15:22:03 +00:00
parent c783685b39
commit 5e641d7377
3 changed files with 14 additions and 3 deletions

View file

@ -76,7 +76,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
public static final int ACCURATE_MATCH = 2;
public static final int INACCURATE_MATCH = 3;
private static SearchFor[] fSearchForValues = { CLASS_STRUCT, FUNCTION, VAR, UNION, METHOD, FIELD, ENUM, ENUMTOR, NAMESPACE, TYPEDEF, MACRO};
public static SearchFor[] fSearchForValues = { CLASS_STRUCT, FUNCTION, VAR, UNION, METHOD, FIELD, ENUM, ENUMTOR, NAMESPACE, TYPEDEF, MACRO};
protected static class Requestor extends NullSourceElementRequestor
{
@ -177,7 +177,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
* @return
*/
private static CSearchPattern createMacroPattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) {
if( limitTo != DECLARATIONS && limitTo != ALL_OCCURRENCES )
if( limitTo != DECLARATIONS && limitTo != ALL_OCCURRENCES && limitTo != DECLARATIONS_DEFINITIONS )
return null;
return new MacroDeclarationPattern( patternString.toCharArray(), matchMode, DECLARATIONS, caseSensitive );

View file

@ -41,6 +41,8 @@ CSearchPage.searchFor.enum= &Enumeration
CSearchPage.searchFor.enumr = Enume&rator
CSearchPage.searchFor.derived = &Derived
CSearchPage.searchFor.friend = &Friend
CSearchPage.searchFor.typedef = Type&def
CSearchPage.searchFor.macro = &Macro
CSearchPage.searchFor.any= An&y Element
CSearchPage.searchFor.classStruct= Cl&ass / Struct

View file

@ -27,6 +27,7 @@ import org.eclipse.cdt.core.model.ICElement;
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.internal.core.search.matching.CSearchPattern;
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
import org.eclipse.cdt.internal.ui.util.RowLayouter;
import org.eclipse.cdt.ui.CUIPlugin;
@ -77,6 +78,12 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
public static final String EXTENSION_POINT_ID= "org.eclipse.cdt.ui.CSearchPage"; //$NON-NLS-1$
public CSearchPage(){
int size = CSearchPattern.fSearchForValues.length;
fSearchForValues = new SearchFor[size + 1];
System.arraycopy(CSearchPattern.fSearchForValues, 0, fSearchForValues, 0,size);
fSearchForValues[size] = UNKNOWN_SEARCH_FOR;
}
public boolean performAction() {
fLineManager.setErrorMessage(null);
SearchPatternData data = getPatternData();
@ -655,7 +662,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, ENUMTOR, NAMESPACE, UNKNOWN_SEARCH_FOR };
private SearchFor[] fSearchForValues;
private String[] fSearchForText= {
CSearchMessages.getString("CSearchPage.searchFor.classStruct"), //$NON-NLS-1$
@ -667,6 +674,8 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
CSearchMessages.getString("CSearchPage.searchFor.enum"), //$NON-NLS-1$
CSearchMessages.getString("CSearchPage.searchFor.enumr"), //$NON-NLS-1$
CSearchMessages.getString("CSearchPage.searchFor.namespace"), //$NON-NLS-1$
CSearchMessages.getString("CSearchPage.searchFor.typedef"), //$NON-NLS-1$
CSearchMessages.getString("CSearchPage.searchFor.macro"), //$NON-NLS-1$
CSearchMessages.getString("CSearchPage.searchFor.any") }; //$NON-NLS-1$