- simplified code for opening editor in TaxonNavigator
authorPatric Plitzner <p.plitzner@bgbm.org>
Fri, 7 Jun 2013 08:17:22 +0000 (08:17 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Fri, 7 Jun 2013 08:17:22 +0000 (08:17 +0000)
 - used IPartContentHasXYZ interfaces for selectionChanged() in Supplemental- and DetailsViewPart

 - formatted code
 - fixed warnings

eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java

index 5925be91e873ab2ed6bc4acddf15898b199cac96..9fdb66b7acb266a0dcae034a2c7766d74e3b7150 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * 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.
 */
@@ -37,7 +37,6 @@ import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.OpenEditorConfiguration;
 import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
 import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
@@ -53,36 +52,36 @@ import eu.etaxonomy.taxeditor.navigation.navigator.TaxonNavigator;
  */
 public class NavigationUtil extends AbstractUtility{
        private static IUndoContext defaultUndoContext;
-               
+
        /**
         * <p>executeEditHandler</p>
         */
        public static void executeEditHandler(){
 
                String commandId = "eu.etaxonomy.taxeditor.navigation.command.editSelection";
-               
-               IHandlerService handlerService = (IHandlerService) NavigationUtil.getService(IHandlerService.class); 
+
+               IHandlerService handlerService = (IHandlerService) AbstractUtility.getService(IHandlerService.class);
                try {
                        handlerService.executeCommand(commandId, null);
                } catch (ExecutionException e) {
-                       NavigationUtil.error(NavigationUtil.class, e);
+                       AbstractUtility.error(NavigationUtil.class, e);
                } catch (NotDefinedException e) {
-                       NavigationUtil.error(NavigationUtil.class, e);
+                       AbstractUtility.error(NavigationUtil.class, e);
                } catch (NotEnabledException e) {
-                       NavigationUtil.error(NavigationUtil.class, e);
+                       AbstractUtility.error(NavigationUtil.class, e);
                } catch (NotHandledException e) {
-                       NavigationUtil.error(NavigationUtil.class, e);
+                       AbstractUtility.error(NavigationUtil.class, e);
                }
        }
-       
+
        /**
         * <p>openEditor</p>
         *
         * @param selectedObject a {@link eu.etaxonomy.cdm.model.common.CdmBase} object.
         */
        public static void openEditor(ICdmBase selectedObject){
-               UUID entityUuid = selectedObject.getUuid();     
-               try {   
+               UUID entityUuid = selectedObject.getUuid();
+               try {
                        if(selectedObject instanceof TaxonNode){
                                EditorUtil.openTaxonNode(entityUuid);
                        }else if(selectedObject instanceof TaxonBase){
@@ -96,12 +95,12 @@ public class NavigationUtil extends AbstractUtility{
                                warningDialog("Unsupported Type", NavigationUtil.class, "No editor exists for the current selection: " + selectedObject);
                        }
                } catch (PartInitException e) {
-                       NavigationUtil.error(NavigationUtil.class, "Error opening the editor", e);
+                       AbstractUtility.error(NavigationUtil.class, "Error opening the editor", e);
                } catch (Exception e) {
-                       EditorUtil.warningDialog("Could not create Taxon", NavigationUtil.class, e.getMessage());
+                       AbstractUtility.warningDialog("Could not create Taxon", NavigationUtil.class, e.getMessage());
                }
        }
-       
+
        public static void openEditor(Object selectedObject){
                if (selectedObject instanceof UuidAndTitleCache){
                        Class type = ((UuidAndTitleCache) selectedObject).getType();
@@ -109,16 +108,16 @@ public class NavigationUtil extends AbstractUtility{
                                try {
                                        EditorUtil.openTaxonBase(((UuidAndTitleCache) selectedObject).getUuid());
                                } catch (PartInitException e) {
-                                       NavigationUtil.error(NavigationUtil.class, "Error opening the editor", e);
+                                       AbstractUtility.error(NavigationUtil.class, "Error opening the editor", e);
                                }
                        }
                }else if(selectedObject instanceof ICdmBase){
-                       openEditor((ICdmBase) selectedObject); 
+                       openEditor((ICdmBase) selectedObject);
                }else{
-                       NavigationUtil.error(NavigationUtil.class, new IllegalArgumentException("Selected object is not supported: " + selectedObject));
+                       AbstractUtility.error(NavigationUtil.class, new IllegalArgumentException("Selected object is not supported: " + selectedObject));
                }
        }
-       
+
        /**
         * <p>openEmpty</p>
         *
@@ -128,10 +127,10 @@ public class NavigationUtil extends AbstractUtility{
                try {
                        EditorUtil.openEmpty(parentNodeUuid);
                } catch (PartInitException e) {
-                       NavigationUtil.error(NavigationUtil.class, "Error opening the editor", e);
+                       AbstractUtility.error(NavigationUtil.class, "Error opening the editor", e);
                }
        }
-       
+
        /**
         * <p>getShell</p>
         *
@@ -150,7 +149,7 @@ public class NavigationUtil extends AbstractUtility{
                return TaxeditorNavigationPlugin.getDefault().getWorkbench().
                                getActiveWorkbenchWindow();
        }
-       
+
        /**
         * <p>getWorkbenchUndoContext</p>
         *
@@ -169,10 +168,10 @@ public class NavigationUtil extends AbstractUtility{
        public static IUndoContext getUndoContext() {
                // FIXME this has to be more specific. Every widget has to have its own undo context
 //             return IOperationHistory.GLOBAL_UNDO_CONTEXT;
-               
-               // Plug-ins that wish their operations to be undoable from workbench views 
-               // such as the Navigator or Package Explorer should assign the workbench 
-               // undo context to their operations. 
+
+               // Plug-ins that wish their operations to be undoable from workbench views
+               // such as the Navigator or Package Explorer should assign the workbench
+               // undo context to their operations.
                if (defaultUndoContext == null) {
                        defaultUndoContext = new UndoContext();
                }
@@ -186,9 +185,9 @@ public class NavigationUtil extends AbstractUtility{
         * @return a boolean.
         */
        public static boolean isDirty(TaxonNode taxonNode){
-               
+
                for (IEditorReference reference : getActivePage().getEditorReferences()) {
-                       
+
                        try {
                                if (reference.getEditorInput() instanceof TaxonEditorInput) {
                                        TaxonEditorInput editorInput = (TaxonEditorInput) reference.getEditorInput();
@@ -197,10 +196,10 @@ public class NavigationUtil extends AbstractUtility{
                                        }
                                }
                        } catch (PartInitException e) {
-                               NavigationUtil.error(NavigationUtil.class, e.getMessage(), e);
+                               AbstractUtility.error(NavigationUtil.class, e.getMessage(), e);
                                throw new RuntimeException(e);
                        }
-                       
+
                }
                return false;
        }
@@ -214,7 +213,8 @@ public class NavigationUtil extends AbstractUtility{
        public static void selectInNavigator(final Object element, final Object parentElement) {
                Display.getDefault().asyncExec(new Runnable(){
 
-                       public void run() {
+                       @Override
+            public void run() {
                                TaxonNavigator navigator = showNavigator();
 
                                if (navigator != null) {
@@ -223,11 +223,11 @@ public class NavigationUtil extends AbstractUtility{
                                                if (parentElement != null) {
                                                        viewer.setExpandedState(parentElement, true);
                                                }
-                                               viewer.setSelection(new StructuredSelection((TaxonNode) element));
+                                               viewer.setSelection(new StructuredSelection(element));
                                        }
                                }
                        }
-                       
+
                });
        }
 
@@ -239,18 +239,18 @@ public class NavigationUtil extends AbstractUtility{
        public static void openSearch(Object selection) {
                if(selection instanceof Taxon){
                        Taxon taxon = (Taxon) selection;
-                       
+
                        handleOpeningOfMultipleTaxonNodes(taxon.getTaxonNodes());
-                       
+
                }else if(selection instanceof Synonym){
                        Synonym synonym = (Synonym) selection;
-                       
+
                        handleOpeningOfMultipleTaxa(synonym.getAcceptedTaxa());
-                       
+
                }else{
                        warningDialog("Not implemented yet", NavigationUtil.class, "You chose to open a name that has no connection to a taxon. The Editor does not support editing of such a content type at the moment.");
                }
-               
+
        }
 
        private static void handleOpeningOfMultipleTaxa(Set<Taxon> acceptedTaxa) {
@@ -271,7 +271,7 @@ public class NavigationUtil extends AbstractUtility{
         */
        private static void handleOpeningOfMultipleTaxonNodes(
                        Set<TaxonNode> taxonNodes) {
-               
+
                if(taxonNodes.size() == 1){
                        openEditor(taxonNodes.iterator().next());
                }else if(taxonNodes.size() > 1){
index 7b9adddc422827062b0f7975877e64f1a6911674..94aeb170bc0fcd422e46a774376fd25927bc9c0f 100644 (file)
@@ -1,9 +1,9 @@
 // $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.
  */
@@ -18,8 +18,6 @@ import java.util.Observer;
 import java.util.Set;
 import java.util.UUID;
 
-import org.eclipse.core.commands.Command;
-import org.eclipse.core.commands.common.NotDefinedException;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jface.viewers.DoubleClickEvent;
@@ -27,8 +25,6 @@ import org.eclipse.jface.viewers.TreePath;
 import org.eclipse.ui.IMemento;
 import org.eclipse.ui.IViewSite;
 import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.handlers.IHandlerService;
 import org.eclipse.ui.navigator.CommonNavigator;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
@@ -45,7 +41,7 @@ import eu.etaxonomy.taxeditor.store.LoginManager;
 
 /**
  * Taxonomic tree implementation using Common Navigator Framework.
- * 
+ *
  * @author p.ciardelli
  * @author n.hoffmann
  * @created 02.06.2009
@@ -60,12 +56,6 @@ public class TaxonNavigator extends CommonNavigator implements
         */
        public static final String ID = "eu.etaxonomy.taxeditor.navigation.navigator"; //$NON-NLS-1$
 
-       /**
-        * Constant
-        * <code>OPEN_COMMAND_ID="eu.etaxonomy.taxeditor.navigation.comma"{trunked}</code>
-        */
-       public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.navigation.command.editSelection";
-
        private static final String TREE_PATH = "treepath";
 
        private static final String TREE_PATHS = "treepaths";
@@ -78,7 +68,7 @@ public class TaxonNavigator extends CommonNavigator implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.navigator.CommonNavigator#getInitialInput()
         */
        /** {@inheritDoc} */
@@ -120,7 +110,7 @@ public class TaxonNavigator extends CommonNavigator implements
         */
        public void refresh() {
                if(getConversationHolder() != null){
-                       getConversationHolder().bind();                 
+                       getConversationHolder().bind();
                }
                getCommonViewer().refresh();
        }
@@ -136,7 +126,7 @@ public class TaxonNavigator extends CommonNavigator implements
         * <p>
         * restore
         * </p>
-        * 
+        *
         * @param memento
         *            a {@link org.eclipse.ui.IMemento} object.
         * @param monitor
@@ -203,8 +193,9 @@ public class TaxonNavigator extends CommonNavigator implements
 
                List<CdmBase> pathList = new ArrayList<CdmBase>();
 
-               if (string.length() == 0)
-                       return null;
+               if (string.length() == 0) {
+            return null;
+        }
 
                for (String uuid : string.split(" ")) {
                        CdmBase cdmBaseObject = CdmStore.getService(
@@ -216,8 +207,9 @@ public class TaxonNavigator extends CommonNavigator implements
                                                IClassificationService.class).load(
                                                UUID.fromString(uuid));
 
-                               if (cdmBaseObject == null)
-                                       return null;
+                               if (cdmBaseObject == null) {
+                    return null;
+                }
                        }
                        pathList.add(cdmBaseObject);
                }
@@ -234,7 +226,7 @@ public class TaxonNavigator extends CommonNavigator implements
         * <p>
         * saveTreeState
         * </p>
-        * 
+        *
         * @param memento
         *            a {@link org.eclipse.ui.IMemento} object.
         * @param progressMonitor
@@ -274,7 +266,7 @@ public class TaxonNavigator extends CommonNavigator implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder
         * ()
@@ -283,7 +275,7 @@ public class TaxonNavigator extends CommonNavigator implements
         * <p>
         * getConversationHolder
         * </p>
-        * 
+        *
         * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
         *         object.
         */
@@ -294,7 +286,7 @@ public class TaxonNavigator extends CommonNavigator implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update
         * (eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
@@ -320,7 +312,7 @@ public class TaxonNavigator extends CommonNavigator implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.part.WorkbenchPart#dispose()
         */
        /** {@inheritDoc} */
@@ -335,7 +327,7 @@ public class TaxonNavigator extends CommonNavigator implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.navigator.CommonNavigator#setFocus()
         */
        /** {@inheritDoc} */
@@ -350,7 +342,7 @@ public class TaxonNavigator extends CommonNavigator implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation
         * (eu.etaxonomy.cdm.model.common.CdmBase)
@@ -366,7 +358,7 @@ public class TaxonNavigator extends CommonNavigator implements
         * <p>
         * save
         * </p>
-        * 
+        *
         * @param memento
         *            a {@link org.eclipse.ui.IMemento} object.
         * @param monitor
@@ -383,26 +375,7 @@ public class TaxonNavigator extends CommonNavigator implements
        /** {@inheritDoc} */
        @Override
        protected void handleDoubleClick(DoubleClickEvent anEvent) {
-
-               ICommandService commandService = (ICommandService) getSite()
-                               .getService(ICommandService.class);
-
-               Command command = commandService.getCommand(OPEN_COMMAND_ID);
-               if (command.isEnabled()) {
-                       IHandlerService handlerService = (IHandlerService) getSite()
-                                       .getService(IHandlerService.class);
-                       try {
-                               handlerService.executeCommand(OPEN_COMMAND_ID, null);
-                       } catch (NotDefinedException e) {
-                               throw new RuntimeException("Could not find open command: "
-                                               + OPEN_COMMAND_ID);
-                       } catch (Exception e) {
-                               NavigationUtil
-                                               .error(getClass(),
-                                                               "An exception occured while trying to open a selection",
-                                                               e);
-                       }
-               }
+               NavigationUtil.executeEditHandler();
                // If the double click is passed up to the super-class it will
                // expand/collapse trees.
                // We do not want that
@@ -413,7 +386,7 @@ public class TaxonNavigator extends CommonNavigator implements
         * <p>
         * onComplete
         * </p>
-        * 
+        *
         * @return a boolean.
         */
        @Override
@@ -423,7 +396,7 @@ public class TaxonNavigator extends CommonNavigator implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.part.WorkbenchPart#showBusy(boolean)
         */
        /** {@inheritDoc} */
@@ -450,6 +423,6 @@ public class TaxonNavigator extends CommonNavigator implements
                if(o instanceof LoginManager){
                        refresh();
                }
-               
+
        }
 }
index 4415ee1d167c387ab1cfd7ca4ca28a04f5a149f1..917f5f40d7e0f3dcbe9b2a77e193f320be22c93e 100644 (file)
@@ -2,9 +2,9 @@ package eu.etaxonomy.taxeditor.navigation.navigator.handler;
 // $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.
 */
@@ -41,47 +41,49 @@ public class EditHandler extends AbstractHandler implements IHandler{
         * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
         */
        /** {@inheritDoc} */
-       public Object execute(ExecutionEvent event) throws ExecutionException {
-       
+       @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+
                ISelection selection = HandlerUtil.getCurrentSelection(event);
-               
+
                if(selection instanceof StructuredSelection){
                        final StructuredSelection structuredSelection = (StructuredSelection) selection;
-                       
+
                        if(structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof Classification){
                                Classification classification = (Classification) structuredSelection.getFirstElement();
-                               
+
                                NewClassificationWizard classificationWizard = new NewClassificationWizard();
                                classificationWizard.init(null, null);
                                classificationWizard.setEntity(classification);
                                WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), classificationWizard);
                                dialog.open();
-                               
+
                        }
                        else{
 
                                Job job = new Job("Opening editor") {
-                                       
+
                                        @Override
                                        protected IStatus run(IProgressMonitor monitor) {
                                                for(final Object selectedObject : structuredSelection.toArray()){
-                                                       
+
                                                        Display.getDefault().asyncExec(new Runnable(){
-       
-                                                               public void run() {
+
+                                                               @Override
+                                public void run() {
                                                                        NavigationUtil.openEditor(selectedObject);
                                                                }
-                                                               
+
                                                        });
                                                }
                                                return Status.OK_STATUS;
                                        }
                                };
-                               
+
                                job.schedule();
                        }
                }
-               
+
                return null;
        }
 }
index d5984d1c502772217fe194b37d1946fd86e92bc3..905e4b847568bf7edc58557f9681f3cfd6f07284 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * 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.
 */
@@ -41,6 +41,7 @@ import eu.etaxonomy.cdm.api.service.config.IFindTaxaAndNamesConfigurator;
 import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.ContextListenerAdapter;
 import eu.etaxonomy.taxeditor.model.IContextListener;
 import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
@@ -56,9 +57,9 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @version 1.0
  */
 public class SearchResultView extends ViewPart implements IConversationEnabled{
-       
+
        private static Object[] EMPTY = new Object[0];
-       
+
        private class ContextListener extends ContextListenerAdapter{
                /* (non-Javadoc)
                 * @see eu.etaxonomy.taxeditor.model.IContextListener#contextStop(org.eclipse.ui.IMemento, org.eclipse.core.runtime.IProgressMonitor)
@@ -66,12 +67,12 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
                @Override
                public void contextStop(IMemento memento, IProgressMonitor monitor) {
                        monitor.subTask("Getting rid of search results");
-                       NavigationUtil.hideView(SearchResultView.this);
+                       AbstractUtility.hideView(SearchResultView.this);
                }
        }
-       
+
        /** Constant <code>ID="eu.etaxonomy.taxeditor.navigation.searc"{trunked}</code> */
-       public static final String ID = 
+       public static final String ID =
                        "eu.etaxonomy.taxeditor.navigation.search.searchResultView"; //$NON-NLS-1$
 
        private TableViewer resultViewer;
@@ -85,42 +86,43 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
        private Text status;
 
        private SearchJob searchJob;
-       
+
        private IContextListener contextListener;
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
         */
        /** {@inheritDoc} */
        @Override
        public void createPartControl(Composite parent) {
-               
+
                conversation = CdmStore.createConversation();
                contextListener = new ContextListener();
                CdmStore.getContextManager().addContextListener(contextListener);
-               
+
                GridLayout layout = new GridLayout();
                layout.marginWidth = 0;
                layout.marginHeight = 0;
-               
+
                parent.setLayout(layout);
-               
+
                Composite infoComposite = createInfoComposite(parent);
                infoComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-               
+
                resultViewer = new TableViewer(parent, SWT.NONE);
                resultViewer.setContentProvider(new ArrayContentProvider());
                resultViewer.setLabelProvider(new SearchResultLabelProvider());
                resultViewer.addDoubleClickListener(new IDoubleClickListener() {
-                       public void doubleClick(DoubleClickEvent event) {
+                       @Override
+            public void doubleClick(DoubleClickEvent event) {
                                NavigationUtil.executeEditHandler();
                        }
                });
-               
+
                resultViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-               
+
                getSite().setSelectionProvider(resultViewer);
-               
+
                // register context menu
                MenuManager menuMgr = new MenuManager();
                menuMgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
@@ -128,39 +130,39 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
 
                Control control = resultViewer.getControl();
                Menu menu = menuMgr.createContextMenu(control);
-               control.setMenu(menu);  
+               control.setMenu(menu);
        }
-       
+
        private Composite createInfoComposite(Composite parent){
                Composite composite = new Composite(parent, SWT.NULL);
-               
+
                composite.setLayout(new GridLayout(2, false));
-               
+
                Label searchStringLabel = new Label(composite, SWT.NULL);
                searchStringLabel.setText("Search String:");
-               
+
                searchString = new Text(composite, SWT.NULL);
                searchString.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                searchString.setEditable(false);
 //             searchString.setText("                                               ");
-               
+
                Label configurationDescriptionLabel = new Label(composite, SWT.NULL);
                configurationDescriptionLabel.setText("Search for:");
-               
+
                configurationLabel = new Text(composite, SWT.WRAP);
                configurationLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                configurationLabel.setEditable(false);
-               
+
                Label statusLabel = new Label(composite, SWT.NULL);
                statusLabel.setText("Status:");
-               
+
                status = new Text(composite, SWT.NULL);
                status.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                status.setEditable(false);
-               
+
                return composite;
        }
-       
+
        /**
         * <p>performSearch</p>
         *
@@ -168,20 +170,23 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
         */
        public void performSearch(IFindTaxaAndNamesConfigurator configurator){
                setPartName("Search: '" + configurator.getTitleSearchString() + "'");
-               
+
                searchString.setText(configurator.getTitleSearchString());
-               
+
                List<String> includedEntities = new ArrayList<String>();
-               if(configurator.isDoTaxa())
-                       includedEntities.add(SearchOption.TAXON.getLabel());
-               if(configurator.isDoSynonyms())
-                       includedEntities.add(SearchOption.SYNONYM.getLabel());
-               if(configurator.isDoNamesWithoutTaxa())
-                       includedEntities.add(SearchOption.NAME.getLabel());
+               if(configurator.isDoTaxa()) {
+            includedEntities.add(SearchOption.TAXON.getLabel());
+        }
+               if(configurator.isDoSynonyms()) {
+            includedEntities.add(SearchOption.SYNONYM.getLabel());
+        }
+               if(configurator.isDoNamesWithoutTaxa()) {
+            includedEntities.add(SearchOption.NAME.getLabel());
+        }
                if(configurator.isDoTaxaByCommonNames()){
                        includedEntities.add(SearchOption.COMMON_NAME.getLabel());
                }
-               
+
                String includedEntitiesString = "";
                for (int i = 0; i < includedEntities.size(); i++){
                        includedEntitiesString += includedEntities.get(i);
@@ -189,16 +194,16 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
                                includedEntitiesString += ", ";
                        }
                }
-               
+
                configurationLabel.setText(includedEntitiesString);
-               
+
                status.setText("Searching...");
-               
+
                searchJob = new SearchJob(Display.getCurrent(), configurator);
                searchJob.schedule();
-               
+
        }
-       
+
        /**
         * <p>displaySearchResult</p>
         *
@@ -206,10 +211,10 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
         */
        protected void displaySearchResult(List<UuidAndTitleCache<TaxonBase>> result) {
                if(result.size() > 0){
-                       resultViewer.setInput(result); 
+                       resultViewer.setInput(result);
                        status.setText(result.size() + " entities found");
                }else{
-                       resultViewer.setInput(EMPTY); 
+                       resultViewer.setInput(EMPTY);
                        status.setText("Search returned no results");
                }
        }
@@ -234,7 +239,8 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
         *
         * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
         */
-       public ConversationHolder getConversationHolder() {
+       @Override
+    public ConversationHolder getConversationHolder() {
                return this.conversation;
        }
 
@@ -242,11 +248,12 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
         * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
         */
        /** {@inheritDoc} */
-       public void update(CdmDataChangeMap changeEvents) {
+       @Override
+    public void update(CdmDataChangeMap changeEvents) {
                // TODO Auto-generated method stub
-               
+
        }
-       
+
        /* (non-Javadoc)
         * @see org.eclipse.ui.part.WorkbenchPart#dispose()
         */
@@ -255,23 +262,24 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
        public void dispose() {
                super.dispose();
                conversation.close();
-               if(searchJob != null)
-                       searchJob.cancel();
+               if(searchJob != null) {
+            searchJob.cancel();
+        }
                CdmStore.getContextManager().removeContextListener(contextListener);
        }
-       
+
        /**
-        * 
+        *
         * @author n.hoffmann
         * @created Feb 2, 2010
         * @version 1.0
         */
        class SearchJob extends Job{
 
-               private IFindTaxaAndNamesConfigurator configurator;
-               
-               private Display display;
-               
+               private final IFindTaxaAndNamesConfigurator configurator;
+
+               private final Display display;
+
                /**
                 * @param name
                 */
@@ -288,19 +296,21 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
                protected IStatus run(IProgressMonitor monitor) {
                        monitor.beginTask("", 100);
                        monitor.worked(20);
-                       
+
                        final List<UuidAndTitleCache<TaxonBase>> searchResult = CdmStore.getSearchManager().findTaxaAndNames(configurator);
                        monitor.worked(40);
-                       
+
                        if(! monitor.isCanceled()){
                                display.asyncExec(new Runnable() {
-                                       public void run() {
+                                       @Override
+                    public void run() {
                                                displaySearchResult(searchResult);
                                        }
                                });
                        }else{
                                display.asyncExec(new Runnable() {
-                                       public void run() {
+                                       @Override
+                    public void run() {
                                                status.setText("Cancelled");
                                        }
                                });
@@ -308,6 +318,6 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
                        monitor.done();
                        return Status.OK_STATUS;
                }
-               
-       }       
+
+       }
 }