- implemented setFocus() of all EditorParts
authorPatric Plitzner <p.plitzner@bgbm.org>
Mon, 18 Aug 2014 11:28:24 +0000 (11:28 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Mon, 18 Aug 2014 11:28:24 +0000 (11:28 +0000)
   - this is to avoid "java.lang.Exception: java.lang.RuntimeException: WARNING: Prevented recursive attempt to activate part"
   - either set the focus to shell or set it to the viewer used

fix for #2754

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/annotatedlineeditor/AnnotatedLineEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/group/authority/CdmAuthorityEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/TaxonNameEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/DataImportEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/editor/definedterm/DefinedTermEditor.java

index f45d45100cf398fd279948ad69720fb6b4495fd4..08876fef01d643cd5a2869b83dd2472903ec86aa 100644 (file)
@@ -19,6 +19,7 @@ import org.eclipse.jface.text.source.ISourceViewer;
 import org.eclipse.jface.text.source.IVerticalRuler;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.editors.text.TextEditor;
 import org.eclipse.ui.texteditor.IDocumentProvider;
 
@@ -258,6 +259,7 @@ public class AnnotatedLineEditor extends TextEditor implements IConversationEnab
                if (getConversationHolder() != null) {
                        getConversationHolder().bind();
                }
+               PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus();
                // TODO pass focus to underlying widgets
        }
 
index b82a717a45b728aee16a7a65a07264b68cb1d4fa..a68fda35cff9b852b64089547f821bffd06e0a13 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.
 */
@@ -10,12 +10,13 @@ package eu.etaxonomy.taxeditor.editor.group.authority;
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorSite;
 import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.EditorPart;
-import org.eclipse.swt.layout.FillLayout;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
@@ -26,7 +27,7 @@ import eu.etaxonomy.taxeditor.ui.group.grantedauthority.CdmAuthorityCompositeVie
 
 /**
  * Editor responsible for editing authorities related to a particular {@link Group} entity.
- * 
+ *
  * @author cmathew
  * @created Mar 28, 2013
  *
@@ -38,9 +39,9 @@ public class CdmAuthorityEditor extends EditorPart implements IConversationEnabl
        private boolean dirty;
        private ConversationHolder conversation;
        private CdmAuthorityCompositeViewer viewer;
-       
-       public CdmAuthorityEditor() {                   
-               
+
+       public CdmAuthorityEditor() {
+
        }
 
        /**
@@ -51,11 +52,11 @@ public class CdmAuthorityEditor extends EditorPart implements IConversationEnabl
        public void createPartControl(Composite parent) {
                Composite container = new Composite(parent, SWT.NONE);
                container.setLayout(new FillLayout(SWT.HORIZONTAL));
-               
+
                this.viewer = new CdmAuthorityCompositeViewer(container, this,((CdmAuthorityEditorInput) getEditorInput()).getGroup());
 
                conversation = ((CdmAuthorityEditorInput) getEditorInput()).getConversationHolder();
-               setPartName(getEditorInput().getName());                        
+               setPartName(getEditorInput().getName());
 
        }
 
@@ -64,7 +65,7 @@ public class CdmAuthorityEditor extends EditorPart implements IConversationEnabl
         */
        @Override
        public void setFocus() {
-       
+           PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus();
        }
 
        /* (non-Javadoc)
@@ -74,7 +75,7 @@ public class CdmAuthorityEditor extends EditorPart implements IConversationEnabl
        public void doSave(IProgressMonitor monitor) {
                try {
                        monitor.beginTask("Saving CDM Authority Editor", 1);
-                       getConversationHolder().commit(true);                   
+                       getConversationHolder().commit(true);
                        dirty = false;
                        firePropertyChange(PROP_DIRTY);
                        monitor.worked(1);
@@ -100,7 +101,7 @@ public class CdmAuthorityEditor extends EditorPart implements IConversationEnabl
                        throws PartInitException {
                setSite(site);
                setInput(input);
-       }       
+       }
 
        /* (non-Javadoc)
         * @see org.eclipse.ui.part.EditorPart#isDirty()
@@ -124,7 +125,7 @@ public class CdmAuthorityEditor extends EditorPart implements IConversationEnabl
        @Override
        public void update(CdmDataChangeMap changeEvents) {
                // TODO Auto-generated method stub
-               
+
        }
 
        /* (non-Javadoc)
@@ -132,18 +133,18 @@ public class CdmAuthorityEditor extends EditorPart implements IConversationEnabl
         */
        @Override
        public void changed(Object element) {
-               //FIXME : should be optimised to split changes into adding / removing authorities 
+               //FIXME : should be optimised to split changes into adding / removing authorities
                //        vs updating authorites
                dirty = viewer.isDirty();
                firePropertyChange(PROP_DIRTY);
                // if the change has happened on the group then refresh the table
                if(element instanceof Group) {
-                       
+
                        //FIXME: activating (setting focus) on the editor happens on every change
                        //       This should be changed to only when the drop is successful
                        getSite().getPage().activate(this);
                }
-               
+
        }
 
        /* (non-Javadoc)
@@ -153,10 +154,10 @@ public class CdmAuthorityEditor extends EditorPart implements IConversationEnabl
        public ConversationHolder getConversationHolder() {
                return conversation;
        }
-       
+
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.forms.editor.FormEditor#dispose()
         */
        @Override
index 492e597fb1621aacefb488728c06fe5aacbdbc36..8f1921f382ee69ba8e72effc689946fd33d0067e 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.
  */
@@ -16,7 +16,6 @@ import java.util.Set;
 
 import org.apache.commons.lang.StringUtils;
 import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.OperationCanceledException;
 import org.eclipse.jface.action.MenuManager;
@@ -36,6 +35,7 @@ import org.eclipse.ui.ISelectionService;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchPartReference;
 import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.forms.ManagedForm;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 import org.eclipse.ui.forms.widgets.ScrolledForm;
@@ -67,10 +67,10 @@ import eu.etaxonomy.taxeditor.editor.name.container.ContainerFactory;
 import eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup;
 import eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup;
 import eu.etaxonomy.taxeditor.editor.name.dnd.NameEditorDropTargetListener;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.IPartChangeListener;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
 import eu.etaxonomy.taxeditor.model.TaxeditorPartService;
-import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.preference.Resources;
 import eu.etaxonomy.taxeditor.security.RequiredPermissions;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -80,15 +80,15 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
  * <p>
  * TaxonNameEditor class.
  * </p>
- * 
+ *
  * @author p.ciardelli
  * @author n.hoffmann
  * @created 15.05.2008
  * @version 1.0
  */
 public class TaxonNameEditor extends EditorPart implements
-               IMultiPageTaxonEditorPage, IAdaptable, IConversationEnabled,
-               IPostOperationEnabled, IPartContentHasDetails, IPartChangeListener,
+               IMultiPageTaxonEditorPage, IConversationEnabled,
+               IPartContentHasDetails, IPartChangeListener,
                ISelectionListener, IDropTargetable, ISecuredEditor {
 
        /** Constant <code>ID="eu.etaxonomy.taxeditor.editor.taxon.name"</code> */
@@ -124,7 +124,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * Constructor for TaxonNameEditor.
         * </p>
-        * 
+        *
         * @param editor
         *            a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor}
         *            object.
@@ -138,7 +138,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * getUndoContext
         * </p>
-        * 
+        *
         * @return a {@link org.eclipse.core.commands.operations.IUndoContext}
         *         object.
         */
@@ -148,7 +148,7 @@ public class TaxonNameEditor extends EditorPart implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
         * .Composite)
@@ -169,7 +169,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * createManagedForm
         * </p>
-        * 
+        *
         * @param composite
         *            a {@link org.eclipse.swt.widgets.Composite} object.
         */
@@ -191,8 +191,8 @@ public class TaxonNameEditor extends EditorPart implements
                                        selection = null;
                                        getSite().getSelectionProvider().setSelection(new StructuredSelection());
                                }
-                               
-                               
+
+
                                return super.setInput(input);
                        }
                };
@@ -218,7 +218,7 @@ public class TaxonNameEditor extends EditorPart implements
                layout.horizontalSpacing = 0;
 
                parent.setLayout(layout);
-               parent.setBackground(EditorUtil
+               parent.setBackground(AbstractUtility
                                .getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
 
                createOrUpdateNameComposites();
@@ -247,7 +247,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * Getter for the field <code>taxon</code>.
         * </p>
-        * 
+        *
         * @return a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
         */
        public Taxon getTaxon() {
@@ -265,18 +265,19 @@ public class TaxonNameEditor extends EditorPart implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
         */
        /** {@inheritDoc} */
        @Override
        public void setFocus() {
+           PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setFocus();
                if (getSelectedContainer() == null) {
                        throw new IllegalStateException(
                                        "There should always be a selected object.");
                }
                getSelectedContainer().setSelected();
-               
+
                // check permissions
                boolean doEnable = permissionsSatisfied();
                setEnabled(doEnable);
@@ -300,7 +301,7 @@ public class TaxonNameEditor extends EditorPart implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder
         * ()
@@ -309,41 +310,45 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * getConversationHolder
         * </p>
-        * 
+        *
         * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
         *         object.
         */
-       public ConversationHolder getConversationHolder() {
+       @Override
+    public ConversationHolder getConversationHolder() {
                return conversation;
        }
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.cdm.persistence.hibernate.ICdmPostCrudObserver#update(eu
         * .etaxonomy.cdm.persistence.hibernate.CdmCrudEvent)
         */
        /** {@inheritDoc} */
-       public void update(CdmDataChangeMap events) {
+       @Override
+    public void update(CdmDataChangeMap events) {
                // redraw();
        }
 
        /**
         * Redraws this editor return true on success
-        * 
+        *
         * @return a boolean.
         */
-       public boolean redraw() {
+       @Override
+    public boolean redraw() {
                return redraw(true);
        }
 
        /**
         * {@inheritDoc}
-        * 
+        *
         * Redraws the editor controls
         */
-       public boolean redraw(boolean focus) {
+       @Override
+    public boolean redraw(boolean focus) {
 
                createOrUpdateNameComposites();
 
@@ -358,7 +363,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * getMultiPageTaxonEditor
         * </p>
-        * 
+        *
         * @return a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor}
         *         object.
         */
@@ -368,16 +373,17 @@ public class TaxonNameEditor extends EditorPart implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.taxeditor.store.operations.IPostOperationEnabled#postOperation
         * ()
         */
        /** {@inheritDoc} */
-       public boolean postOperation(CdmBase objectAffectedByOperation) {
+       @Override
+    public boolean postOperation(CdmBase objectAffectedByOperation) {
 
                editor.changed(objectAffectedByOperation);
-               
+
                redraw(false);
 
                if (objectAffectedByOperation instanceof TaxonBase) {
@@ -391,7 +397,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * Getter for the field <code>managedForm</code>.
         * </p>
-        * 
+        *
         * @return the managedForm
         */
        public ManagedForm getManagedForm() {
@@ -402,10 +408,11 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * getControl
         * </p>
-        * 
+        *
         * @return a {@link org.eclipse.swt.widgets.Composite} object.
         */
-       public Composite getControl() {
+       @Override
+    public Composite getControl() {
                return this.getManagedForm().getForm().getBody();
        }
 
@@ -413,7 +420,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * Getter for the field <code>menu</code>.
         * </p>
-        * 
+        *
         * @return the menu
         */
        public Menu getMenu() {
@@ -429,7 +436,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * checkForEmptyNames
         * </p>
-        * 
+        *
         * @return true if there are empty names
         */
        public boolean checkForEmptyNames() {
@@ -495,8 +502,9 @@ public class TaxonNameEditor extends EditorPart implements
        public void init(IEditorSite site, IEditorInput input)
                        throws PartInitException {
 
-               if (!(input instanceof IEditorInput))
-                       throw new PartInitException("Invalid Input: Must be IEditorInput");
+               if (!(input != null)) {
+            throw new PartInitException("Invalid Input: Must be IEditorInput");
+        }
 
                if (input.getAdapter(Taxon.class) != null) {
                        taxon = (Taxon) input.getAdapter(Taxon.class);
@@ -513,7 +521,7 @@ public class TaxonNameEditor extends EditorPart implements
 
 
        /**
-        * 
+        *
         */
        private void createDragSupport() {
                // Listen for names being dragged outside of existing homotypic groups -
@@ -531,7 +539,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * Getter for the field <code>acceptedNameContainer</code>.
         * </p>
-        * 
+        *
         * @return a
         *         {@link eu.etaxonomy.taxeditor.editor.name.container.AcceptedNameContainer}
         *         object.
@@ -544,7 +552,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * getSynonymGroup
         * </p>
-        * 
+        *
         * @param homotypicalGroup
         *            a {@link eu.etaxonomy.cdm.model.name.HomotypicalGroup} object.
         * @return a
@@ -566,7 +574,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * getDirtyNames
         * </p>
-        * 
+        *
         * @return a Set containing all composites that have been edited
         */
        public Set<AbstractGroupedContainer> getDirtyNames() {
@@ -585,7 +593,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * getGroupedContainers
         * </p>
-        * 
+        *
         * @return a {@link java.util.List} object.
         */
        public List<AbstractGroupedContainer> getGroupedContainers() {
@@ -602,7 +610,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * getAllGroups
         * </p>
-        * 
+        *
         * @return a {@link java.util.List} object.
         */
        public List<AbstractGroup> getAllGroups() {
@@ -611,9 +619,9 @@ public class TaxonNameEditor extends EditorPart implements
                allGroups.add(getAcceptedGroup());
 
 //             List<HomotypicalSynonymGroup> grps = getHeterotypicSynonymGroups(); // UNUSED => remove
-               
+
                heterotypicSynonymGroups = getHeterotypicSynonymGroups();
-               
+
                if (heterotypicSynonymGroups != null) {
                        allGroups.addAll(heterotypicSynonymGroups);
                }
@@ -627,7 +635,7 @@ public class TaxonNameEditor extends EditorPart implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.part.EditorPart#isDirty()
         */
        /** {@inheritDoc} */
@@ -638,7 +646,7 @@ public class TaxonNameEditor extends EditorPart implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.part.WorkbenchPart#dispose()
         */
        /** {@inheritDoc} */
@@ -649,7 +657,7 @@ public class TaxonNameEditor extends EditorPart implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
         */
        /** {@inheritDoc} */
@@ -660,12 +668,13 @@ public class TaxonNameEditor extends EditorPart implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.
         * IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
         */
        /** {@inheritDoc} */
-       public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+       @Override
+    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
 
        }
 
@@ -673,11 +682,12 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * getNameEditor
         * </p>
-        * 
+        *
         * @return a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor}
         *         object.
         */
-       public TaxonNameEditor getEditor() {
+       @Override
+    public TaxonNameEditor getEditor() {
                return this;
        }
 
@@ -685,7 +695,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * Getter for the field <code>selectedObject</code>.
         * </p>
-        * 
+        *
         * @return a
         *         {@link eu.etaxonomy.taxeditor.editor.name.container.AbstractGroupedContainer}
         *         object.
@@ -712,10 +722,11 @@ public class TaxonNameEditor extends EditorPart implements
         * dragEntered
         * </p>
         */
-       public void dragEntered() {
+       @Override
+    public void dragEntered() {
                // TODO change this
                getControl().setBackground(
-                               EditorUtil.getColor(Resources.COLOR_DRAG_ENTER));
+                               AbstractUtility.getColor(Resources.COLOR_DRAG_ENTER));
        }
 
        /**
@@ -723,9 +734,10 @@ public class TaxonNameEditor extends EditorPart implements
         * dragLeft
         * </p>
         */
-       public void dragLeft() {
+       @Override
+    public void dragLeft() {
                getControl().setBackground(
-                               EditorUtil.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
+                               AbstractUtility.getColor(Resources.COLOR_COMPOSITE_BACKGROUND));
        }
 
 
@@ -733,7 +745,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * setMisapplicationsGroup
         * </p>
-        * 
+        *
         * @param misappliedGroup
         *            a
         *            {@link eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup}
@@ -745,7 +757,7 @@ public class TaxonNameEditor extends EditorPart implements
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage#isRedrawing()
         */
@@ -753,10 +765,11 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * isRedrawing
         * </p>
-        * 
+        *
         * @return a boolean.
         */
-       public boolean isRedrawing() {
+       @Override
+    public boolean isRedrawing() {
                return false;
        }
 
@@ -764,7 +777,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * getToolkit
         * </p>
-        * 
+        *
         * @return a {@link org.eclipse.ui.forms.widgets.FormToolkit} object.
         */
        public FormToolkit getToolkit() {
@@ -775,7 +788,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * getHeterotypicSynonymGroups
         * </p>
-        * 
+        *
         * @return a {@link java.util.List} object.
         */
        public List<HomotypicalSynonymGroup> getHeterotypicSynonymGroups() {
@@ -786,7 +799,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * addHeterotypicSynonymGroup
         * </p>
-        * 
+        *
         * @param group
         *            a
         *            {@link eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup}
@@ -800,7 +813,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * getHomotypicSynonymGroup
         * </p>
-        * 
+        *
         * @return a
         *         {@link eu.etaxonomy.taxeditor.editor.name.container.HomotypicalSynonymGroup}
         *         object.
@@ -810,7 +823,7 @@ public class TaxonNameEditor extends EditorPart implements
        }
 
        /**
-        * 
+        *
         * @param acceptedGroup
         */
        public void setAcceptedGroup(AcceptedGroup acceptedGroup) {
@@ -821,7 +834,7 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * Getter for the field <code>misappliedGroup</code>.
         * </p>
-        * 
+        *
         * @return a
         *         {@link eu.etaxonomy.taxeditor.editor.name.container.MisappliedGroup}
         *         object.
@@ -835,11 +848,11 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * isActive
         * </p>
-        * 
+        *
         * @return a boolean.
         */
        public boolean isActive() {
-               IWorkbenchPart activePart = EditorUtil.getActivePart();
+               IWorkbenchPart activePart = AbstractUtility.getActivePart();
                return editor.equals(activePart);
        }
 
@@ -847,16 +860,18 @@ public class TaxonNameEditor extends EditorPart implements
         * <p>
         * onComplete
         * </p>
-        * 
+        *
         * @return a boolean.
         */
-       public boolean onComplete() {
+       @Override
+    public boolean onComplete() {
                getContainer(objectAffectedByLastOperation).setSelected();
                return true;
        }
 
        /** {@inheritDoc} */
-       public void partChanged(Integer eventType, IWorkbenchPartReference partRef) {
+       @Override
+    public void partChanged(Integer eventType, IWorkbenchPartReference partRef) {
                if (!partRef.getPart(false).equals(editor)) {
                        // getSelectedObject().colorSelected(AbstractGroupedContainer.SELECTED_NO_FOCUS);
                }
@@ -868,7 +883,7 @@ public class TaxonNameEditor extends EditorPart implements
        public void removeGroup(AbstractGroup group) {
                if (group != null) {
                        group.dispose();
-                       
+
                        //if (heterotypicSynonymGroups != null) {
                        heterotypicSynonymGroups.remove(group);
                        //}
@@ -889,12 +904,13 @@ public class TaxonNameEditor extends EditorPart implements
                }
                return getAcceptedNameContainer();
        }
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.editor.IMultiPageTaxonEditorPage#setOnError()
         */
-       public void setOnError() {
-               Color disabledColor =  StoreUtil.getColor(Resources.COLOR_EDITOR_ERROR);
+       @Override
+    public void setOnError() {
+               Color disabledColor =  AbstractUtility.getColor(Resources.COLOR_EDITOR_ERROR);
                setEnabled(false, disabledColor);
        }
 
@@ -903,16 +919,16 @@ public class TaxonNameEditor extends EditorPart implements
         */
        @Override
        public void setDisabled(){
-               Color disabledColor =  StoreUtil.getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND);
+               Color disabledColor =  AbstractUtility.getColor(Resources.COLOR_TEXT_DISABLED_BACKGROUND);
                setEnabled(false);
        }
-       
+
        protected void setEnabled(boolean enabled, Color background) {
-       
+
                for(AbstractGroupedContainer groupedContainer : getGroupedContainers()){
                        groupedContainer.setEnabled(enabled);
                }
-               
+
                // send an empty selection to the current provider - TODO only on error ???
                if (!enabled) {
                        getManagedForm().setInput(null);
@@ -923,10 +939,10 @@ public class TaxonNameEditor extends EditorPart implements
                }
                getControl().setBackground(background);
        }
-       
+
        @Override
        public void setEnabled(boolean enabled) {
-               Color background =  StoreUtil.getColor(enabled ? Resources.COLOR_COMPOSITE_BACKGROUND : Resources.COLOR_TEXT_DISABLED_BACKGROUND);
+               Color background =  AbstractUtility.getColor(enabled ? Resources.COLOR_COMPOSITE_BACKGROUND : Resources.COLOR_TEXT_DISABLED_BACKGROUND);
                setEnabled(enabled, background);
        }
 }
index 6e460a71995d208f712b487043f934c9ddd899cf..9cf41e4d99770e6b5a4c7da6e22002412920e257 100644 (file)
@@ -82,6 +82,7 @@ IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, I
      */
     @Override
     public void setFocus() {
+        tableViewer.getControl().setFocus();
         //make sure to bind again if maybe in another view the conversation was unbound
         if(!conversation.isBound()){
             conversation.bind();
index bab27cfed83353fb37aa25949f082ea979737abf..90fc97eeb9c9f4fdb5297f5594529e3a05556bff 100644 (file)
@@ -195,6 +195,7 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
      */
     @Override
     public void setFocus() {
+        viewer.getControl().setFocus();
         //make sure to bind again if maybe in another view the conversation was unbound
         if(!conversation.isBound()){
             conversation.bind();
index 2600f04779d0a1754b5f1e0f44740bd583023dea..5fc4322ef822ff4b992103ccad01b0b5f812b3f4 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$\r
 /**\r
  * Copyright (C) 2009 EDIT\r
- * European Distributed Institute of Taxonomy \r
+ * European Distributed Institute of Taxonomy\r
  * http://www.e-taxonomy.eu\r
- * \r
+ *\r
  * The contents of this file are subject to the Mozilla Public License Version 1.1\r
  * See LICENSE.TXT at the top of this package for the full license terms.\r
  */\r
@@ -52,7 +52,7 @@ public class DefinedTermEditor extends EditorPart implements IConversationEnable
        public static final String ID = "eu.etaxonomy.taxeditor.editor.definedTerm";\r
 \r
        public static final String OPEN_COMMAND_ID = "eu.etaxonomy.taxeditor.store.openDefinedTermEditor";\r
-       \r
+\r
        protected TreeViewer viewer;\r
        protected ConversationHolder conversation;\r
        private ISelectionService selectionService;\r
@@ -60,9 +60,9 @@ public class DefinedTermEditor extends EditorPart implements IConversationEnable
 \r
 \r
 \r
-       private int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;\r
+       private final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE;\r
        /**\r
-        * \r
+        *\r
         */\r
        public DefinedTermEditor() {\r
                super();\r
@@ -71,42 +71,42 @@ public class DefinedTermEditor extends EditorPart implements IConversationEnable
 \r
        @Override\r
        public void createPartControl(Composite parent) {\r
-                       \r
+\r
        //              parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));\r
-                       \r
+\r
                        FillLayout layout = new FillLayout();\r
                        layout.marginHeight = 0;\r
                        layout.marginWidth = 0;\r
                        layout.type = SWT.VERTICAL;\r
-                       \r
+\r
                        parent.setLayout(layout);\r
                        viewer = new TreeViewer(parent);\r
                        viewer.getControl().setLayoutData(LayoutConstants.FILL());\r
                        viewer.setContentProvider(new TermContentProvider());\r
                        viewer.setLabelProvider(new TermLabelProvider());\r
                        viewer.setSorter(new ViewerSorter());\r
-                       \r
+\r
                        Transfer[] transfers = new Transfer[] { TermTransfer.getInstance() };\r
                        viewer.addDragSupport(dndOperations, transfers, new DefinedTermDragListener(viewer));\r
                        viewer.addDropSupport(dndOperations, transfers, new DefinedTermDropAdapter(this));\r
-                                                                       \r
+\r
                        getDefinedTermEditorInput().initialiseVocabularies();\r
                        viewer.setInput(getDefinedTermEditorInput().getVocabularies());\r
-                                               \r
+\r
                        getSite().setSelectionProvider(viewer);\r
-                       \r
+\r
                        selectionService = getSite().getWorkbenchWindow().getSelectionService();\r
                        selectionService.addSelectionListener(this);\r
-       \r
+\r
                        setPartName(getEditorInput().getName());\r
                        createMenu();\r
                }\r
-       \r
-       \r
 \r
-       \r
+\r
+\r
+\r
        /**\r
-        * \r
+        *\r
         */\r
        public TermEditorInput getDefinedTermEditorInput() {\r
                return (TermEditorInput) getEditorInput();\r
@@ -117,17 +117,17 @@ public class DefinedTermEditor extends EditorPart implements IConversationEnable
         */\r
        @Override\r
        public boolean postOperation(CdmBase objectAffectedByOperation) {\r
-                       \r
-               \r
-               viewer.refresh();               \r
-               \r
+\r
+\r
+               viewer.refresh();\r
+\r
                if(objectAffectedByOperation != null){\r
                        viewer.setSelection(new StructuredSelection(objectAffectedByOperation));\r
                }\r
                setDirty(true);\r
 \r
                return true;\r
-       } \r
+       }\r
 \r
        private void createMenu() {\r
                // register context menu\r
@@ -135,14 +135,14 @@ public class DefinedTermEditor extends EditorPart implements IConversationEnable
                menuManager\r
                                .add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));\r
                getSite().registerContextMenu(ID, menuManager, viewer);\r
-       \r
+\r
                Control control = viewer.getControl();\r
                Menu menu = menuManager.createContextMenu(control);\r
                control.setMenu(menu);\r
        }\r
-       \r
 \r
-               \r
+\r
+\r
 \r
        @Override\r
        public void doSave(IProgressMonitor monitor) {\r
@@ -150,7 +150,7 @@ public class DefinedTermEditor extends EditorPart implements IConversationEnable
                setDirty(false);\r
                getDefinedTermEditorInput().initialiseVocabularies();\r
        }\r
-       \r
+\r
 \r
        @Override\r
        public void doSaveAs() {}\r
@@ -159,7 +159,7 @@ public class DefinedTermEditor extends EditorPart implements IConversationEnable
        public void init(IEditorSite site, IEditorInput input) throws PartInitException {\r
                setSite(site);\r
                setInput(input);\r
-               \r
+\r
        }\r
 \r
        @Override\r
@@ -174,13 +174,14 @@ public class DefinedTermEditor extends EditorPart implements IConversationEnable
 \r
        @Override\r
        public void setFocus() {\r
+           viewer.getControl().setFocus();\r
                getConversationHolder().bind();\r
        }\r
 \r
        @Override\r
        public void update(CdmDataChangeMap changeEvents) {\r
                // TODO Auto-generated method stub\r
-               \r
+\r
        }\r
 \r
        @Override\r
@@ -191,7 +192,7 @@ public class DefinedTermEditor extends EditorPart implements IConversationEnable
        @Override\r
        public void selectionChanged(IWorkbenchPart part, ISelection selection) {\r
                // TODO Auto-generated method stub\r
-               \r
+\r
        }\r
 \r
        @Override\r
@@ -216,7 +217,7 @@ public class DefinedTermEditor extends EditorPart implements IConversationEnable
        }\r
 \r
        /**\r
-        * \r
+        *\r
         */\r
        public TreeViewer getViewer() {\r
                return viewer;\r