// $Id$
/**
* Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy
+ * European Distributed Institute of Taxonomy
* http://www.e-taxonomy.eu
- *
+ *
* The contents of this file are subject to the Mozilla Public License Version 1.1
* See LICENSE.TXT at the top of this package for the full license terms.
*/
* Handles focus changes for the search textfield.
*/
private void registerAtFocusService() {
- IFocusService focusService =
+ IFocusService focusService =
(IFocusService) PlatformUI.getWorkbench().getService(IFocusService.class);
if (focusService != null) {
focusService.addFocusTracker(text_search, "navigation.textControlId");
private void addTextListeners() {
text_search.addFocusListener(new FocusListener() {
- public void focusGained(FocusEvent e) {
+ @Override
+ public void focusGained(FocusEvent e) {
text_search.setForeground(NavigationUtil.getColor(Resources.SEARCH_VIEW_FOCUS));
if (defaultText.equals(text_search.getText())) {
text_search.setText("");
}
}
- public void focusLost(FocusEvent e) {
+ @Override
+ public void focusLost(FocusEvent e) {
if (text_search.getText() == "") {
text_search.setForeground(NavigationUtil.getColor(Resources.SEARCH_VIEW_FOREGROUND));
text_search.setText(defaultText);
if(searchString == null){
return;
}
-
+
if("*".equals(searchString.trim())){
MessagingUtils.warningDialog(Messages.SearchBar_2, this, Messages.SearchBar_3);
return;
}
-
-
+
+
IFindTaxaAndNamesConfigurator configurator = configurationListener.getConfigurator();
configurator.setTitleSearchString(searchString);
openSearchResultsView(configurator);
-
+
}
-
+
private String getSearchString(){
String searchString = text_search.getText().trim();
- if (searchString.equals(defaultText) || searchString.length() == 0)
- return null;
+ if (searchString.equals(defaultText) || searchString.length() == 0) {
+ return null;
+ }
return searchString;
}
-
+
/**
* Opens a new instance of the search result view to display the result to the user.
- *
+ *
* @param searchResult
*/
private void openSearchResultsView(IFindTaxaAndNamesConfigurator configurator) {
boolean openResultInSeparateWindows = PreferencesUtil.getPreferenceStore().getBoolean((IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS));
if(openResultInSeparateWindows){
- //increment change secondary id so it is unique
+ //increment change secondary id so it is unique
secondaryId += "1";
}
/**
* Handles drop down menu selection. Available items are defined in the enumeration SearchOption.
- *
+ *
* @author n.hoffmann
* @created Feb 2, 2010
* @version 1.0
/**
* Handles search configuration selection.
- *
+ *
* @author n.hoffmann
* @created Feb 2, 2010
* @version 1.0
class ConfigurationSelectionListener extends SelectionAdapter {
private IFindTaxaAndNamesConfigurator configurator = PreferencesUtil.getSearchConfigurator();
-
+
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse
* .swt.events.SelectionEvent)
*/
@Override
public void widgetSelected(SelectionEvent e) {
- MessagingUtils.info(Messages.SearchBar_5);
SearchOption option = (SearchOption) e.widget.getData();
switch (option){
break;
case COMMON_NAME:
configurator.setDoTaxaByCommonNames(getConfigurator().isDoTaxaByCommonNames() ? false : true);
- break;
+ break;
}
-
+
saveConfigurator();
}
/**
* Available search options.
- *
+ *
* @author n.hoffmann
* @created Feb 2, 2010
* @version 1.0
*/
enum SearchOption {
- TAXON(Messages.SearchBar_6),
- SYNONYM(Messages.SearchBar_7),
- NAME(Messages.SearchBar_8),
+ TAXON(Messages.SearchBar_6),
+ SYNONYM(Messages.SearchBar_7),
+ NAME(Messages.SearchBar_8),
COMMON_NAME(Messages.SearchBar_9);
private final String label;