Skip to content

Commit de37a2c

Browse files
eclipse-platform-botakurtakov
authored andcommitted
Perform clean code of bundles/org.eclipse.search
1 parent 0cd325d commit de37a2c

File tree

66 files changed

+748
-507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+748
-507
lines changed

bundles/org.eclipse.search/newsearch/org/eclipse/search/ui/ISearchPageContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public interface ISearchPageContainer {
105105
* Sets the selected scope of this search page container. The scope is
106106
* WORKSPACE_SCOPE, SELECTED_PROJECTS_SCOPE, SELECTION_SCOPE,
107107
* OPENED_EDITORS_SCOPE or WORKING_SET_SCOPE.
108-
*
108+
*
109109
* @param scope
110110
* the newly selected scope
111111
*

bundles/org.eclipse.search/newsearch/org/eclipse/search/ui/NewSearchUI.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,14 @@ public static void runQuery(ISearchQuery query) {
7171
if (query == null) {
7272
throw new IllegalArgumentException("query must not be null"); //$NON-NLS-1$
7373
}
74-
if (query.canRunInBackground())
74+
if (query.canRunInBackground()) {
7575
runQueryInBackground(query);
76-
else {
76+
} else {
7777
IStatus status= runQueryInForeground(null, query);
7878
if (status != null) {
79-
if (!status.isOK())
79+
if (!status.isOK()) {
8080
SearchPlugin.log(status);
81+
}
8182
if (status.getSeverity() == IStatus.ERROR) {
8283
ErrorDialog.openError(SearchPlugin.getActiveWorkbenchShell(), SearchMessages.NewSearchUI_error_title, SearchMessages.NewSearchUI_error_label, status);
8384
}
@@ -131,10 +132,11 @@ public static void runQueryInBackground(ISearchQuery query, ISearchResultViewPar
131132
if (query == null) {
132133
throw new IllegalArgumentException("query must not be null"); //$NON-NLS-1$
133134
}
134-
if (query.canRunInBackground())
135+
if (query.canRunInBackground()) {
135136
InternalSearchUI.getInstance().runSearchInBackground(query, view);
136-
else
137+
} else {
137138
throw new IllegalArgumentException("Query can not be run in background"); //$NON-NLS-1$
139+
}
138140
}
139141

140142
/**

bundles/org.eclipse.search/newsearch/org/eclipse/search/ui/text/AbstractTextSearchResult.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ public Enumeration<Match> getMatchSet(Object element) {
118118
* @param match the match to add
119119
*/
120120
public void addMatch(Match match) {
121-
if (didAddMatch(match))
121+
if (didAddMatch(match)) {
122122
fireChange(getSearchResultEvent(match, MatchEvent.ADDED));
123+
}
123124
}
124125

125126
/**
@@ -137,8 +138,9 @@ public void addMatches(Match[] matches) {
137138
reallyAdded.add(match);
138139
}
139140
}
140-
if (!reallyAdded.isEmpty())
141+
if (!reallyAdded.isEmpty()) {
141142
fireChange(getSearchResultEvent(reallyAdded, MatchEvent.ADDED));
143+
}
142144
}
143145

144146
private MatchEvent getSearchResultEvent(Match match, int eventKind) {
@@ -164,8 +166,9 @@ private boolean didAddMatch(Match match) {
164166

165167
private static int compare(Match match2, Match match1) {
166168
int diff= match2.getOffset()-match1.getOffset();
167-
if (diff != 0)
169+
if (diff != 0) {
168170
return diff;
171+
}
169172
return match2.getLength()-match1.getLength();
170173
}
171174

@@ -193,8 +196,9 @@ private void doRemoveAll() {
193196
* @param match the match to remove
194197
*/
195198
public void removeMatch(Match match) {
196-
if (didRemoveMatch(match))
199+
if (didRemoveMatch(match)) {
197200
fireChange(getSearchResultEvent(match, MatchEvent.REMOVED));
201+
}
198202
}
199203

200204
/**
@@ -209,11 +213,13 @@ public void removeMatch(Match match) {
209213
public void removeMatches(Match[] matches) {
210214
Collection<Match> existing= new ArrayList<>();
211215
for (Match match : matches) {
212-
if (didRemoveMatch(match))
216+
if (didRemoveMatch(match)) {
213217
existing.add(match); // no duplicate matches at this point
218+
}
214219
}
215-
if (!existing.isEmpty())
220+
if (!existing.isEmpty()) {
216221
fireChange(getSearchResultEvent(existing, MatchEvent.REMOVED));
222+
}
217223
}
218224

219225

@@ -340,8 +346,9 @@ public int getMatchCount(Object element) {
340346
return 0;
341347
}
342348
Set<Match> matches = fElementsToMatches.get(element);
343-
if (matches != null)
349+
if (matches != null) {
344350
return matches.size();
351+
}
345352
return 0;
346353
}
347354

0 commit comments

Comments
 (0)