Working on the polytomous key editor
authorn.hoffmann <n.hoffmann@localhost>
Mon, 11 Apr 2011 14:12:53 +0000 (14:12 +0000)
committern.hoffmann <n.hoffmann@localhost>
Mon, 11 Apr 2011 14:12:53 +0000 (14:12 +0000)
15 files changed:
.gitattributes
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/OpenBulkEditorContributionItem.java
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorUtil.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/AbstractGraphKeyEditor.java [moved from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/AbstractKeyEditor.java with 87% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/KeyEditor.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/handler/ApplyLayoutHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyGraphEditor.java [moved from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditor.java with 83% similarity]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListContentProvider.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListEditor.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListViewer.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/CreateNodeHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/ConceptViewPart.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptiveViewPart.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmEditorViewPart.java

index 2819c161c8e1b194669659029be96640c1cc270f..8a597047fee36481ea2eaa431984e257ff4858c1 100644 (file)
@@ -341,13 +341,17 @@ eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handle
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewSpecimenHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/create/NewTeamHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/internal/TaxeditorEditorPlugin.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/AbstractGraphKeyEditor.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/AbstractIdentificationEditorInput.java -text
-eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/AbstractKeyEditor.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/KeyEditor.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/handler/ApplyLayoutHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyContentProvider.java -text
-eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditor.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorInput.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyGraphEditor.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyLabelProvider.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListContentProvider.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListEditor.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListViewer.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/CreateNodeHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/DeleteNodeHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/CreateNodeOperation.java -text
index 9c50be23a85c7da341b86cc657577719fb96381c..e4090a311be132a6de52fdd9ea12648b6f38c52b 100644 (file)
@@ -1,12 +1,12 @@
 // $Id$
 /**
-* Copyright (C) 2007 EDIT
-* 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.
-*/
+ * Copyright (C) 2007 EDIT
+ * 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.
+ */
 
 package eu.etaxonomy.taxeditor.bulkeditor.command;
 
@@ -15,7 +15,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.log4j.Logger;
 import org.eclipse.jface.action.IContributionItem;
 import org.eclipse.swt.SWT;
 import org.eclipse.ui.PlatformUI;
@@ -26,48 +25,57 @@ import org.eclipse.ui.menus.CommandContributionItemParameter;
 import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
 
 /**
- * <p>OpenBulkEditorContributionItem class.</p>
- *
+ * <p>
+ * OpenBulkEditorContributionItem class.
+ * </p>
+ * 
  * @author p.ciardelli
  * @created 19.08.2009
  * @version 1.0
  */
 public class OpenBulkEditorContributionItem extends CompoundContributionItem {
-       private static final Logger logger = Logger
-                       .getLogger(OpenBulkEditorContributionItem.class);
 
        /**
-        * <p>Constructor for OpenBulkEditorContributionItem.</p>
+        * <p>
+        * Constructor for OpenBulkEditorContributionItem.
+        * </p>
         */
        public OpenBulkEditorContributionItem() {
        }
 
        /**
-        * <p>Constructor for OpenBulkEditorContributionItem.</p>
-        *
-        * @param id a {@link java.lang.String} object.
+        * <p>
+        * Constructor for OpenBulkEditorContributionItem.
+        * </p>
+        * 
+        * @param id
+        *            a {@link java.lang.String} object.
         */
        public OpenBulkEditorContributionItem(String id) {
                super(id);
        }
-       
-       /* (non-Javadoc)
-        * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
         */
        /** {@inheritDoc} */
        @Override
        protected IContributionItem[] getContributionItems() {
-               
+
                List<IContributionItem> contributionItems = new ArrayList<IContributionItem>();
-               
-               Map inputTypeValues = (new BulkEditorInputTypeValues()).getParameterValues();
+
+               Map inputTypeValues = (new BulkEditorInputTypeValues())
+                               .getParameterValues();
                for (Object key : inputTypeValues.keySet()) {
-                       contributionItems.add(createContributionItem(
-                                                               (String) key, (String) inputTypeValues.get(key)));
+                       contributionItems.add(createContributionItem((String) key,
+                                       (String) inputTypeValues.get(key)));
                }
-               
-               return (IContributionItem[])contributionItems.
-                                                                       toArray(new IContributionItem[contributionItems.size()]);
+
+               return contributionItems
+                               .toArray(new IContributionItem[contributionItems.size()]);
        }
 
        /**
@@ -75,18 +83,18 @@ public class OpenBulkEditorContributionItem extends CompoundContributionItem {
         * @param object
         * @return
         */
-       private IContributionItem createContributionItem(String label, String inputType) {
-               CommandContributionItemParameter parameter = 
-                               new CommandContributionItemParameter(
-                                               PlatformUI.getWorkbench().getActiveWorkbenchWindow(),
-                                               null, IBulkEditorConstants.DYNAMIC_OPEN_MENU_ID, SWT.NONE);
-               
+       private IContributionItem createContributionItem(String label,
+                       String inputType) {
+               CommandContributionItemParameter parameter = new CommandContributionItemParameter(
+                               PlatformUI.getWorkbench().getActiveWorkbenchWindow(), null,
+                               IBulkEditorConstants.DYNAMIC_OPEN_MENU_ID, SWT.NONE);
+
                parameter.label = label;
-               
+
                Map parameters = new HashMap();
-               parameters.put(IBulkEditorConstants.INPUT_TYPE_PARAMETER_ID, inputType);        
+               parameters.put(IBulkEditorConstants.INPUT_TYPE_PARAMETER_ID, inputType);
                parameter.parameters = parameters;
-               
+
                return new CommandContributionItem(parameter);
        }
 }
index bfbd8d93ef5dfc2be8f8bfc4382293a42e2647f0..d4db3eb0d312e4f7ddf580c6e6968c9a9a525484 100644 (file)
             name="Taxon Name Editor">
       </editor>
       <editor
-            class="eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditor"
+            class="eu.etaxonomy.taxeditor.editor.key.KeyEditor"
             default="false"
-            id="eu.etaxonomy.taxeditor.editor.key.polytomous"
-            name="Polytomous Key Editor">
+            id="eu.etaxonomy.taxeditor.editor.key"
+            name="Key">
+      </editor>
+      <editor
+            class="eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyGraphEditor"
+            default="false"
+            id="eu.etaxonomy.taxeditor.editor.key.polytomous.graph"
+            name="Polytomous Key Graph Editor">
+      </editor>
+      <editor
+            class="eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListEditor"
+            default="false"
+            id="eu.etaxonomy.taxeditor.editor.key.polytomous.list"
+            name="Polytomous Key List Editor">
       </editor>
    </extension>
       <extension
index a781c7afe926cdaebf0ce6295053184625eacffc..2fcf7ad76592820c07cddfabb8c949a43f4682f1 100644 (file)
@@ -1,11 +1,11 @@
 /**
-* Copyright (C) 2007 EDIT
-* 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.
-*/
+ * Copyright (C) 2007 EDIT
+ * 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.
+ */
 
 package eu.etaxonomy.taxeditor.editor;
 
@@ -27,21 +27,18 @@ import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.handlers.HandlerUtil;
 
 import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
-import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditor;
+import eu.etaxonomy.taxeditor.editor.key.KeyEditor;
 import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorInput;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
-import eu.etaxonomy.taxeditor.view.detail.DetailsViewPart;
-import eu.etaxonomy.taxeditor.view.supplementaldata.SupplementalDataViewPart;
 
 /**
  * Utility for the editor package
- *
+ * 
  * @author n.hoffmann
  * @created 20.01.2009
  * @version 1.0
  */
-public class EditorUtil extends AbstractUtility{
+public class EditorUtil extends AbstractUtility {
 
        private static boolean isSaving = false;
 
@@ -50,223 +47,273 @@ public class EditorUtil extends AbstractUtility{
         * 
         * @param input
         * @param editorId
-        * @return 
-        * @return 
+        * @return
+        * @return
         * @throws PartInitException
         */
-       private static IEditorPart open(final IEditorInput input, final String editorId) throws PartInitException{
+       private static IEditorPart open(final IEditorInput input,
+                       final String editorId) throws PartInitException {
                return getActivePage().openEditor(input, editorId);
        }
-       
+
        /**
         * Opens a new editor window with the given TaxonEditorInput
-        *
-        * @param input a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput} object.
-        * @throws org.eclipse.ui.PartInitException if any.
+        * 
+        * @param input
+        *            a {@link eu.etaxonomy.taxeditor.editor.TaxonEditorInput}
+        *            object.
+        * @throws org.eclipse.ui.PartInitException
+        *             if any.
         */
-       public static void open(TaxonEditorInput input) throws PartInitException{
+       public static void open(TaxonEditorInput input) throws PartInitException {
                open(input, MultiPageTaxonEditor.ID);
        }
-       
-       public static void open(PolytomousKeyEditorInput input) throws PartInitException{
-               open(input, PolytomousKeyEditor.ID);
+
+       public static void open(PolytomousKeyEditorInput input)
+                       throws PartInitException {
+               open(input, KeyEditor.ID);
        }
 
        /**
-        * Taxon Editors may be opened by supplying a taxon node uuid.
-        * Session gets initialised here and is passed to the editor
-        *
-        * @param taxonNodeUuid a {@link java.util.UUID} object.
-        * @throws java.lang.Exception if any.
+        * Taxon Editors may be opened by supplying a taxon node uuid. Session gets
+        * initialised here and is passed to the editor
+        * 
+        * @param taxonNodeUuid
+        *            a {@link java.util.UUID} object.
+        * @throws java.lang.Exception
+        *             if any.
         */
        public static void openTaxonNode(UUID taxonNodeUuid) throws Exception {
-               TaxonEditorInput input = TaxonEditorInput.NewInstance(taxonNodeUuid); 
+               TaxonEditorInput input = TaxonEditorInput.NewInstance(taxonNodeUuid);
                open(input);
        }
-       
+
        /**
-        * <p>openTaxonBase</p>
-        *
-        * @param taxonBaseUuid a {@link java.util.UUID} object.
-        * @throws org.eclipse.ui.PartInitException if any.
+        * <p>
+        * openTaxonBase
+        * </p>
+        * 
+        * @param taxonBaseUuid
+        *            a {@link java.util.UUID} object.
+        * @throws org.eclipse.ui.PartInitException
+        *             if any.
         */
-       public static void openTaxonBase(UUID taxonBaseUuid) throws PartInitException {
-               TaxonEditorInput input = TaxonEditorInput.NewInstanceFromTaxonBase(taxonBaseUuid); 
+       public static void openTaxonBase(UUID taxonBaseUuid)
+                       throws PartInitException {
+               TaxonEditorInput input = TaxonEditorInput
+                               .NewInstanceFromTaxonBase(taxonBaseUuid);
                open(input);
        }
-       
 
        /**
-        * <p>findEditorByTaxonNodeUuid</p>
-        *
-        * @param taxonNodeUuid a {@link java.util.UUID} object.
+        * <p>
+        * findEditorByTaxonNodeUuid
+        * </p>
+        * 
+        * @param taxonNodeUuid
+        *            a {@link java.util.UUID} object.
         * @return a {@link org.eclipse.ui.IEditorPart} object.
-        * @throws java.lang.Exception if any.
+        * @throws java.lang.Exception
+        *             if any.
         */
-       public static IEditorPart findEditorByTaxonNodeUuid(UUID taxonNodeUuid) throws Exception{
-               IEditorInput input = TaxonEditorInput.NewInstance(taxonNodeUuid); 
+       public static IEditorPart findEditorByTaxonNodeUuid(UUID taxonNodeUuid)
+                       throws Exception {
+               IEditorInput input = TaxonEditorInput.NewInstance(taxonNodeUuid);
                return getActivePage().findEditor(input);
        }
-       
+
        /**
-        * An uninitialized taxon is one that hasn't been saved yet. As such, it should appear in neither
-        * the list of recent names nor in the taxonomic tree when opened.
-        *
-        * @throws org.eclipse.ui.PartInitException if any.
-        * @param parentNodeUuid a {@link java.util.UUID} object.
+        * An uninitialized taxon is one that hasn't been saved yet. As such, it
+        * should appear in neither the list of recent names nor in the taxonomic
+        * tree when opened.
+        * 
+        * @throws org.eclipse.ui.PartInitException
+        *             if any.
+        * @param parentNodeUuid
+        *            a {@link java.util.UUID} object.
         */
-       public static void openEmpty(UUID parentNodeUuid) throws PartInitException{
-               TaxonEditorInput input = TaxonEditorInput.NewEmptyInstance(parentNodeUuid);
+       public static void openEmpty(UUID parentNodeUuid) throws PartInitException {
+               TaxonEditorInput input = TaxonEditorInput
+                               .NewEmptyInstance(parentNodeUuid);
                open(input, MultiPageTaxonEditor.ID);
-               
+
                getActiveMultiPageTaxonEditor().changed(null);
-               
-               
+
        }
 
        /**
-        * <p>setSaving</p>
-        *
-        * @param isSaving a boolean.
+        * <p>
+        * setSaving
+        * </p>
+        * 
+        * @param isSaving
+        *            a boolean.
         */
        public static void setSaving(boolean isSaving) {
                EditorUtil.isSaving = isSaving;
        }
 
        /**
-        * <p>isSaving</p>
-        *
+        * <p>
+        * isSaving
+        * </p>
+        * 
         * @return a boolean.
         */
        public static boolean isSaving() {
                return isSaving;
        }
-       
+
        /**
-        * Returns a set of all currently open
-        * <code>MultiPageTaxonEditor</code>s.
-        *
+        * Returns a set of all currently open <code>MultiPageTaxonEditor</code>s.
+        * 
         * @return a {@link java.util.Set} object.
         */
        public static Set<IEditorPart> getOpenEditors() {
                Set<IEditorPart> taxonEditors = new HashSet<IEditorPart>();
-               
-               if(getActivePage() != null){
-                       for (IEditorReference reference : getActivePage().getEditorReferences()) {
+
+               if (getActivePage() != null) {
+                       for (IEditorReference reference : getActivePage()
+                                       .getEditorReferences()) {
                                IEditorPart editor = reference.getEditor(false);
                                if (editor instanceof MultiPageTaxonEditor) {
                                        taxonEditors.add(editor);
                                }
                        }
                }
-               
+
                return taxonEditors;
        }
-       
+
        /**
         * Returns the currently active taxon editor
-        *
+        * 
         * @return the taxon editor that has focus
         */
-       public static MultiPageTaxonEditor getActiveMultiPageTaxonEditor(){
+       public static MultiPageTaxonEditor getActiveMultiPageTaxonEditor() {
                IEditorPart editorPart = getActiveEditor();
-               if(editorPart != null && editorPart instanceof MultiPageTaxonEditor){
+               if (editorPart != null && editorPart instanceof MultiPageTaxonEditor) {
                        MultiPageTaxonEditor editor = (MultiPageTaxonEditor) editorPart;
                        editor.getConversationHolder().bind();
                        return editor;
                }
                return null;
        }
-       
+
        /**
-        * <p>getActiveEditorPage</p>
-        *
-        * @param page a {@link eu.etaxonomy.taxeditor.editor.Page} object.
+        * <p>
+        * getActiveEditorPage
+        * </p>
+        * 
+        * @param page
+        *            a {@link eu.etaxonomy.taxeditor.editor.Page} object.
         * @return a {@link org.eclipse.ui.IEditorPart} object.
         */
-       public static IEditorPart getActiveEditorPage(Page page){
+       public static IEditorPart getActiveEditorPage(Page page) {
                MultiPageTaxonEditor editor = getActiveMultiPageTaxonEditor();
-               
+
                return editor != null ? editor.getPage(page) : null;
        }
-       
+
        /**
         * Returns the selection of the currently active taxon editor
-        *
+        * 
         * @return a {@link org.eclipse.jface.viewers.ISelection} object.
         */
-       public static ISelection getCurrentSelection(){
-               if(getActiveMultiPageTaxonEditor() == null){
+       public static ISelection getCurrentSelection() {
+               if (getActiveMultiPageTaxonEditor() == null) {
                        return null;
-               }else{
-                       return getActiveMultiPageTaxonEditor().getSite().getSelectionProvider().getSelection();
+               } else {
+                       return getActiveMultiPageTaxonEditor().getSite()
+                                       .getSelectionProvider().getSelection();
                }
        }
 
        /**
-        * <p>getUndoContext</p>
-        *
-        * @param editor a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor} object.
-        * @return a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+        * <p>
+        * getUndoContext
+        * </p>
+        * 
+        * @param editor
+        *            a {@link eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor}
+        *            object.
+        * @return a {@link org.eclipse.core.commands.operations.IUndoContext}
+        *         object.
         */
-       public static IUndoContext getUndoContext(MultiPageTaxonEditor editor){
+       public static IUndoContext getUndoContext(MultiPageTaxonEditor editor) {
                return editor.getUndoContext();
        }
-       
+
        /**
-        * <p>getUndoContext</p>
-        *
-        * @return a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+        * <p>
+        * getUndoContext
+        * </p>
+        * 
+        * @return a {@link org.eclipse.core.commands.operations.IUndoContext}
+        *         object.
         */
        public static IUndoContext getUndoContext() {
                return IOperationHistory.GLOBAL_UNDO_CONTEXT;
        }
 
-
        /**
-        * <p>forceUserSave</p>
-        *
-        * @param editor a {@link org.eclipse.ui.IEditorPart} object.
-        * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
+        * <p>
+        * forceUserSave
+        * </p>
+        * 
+        * @param editor
+        *            a {@link org.eclipse.ui.IEditorPart} object.
+        * @param shell
+        *            a {@link org.eclipse.swt.widgets.Shell} object.
         * @return a boolean.
         */
        public static boolean forceUserSave(IEditorPart editor, Shell shell) {
                if (editor.isDirty()) {
-                       
-                       boolean doSave = MessageDialog.openConfirm(shell, "Confirm save", "The current editor must be saved before this action can be executed.");
-                       
+
+                       boolean doSave = MessageDialog
+                                       .openConfirm(shell, "Confirm save",
+                                                       "The current editor must be saved before this action can be executed.");
+
                        if (!doSave) {
                                return false;
                        }
-                       
+
                        editor.doSave(EditorUtil.getMonitor());
                }
                return true;
-       }       
-       
+       }
+
        /**
-        * <p>getSelection</p>
-        *
-        * @param event a {@link org.eclipse.core.commands.ExecutionEvent} object.
+        * <p>
+        * getSelection
+        * </p>
+        * 
+        * @param event
+        *            a {@link org.eclipse.core.commands.ExecutionEvent} object.
         * @return a {@link org.eclipse.jface.viewers.IStructuredSelection} object.
         */
-       public static IStructuredSelection getSelection(ExecutionEvent event){
+       public static IStructuredSelection getSelection(ExecutionEvent event) {
                IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
-                               
-               return (IStructuredSelection) activeEditor.getSite().getSelectionProvider().getSelection();
+
+               return (IStructuredSelection) activeEditor.getSite()
+                               .getSelectionProvider().getSelection();
        }
-       
+
        /**
-        * <p>getPluginId</p>
-        *
+        * <p>
+        * getPluginId
+        * </p>
+        * 
         * @return a {@link java.lang.String} object.
         */
-       protected static String getPluginId(){
+       protected static String getPluginId() {
                return TaxeditorEditorPlugin.PLUGIN_ID;
        }
 
-       public static void openPolytomousKey(UUID polytomousKeyUuid) throws Exception{
-               PolytomousKeyEditorInput input = PolytomousKeyEditorInput.NewInstance(polytomousKeyUuid);
+       public static void openPolytomousKey(UUID polytomousKeyUuid)
+                       throws Exception {
+               PolytomousKeyEditorInput input = PolytomousKeyEditorInput
+                               .NewInstance(polytomousKeyUuid);
                open(input);
        }
 }
similarity index 87%
rename from eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/AbstractKeyEditor.java
rename to eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/AbstractGraphKeyEditor.java
index b860e06a0d53762e5baa8d005ce8886fc9900c2c..81f8b1be6aa0a0ed2e891d347e160c8451c64f25 100644 (file)
@@ -16,7 +16,6 @@ import org.eclipse.swt.events.ControlListener;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorSite;
@@ -30,8 +29,6 @@ import org.eclipse.zest.core.viewers.ZoomContributionViewItem;
 import org.eclipse.zest.core.widgets.ZestStyles;
 import org.eclipse.zest.layouts.LayoutAlgorithm;
 import org.eclipse.zest.layouts.LayoutStyles;
-import org.eclipse.zest.layouts.algorithms.CompositeLayoutAlgorithm;
-import org.eclipse.zest.layouts.algorithms.HorizontalShift;
 import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm;
 
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
@@ -47,11 +44,12 @@ import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
  * @author n.hoffmann
  * 
  */
-public abstract class AbstractKeyEditor<T extends IIdentificationKey> extends
-               EditorPart implements IConversationEnabled, IZoomableWorkbenchPart,
-               IPostOperationEnabled, IDirtyMarkableSelectionProvider {
+public abstract class AbstractGraphKeyEditor<T extends IIdentificationKey>
+               extends EditorPart implements IConversationEnabled,
+               IZoomableWorkbenchPart, IPostOperationEnabled,
+               IDirtyMarkableSelectionProvider {
 
-       private final CdmFormFactory formFactory;
+       private CdmFormFactory formFactory;
        private Composite container;
        private GraphViewer graphViewer;
 
@@ -61,10 +59,6 @@ public abstract class AbstractKeyEditor<T extends IIdentificationKey> extends
        private boolean dirty = false;
        private IToolBarManager toolBarManager;
 
-       public AbstractKeyEditor() {
-               formFactory = new CdmFormFactory(Display.getDefault());
-       }
-
        /*
         * (non-Javadoc)
         * 
@@ -99,6 +93,7 @@ public abstract class AbstractKeyEditor<T extends IIdentificationKey> extends
                        throws PartInitException {
                setSite(site);
                setInput(input);
+               formFactory = new CdmFormFactory(site.getShell().getDisplay());
        }
 
        /*
@@ -220,17 +215,17 @@ public abstract class AbstractKeyEditor<T extends IIdentificationKey> extends
 
        private LayoutAlgorithm getLayoutAlgoritm() {
                if (layoutAlgoritm == null) {
-                       layoutAlgoritm = new CompositeLayoutAlgorithm(
-                                       LayoutStyles.NO_LAYOUT_NODE_RESIZING,
-                                       new LayoutAlgorithm[] {
-                                                       new TreeLayoutAlgorithm(
-                                                                       LayoutStyles.NO_LAYOUT_NODE_RESIZING),
-                                                       new HorizontalShift(
-                                                                       LayoutStyles.NO_LAYOUT_NODE_RESIZING) });
-
-                       // layoutAlgoritm = new TreeLayoutAlgorithm(
-                       // LayoutStyles.NO_LAYOUT_NODE_RESIZING);
-                       // layoutAlgoritm.setEntityAspectRatio(2.5);
+                       // layoutAlgoritm = new CompositeLayoutAlgorithm(
+                       // LayoutStyles.NO_LAYOUT_NODE_RESIZING,
+                       // new LayoutAlgorithm[] {
+                       // new TreeLayoutAlgorithm(
+                       // LayoutStyles.NO_LAYOUT_NODE_RESIZING),
+                       // new HorizontalShift(
+                       // LayoutStyles.NO_LAYOUT_NODE_RESIZING) });
+
+                       layoutAlgoritm = new TreeLayoutAlgorithm(
+                                       LayoutStyles.NO_LAYOUT_NODE_RESIZING);
+                       layoutAlgoritm.setEntityAspectRatio(0.5);
                }
                return layoutAlgoritm;
        }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/KeyEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/KeyEditor.java
new file mode 100644 (file)
index 0000000..d45c500
--- /dev/null
@@ -0,0 +1,183 @@
+// $Id$
+/**
+ * Copyright (C) 2007 EDIT
+ * 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.
+ */
+
+package eu.etaxonomy.taxeditor.editor.key;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.editor.FormEditor;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyGraphEditor;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyListEditor;
+import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider;
+import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 30, 2011
+ * @version 1.0
+ */
+public class KeyEditor extends FormEditor implements IConversationEnabled,
+               IDirtyMarkableSelectionProvider, IPartContentHasDetails {
+
+       public static final String ID = "eu.etaxonomy.taxeditor.editor.key";
+
+       private ConversationHolder conversation;
+
+       private AbstractIdentificationEditorInput input;
+
+       private boolean dirty;
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.
+        * IProgressMonitor)
+        */
+       @Override
+       public void doSave(IProgressMonitor monitor) {
+               try {
+                       monitor.beginTask("Saving Editor", 1);
+                       getConversationHolder().commit(true);
+                       setDirty(false);
+                       monitor.worked(1);
+               } finally {
+                       monitor.done();
+               }
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.part.EditorPart#doSaveAs()
+        */
+       @Override
+       public void doSaveAs() {
+               // not allowed
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
+        */
+       @Override
+       public boolean isSaveAsAllowed() {
+               return false;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update
+        * (eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
+        */
+       @Override
+       public void update(CdmDataChangeMap arg0) {
+               // TODO Auto-generated method stub
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder
+        * ()
+        */
+       @Override
+       public ConversationHolder getConversationHolder() {
+               return conversation;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider#changed(
+        * java.lang.Object)
+        */
+       @Override
+       public void changed(Object element) {
+               editorDirtyStateChanged();
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.forms.editor.FormEditor#editorDirtyStateChanged()
+        */
+       @Override
+       public void editorDirtyStateChanged() {
+               dirty = true;
+               super.editorDirtyStateChanged();
+       }
+
+       @Override
+       protected void handlePropertyChange(int propertyId) {
+               if (propertyId == PROP_DIRTY) {
+                       setDirty(true);
+               }
+               super.handlePropertyChange(propertyId);
+       }
+
+       private void setDirty(boolean dirty) {
+               this.dirty = dirty;
+               firePropertyChange(PROP_DIRTY);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.forms.editor.FormEditor#isDirty()
+        */
+       @Override
+       public boolean isDirty() {
+               return dirty;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.forms.editor.FormEditor#dispose()
+        */
+       @Override
+       public void dispose() {
+               conversation.unregisterForDataStoreChanges(this);
+               conversation.close();
+               super.dispose();
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.forms.editor.FormEditor#addPages()
+        */
+       @Override
+       protected void addPages() {
+               input = (AbstractIdentificationEditorInput) getEditorInput();
+               conversation = input.getConversationHolder();
+               conversation.registerForDataStoreChanges(this);
+
+               try {
+                       addPage(0, new PolytomousKeyListEditor(), input);
+                       setPageText(0, "List");
+                       addPage(1, new PolytomousKeyGraphEditor(), input);
+                       setPageText(1, "Graph");
+               } catch (PartInitException e) {
+                       EditorUtil.error(getClass(), e);
+               }
+
+       }
+}
index 4fdfcccf061b42486016b8927f957287e1314781..3e8fd2aa3106f9c75a1372dfd3901e86a923de22 100644 (file)
@@ -9,7 +9,7 @@ import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.handlers.HandlerUtil;
 
-import eu.etaxonomy.taxeditor.editor.key.AbstractKeyEditor;
+import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor;
 
 /**
  * @author n.hoffmann
@@ -24,8 +24,8 @@ public class ApplyLayoutHandler extends AbstractHandler {
        public Object execute(ExecutionEvent event) throws ExecutionException {
                IEditorPart editor = HandlerUtil.getActiveEditor(event);
                
-               if(editor instanceof AbstractKeyEditor){
-                       ((AbstractKeyEditor) editor).applyLayout();
+               if(editor instanceof AbstractGraphKeyEditor){
+                       ((AbstractGraphKeyEditor) editor).applyLayout();
                }
                
                return null;
@@ -8,15 +8,15 @@ import org.eclipse.jface.viewers.IContentProvider;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.model.description.PolytomousKey;
-import eu.etaxonomy.taxeditor.editor.key.AbstractKeyEditor;
+import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor;
 
 /**
  * @author n.hoffmann
  * 
  */
-public class PolytomousKeyEditor extends AbstractKeyEditor<PolytomousKey> {
+public class PolytomousKeyGraphEditor extends AbstractGraphKeyEditor<PolytomousKey> {
 
-       public static final String ID = "eu.etaxonomy.taxeditor.editor.key.polytomous";
+       public static final String ID = "eu.etaxonomy.taxeditor.editor.key.polytomous.graph";
 
        @Override
        public ConversationHolder getConversationHolder() {
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListContentProvider.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListContentProvider.java
new file mode 100644 (file)
index 0000000..7281706
--- /dev/null
@@ -0,0 +1,41 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* 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.
+*/
+
+package eu.etaxonomy.taxeditor.editor.key.polytomous;
+
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * @author n.hoffmann
+ * @created Apr 4, 2011
+ * @version 1.0
+ */
+public class PolytomousKeyListContentProvider implements IContentProvider {
+
+       /* (non-Javadoc)
+        * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+        */
+       @Override
+       public void dispose() {
+               // TODO Auto-generated method stub
+
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+        */
+       @Override
+       public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+               // TODO Auto-generated method stub
+
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListEditor.java
new file mode 100644 (file)
index 0000000..71eaa62
--- /dev/null
@@ -0,0 +1,148 @@
+// $Id$
+/**
+ * Copyright (C) 2007 EDIT
+ * 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.
+ */
+
+package eu.etaxonomy.taxeditor.editor.key.polytomous;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+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.part.EditorPart;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
+import eu.etaxonomy.cdm.model.description.PolytomousKey;
+import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+
+/**
+ * @author n.hoffmann
+ * @created Mar 31, 2011
+ * @version 1.0
+ */
+public class PolytomousKeyListEditor extends EditorPart implements
+               IConversationEnabled {
+
+       public static final String ID = "eu.etaxonomy.taxeditor.editor.key.polytomous.list";
+
+       private CdmFormFactory formFactory;
+       private Composite container;
+
+       private PolytomousKeyListViewer viewer;
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update
+        * (eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
+        */
+       @Override
+       public void update(CdmDataChangeMap arg0) {
+
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder
+        * ()
+        */
+       @Override
+       public ConversationHolder getConversationHolder() {
+               return ((PolytomousKeyEditorInput) getEditorInput())
+                               .getConversationHolder();
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.
+        * IProgressMonitor)
+        */
+       @Override
+       public void doSave(IProgressMonitor monitor) {
+
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.part.EditorPart#doSaveAs()
+        */
+       @Override
+       public void doSaveAs() {
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite,
+        * org.eclipse.ui.IEditorInput)
+        */
+       @Override
+       public void init(IEditorSite site, IEditorInput input)
+                       throws PartInitException {
+               setSite(site);
+               setInput(input);
+               formFactory = new CdmFormFactory(site.getShell().getDisplay());
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.part.EditorPart#isDirty()
+        */
+       @Override
+       public boolean isDirty() {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
+        */
+       @Override
+       public boolean isSaveAsAllowed() {
+               return false;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
+        * .Composite)
+        */
+       @Override
+       public void createPartControl(Composite parent) {
+               container = formFactory.createComposite(parent);
+
+               viewer = new PolytomousKeyListViewer(container);
+               PolytomousKey key = ((PolytomousKeyEditorInput) getEditorInput())
+                               .getKey();
+               viewer.setInput(key);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+        */
+       @Override
+       public void setFocus() {
+               setPartName("Test");
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListViewer.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListViewer.java
new file mode 100644 (file)
index 0000000..5d83fe1
--- /dev/null
@@ -0,0 +1,107 @@
+// $Id$
+/**
+ * Copyright (C) 2007 EDIT
+ * 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.
+ */
+
+package eu.etaxonomy.taxeditor.editor.key.polytomous;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+
+/**
+ * @author n.hoffmann
+ * @created Apr 4, 2011
+ * @version 1.0
+ */
+public class PolytomousKeyListViewer extends Viewer {
+
+       private Object input;
+       private ISelection selection;
+
+       private Control control;
+
+       private final CdmFormFactory formFactory;
+
+       private final ScrolledForm form;
+
+       public PolytomousKeyListViewer(Composite parent) {
+               formFactory = new CdmFormFactory(parent.getDisplay());
+               form = formFactory.createScrolledForm(parent);
+               form.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.jface.viewers.Viewer#getControl()
+        */
+       @Override
+       public Control getControl() {
+               return control;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.jface.viewers.Viewer#getInput()
+        */
+       @Override
+       public Object getInput() {
+               return input;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.jface.viewers.Viewer#getSelection()
+        */
+       @Override
+       public ISelection getSelection() {
+               return selection;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.jface.viewers.Viewer#refresh()
+        */
+       @Override
+       public void refresh() {
+
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.eclipse.jface.viewers.Viewer#setInput(java.lang.Object)
+        */
+       @Override
+       public void setInput(Object input) {
+               this.input = input;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
+        * .ISelection, boolean)
+        */
+       @Override
+       public void setSelection(ISelection selection, boolean reveal) {
+               this.selection = selection;
+       }
+
+}
index 59efb55da34a76dfad537190ea56ce0275811d5d..12fb3dc6d2758ff190e68fff2f8c9454dc4bec76 100644 (file)
@@ -14,7 +14,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
 
 import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditor;
+import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyGraphEditor;
 import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.CreateNodeOperation;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 
@@ -32,8 +32,8 @@ public class CreateNodeHandler extends AbstractHandler {
                
                IEditorPart editor = HandlerUtil.getActiveEditor(event);
                
-               if(editor instanceof PolytomousKeyEditor){
-                       PolytomousKeyEditor keyEditor = (PolytomousKeyEditor) editor;
+               if(editor instanceof PolytomousKeyGraphEditor){
+                       PolytomousKeyGraphEditor keyEditor = (PolytomousKeyGraphEditor) editor;
                        
                        IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getActiveMenuSelection(event);
                        
index 16a89724c0a73f63ec0ddd1bc57fd2d2dd0eb50c..4aa081d5c94a35a9dae38bad8ba35ba95d9dabec 100644 (file)
@@ -28,7 +28,7 @@ import org.eclipse.ui.IWorkbenchPart;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.key.AbstractKeyEditor;
+import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor;
 import eu.etaxonomy.taxeditor.view.AbstractCdmEditorViewPart;
 
 /**
@@ -57,7 +57,7 @@ public class ConceptViewPart extends AbstractCdmEditorViewPart {
                        return;
                }
                
-               if(part instanceof AbstractKeyEditor){
+               if(part instanceof AbstractGraphKeyEditor){
                        showEmptyPage();
                        return;
                }
index 7c405157db5f188ba35c7f1306ae77bf838d49d3..b3799a0c3726771848b7df051ff53e77931fb27c 100644 (file)
@@ -42,7 +42,7 @@ import eu.etaxonomy.cdm.model.description.TaxonDescription;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
-import eu.etaxonomy.taxeditor.editor.key.AbstractKeyEditor;
+import eu.etaxonomy.taxeditor.editor.key.AbstractGraphKeyEditor;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainerTree;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
@@ -160,7 +160,7 @@ public class DescriptiveViewPart extends AbstractCdmEditorViewPart implements IP
                        return;
                }
                
-               if(part instanceof AbstractKeyEditor){
+               if(part instanceof AbstractGraphKeyEditor){
                        showEmptyPage();
                        return;
                }
index 1240b09f8f7cb551cb04845f33f27a961b4a54b5..e75e6d1adcad0b36d45751d15351721503ebf43f 100644 (file)
@@ -10,47 +10,58 @@ import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
 
 /**
- * <p>Abstract AbstractCdmEditorViewPart class.</p>
- *
+ * <p>
+ * Abstract AbstractCdmEditorViewPart class.
+ * </p>
+ * 
  * @author n.hoffmann
  * @created Sep 21, 2010
  * @version 1.0
  */
 public abstract class AbstractCdmEditorViewPart extends AbstractCdmViewPart {
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createPartControl(org.eclipse.swt.widgets.Composite)
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createPartControl(org
+        * .eclipse.swt.widgets.Composite)
         */
        /** {@inheritDoc} */
        @Override
        public void createPartControl(Composite parent) {
-       
+
                super.createPartControl(parent);
-               
+
                // show viewer if there is an open editor
-//             if(getEditor() != null){
-//                     showViewer(getEditor(), new StructuredSelection(getInitialInput()));
-//             }
+               // if(getEditor() != null){
+               // showViewer(getEditor(), new StructuredSelection(getInitialInput()));
+               // }
        }
-               
+
        /**
-        * <p>getEditor</p>
-        *
+        * <p>
+        * getEditor
+        * </p>
+        * 
         * @return the currently active editor
         */
-       public IEditorPart getEditor(){
+       public IEditorPart getEditor() {
                return StoreUtil.getActiveEditor();
        }
-       
+
        /** {@inheritDoc} */
-       public void changed(Object object){
-               if(part instanceof AbstractCdmViewPart){
+       @Override
+       public void changed(Object object) {
+               if (part instanceof AbstractCdmViewPart) {
                        ((AbstractCdmViewPart) part).changed(object);
-               }else{
-                       if(getEditor() != null && getEditor() instanceof IDirtyMarkableSelectionProvider){
-                       
-                               ((IDirtyMarkableSelectionProvider) getEditor()).changed(object);
-                               
+               } else {
+                       IEditorPart editor = getEditor();
+                       if (editor != null
+                                       && editor instanceof IDirtyMarkableSelectionProvider) {
+
+                               ((IDirtyMarkableSelectionProvider) editor).changed(object);
+
                        }
                }
        }