Project

General

Profile

« Previous | Next » 

Revision 5f2bb8fe

Added by Patrick Plitzner about 9 years ago

  • removed unnecessary message logging

View differences:

eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/messages.properties
3 3
SearchBar_2=Could not execute search
4 4
SearchBar_3=Please type at least one character when using the "*" wildcard.
5 5
SearchBar_4=Error opening search result.
6
SearchBar_5=configuration menu clicked
7 6
SearchBar_6=Taxa
8 7
SearchBar_7=Synonyms
9 8
SearchBar_8=Names (without taxa)
eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/messages_de.properties
3 3
SearchBar_2=Suche konnte nicht ausgef\u00FChrt werden
4 4
SearchBar_3=Bitte geben Sie mindestens ein Zeichen, wenn Sie die "*" Platzhalter benutzen wollen
5 5
SearchBar_4=Fehler beim f\u00fcffnen des Suchergebnisses
6
SearchBar_5=Konfigurationsmenü angeklickt
7 6
SearchBar_6=Taxa
8 7
SearchBar_7=Synonyme
9 8
SearchBar_8=Namen (ohne Taxa)
eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/messages_en.properties
3 3
SearchBar_2=Could not execute search
4 4
SearchBar_3=Please type at least one character when using the "*" wildcard.
5 5
SearchBar_4=Error opening search result.
6
SearchBar_5=configuration menu clicked
7 6
SearchBar_6=Taxa
8 7
SearchBar_7=Synonyms
9 8
SearchBar_8=Names (without taxa)
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/Messages.java
23 23
    public static String SearchBar_2;
24 24
    public static String SearchBar_3;
25 25
    public static String SearchBar_4;
26
    public static String SearchBar_5;
27 26
    public static String SearchBar_6;
28 27
    public static String SearchBar_7;
29 28
    public static String SearchBar_8;
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java
1 1
// $Id$
2 2
/**
3 3
 * Copyright (C) 2007 EDIT
4
 * European Distributed Institute of Taxonomy 
4
 * European Distributed Institute of Taxonomy
5 5
 * http://www.e-taxonomy.eu
6
 * 
6
 *
7 7
 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
 * See LICENSE.TXT at the top of this package for the full license terms.
9 9
 */
......
75 75
	 * Handles focus changes for the search textfield.
76 76
	 */
77 77
	private void registerAtFocusService() {
78
		IFocusService focusService = 
78
		IFocusService focusService =
79 79
			(IFocusService) PlatformUI.getWorkbench().getService(IFocusService.class);
80 80
		if (focusService != null) {
81 81
			focusService.addFocusTracker(text_search, "navigation.textControlId");
......
124 124
	private void addTextListeners() {
125 125
		text_search.addFocusListener(new FocusListener() {
126 126

  
127
			public void focusGained(FocusEvent e) {
127
			@Override
128
            public void focusGained(FocusEvent e) {
128 129
				text_search.setForeground(NavigationUtil.getColor(Resources.SEARCH_VIEW_FOCUS));
129 130
				if (defaultText.equals(text_search.getText())) {
130 131
					text_search.setText("");
131 132
				}
132 133
			}
133 134

  
134
			public void focusLost(FocusEvent e) {
135
			@Override
136
            public void focusLost(FocusEvent e) {
135 137
				if (text_search.getText() == "") {
136 138
					text_search.setForeground(NavigationUtil.getColor(Resources.SEARCH_VIEW_FOREGROUND));
137 139
					text_search.setText(defaultText);
......
176 178
		if(searchString == null){
177 179
			return;
178 180
		}
179
		
181

  
180 182
		if("*".equals(searchString.trim())){
181 183
			MessagingUtils.warningDialog(Messages.SearchBar_2, this, Messages.SearchBar_3);
182 184
			return;
183 185
		}
184
		
185
		
186

  
187

  
186 188
		IFindTaxaAndNamesConfigurator configurator = configurationListener.getConfigurator();
187 189
		configurator.setTitleSearchString(searchString);
188 190
		openSearchResultsView(configurator);
189
		
191

  
190 192
	}
191
	
193

  
192 194
	private String getSearchString(){
193 195
		String searchString = text_search.getText().trim();
194
		if (searchString.equals(defaultText) || searchString.length() == 0)
195
			return null;
196
		if (searchString.equals(defaultText) || searchString.length() == 0) {
197
            return null;
198
        }
196 199
		return searchString;
197 200
	}
198
	
201

  
199 202
	/**
200 203
	 * Opens a new instance of the search result view to display the result to the user.
201
	 * 
204
	 *
202 205
	 * @param searchResult
203 206
	 */
204 207
	private void openSearchResultsView(IFindTaxaAndNamesConfigurator configurator) {
205 208
		boolean openResultInSeparateWindows = PreferencesUtil.getPreferenceStore().getBoolean((IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS));
206 209
		if(openResultInSeparateWindows){
207
			//increment change secondary id so it is unique 
210
			//increment change secondary id so it is unique
208 211
			secondaryId += "1";
209 212
		}
210 213

  
......
221 224

  
222 225
	/**
223 226
	 * Handles drop down menu selection. Available items are defined in the enumeration SearchOption.
224
	 * 
227
	 *
225 228
	 * @author n.hoffmann
226 229
	 * @created Feb 2, 2010
227 230
	 * @version 1.0
......
258 261

  
259 262
	/**
260 263
	 * Handles search configuration selection.
261
	 * 
264
	 *
262 265
	 * @author n.hoffmann
263 266
	 * @created Feb 2, 2010
264 267
	 * @version 1.0
......
266 269
	class ConfigurationSelectionListener extends SelectionAdapter {
267 270

  
268 271
		private IFindTaxaAndNamesConfigurator configurator = PreferencesUtil.getSearchConfigurator();
269
		
272

  
270 273
		/*
271 274
		 * (non-Javadoc)
272
		 * 
275
		 *
273 276
		 * @see
274 277
		 * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse
275 278
		 * .swt.events.SelectionEvent)
276 279
		 */
277 280
		@Override
278 281
		public void widgetSelected(SelectionEvent e) {
279
			MessagingUtils.info(Messages.SearchBar_5);
280 282
			SearchOption option = (SearchOption) e.widget.getData();
281 283

  
282 284
			switch (option){
......
291 293
				break;
292 294
			case COMMON_NAME:
293 295
				configurator.setDoTaxaByCommonNames(getConfigurator().isDoTaxaByCommonNames() ? false : true);
294
				break;				
296
				break;
295 297
			}
296
			
298

  
297 299
			saveConfigurator();
298 300
		}
299 301

  
......
309 311

  
310 312
	/**
311 313
	 * Available search options.
312
	 * 
314
	 *
313 315
	 * @author n.hoffmann
314 316
	 * @created Feb 2, 2010
315 317
	 * @version 1.0
316 318
	 */
317 319
	enum SearchOption {
318
		TAXON(Messages.SearchBar_6), 
319
		SYNONYM(Messages.SearchBar_7), 
320
		NAME(Messages.SearchBar_8), 
320
		TAXON(Messages.SearchBar_6),
321
		SYNONYM(Messages.SearchBar_7),
322
		NAME(Messages.SearchBar_8),
321 323
		COMMON_NAME(Messages.SearchBar_9);
322 324

  
323 325
		private final String label;

Also available in: Unified diff