Lines 71-77
Link Here
|
71 |
import org.eclipse.jdt.internal.corext.util.Messages; |
71 |
import org.eclipse.jdt.internal.corext.util.Messages; |
72 |
|
72 |
|
73 |
import org.eclipse.jdt.ui.search.ElementQuerySpecification; |
73 |
import org.eclipse.jdt.ui.search.ElementQuerySpecification; |
74 |
import org.eclipse.jdt.ui.search.PatternQuerySpecification; |
74 |
import org.eclipse.jdt.ui.search.FfrPatternQuerySpecification; |
75 |
import org.eclipse.jdt.ui.search.QuerySpecification; |
75 |
import org.eclipse.jdt.ui.search.QuerySpecification; |
76 |
|
76 |
|
77 |
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; |
77 |
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds; |
Lines 87-92
Link Here
|
87 |
public class JavaSearchPage extends DialogPage implements ISearchPage { |
87 |
public class JavaSearchPage extends DialogPage implements ISearchPage { |
88 |
|
88 |
|
89 |
private static class SearchPatternData { |
89 |
private static class SearchPatternData { |
|
|
90 |
private final int matchMode; |
90 |
private final int searchFor; |
91 |
private final int searchFor; |
91 |
private final int limitTo; |
92 |
private final int limitTo; |
92 |
private final String pattern; |
93 |
private final String pattern; |
Lines 98-109
Link Here
|
98 |
private IJavaElement javaElement; |
99 |
private IJavaElement javaElement; |
99 |
|
100 |
|
100 |
public SearchPatternData(int searchFor, int limitTo, int matchLocations, boolean isCaseSensitive, String pattern, IJavaElement element, int includeMask) { |
101 |
public SearchPatternData(int searchFor, int limitTo, int matchLocations, boolean isCaseSensitive, String pattern, IJavaElement element, int includeMask) { |
101 |
this(searchFor, limitTo, matchLocations, pattern, isCaseSensitive, element, ISearchPageContainer.WORKSPACE_SCOPE, null, includeMask); |
102 |
this(searchFor, limitTo, SearchPattern.R_EXACT_MATCH, matchLocations, pattern, isCaseSensitive, element, ISearchPageContainer.WORKSPACE_SCOPE, null, includeMask); |
102 |
} |
103 |
} |
103 |
|
104 |
|
104 |
public SearchPatternData(int searchFor, int limitTo, int matchLocations, String pattern, boolean isCaseSensitive, IJavaElement element, int scope, IWorkingSet[] workingSets, int includeMask) { |
105 |
public SearchPatternData(int searchFor, int limitTo, int matchMode, int matchLocations, String pattern, boolean isCaseSensitive, IJavaElement element, int includeMask) { |
|
|
106 |
this(searchFor, limitTo, matchMode, matchLocations, pattern, isCaseSensitive, element, ISearchPageContainer.WORKSPACE_SCOPE, null, includeMask); |
107 |
} |
108 |
|
109 |
public SearchPatternData(int searchFor, int limitTo, int matchMode, int matchLocations, String pattern, boolean isCaseSensitive, IJavaElement element, int scope, IWorkingSet[] workingSets, int includeMask) { |
105 |
this.searchFor= searchFor; |
110 |
this.searchFor= searchFor; |
106 |
this.limitTo= limitTo; |
111 |
this.limitTo= limitTo; |
|
|
112 |
this.matchMode = matchMode; |
107 |
this.matchLocations= matchLocations; |
113 |
this.matchLocations= matchLocations; |
108 |
this.pattern= pattern; |
114 |
this.pattern= pattern; |
109 |
this.isCaseSensitive= isCaseSensitive; |
115 |
this.isCaseSensitive= isCaseSensitive; |
Lines 130-135
Link Here
|
130 |
return limitTo; |
136 |
return limitTo; |
131 |
} |
137 |
} |
132 |
|
138 |
|
|
|
139 |
public int getMatchMode() { |
140 |
return this.matchMode; |
141 |
} |
142 |
|
133 |
public String getPattern() { |
143 |
public String getPattern() { |
134 |
return pattern; |
144 |
return pattern; |
135 |
} |
145 |
} |
Lines 159-164
Link Here
|
159 |
settings.put("scope", scope); //$NON-NLS-1$ |
169 |
settings.put("scope", scope); //$NON-NLS-1$ |
160 |
settings.put("pattern", pattern); //$NON-NLS-1$ |
170 |
settings.put("pattern", pattern); //$NON-NLS-1$ |
161 |
settings.put("limitTo", limitTo); //$NON-NLS-1$ |
171 |
settings.put("limitTo", limitTo); //$NON-NLS-1$ |
|
|
172 |
settings.put("matchMode", this.matchMode); //$NON-NLS-1$ |
162 |
settings.put("matchLocations", matchLocations); //$NON-NLS-1$ |
173 |
settings.put("matchLocations", matchLocations); //$NON-NLS-1$ |
163 |
settings.put("javaElement", javaElement != null ? javaElement.getHandleIdentifier() : ""); //$NON-NLS-1$ //$NON-NLS-2$ |
174 |
settings.put("javaElement", javaElement != null ? javaElement.getHandleIdentifier() : ""); //$NON-NLS-1$ //$NON-NLS-2$ |
164 |
settings.put("isCaseSensitive", isCaseSensitive); //$NON-NLS-1$ |
175 |
settings.put("isCaseSensitive", isCaseSensitive); //$NON-NLS-1$ |
Lines 204-210
Link Here
|
204 |
int searchFor= settings.getInt("searchFor"); //$NON-NLS-1$ |
215 |
int searchFor= settings.getInt("searchFor"); //$NON-NLS-1$ |
205 |
int scope= settings.getInt("scope"); //$NON-NLS-1$ |
216 |
int scope= settings.getInt("scope"); //$NON-NLS-1$ |
206 |
int limitTo= settings.getInt("limitTo"); //$NON-NLS-1$ |
217 |
int limitTo= settings.getInt("limitTo"); //$NON-NLS-1$ |
207 |
|
218 |
int matchMode= settings.getInt("matchMode"); //$NON-NLS-1$ |
|
|
219 |
|
208 |
int matchLocations= 0; |
220 |
int matchLocations= 0; |
209 |
if (settings.get("matchLocations") != null) { //$NON-NLS-1$ |
221 |
if (settings.get("matchLocations") != null) { //$NON-NLS-1$ |
210 |
matchLocations= settings.getInt("matchLocations"); //$NON-NLS-1$ |
222 |
matchLocations= settings.getInt("matchLocations"); //$NON-NLS-1$ |
Lines 221-227
Link Here
|
221 |
includeMask= JavaSearchScopeFactory.ALL; |
233 |
includeMask= JavaSearchScopeFactory.ALL; |
222 |
} |
234 |
} |
223 |
} |
235 |
} |
224 |
return new SearchPatternData(searchFor, limitTo, matchLocations, pattern, isCaseSensitive, elem, scope, workingSets, includeMask); |
236 |
return new SearchPatternData(searchFor, limitTo, matchMode, matchLocations, pattern, isCaseSensitive, elem, scope, workingSets, includeMask); |
225 |
} catch (NumberFormatException e) { |
237 |
} catch (NumberFormatException e) { |
226 |
return null; |
238 |
return null; |
227 |
} |
239 |
} |
Lines 278-283
Link Here
|
278 |
private int fMatchLocations; |
290 |
private int fMatchLocations; |
279 |
private Link fMatchLocationsLink; |
291 |
private Link fMatchLocationsLink; |
280 |
|
292 |
|
|
|
293 |
private Button[] matchMode; |
294 |
|
281 |
/** |
295 |
/** |
282 |
* |
296 |
* |
283 |
*/ |
297 |
*/ |
Lines 341-347
Link Here
|
341 |
SearchUtil.warnIfBinaryConstant(data.getJavaElement(), getShell()); |
355 |
SearchUtil.warnIfBinaryConstant(data.getJavaElement(), getShell()); |
342 |
querySpec= new ElementQuerySpecification(data.getJavaElement(), limitTo, scope, scopeDescription); |
356 |
querySpec= new ElementQuerySpecification(data.getJavaElement(), limitTo, scope, scopeDescription); |
343 |
} else { |
357 |
} else { |
344 |
querySpec= new PatternQuerySpecification(data.getPattern(), searchFor, data.isCaseSensitive(), limitTo, scope, scopeDescription); |
358 |
FfrPatternQuerySpecification ffrQuerySpec= new FfrPatternQuerySpecification(data.getPattern(), searchFor, data.getMatchMode(), data.isCaseSensitive(), data.getLimitTo(), scope, scopeDescription); |
|
|
359 |
querySpec = ffrQuerySpec; |
345 |
data.setJavaElement(null); |
360 |
data.setJavaElement(null); |
346 |
} |
361 |
} |
347 |
|
362 |
|
Lines 375-381
Link Here
|
375 |
fillLimitToGroup(searchFor, limitTo); |
390 |
fillLimitToGroup(searchFor, limitTo); |
376 |
return limitTo; |
391 |
return limitTo; |
377 |
} |
392 |
} |
378 |
|
393 |
|
|
|
394 |
private int getMatchMode() { |
395 |
int mode = SearchPattern.R_EXACT_MATCH; |
396 |
for (int i= 1, l=this.matchMode.length; i<l; i++) { |
397 |
if (this.matchMode[i].getSelection()) { |
398 |
mode |= 1 << i; |
399 |
} |
400 |
} |
401 |
return mode; |
402 |
} |
403 |
|
404 |
private void setMatchMode(int mode) { |
405 |
if (mode == 0) { |
406 |
this.matchMode[0].setSelection(true); |
407 |
return; |
408 |
} |
409 |
this.matchMode[0].setSelection(false); |
410 |
for (int i= 1; i < this.matchMode.length; i++) { |
411 |
this.matchMode[i].setSelection((mode & (1 <<i)) != 0); |
412 |
} |
413 |
} |
414 |
|
379 |
private int getIncludeMask() { |
415 |
private int getIncludeMask() { |
380 |
int mask= 0; |
416 |
int mask= 0; |
381 |
for (int i= 0; i < fIncludeMasks.length; i++) { |
417 |
for (int i= 0; i < fIncludeMasks.length; i++) { |
Lines 459-464
Link Here
|
459 |
match= new SearchPatternData( |
495 |
match= new SearchPatternData( |
460 |
getSearchFor(), |
496 |
getSearchFor(), |
461 |
getLimitTo(), |
497 |
getLimitTo(), |
|
|
498 |
getMatchMode(), |
462 |
fMatchLocations, |
499 |
fMatchLocations, |
463 |
pattern, |
500 |
pattern, |
464 |
fCaseSensitive.getSelection(), |
501 |
fCaseSensitive.getSelection(), |
Lines 524-529
Link Here
|
524 |
Control limitTo= createLimitTo(result); |
561 |
Control limitTo= createLimitTo(result); |
525 |
limitTo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1)); |
562 |
limitTo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1)); |
526 |
|
563 |
|
|
|
564 |
Control mode= createMatchMode(result); |
565 |
mode.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1)); |
566 |
|
527 |
Control includeMask= createIncludeMask(result); |
567 |
Control includeMask= createIncludeMask(result); |
528 |
includeMask.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1)); |
568 |
includeMask.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1)); |
529 |
|
569 |
|
Lines 665-671
Link Here
|
665 |
SearchPatternData initialData= (SearchPatternData) fPreviousSearchPatterns.get(selectionIndex); |
705 |
SearchPatternData initialData= (SearchPatternData) fPreviousSearchPatterns.get(selectionIndex); |
666 |
|
706 |
|
667 |
setSearchFor(initialData.getSearchFor()); |
707 |
setSearchFor(initialData.getSearchFor()); |
668 |
setLimitTo(initialData.getSearchFor(), initialData.getLimitTo()); |
708 |
setMatchMode(initialData.getMatchMode()); |
|
|
709 |
int limitToVal= setLimitTo(initialData.getSearchFor(), initialData.getLimitTo()); |
669 |
setIncludeMask(initialData.getIncludeMask()); |
710 |
setIncludeMask(initialData.getIncludeMask()); |
670 |
setMatchLocations(initialData.getMatchLocations()); |
711 |
setMatchLocations(initialData.getMatchLocations()); |
671 |
|
712 |
|
Lines 695-701
Link Here
|
695 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_method, METHOD, false), |
736 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_method, METHOD, false), |
696 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_package, PACKAGE, false), |
737 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_package, PACKAGE, false), |
697 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_constructor, CONSTRUCTOR, false), |
738 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_constructor, CONSTRUCTOR, false), |
698 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_field, FIELD, false) |
739 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_field, FIELD, false), |
|
|
740 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_class, IJavaSearchConstants.CLASS, false), |
741 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_interface, IJavaSearchConstants.INTERFACE, false), |
742 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_enum, IJavaSearchConstants.ENUM, false), |
743 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_annotation, IJavaSearchConstants.ANNOTATION_TYPE, false), |
744 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_class_enum, IJavaSearchConstants.CLASS_AND_ENUM, false), |
745 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_searchFor_class_interface, IJavaSearchConstants.CLASS_AND_INTERFACE, false) |
699 |
}; |
746 |
}; |
700 |
|
747 |
|
701 |
// Fill with dummy radio buttons |
748 |
// Fill with dummy radio buttons |
Lines 812-818
Link Here
|
812 |
updateUseJRE(); |
859 |
updateUseJRE(); |
813 |
} |
860 |
} |
814 |
|
861 |
|
|
|
862 |
private Control createMatchMode(Composite parent) { |
863 |
Group result= new Group(parent, SWT.NONE); |
864 |
result.setText(SearchMessages.SearchPage_matchMode_label); |
865 |
result.setLayout(new GridLayout(2, true)); |
866 |
|
867 |
this.matchMode = new Button[] { |
868 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_exact, SearchPattern.R_EXACT_MATCH, true), |
869 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_prefix,SearchPattern.R_PREFIX_MATCH, false), |
870 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_pattern,SearchPattern.R_PATTERN_MATCH, false), |
871 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_regexp,SearchPattern.R_REGEXP_MATCH, false), |
872 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_erasure,SearchPattern.R_ERASURE_MATCH, false), |
873 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_equivalent,SearchPattern.R_EQUIVALENT_MATCH, false), |
874 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_full,SearchPattern.R_FULL_MATCH, false), |
875 |
createButton(result, SWT.RADIO, SearchMessages.SearchPage_matchMode_camelcase,SearchPattern.R_CAMELCASE_MATCH, false), |
876 |
}; |
877 |
return result; |
878 |
} |
815 |
|
879 |
|
|
|
880 |
|
881 |
|
816 |
protected final void performConfigureMatchLocation() { |
882 |
protected final void performConfigureMatchLocation() { |
817 |
for (int i= 0; i < fLimitTo.length; i++) { |
883 |
for (int i= 0; i < fLimitTo.length; i++) { |
818 |
Button curr= fLimitTo[i]; |
884 |
Button curr= fLimitTo[i]; |
Lines 903-909
Link Here
|
903 |
fCaseSensitive.setEnabled(fJavaElement == null); |
969 |
fCaseSensitive.setEnabled(fJavaElement == null); |
904 |
|
970 |
|
905 |
setSearchFor(initData.getSearchFor()); |
971 |
setSearchFor(initData.getSearchFor()); |
906 |
setLimitTo(initData.getSearchFor(), initData.getLimitTo()); |
972 |
setMatchMode(initData.getMatchMode()); |
|
|
973 |
int limitToVal= setLimitTo(initData.getSearchFor(), initData.getLimitTo()); |
907 |
setIncludeMask(initData.getIncludeMask()); |
974 |
setIncludeMask(initData.getIncludeMask()); |
908 |
setMatchLocations(initData.getMatchLocations()); |
975 |
setMatchLocations(initData.getMatchLocations()); |
909 |
|
976 |
|