Merge branch 'release/5.11.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / search / SearchBar.java
index 79b839397fa7e820238ac78f0e47dabfdaa14904..363ce8a297be6dddd7f955e297e4c975efe1bd26 100644 (file)
@@ -31,6 +31,7 @@ import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.RowData;
 import org.eclipse.swt.layout.RowLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
@@ -142,6 +143,9 @@ public class SearchBar implements IContextListener{
                text_search.setForeground(AbstractUtility.getColor(Resources.SEARCH_VIEW_FOREGROUND));
                text_search.setText(defaultText);
         text_search.setEnabled(false);
+        RowData layoutData = new RowData();
+        layoutData.width = 150;
+        text_search.setLayoutData(layoutData);
 
                addTextListeners();
        }
@@ -186,12 +190,12 @@ public class SearchBar implements IContextListener{
        private void createLayout(Composite composite) {
                final RowLayout layout = new RowLayout();
                layout.wrap = false;
-               layout.pack = true;
-               layout.justify = true;
+               layout.pack = false;
+               layout.justify = false;
                layout.type = SWT.HORIZONTAL;
-               layout.marginLeft = 0;
+               layout.marginLeft = 5;
                layout.marginTop = 0;
-               layout.marginRight = 0;
+               layout.marginRight = 5;
                layout.marginBottom = 0;
                layout.spacing = 0;
                composite.setLayout(layout);
@@ -229,7 +233,7 @@ public class SearchBar implements IContextListener{
         * @param searchResult
         */
        private void openSearchResultsView(IFindTaxaAndNamesConfigurator configurator) {
-               boolean openResultInSeparateWindows = PreferencesUtil.getPreferenceStore().getBoolean((IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS));
+               boolean openResultInSeparateWindows = PreferencesUtil.getBooleanValue((IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS));
                String partId = AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_NAVIGATION_SEARCH_E4_SEARCHRESULTVIEWE4;
 
                MPart part = null;
@@ -314,7 +318,6 @@ public class SearchBar implements IContextListener{
         *
         * @author n.hoffmann
         * @created Feb 2, 2010
-        * @version 1.0
         */
        class ConfigurationSelectionListener extends SelectionAdapter {
 
@@ -335,8 +338,13 @@ public class SearchBar implements IContextListener{
                                configurator.setDoNamesWithoutTaxa(configurator.isDoNamesWithoutTaxa() ? false : true);
                                break;
                        case COMMON_NAME:
-                               configurator.setDoTaxaByCommonNames(getConfigurator().isDoTaxaByCommonNames() ? false : true);
+                               configurator.setDoTaxaByCommonNames(configurator.isDoTaxaByCommonNames() ? false : true);
                                break;
+            case UNPUBLISHED:
+                configurator.setIncludeUnpublished(configurator.isIncludeUnpublished() ? false : true);
+                break;
+            default:
+                break;
                        }
 
                        saveConfigurator();
@@ -347,8 +355,9 @@ public class SearchBar implements IContextListener{
                }
 
                private void saveConfigurator() {
-                       PreferencesUtil.setSearchConfigurator(getConfigurator());
-                       this.configurator = PreferencesUtil.getSearchConfigurator();
+                       PreferencesUtil.setSearchConfigurator(configurator);
+                       PreferencesUtil.firePreferencesChanged(this.getClass());
+
                }
        }