Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 162301 Details for
Bug 306196
[search] NPE while searching for annotation references in rt.jar of JRE 6.0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
JDT/UI patch to get access to all the constants in the Java Search page
UISearchDialog-3.6M6.txt (text/plain), 16.43 KB, created by
Frederic Fusier
on 2010-03-17 11:20:30 EDT
(
hide
)
Description:
JDT/UI patch to get access to all the constants in the Java Search page
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2010-03-17 11:20:30 EDT
Size:
16.43 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: ui/org/eclipse/jdt/internal/ui/search/JavaSearchPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchPage.java,v >retrieving revision 1.140 >diff -u -r1.140 JavaSearchPage.java >--- ui/org/eclipse/jdt/internal/ui/search/JavaSearchPage.java 13 Oct 2009 08:50:28 -0000 1.140 >+++ ui/org/eclipse/jdt/internal/ui/search/JavaSearchPage.java 17 Mar 2010 14:37:18 -0000 >@@ -71,7 +71,7 @@ > import org.eclipse.jdt.internal.corext.util.Messages; > > import org.eclipse.jdt.ui.search.ElementQuerySpecification; >-import org.eclipse.jdt.ui.search.PatternQuerySpecification; >+import org.eclipse.jdt.ui.search.FfrPatternQuerySpecification; > import org.eclipse.jdt.ui.search.QuerySpecification; > > import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; >@@ -87,6 +87,7 @@ > public class JavaSearchPage extends DialogPage implements ISearchPage { > > private static class SearchPatternData { >+ private final int matchMode; > private final int searchFor; > private final int limitTo; > private final String pattern; >@@ -98,12 +99,17 @@ > private IJavaElement javaElement; > > public SearchPatternData(int searchFor, int limitTo, int matchLocations, boolean isCaseSensitive, String pattern, IJavaElement element, int includeMask) { >- this(searchFor, limitTo, matchLocations, pattern, isCaseSensitive, element, ISearchPageContainer.WORKSPACE_SCOPE, null, includeMask); >+ this(searchFor, limitTo, SearchPattern.R_EXACT_MATCH, matchLocations, pattern, isCaseSensitive, element, ISearchPageContainer.WORKSPACE_SCOPE, null, includeMask); > } > >- public SearchPatternData(int searchFor, int limitTo, int matchLocations, String pattern, boolean isCaseSensitive, IJavaElement element, int scope, IWorkingSet[] workingSets, int includeMask) { >+ public SearchPatternData(int searchFor, int limitTo, int matchMode, int matchLocations, String pattern, boolean isCaseSensitive, IJavaElement element, int includeMask) { >+ this(searchFor, limitTo, matchMode, matchLocations, pattern, isCaseSensitive, element, ISearchPageContainer.WORKSPACE_SCOPE, null, includeMask); >+ } >+ >+ public SearchPatternData(int searchFor, int limitTo, int matchMode, int matchLocations, String pattern, boolean isCaseSensitive, IJavaElement element, int scope, IWorkingSet[] workingSets, int includeMask) { > this.searchFor= searchFor; > this.limitTo= limitTo; >+ this.matchMode = matchMode; > this.matchLocations= matchLocations; > this.pattern= pattern; > this.isCaseSensitive= isCaseSensitive; >@@ -130,6 +136,10 @@ > return limitTo; > } > >+ public int getMatchMode() { >+ return this.matchMode; >+ } >+ > public String getPattern() { > return pattern; > } >@@ -159,6 +169,7 @@ > settings.put("scope", scope); //$NON-NLS-1$ > settings.put("pattern", pattern); //$NON-NLS-1$ > settings.put("limitTo", limitTo); //$NON-NLS-1$ >+ settings.put("matchMode", this.matchMode); //$NON-NLS-1$ > settings.put("matchLocations", matchLocations); //$NON-NLS-1$ > settings.put("javaElement", javaElement != null ? javaElement.getHandleIdentifier() : ""); //$NON-NLS-1$ //$NON-NLS-2$ > settings.put("isCaseSensitive", isCaseSensitive); //$NON-NLS-1$ >@@ -204,7 +215,8 @@ > int searchFor= settings.getInt("searchFor"); //$NON-NLS-1$ > int scope= settings.getInt("scope"); //$NON-NLS-1$ > int limitTo= settings.getInt("limitTo"); //$NON-NLS-1$ >- >+ int matchMode= settings.getInt("matchMode"); //$NON-NLS-1$ >+ > int matchLocations= 0; > if (settings.get("matchLocations") != null) { //$NON-NLS-1$ > matchLocations= settings.getInt("matchLocations"); //$NON-NLS-1$ >@@ -221,7 +233,7 @@ > includeMask= JavaSearchScopeFactory.ALL; > } > } >- return new SearchPatternData(searchFor, limitTo, matchLocations, pattern, isCaseSensitive, elem, scope, workingSets, includeMask); >+ return new SearchPatternData(searchFor, limitTo, matchMode, matchLocations, pattern, isCaseSensitive, elem, scope, workingSets, includeMask); > } catch (NumberFormatException e) { > return null; > } >@@ -278,6 +290,8 @@ > private int fMatchLocations; > private Link fMatchLocationsLink; > >+ private Button[] matchMode; >+ > /** > * > */ >@@ -341,7 +355,8 @@ > SearchUtil.warnIfBinaryConstant(data.getJavaElement(), getShell()); > querySpec= new ElementQuerySpecification(data.getJavaElement(), limitTo, scope, scopeDescription); > } else { >- querySpec= new PatternQuerySpecification(data.getPattern(), searchFor, data.isCaseSensitive(), limitTo, scope, scopeDescription); >+ FfrPatternQuerySpecification ffrQuerySpec= new FfrPatternQuerySpecification(data.getPattern(), searchFor, data.getMatchMode(), data.isCaseSensitive(), data.getLimitTo(), scope, scopeDescription); >+ querySpec = ffrQuerySpec; > data.setJavaElement(null); > } > >@@ -375,7 +390,28 @@ > fillLimitToGroup(searchFor, limitTo); > return limitTo; > } >- >+ >+ private int getMatchMode() { >+ int mode = SearchPattern.R_EXACT_MATCH; >+ for (int i= 1, l=this.matchMode.length; i<l; i++) { >+ if (this.matchMode[i].getSelection()) { >+ mode |= 1 << i; >+ } >+ } >+ return mode; >+ } >+ >+ private void setMatchMode(int mode) { >+ if (mode == 0) { >+ this.matchMode[0].setSelection(true); >+ return; >+ } >+ this.matchMode[0].setSelection(false); >+ for (int i= 1; i < this.matchMode.length; i++) { >+ this.matchMode[i].setSelection((mode & (1 <<i)) != 0); >+ } >+ } >+ > private int getIncludeMask() { > int mask= 0; > for (int i= 0; i < fIncludeMasks.length; i++) { >@@ -459,6 +495,7 @@ > match= new SearchPatternData( > getSearchFor(), > getLimitTo(), >+ getMatchMode(), > fMatchLocations, > pattern, > fCaseSensitive.getSelection(), >@@ -524,6 +561,9 @@ > Control limitTo= createLimitTo(result); > limitTo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1)); > >+ Control mode= createMatchMode(result); >+ mode.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1)); >+ > Control includeMask= createIncludeMask(result); > includeMask.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1)); > >@@ -665,7 +705,8 @@ > SearchPatternData initialData= (SearchPatternData) fPreviousSearchPatterns.get(selectionIndex); > > setSearchFor(initialData.getSearchFor()); >- setLimitTo(initialData.getSearchFor(), initialData.getLimitTo()); >+ setMatchMode(initialData.getMatchMode()); >+ int limitToVal= setLimitTo(initialData.getSearchFor(), initialData.getLimitTo()); > setIncludeMask(initialData.getIncludeMask()); > setMatchLocations(initialData.getMatchLocations()); > >@@ -695,7 +736,13 @@ > createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_method, METHOD, false), > createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_package, PACKAGE, false), > createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_constructor, CONSTRUCTOR, false), >- createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_field, FIELD, false) >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_field, FIELD, false), >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_class, IJavaSearchConstants.CLASS, false), >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_interface, IJavaSearchConstants.INTERFACE, false), >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_enum, IJavaSearchConstants.ENUM, false), >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_annotation, IJavaSearchConstants.ANNOTATION_TYPE, false), >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_class_enum, IJavaSearchConstants.CLASS_AND_ENUM, false), >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_class_interface, IJavaSearchConstants.CLASS_AND_INTERFACE, false) > }; > > // Fill with dummy radio buttons >@@ -812,7 +859,26 @@ > updateUseJRE(); > } > >+ private Control createMatchMode(Composite parent) { >+ Group result= new Group(parent, SWT.NONE); >+ result.setText(SearchMessages.SearchPage_matchMode_label); >+ result.setLayout(new GridLayout(2, true)); >+ >+ this.matchMode = new Button[] { >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_exact, SearchPattern.R_EXACT_MATCH, true), >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_prefix,SearchPattern.R_PREFIX_MATCH, false), >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_pattern,SearchPattern.R_PATTERN_MATCH, false), >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_regexp,SearchPattern.R_REGEXP_MATCH, false), >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_erasure,SearchPattern.R_ERASURE_MATCH, false), >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_equivalent,SearchPattern.R_EQUIVALENT_MATCH, false), >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_full,SearchPattern.R_FULL_MATCH, false), >+ createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_camelcase,SearchPattern.R_CAMELCASE_MATCH, false), >+ }; >+ return result; >+ } > >+ >+ > protected final void performConfigureMatchLocation() { > for (int i= 0; i < fLimitTo.length; i++) { > Button curr= fLimitTo[i]; >@@ -903,7 +969,8 @@ > fCaseSensitive.setEnabled(fJavaElement == null); > > setSearchFor(initData.getSearchFor()); >- setLimitTo(initData.getSearchFor(), initData.getLimitTo()); >+ setMatchMode(initData.getMatchMode()); >+ int limitToVal= setLimitTo(initData.getSearchFor(), initData.getLimitTo()); > setIncludeMask(initData.getIncludeMask()); > setMatchLocations(initData.getMatchLocations()); > >Index: ui/org/eclipse/jdt/internal/ui/search/JavaSearchQuery.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchQuery.java,v >retrieving revision 1.48 >diff -u -r1.48 JavaSearchQuery.java >--- ui/org/eclipse/jdt/internal/ui/search/JavaSearchQuery.java 11 Sep 2008 11:59:07 -0000 1.48 >+++ ui/org/eclipse/jdt/internal/ui/search/JavaSearchQuery.java 17 Mar 2010 14:37:18 -0000 >@@ -40,6 +40,7 @@ > > import org.eclipse.jdt.ui.JavaElementLabels; > import org.eclipse.jdt.ui.search.ElementQuerySpecification; >+import org.eclipse.jdt.ui.search.FfrPatternQuerySpecification; > import org.eclipse.jdt.ui.search.IMatchPresentation; > import org.eclipse.jdt.ui.search.IQueryParticipant; > import org.eclipse.jdt.ui.search.ISearchRequestor; >@@ -126,6 +127,9 @@ > PatternQuerySpecification patternSpec = (PatternQuerySpecification) fPatternData; > stringPattern= patternSpec.getPattern(); > int matchMode= getMatchMode(stringPattern) | SearchPattern.R_ERASURE_MATCH; >+ if (patternSpec instanceof FfrPatternQuerySpecification) { >+ matchMode = ((FfrPatternQuerySpecification) patternSpec).matchMode(); >+ } > if (patternSpec.isCaseSensitive()) > matchMode |= SearchPattern.R_CASE_SENSITIVE; > pattern= SearchPattern.createPattern(patternSpec.getPattern(), patternSpec.getSearchFor(), patternSpec.getLimitTo(), matchMode); >Index: ui/org/eclipse/jdt/internal/ui/search/SearchMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/SearchMessages.java,v >retrieving revision 1.32 >diff -u -r1.32 SearchMessages.java >--- ui/org/eclipse/jdt/internal/ui/search/SearchMessages.java 9 Oct 2009 12:06:05 -0000 1.32 >+++ ui/org/eclipse/jdt/internal/ui/search/SearchMessages.java 17 Mar 2010 14:37:19 -0000 >@@ -71,6 +71,21 @@ > public static String SearchPage_searchFor_field; > public static String SearchPage_searchFor_package; > public static String SearchPage_searchFor_constructor; >+ public static String SearchPage_searchFor_class; >+ public static String SearchPage_searchFor_interface; >+ public static String SearchPage_searchFor_enum; >+ public static String SearchPage_searchFor_annotation; >+ public static String SearchPage_searchFor_class_enum; >+ public static String SearchPage_searchFor_class_interface; >+ public static String SearchPage_matchMode_label; >+ public static String SearchPage_matchMode_exact; >+ public static String SearchPage_matchMode_prefix; >+ public static String SearchPage_matchMode_pattern; >+ public static String SearchPage_matchMode_regexp; >+ public static String SearchPage_matchMode_erasure; >+ public static String SearchPage_matchMode_equivalent; >+ public static String SearchPage_matchMode_full; >+ public static String SearchPage_matchMode_camelcase; > public static String SearchPage_limitTo_label; > public static String SearchPage_limitTo_declarations; > public static String SearchPage_limitTo_implementors; >Index: ui/org/eclipse/jdt/internal/ui/search/SearchMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/SearchMessages.properties,v >retrieving revision 1.139 >diff -u -r1.139 SearchMessages.properties >--- ui/org/eclipse/jdt/internal/ui/search/SearchMessages.properties 19 Feb 2010 10:23:48 -0000 1.139 >+++ ui/org/eclipse/jdt/internal/ui/search/SearchMessages.properties 17 Mar 2010 14:37:19 -0000 >@@ -53,6 +53,22 @@ > SearchPage_searchIn_projects=Re&quired projects > SearchPage_searchIn_libraries=Applicatio&n libraries > SearchPage_searchFor_constructor= Constr&uctor >+SearchPage_searchFor_class= &Class >+SearchPage_searchFor_interface= &Interface >+SearchPage_searchFor_enum= &Enum >+SearchPage_searchFor_annotation= &Annotation >+SearchPage_searchFor_class_enum= Class+En&um >+SearchPage_searchFor_class_interface= Class+Inte&rface >+ >+SearchPage_matchMode_label= Match Mode >+SearchPage_matchMode_exact= &Exact >+SearchPage_matchMode_prefix= &Prefix >+SearchPage_matchMode_pattern= Pa&ttern >+SearchPage_matchMode_regexp= &Regexp >+SearchPage_matchMode_erasure= Eras&ure >+SearchPage_matchMode_equivalent= E&quivalent >+SearchPage_matchMode_full= &Full >+SearchPage_matchMode_camelcase= &Camel Case > > SearchPage_limitTo_label= Limit To > SearchPage_limitTo_declarations= Dec&larations >@@ -65,6 +81,13 @@ > SearchPage_expression_label= Search strin&g (* = any string, ? = any character): > SearchPage_expression_caseSensitive= &Case sensitive > >+#SearchPage_searchJRE_label=Search the JRE s&ystem libraries >+SearchPage_includeMask_label=Search include mask >+SearchPage_includeMask_sources=Sources >+SearchPage_includeMask_applicationLibraries=Application Libraries >+SearchPage_includeMask_systemLibraries=System Libraries >+SearchPage_includeMask_referencedProjects=Referenced Projects >+ > # Concatenate two working set names e.g. "Source, Lib" > SearchUtil_workingSetConcatenation= {0}, {1} > >Index: ui/org/eclipse/jdt/ui/search/FfrPatternQuerySpecification.java >=================================================================== >RCS file: ui/org/eclipse/jdt/ui/search/FfrPatternQuerySpecification.java >diff -N ui/org/eclipse/jdt/ui/search/FfrPatternQuerySpecification.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/jdt/ui/search/FfrPatternQuerySpecification.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.ui.search; >+ >+import org.eclipse.jdt.core.search.IJavaSearchScope; >+ >+public class FfrPatternQuerySpecification extends PatternQuerySpecification { >+private int matchMode; >+public String[] logicalPatterns; >+public int patternKind = 0; >+ >+public FfrPatternQuerySpecification(String pattern, >+ int searchFor, >+ int mode, >+ boolean caseSensitive, >+ int limitTo, >+ IJavaSearchScope scope, >+ String scopeDescription) { >+ super(pattern, searchFor, caseSensitive, limitTo, scope, scopeDescription); >+ this.matchMode = mode; >+} >+ >+public int matchMode() { >+ return this.matchMode; >+} >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 306196
: 162301 |
162740
|
162741