Merge branch 'develop' into remoting-4.0
authorCherian Mathew <c.mathew@bgbm.org>
Mon, 24 Aug 2015 09:34:25 +0000 (11:34 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Mon, 24 Aug 2015 09:34:25 +0000 (11:34 +0200)
Conflicts:
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientOccurenceService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientTaxonService.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureDistributionDetailElement.java

81 files changed:
eu.etaxonomy.taxeditor.application/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.application/plugin.xml
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/handler/MergeGroupHandler.java
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_en.properties
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/KeyEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyListEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/operation/DeleteNodeOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/DataImportEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/GbifImportEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientOccurenceService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/transientServices/TransientTaxonService.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/MoveDerivateOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionElementsHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionToOtherTaxonHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/operation/MoveDescriptionElementsOperation.java
eu.etaxonomy.taxeditor.feature/build.properties.with.jre
eu.etaxonomy.taxeditor.feature/feature.xml
eu.etaxonomy.taxeditor.molecular.lib/.classpath [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular.lib/.gitignore [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular.lib/.project [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular.lib/META-INF/MANIFEST.MF [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular.lib/build.properties [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular.lib/lib/.gitignore [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular.lib/pom.xml [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/.classpath [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/.gitignore [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/.project [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/META-INF/MANIFEST.MF [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/plugin.properties [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/plugin_de.properties [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/plugin_en.properties [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/build.properties [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/icons/insert-16x16.png [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/icons/overwrite-16x16.png [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-left-16x16.png [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-left-disabled-16x16.png [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-right-16x16.png [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-right-disabled-16x16.png [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/plugin.xml [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/pom.xml [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/TaxeditorMolecularPlugin.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditorInput.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramMouseListener.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramViewPart.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractAlignmentEditorHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractPherogramComponentHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ChangePherogramQualityOutputType.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CreateConsensusSequenceHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramLeftHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramRightHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/EditSequenceHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/HandlerTools.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/LoadPherogramHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ReverseComplementHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ShowPherogramHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/SpecimenPropertyTester.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleInsertOverwriteHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleLeftRightInsertionHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleShowPherogramBaseCallLinesHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleShowPherogramProbabilitiesHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/UpdateConsensusSequenceHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/package-info.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/PolytomousKeyViewPart.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorContentService.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorDnDService.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorViewer.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDragListener.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapter.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/DeleteHandler.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteConfiguratorDialog.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteNodeConfiguratorComposite.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/FeatureDistributionDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/key/PolytomousKeyNodeDetailElement.java
eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product.with.jre [new file with mode: 0644]
pom.xml

index a2467b13c193b7ae54beb37a27df403f1e51c611..aaacf83eb4238b7ab44359144cd6a229f55f32f4 100644 (file)
@@ -22,6 +22,7 @@ Require-Bundle: org.eclipse.ui,
  eu.etaxonomy.taxeditor.bulkeditor,
  eu.etaxonomy.taxeditor.editor,
  eu.etaxonomy.taxeditor.printpublisher,
+ eu.etaxonomy.taxeditor.molecular,
  eu.etaxonomy.taxeditor.help,
  org.eclipse.equinox.ds,
  org.eclipse.equinox.util,
index b74e209ce9d93b65fa3e04ed7461db32d7388015..f6e4ab946c5c8d097e40cd1c545415db42e68b5e 100644 (file)
        id="eu_etaxonomy_taxeditor_product"\r
        point="org.eclipse.core.runtime.products">\r
     <product\r
-          application="eu.etaxonomy.taxeditor.application.application"\r
+          application="eu.etaxonomy.taxeditor.editor.application"\r
           name="EDIT Taxonomic Editor">\r
        <property\r
              name="appName"\r
index 5c0e8676ed02da8bbc536308dd3309393683d872..4a8ae8a3ce9df24256ef97a5e99e4312e99a7e11 100644 (file)
@@ -22,12 +22,17 @@ import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.eclipse.ui.texteditor.IDocumentProvider;
 
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+import eu.etaxonomy.cdm.model.reference.Reference;
+import eu.etaxonomy.cdm.strategy.merge.MergeException;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.IEntityContainer;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;
 import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
 import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
+import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
  * <p>MergeGroupHandler class.</p>
@@ -71,10 +76,41 @@ public class MergeGroupHandler extends AbstractHandler {
                        }                       
                        Object targetEntity = ((IEntityContainer<?>) targetAnnotation).getEntity();
                        
+                       TeamOrPersonBase teamOrPerson = null;
+                       Reference ref = null;
+                       if (targetEntity instanceof TeamOrPersonBase){
+                               teamOrPerson = HibernateProxyHelper.deproxy(targetEntity, TeamOrPersonBase.class);
+                       } else if(targetEntity instanceof Reference){
+                               ref = HibernateProxyHelper.deproxy(targetEntity, Reference.class);
+                       }
                        logger.info("Merging group");
 //                     model.printAnnotations();
                        for (LineAnnotation annotation : candidateAnnotations) {
+                               //first check whether entities are mergeable
+                               
                                
+                       try{
+                               if (ref != null){
+                                       Reference ref2 = HibernateProxyHelper.deproxy(annotation.getEntity(), Reference.class);
+                                       
+                                       if (!CdmStore.getCommonService().isMergeable(ref, ref2, null)){
+                                               MessageDialog.openWarning(HandlerUtil.getActiveShell(event), 
+                                                               "No merge possible", "A merge of " + ref.getTitleCache() + " and " + ref2.getTitleCache() + " is not possible.");
+                                               return null;
+                                       }
+                               }
+                               if (teamOrPerson != null){
+                                       TeamOrPersonBase teamOrPerson2 = HibernateProxyHelper.deproxy(annotation.getEntity(), TeamOrPersonBase.class);
+                                       
+                                       if (!CdmStore.getCommonService().isMergeable(teamOrPerson, teamOrPerson2, null)){
+                                               MessageDialog.openWarning(HandlerUtil.getActiveShell(event), 
+                                                               "No merge possible", "A merge of " + teamOrPerson.getTitleCache() + " and " + teamOrPerson2.getTitleCache() + " is not possible.");
+                                               return null;
+                                       }
+                               }
+                       }catch(MergeException e){
+                                       
+                       }
                                ((BulkEditor) editor).removeAnnotatedLine(annotation);
                                
                                // Mark entity container for merging with target entity
index 1c03030fc915ddc834cf1df4280e190e31a92032..8281fca55730c8e4d81a2fa766ff092f498fea7d 100644 (file)
@@ -9,7 +9,7 @@ editor.name.1 = Key
 editor.name.2 = Polytomous Key Graph Editor\r
 editor.name.3 = Polytomous Key List Editor\r
 editor.name.4 = Cdm Authority Editor\r
-editor.name.5 = Derivative View\r
+editor.name.5 = Derivative Editor\r
 view.name = Factual Data\r
 view.name.0 = Uses\r
 view.name.1 = Media\r
@@ -112,7 +112,7 @@ command.name.32 = Create Concept Relation
 command.name.33 = Open Related Concept\r
 category.name.7 = -- Group\r
 command.name.34 = Edit CDM Authorities\r
-command.name.35 = Open Derivative View\r
+command.name.35 = Open Derivative Editor\r
 scheme.description = The default key binding scheme for the Taxonomic Editor\r
 scheme.name = Taxonomic Editor Default Key Bindings\r
 editor.name.6 = Specimen Import Editor\r
index 8c098c37d1ef2755eed2653be8f0e0114b075ec4..a4d096a11d103606e828005e75ba6cb461142e33 100644 (file)
@@ -112,7 +112,7 @@ command.name.32 = Erstelle Konzeptrelationen
 command.name.33 = \u00d6ffne verbundenes Konzept
 category.name.7 = -- Gruppe
 command.name.34 = Bearbeite CDM Rechte
-command.name.35 = \u00d6ffne Derivate Ansicht
+command.name.35 = \u00d6ffne Derivat-Editor
 scheme.description = Die Standard Tastenkombinationsschema f\u00fcr den Taxonomischen Editor
 scheme.name = Taxonomic Editor Standard Tastenkombinationen
 editor.name.6 = Specimen Import Editor
@@ -139,8 +139,8 @@ marker.field.2 = Attribut
 marker.field.3 = Problematischer Wert
 marker.field.4 = Problembeschreibung
 marker.field.5 = Validierer
-marker.field.6 = Entittsklasse
-marker.field.7 = Entitts ID
+marker.field.6 = Entit\u00e4tsklasse
+marker.field.7 = Entit\u00e4ts ID
 extension.name.0 = Validierungs-Fehler
 command.label.51 = \u00d6ffne Specimen-Editor
 command.label.52 = L\u00f6schen
index 65d48bae536842cd7d76985773f77ae134851e3f..17a5b049048252c4a6b4c41bee895d67cbf1b017 100644 (file)
@@ -111,7 +111,6 @@ command.name.32 = Create Concept Relation
 command.name.33 = Open Related Concept\r
 category.name.7 = -- Group\r
 command.name.34 = Edit CDM Authorities\r
-command.name.35 = Open Derivate View\r
 scheme.description = The default key binding scheme for the Taxonomic Editor\r
 scheme.name = Taxonomic Editor Default Key Bindingseditor.name.6 = Specimen Import Editor\r
 editor.name.7 = Gbif Import Editor\r
index 2129cf851c6be335f80d1f43e03a404e571a289d..3dc4659d3d6c02c00691190e365b065fb505d82b 100644 (file)
             <visibleWhen
                   checkEnabled="true">
                <or>
-                  <reference
-                        definitionId="isDescriptionElement">
-                  </reference>
                   <reference
                         definitionId="isFeatureNodeContainer">
                   </reference>
             id="eu.etaxonomy.taxeditor.editor.media.command.delete"
             name="%command.name.49">
       </command>
+      
       <category
             id="eu.etaxonomy.taxeditor.editor.new.category"
             name="%category.name.4">
       <command
             categoryId="eu.etaxonomy.taxeditor.editor.view.descriptive.command.category"
             defaultHandler="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.MoveDescriptionToOtherTaxonHandler"
-            id="eu.etaxonomy.taxeditor.editor.commands.description.moveDescriptionToTaxon"
+            id="eu.etaxonomy.taxeditor.editor.view.descriptive.command.moveDescriptionToTaxon"
             name="%command.name.13">
       </command>
+       
       <command
             categoryId="eu.etaxonomy.taxeditor.editor.view.descriptive.command.category"
             defaultHandler="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.MoveDescriptionElementsHandler"
-            id="eu.etaxonomy.taxeditor.description.commands.moveDescriptionElements"
+            id="eu.etaxonomy.taxeditor.editor.view.descriptive.command.moveDescriptionElements"
             name="%command.name.12">
       </command>
         
index 8eeb482b80025cafae8a74d4407e75ab3841acdb..b6ca9645abd52bb6e75739fd5a5f90b63c2d3fe1 100644 (file)
@@ -107,6 +107,7 @@ public class KeyEditor extends FormEditor implements IConversationEnabled,
 
        @Override
        public void setFocus() {
+               getConversationHolder().commit(true);
                getConversationHolder().bind();
                polytomousKeyEditorInput.bind();
                super.setFocus();
index ce2d59515fa7ca6b40ce4535da5aa63c7a43af75..7b8fb00a58da47b6e36d9cbf548dbbd7fa5ba0f5 100644 (file)
@@ -348,7 +348,8 @@ public class PolytomousKeyListEditor extends EditorPart implements
        @Override
        public boolean postOperation(CdmBase objectAffectedByOperation) {
                viewer.refresh();
-
+               getConversationHolder().bind();
+               getConversationHolder().commit(true);
                editor.changed(objectAffectedByOperation);
 
                if (objectAffectedByOperation != null) {
index 666078b85ffbc16795fb68c612c9ac139887d0fe..684d8eebd7ea30f60d6c3356ae05b1d9ebb62371 100644 (file)
@@ -11,8 +11,11 @@ import org.eclipse.core.runtime.IStatus;
 import org.eclipse.jface.dialogs.MessageDialog;
 
 import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IPolytomousKeyNodeService;
 import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.taxeditor.bulkeditor.internal.TaxeditorBulkeditorPlugin;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -50,15 +53,27 @@ public class DeleteNodeOperation extends AbstractPostTaxonOperation {
                controller = CdmStore.getCurrentApplicationConfiguration();
 
                IPolytomousKeyNodeService service = controller.getPolytomousKeyNodeService();
-               
+               DeleteResult result;
                if (node.getChildren().size()>0){
                        if(! MessageDialog.openQuestion(null, "Confirm deletion of children", "The selected node has children, do you want to delete them, too?")) {
-                               service.delete(node.getUuid(), false);
+                               result = service.delete(node.getUuid(), false);
                        } else{
-                               service.delete(node.getUuid(), true);
+                               result = service.delete(node.getUuid(), true);
                        }
                } else{
-                       service.delete(node.getUuid(), true);
+                       result = service.delete(node.getUuid(), true);
+               }
+               
+               if (!result.isOk() || result.getExceptions().size() > 0){
+                       Exception t = new Exception();
+                       if (result.getExceptions().size() >1){
+                               for (Exception e:result.getExceptions()){
+                                       t.addSuppressed(e);
+                               }
+                       }else {
+                               t = result.getExceptions().iterator().next();
+                       }
+                       MessagingUtils.errorDialog("Exception occured. Delete not possible", getClass(),null, TaxeditorBulkeditorPlugin.PLUGIN_ID, t, true);
                }
                return postExecute(null);
        }
index a74d15d44c56ca2ddcb11d95df5fc740297d1631..5be66c8bce3a9913d602e7e09673efd28c78891d 100644 (file)
@@ -21,6 +21,9 @@ import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
+ * Input for {@link DataImportEditor}. This class queries a data source for
+ * occurrences and passes them to the editor.
+ *
  * @author pplitzner
  * @date 25.02.2014
  *
@@ -35,65 +38,40 @@ public abstract class DataImportEditorInput<T> implements IEditorInput {
 
     protected OccurenceQuery query;
 
-    /**
-     * @param results
-     */
     public DataImportEditorInput() {
         this.conversationHolder = CdmStore.createConversation();
     }
 
-
-    /* (non-Javadoc)
-     * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
-     */
     @Override
     public Object getAdapter(Class adapter) {
         // TODO Auto-generated method stub
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.ui.IEditorInput#exists()
-     */
     @Override
     public boolean exists() {
         return false;
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
-     */
     @Override
     public ImageDescriptor getImageDescriptor() {
         // TODO Auto-generated method stub
         return null;
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.ui.IEditorInput#getPersistable()
-     */
     @Override
     public IPersistableElement getPersistable() {
         return null;
     }
 
-    /**
-     * @return the results
-     */
     public Collection<T> getResults() {
         return results;
     }
 
-    /**
-     * @param results the results to set
-     */
     public void setResults(Collection<T> results) {
         this.results = results;
     }
 
-    /**
-     * @return the conversationHolder
-     */
     public ConversationHolder getConversationHolder() {
         return conversationHolder;
     }
index ed7c89cc0cf3313004d0ee90754c186585ec99ec..3aaf22c5269c7e72b2681852295ae285da873d1f 100644 (file)
@@ -26,9 +26,6 @@ import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
  */
 public class GbifImportEditorInput extends DataImportEditorInput<GbifResponse> {
 
-    /**
-     * @param query
-     */
     public GbifImportEditorInput(OccurenceQuery query) {
         super();
         this.query = query;
@@ -50,25 +47,16 @@ public class GbifImportEditorInput extends DataImportEditorInput<GbifResponse> {
     }
 
 
-    /* (non-Javadoc)
-     * @see org.eclipse.ui.IEditorInput#getName()
-     */
     @Override
     public String getName() {
         return "[GBIF] " + query.toString();
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.ui.IEditorInput#getToolTipText()
-     */
     @Override
     public String getToolTipText() {
         return "[GBIF] " + query.toString();
     }
 
-    /* (non-Javadoc)
-     * @see java.lang.Object#hashCode()
-     */
     @Override
     public int hashCode() {
         final int prime = 31;
@@ -77,9 +65,6 @@ public class GbifImportEditorInput extends DataImportEditorInput<GbifResponse> {
         return result;
     }
 
-    /* (non-Javadoc)
-     * @see java.lang.Object#equals(java.lang.Object)
-     */
     @Override
     public boolean equals(Object obj) {
         if (this == obj) {
index e705652463c47b91c83de56f303eeb89483ed341..001a7ab7bbf2a29f811b1a4fd155e609e14d19de 100644 (file)
@@ -1031,5 +1031,4 @@ public class TransientOccurenceService implements IOccurrenceService {
     public DeleteResult deleteSingleRead(UUID arg0, UUID arg1) {
         return defaultService.deleteSingleRead(arg0, arg1);
     }
-
 }
index c671282dfcd43bd707fc9e50782da30337c278a7..8870c5bf55761118fd14ad9b6641dd5de1820acc 100644 (file)
@@ -1523,4 +1523,5 @@ public class TransientTaxonService implements ITaxonService {
             SynonymRelationshipType arg3) throws DataChangeNoRollbackException {
         return defaultService.changeRelatedTaxonToSynonym(arg0, arg1, arg2, arg3);
     }
+
 }
index bc31a66b8f4505c86120c6f8da131b67e75dd28c..64041cfa82e315d55a96812ee6fa7babc6e7e779 100644 (file)
@@ -177,7 +177,7 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
             DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) getEditorInput();
             return derivateViewEditorInput.getName();
         }
-        return "Derivative View";
+        return "Derivative Editor";
     }
 
     /* (non-Javadoc)
index b863dcbe28a14aa047007dccf5189f11df1cd582..9931904ff8478df078fe61513974fef264703074 100644 (file)
@@ -63,7 +63,7 @@ public class MoveDerivateOperation extends AbstractPostOperation<CdmBase>  {
             derivateView = (DerivateView) getPostOperationEnabled();
         }
         if(derivateView==null){
-            MessagingUtils.operationDialog(this, new NullPointerException("DerivativeView was null"), TaxeditorEditorPlugin.PLUGIN_ID, this.getLabel(), getLabel());
+            MessagingUtils.operationDialog(this, new NullPointerException("Derivative Editor was null"), TaxeditorEditorPlugin.PLUGIN_ID, this.getLabel(), getLabel());
             return Status.CANCEL_STATUS;
         }
         if(derivateView.isDirty()){
index 0c2306ba6081a6da06c1e32e6b2dedc3cd552664..9a801a4d412797995c6899f6ae3f8c6045152438 100644 (file)
@@ -20,25 +20,36 @@ import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.commands.common.NotDefinedException;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.handlers.HandlerUtil;
 
 import eu.etaxonomy.cdm.api.service.IDescriptionService;
 import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.common.Annotation;
 import eu.etaxonomy.cdm.model.common.AnnotationType;
+import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.Language;
+import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
 import eu.etaxonomy.cdm.model.description.TaxonDescription;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
+import eu.etaxonomy.taxeditor.editor.Page;
+import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
 import eu.etaxonomy.taxeditor.editor.view.descriptive.DescriptiveViewPart;
 import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionElementsOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonBaseSelectionDialog;
+import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonNodeSelectionDialog;
 
 
 /**
@@ -46,8 +57,9 @@ import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonBaseSelectionDialog;
  * @created Feb 8, 2011
  * @version 1.0
  */
-public class MoveDescriptionElementsHandler extends AbstractHandler {
-
+public class MoveDescriptionElementsHandler extends AbstractHandler implements IPostOperationEnabled{
+       private UUID newAcceptedTaxonNodeUuid;
+       private TaxonNameEditor editor;
        /* (non-Javadoc)
         * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
         */
@@ -55,7 +67,7 @@ public class MoveDescriptionElementsHandler extends AbstractHandler {
        public Object execute(ExecutionEvent event) throws ExecutionException {
                
 //             ConversationHolder conversation = CdmStore.createConversation();
-               
+               editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME);
                ISelection selection = HandlerUtil.getCurrentSelection(event);
                
                if(selection instanceof IStructuredSelection){
@@ -81,14 +93,28 @@ public class MoveDescriptionElementsHandler extends AbstractHandler {
                        if(elements.size() == 0){
                                return null;
                        }
+                       DescriptionBase description = elements.get(0).getInDescription();
+                       List<UUID> excludeTaxa = new ArrayList<UUID>();
+                       if (description.isInstanceOf(TaxonDescription.class)){
+                               TaxonDescription taxonDescription = HibernateProxyHelper.deproxy(description, TaxonDescription.class);
+                               Taxon actualTaxon = taxonDescription.getTaxon();
+                               excludeTaxa.add(actualTaxon.getUuid());
+                       }
                        
-                       Taxon targetTaxon = TaxonBaseSelectionDialog.selectTaxon(HandlerUtil.getActiveShell(event), EditorUtil.getActiveMultiPageTaxonEditor().getConversationHolder(), null);
+                       
+                       TaxonNode newAcceptedTaxonNode = TaxonNodeSelectionDialog.select(HandlerUtil.getActiveShell(event),
+                                       editor.getConversationHolder(),
+                                       "Choose the accepted taxon",
+                                       excludeTaxa,
+                                       null,
+                                       null);
+                       Taxon targetTaxon = newAcceptedTaxonNode.getTaxon();
                        
                        if(targetTaxon == null){
                                // canceled
                                return null;
                        }
-                                               
+                       newAcceptedTaxonNodeUuid = newAcceptedTaxonNode.getUuid();                      
                        TaxonDescription targetDescription = TaxonDescription.NewInstance(targetTaxon);
                        String moveMessage = String.format("Elements moved from %s", EditorUtil.getActiveMultiPageTaxonEditor().getTaxon());
                        targetDescription.setTitleCache(moveMessage, true);
@@ -99,10 +125,11 @@ public class MoveDescriptionElementsHandler extends AbstractHandler {
                        try {
                                AbstractPostOperation operation = new MoveDescriptionElementsOperation(
                                                event.getCommand().getName(), EditorUtil.getUndoContext(), 
-                                               targetDescription, elements, false, (IPostOperationEnabled) EditorUtil.getView(DescriptiveViewPart.ID, true));
+                                               targetDescription, elements, false, this);
+                               
                                EditorUtil.executeOperation(operation);
-//                             conversation.commit(true);
-                               CdmStore.getService(ITaxonService.class).saveOrUpdate(targetTaxon);
+                               
+                               //CdmStore.getService(ITaxonService.class).saveOrUpdate(targetTaxon);
                                
                        } catch (NotDefinedException e) {
                                MessagingUtils.error(getClass(), e);
@@ -112,4 +139,44 @@ public class MoveDescriptionElementsHandler extends AbstractHandler {
                return null;
        }
 
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
+        */
+       /** {@inheritDoc} */
+       @Override
+    public boolean postOperation(CdmBase objectAffectedByOperation) {
+               
+               editor.getConversationHolder().bind();
+               editor.getConversationHolder().commit(true);
+               Display.getDefault().asyncExec(new Runnable(){
+                       
+            public void run() {
+                               //AbstractUtility.close(editor.getMultiPageTaxonEditor());
+
+                               try {
+                                       MultiPageTaxonEditor possibleOpenEditor = (MultiPageTaxonEditor) EditorUtil.findEditorByTaxonNodeUuid(newAcceptedTaxonNodeUuid);
+                                       if(possibleOpenEditor != null){
+                                               AbstractUtility.close(possibleOpenEditor);
+                                       }
+                                       EditorUtil.openTaxonNode(newAcceptedTaxonNodeUuid);
+                               } catch (PartInitException e) {
+                                       MessagingUtils.error(this.getClass(), e);
+                                       throw new RuntimeException(e);
+                               } catch (Exception e) {
+                                       MessagingUtils.warningDialog("Could not create Taxon", this, e.getMessage());
+                               }
+                       }
+
+               });
+
+
+               return true;
+       }
+
+       @Override
+       public boolean onComplete() {
+               // TODO Auto-generated method stub
+               return false;
+       }
+       
 }
index 1f20f38b330cb94de5fbf6b4c1111fab8eb9729c..ae860755cd9747acedb1cdfe6a9ddb2a1bb6bc47 100644 (file)
@@ -20,6 +20,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
 
 import eu.etaxonomy.cdm.api.service.IDescriptionService;
 import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.cdm.model.description.TaxonDescription;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
@@ -28,6 +29,7 @@ import eu.etaxonomy.taxeditor.editor.Page;
 import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
 import eu.etaxonomy.taxeditor.editor.view.descriptive.operation.MoveDescriptionToOtherTaxonOperation;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
@@ -67,8 +69,14 @@ public class MoveDescriptionToOtherTaxonHandler extends AbstractHandler
                        IStructuredSelection structuredSelection = (IStructuredSelection) selection;
 
                        for(Object element : structuredSelection.toArray()){
-                               if (element instanceof TaxonDescription){
-                                       UUID uuid = ((TaxonDescription)element).getUuid();
+                               UUID uuid = null;
+                               if (element instanceof FeatureNodeContainer){
+                                       uuid = ((FeatureNodeContainer)element).getDescription().getUuid();
+                               }       else if (element instanceof DescriptionBase){
+                                       uuid = ((DescriptionBase)element).getUuid();
+                               }
+                               
+                               if (uuid != null){
                                        descriptions.add((TaxonDescription) CdmStore.getService(IDescriptionService.class).load(uuid, null));
                                }
                        }
index 5b4b0053ed727bfea012bd536bf289b3378dd06e..fd74d72745e6dc55a6ef9ba1e3f7b74ca6c2f8d1 100644 (file)
@@ -17,10 +17,17 @@ import org.eclipse.core.commands.operations.IUndoContext;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
 
 import eu.etaxonomy.cdm.api.service.IDescriptionService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.MultiPageTaxonEditor;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -30,7 +37,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @created Feb 8, 2011
  * @version 1.0
  */
-public class MoveDescriptionElementsOperation extends AbstractPostTaxonOperation {
+public class MoveDescriptionElementsOperation extends AbstractPostTaxonOperation{
 
        private Collection<DescriptionElementBase> descriptionElements;
        private DescriptionBase targetDescription;
@@ -68,6 +75,7 @@ public class MoveDescriptionElementsOperation extends AbstractPostTaxonOperation
                
                service.moveDescriptionElementsToDescription(descriptionElements, targetDescription, isCopy);
                
+               
                return postExecute(targetDescription);
        }
 
@@ -90,5 +98,7 @@ public class MoveDescriptionElementsOperation extends AbstractPostTaxonOperation
                // TODO Auto-generated method stub
                return null;
        }
+       
+       
 
 }
index 73564880ab8a98167a170b6ea6baf7e95a4185d6..421dda37b47695e7305d74400a71e3d3e1ac2a72 100644 (file)
@@ -8,4 +8,4 @@ root.win32.win32.x86_64.permissions.755=jre/bin/**
 root.win32.win32.x86=win-32
 root.win32.win32.x86.permissions.755=jre/bin/**
 root.macosx.cocoa.x86_64=mac-64
-root.macosx.cocoa.x86_64.permissions.755=jre/bin/**
\ No newline at end of file
+root.macosx.cocoa.x86_64.permissions.755=jre/Contents/Home/jre/bin/**
\ No newline at end of file
index 0f59e5e90da48ff947e9a2491c8153de516bf8cf..71062e2e8eab8ba742b7c768da36cf326977accb 100644 (file)
          version="0.0.0"
          unpack="false"/>
 
+   <plugin
+         id="eu.etaxonomy.taxeditor.molecular"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="eu.etaxonomy.taxeditor.molecular.lib"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
 </feature>
diff --git a/eu.etaxonomy.taxeditor.molecular.lib/.classpath b/eu.etaxonomy.taxeditor.molecular.lib/.classpath
new file mode 100644 (file)
index 0000000..1d66dd2
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry exported="true" kind="lib" path="lib/bioinfweb-commons-bio-2-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/bioinfweb-commons-core-2-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/bioinfweb-commons-swing-2-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/bioinfweb-commons-swt-2-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/core-1.9.2-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/libralign-biojava1-0-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/libralign-core-0-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/libralign-swt-0-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/sequencing-1.9.2-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/tic-core-2-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/tic-swt-2-SNAPSHOT.jar"/>
+       <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/eu.etaxonomy.taxeditor.molecular.lib/.gitignore b/eu.etaxonomy.taxeditor.molecular.lib/.gitignore
new file mode 100644 (file)
index 0000000..e6066b2
--- /dev/null
@@ -0,0 +1,2 @@
+/target
+.settings/
diff --git a/eu.etaxonomy.taxeditor.molecular.lib/.project b/eu.etaxonomy.taxeditor.molecular.lib/.project
new file mode 100644 (file)
index 0000000..45f118a
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>eu.etaxonomy.taxeditor.molecular.lib</name>
+       <comment>The Taxonomic Editor for EDIT&apos;s platform for
+    cybertaxonomy. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/eu.etaxonomy.taxeditor.molecular.lib/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.molecular.lib/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..3ee9c82
--- /dev/null
@@ -0,0 +1,164 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: eu.etaxonomy.taxeditor.molecular.lib
+Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular.lib;singleton:=true
+Bundle-Version: 3.8.0.qualifier
+Bundle-ClassPath: .,
+ lib/bioinfweb-commons-bio-2-SNAPSHOT.jar,
+ lib/bioinfweb-commons-core-2-SNAPSHOT.jar,
+ lib/bioinfweb-commons-swing-2-SNAPSHOT.jar,
+ lib/bioinfweb-commons-swt-2-SNAPSHOT.jar,
+ lib/core-1.9.2-SNAPSHOT.jar,
+ lib/libralign-biojava1-0-SNAPSHOT.jar,
+ lib/libralign-core-0-SNAPSHOT.jar,
+ lib/libralign-swt-0-SNAPSHOT.jar,
+ lib/sequencing-1.9.2-SNAPSHOT.jar,
+ lib/tic-core-2-SNAPSHOT.jar,
+ lib/tic-swt-2-SNAPSHOT.jar
+Export-Package: info.bioinfweb.commons,
+ info.bioinfweb.commons.appversion,
+ info.bioinfweb.commons.beans,
+ info.bioinfweb.commons.bio,
+ info.bioinfweb.commons.changemonitor,
+ info.bioinfweb.commons.collections,
+ info.bioinfweb.commons.collections.observable,
+ info.bioinfweb.commons.graphics,
+ info.bioinfweb.commons.io,
+ info.bioinfweb.commons.log,
+ info.bioinfweb.commons.progress,
+ info.bioinfweb.commons.swing,
+ info.bioinfweb.commons.swing.scrollpaneselector,
+ info.bioinfweb.commons.swt,
+ info.bioinfweb.commons.text,
+ info.bioinfweb.libralign,
+ info.bioinfweb.libralign.actions,
+ info.bioinfweb.libralign.alignmentarea,
+ info.bioinfweb.libralign.alignmentarea.content,
+ info.bioinfweb.libralign.alignmentarea.label,
+ info.bioinfweb.libralign.alignmentarea.order,
+ info.bioinfweb.libralign.alignmentarea.paintsettings,
+ info.bioinfweb.libralign.alignmentarea.rowsarea,
+ info.bioinfweb.libralign.alignmentarea.selection,
+ info.bioinfweb.libralign.alignmentarea.tokenpainter,
+ info.bioinfweb.libralign.dataarea,
+ info.bioinfweb.libralign.dataarea.implementations,
+ info.bioinfweb.libralign.dataarea.implementations.charset,
+ info.bioinfweb.libralign.dataarea.implementations.pherogram,
+ info.bioinfweb.libralign.editsettings,
+ info.bioinfweb.libralign.model,
+ info.bioinfweb.libralign.model.adapters,
+ info.bioinfweb.libralign.model.concatenated,
+ info.bioinfweb.libralign.model.data,
+ info.bioinfweb.libralign.model.events,
+ info.bioinfweb.libralign.model.exception,
+ info.bioinfweb.libralign.model.factory,
+ info.bioinfweb.libralign.model.factory.continuous,
+ info.bioinfweb.libralign.model.implementations,
+ info.bioinfweb.libralign.model.implementations.swingundo,
+ info.bioinfweb.libralign.model.implementations.swingundo.edits,
+ info.bioinfweb.libralign.model.implementations.swingundo.edits.sequence,
+ info.bioinfweb.libralign.model.implementations.swingundo.edits.token,
+ info.bioinfweb.libralign.model.implementations.translation,
+ info.bioinfweb.libralign.model.tokenset,
+ info.bioinfweb.libralign.model.tokenset.continuous,
+ info.bioinfweb.libralign.multiplealignments,
+ info.bioinfweb.libralign.pherogram,
+ info.bioinfweb.libralign.pherogram.distortion,
+ info.bioinfweb.libralign.pherogram.model,
+ info.bioinfweb.libralign.pherogram.provider,
+ info.bioinfweb.libralign.pherogram.view,
+ info.bioinfweb.tic,
+ info.bioinfweb.tic.exception,
+ info.bioinfweb.tic.input,
+ info.bioinfweb.tic.toolkit,
+ info.bioinfweb.tic.toolkit.layoutdata,
+ org.biojava.bibliography,
+ org.biojava.bio,
+ org.biojava.bio.alignment,
+ org.biojava.bio.annodb,
+ org.biojava.bio.chromatogram,
+ org.biojava.bio.chromatogram.graphic,
+ org.biojava.bio.dist,
+ org.biojava.bio.dp,
+ org.biojava.bio.dp.onehead,
+ org.biojava.bio.dp.twohead,
+ org.biojava.bio.molbio,
+ org.biojava.bio.program,
+ org.biojava.bio.program.abi,
+ org.biojava.bio.program.blast2html,
+ org.biojava.bio.program.fastq,
+ org.biojava.bio.program.formats,
+ org.biojava.bio.program.gff,
+ org.biojava.bio.program.gff3,
+ org.biojava.bio.program.hmmer,
+ org.biojava.bio.program.homologene,
+ org.biojava.bio.program.indexdb,
+ org.biojava.bio.program.phred,
+ org.biojava.bio.program.scf,
+ org.biojava.bio.program.ssaha,
+ org.biojava.bio.program.ssbind,
+ org.biojava.bio.program.tagvalue,
+ org.biojava.bio.program.unigene,
+ org.biojava.bio.program.xff,
+ org.biojava.bio.program.xml,
+ org.biojava.bio.proteomics,
+ org.biojava.bio.proteomics.aaindex,
+ org.biojava.bio.search,
+ org.biojava.bio.seq,
+ org.biojava.bio.seq.db,
+ org.biojava.bio.seq.db.biofetch,
+ org.biojava.bio.seq.db.emblcd,
+ org.biojava.bio.seq.db.flat,
+ org.biojava.bio.seq.distributed,
+ org.biojava.bio.seq.filter,
+ org.biojava.bio.seq.homol,
+ org.biojava.bio.seq.impl,
+ org.biojava.bio.seq.io,
+ org.biojava.bio.seq.io.agave,
+ org.biojava.bio.seq.io.filterxml,
+ org.biojava.bio.seq.io.game,
+ org.biojava.bio.seq.io.game12,
+ org.biojava.bio.seq.projection,
+ org.biojava.bio.symbol,
+ org.biojava.bio.taxa,
+ org.biojava.directory,
+ org.biojava.naming,
+ org.biojava.ontology,
+ org.biojava.ontology.io,
+ org.biojava.ontology.obo,
+ org.biojava.stats.svm,
+ org.biojava.stats.svm.tools,
+ org.biojava.utils,
+ org.biojava.utils.automata,
+ org.biojava.utils.cache,
+ org.biojava.utils.candy,
+ org.biojava.utils.io,
+ org.biojava.utils.lsid,
+ org.biojava.utils.math,
+ org.biojava.utils.net,
+ org.biojava.utils.process,
+ org.biojava.utils.regex,
+ org.biojava.utils.stax,
+ org.biojava.utils.walker,
+ org.biojava.utils.xml,
+ org.biojavax,
+ org.biojavax.bio,
+ org.biojavax.bio.alignment,
+ org.biojavax.bio.alignment.blast,
+ org.biojavax.bio.db,
+ org.biojavax.bio.db.ncbi,
+ org.biojavax.bio.seq,
+ org.biojavax.bio.seq.io,
+ org.biojavax.bio.taxa,
+ org.biojavax.bio.taxa.io,
+ org.biojavax.ga,
+ org.biojavax.ga.exception,
+ org.biojavax.ga.functions,
+ org.biojavax.ga.impl,
+ org.biojavax.ga.util,
+ org.biojavax.ontology,
+ org.biojavax.utils,
+ org.jdesktop.swingx.scrollpaneselector
+Bundle-ActivationPolicy: lazy
+Import-Package: javax.swing
+Require-Bundle: org.eclipse.swt
diff --git a/eu.etaxonomy.taxeditor.molecular.lib/build.properties b/eu.etaxonomy.taxeditor.molecular.lib/build.properties
new file mode 100644 (file)
index 0000000..97e80af
--- /dev/null
@@ -0,0 +1,12 @@
+bin.includes = META-INF/,\
+               lib/bioinfweb-commons-bio-2-SNAPSHOT.jar,\
+               lib/bioinfweb-commons-core-2-SNAPSHOT.jar,\
+               lib/bioinfweb-commons-swing-2-SNAPSHOT.jar,\
+               lib/bioinfweb-commons-swt-2-SNAPSHOT.jar,\
+               lib/core-1.9.2-SNAPSHOT.jar,\
+               lib/libralign-biojava1-0-SNAPSHOT.jar,\
+               lib/libralign-core-0-SNAPSHOT.jar,\
+               lib/libralign-swt-0-SNAPSHOT.jar,\
+               lib/sequencing-1.9.2-SNAPSHOT.jar,\
+               lib/tic-core-2-SNAPSHOT.jar,\
+               lib/tic-swt-2-SNAPSHOT.jar
diff --git a/eu.etaxonomy.taxeditor.molecular.lib/lib/.gitignore b/eu.etaxonomy.taxeditor.molecular.lib/lib/.gitignore
new file mode 100644 (file)
index 0000000..0557829
--- /dev/null
@@ -0,0 +1 @@
+/*.jar
diff --git a/eu.etaxonomy.taxeditor.molecular.lib/pom.xml b/eu.etaxonomy.taxeditor.molecular.lib/pom.xml
new file mode 100644 (file)
index 0000000..5700ef8
--- /dev/null
@@ -0,0 +1,189 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>eu.etaxonomy.taxeditor</groupId>
+  <artifactId>eu.etaxonomy.taxeditor.molecular.lib</artifactId>
+  <packaging>eclipse-plugin</packaging>
+  
+  <parent>
+    <groupId>eu.etaxonomy</groupId>
+    <artifactId>taxeditor-parent</artifactId>
+    <version>3.8.0-SNAPSHOT</version>
+  </parent>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>2.4</version>
+        <executions>
+          <execution>
+            <id>copy-dependencies</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>copy-dependencies</goal>
+            </goals>
+            <configuration>
+              <includeArtifactIds>libralign-swt, libralign-core,
+                bioinfweb-commons-swt, bioinfweb-commons-core,
+                bioinfweb-commons-bio, bioinfweb-commons-swing,
+                tic-core, libralign-biojava1, core, sequencing, tic-swt</includeArtifactIds>
+              <outputDirectory>lib</outputDirectory>
+              <overWriteReleases>true</overWriteReleases>
+              <overWriteSnapshots>true</overWriteSnapshots>
+              <excludeTransitive>true</excludeTransitive>
+            </configuration>
+          </execution>
+          <!-- <execution> -->
+          <!-- <id>copy-dependencies-sources</id> -->
+          <!-- <phase>validate</phase> -->
+          <!-- <goals> -->
+          <!-- <goal>copy-dependencies</goal> -->
+          <!-- </goals> -->
+          <!-- <configuration> -->
+          <!-- <classifier>sources</classifier> -->
+          <!-- <includeArtifactIds>cdmlib-commons,cdmlib-model,cdmlib-persistence,cdmlib-remote,cdmlib-print,cdmlib-services,cdmlib-ext,cdmlib-io</includeArtifactIds> -->
+          <!-- <outputDirectory>lib</outputDirectory> -->
+          <!-- <overWriteReleases>true</overWriteReleases> -->
+          <!-- <overWriteSnapshots>true</overWriteSnapshots> -->
+          <!-- <excludeTransitive>true</excludeTransitive> -->
+          <!-- <failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact> -->
+          <!-- </configuration> -->
+          <!-- </execution> -->
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>1.7</version>
+        <executions>
+          <execution>
+            <id>remove-existing-jars</id>
+            <phase>clean</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <target>
+                <echo>Remove all jars</echo>
+                <delete>
+                  <fileset dir="./lib" includes="*" />
+                </delete>
+              </target>
+            </configuration>
+          </execution>
+          <execution>
+            <id>update-snapshot-jar-names</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <target>
+                <echo>Update jars to SNAPSHOT when build with
+                  timestamp</echo>
+                <move todir="./lib">
+                  <fileset dir="./lib" />
+                  <mapper type="regexp"
+                    from="(^bioinfweb\-.*\-[0-9]-)[0-9.-]+(\.jar)" to="\1SNAPSHOT\2" />
+                </move>
+                <move todir="./lib">
+                  <fileset dir="./lib" />
+                  <mapper type="regexp"
+                    from="(^libralign\-.*\-[0-9]-)[0-9.-]+(\.jar)" to="\1SNAPSHOT\2" />
+                </move>
+                <move todir="./lib">
+                  <fileset dir="./lib" />
+                  <mapper type="regexp"
+                    from="(^tic\-.*\-[0-9]-)[0-9.-]+(\.jar)" to="\1SNAPSHOT\2" />
+                </move>
+                <move todir="./lib">
+                  <fileset dir="./lib" />
+                  <mapper type="regexp"
+                    from="(^core\-[0-9]\.[0-9]\.[0-9])(\.jar)" to="\1-SNAPSHOT\2" />
+                </move>
+                <move todir="./lib">
+                  <fileset dir="./lib" />
+                  <mapper type="regexp"
+                    from="(^sequencing\-[0-9]\.[0-9]\.[0-9])(\.jar)" to="\1-SNAPSHOT\2" />
+                </move>
+              </target>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <!-- LibrAling -->
+    <dependency>
+      <groupId>info.bioinfweb.libralign</groupId>
+      <artifactId>libralign-core</artifactId>
+      <version>0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>info.bioinfweb.libralign</groupId>
+      <artifactId>libralign-swt</artifactId>
+      <version>0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>info.bioinfweb.libralign</groupId>
+      <artifactId>libralign-biojava1</artifactId>
+      <version>0-SNAPSHOT</version>
+    </dependency>
+    <!-- commons -->
+    <dependency>
+      <groupId>info.bioinfweb.commons.java</groupId>
+      <artifactId>bioinfweb-commons-swt</artifactId>
+      <version>2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>info.bioinfweb.commons.java</groupId>
+      <artifactId>bioinfweb-commons-core</artifactId>
+      <version>2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>info.bioinfweb.commons.java</groupId>
+      <artifactId>bioinfweb-commons-bio</artifactId>
+      <version>2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>info.bioinfweb.commons.java</groupId>
+      <artifactId>bioinfweb-commons-swing</artifactId>
+      <version>2-SNAPSHOT</version>
+    </dependency>
+    <!-- tic -->
+    <dependency>
+      <groupId>info.bioinfweb.tic</groupId>
+      <artifactId>tic-core</artifactId>
+      <version>2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>info.bioinfweb.tic</groupId>
+      <artifactId>tic-swt</artifactId>
+      <version>2-SNAPSHOT</version>
+    </dependency>
+    <!-- biojava -->
+    <dependency>
+      <groupId>org.biojava</groupId>
+      <artifactId>core</artifactId>
+      <version>1.9.2</version>
+    </dependency>
+    <dependency>
+      <groupId>org.biojava</groupId>
+      <artifactId>sequencing</artifactId>
+      <version>1.9.2</version>
+    </dependency>
+  </dependencies>
+
+  <repositories>
+    <repository>
+      <id>bioinfweb-maven-repo</id>
+      <name>bioinfweb repository</name>
+      <url>http://bioinfweb.info/MavenRepository/</url>
+    </repository>
+  </repositories>
+  
+</project> 
+
diff --git a/eu.etaxonomy.taxeditor.molecular/.classpath b/eu.etaxonomy.taxeditor.molecular/.classpath
new file mode 100644 (file)
index 0000000..f14ba2c
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry including="**/*.java" kind="src" path="src/main/java"/>
+       <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/eu.etaxonomy.taxeditor.molecular/.gitignore b/eu.etaxonomy.taxeditor.molecular/.gitignore
new file mode 100644 (file)
index 0000000..e6066b2
--- /dev/null
@@ -0,0 +1,2 @@
+/target
+.settings/
diff --git a/eu.etaxonomy.taxeditor.molecular/.project b/eu.etaxonomy.taxeditor.molecular/.project
new file mode 100644 (file)
index 0000000..3826881
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>eu.etaxonomy.taxeditor.molecular</name>
+       <comment>Provides editors, views and operations for handling molecular data and alignments. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.eclipse.pde.PluginNature</nature>
+       </natures>
+</projectDescription>
diff --git a/eu.etaxonomy.taxeditor.molecular/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.molecular/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..05dba64
--- /dev/null
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Molecular Bundle
+Bundle-SymbolicName: eu.etaxonomy.taxeditor.molecular;singleton:=true
+Bundle-Version: 3.8.0.qualifier
+Bundle-Activator: eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.expressions,
+ org.eclipse.ui.ide,
+ eu.etaxonomy.taxeditor.bulkeditor,
+ eu.etaxonomy.taxeditor.cdmlib,
+ eu.etaxonomy.taxeditor.editor,
+ eu.etaxonomy.taxeditor.store,
+ eu.etaxonomy.taxeditor.molecular.lib
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: EDIT
+Export-Package: eu.etaxonomy.taxeditor.molecular,
+ eu.etaxonomy.taxeditor.molecular.editor,
+ eu.etaxonomy.taxeditor.molecular.handler
+Bundle-ClassPath: .
diff --git a/eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/plugin.properties b/eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/plugin.properties
new file mode 100644 (file)
index 0000000..e2943e3
--- /dev/null
@@ -0,0 +1,164 @@
+#Properties file for taxeditor-editor
+Bundle-Vendor.0 = EDIT
+Bundle-Name.0 = EDIT Taxonomic Editor - Editor Bundle
+command.name.17 = Set Basionym
+command.name.18 = Remove Basionym
+editor.name = Multipage Taxon Editor
+editor.name.0 = Taxon Name Editor
+editor.name.1 = Key
+editor.name.2 = Polytomous Key Graph Editor
+editor.name.3 = Polytomous Key List Editor
+editor.name.4 = Cdm Authority Editor
+editor.name.5 = Derivative View
+view.name = Factual Data
+view.name.0 = Uses
+view.name.1 = Media
+view.name.2 = Concept Relations
+view.name.3 = Concept Graph
+category.name = Taxonomic Editor
+command.label = Reference
+command.label.0 = Name
+command.label.1 = Team
+command.label.2 = Person
+command.label.3 = Specimen
+command.label.4 = Factual Data
+command.label.5 = Media
+command.label.6 = Concept
+command.label.7 = Concept Graph
+command.label.8 = Open Parent
+menu.label = New
+command.label.9 = Heterotypic Synonym
+command.label.10 = Homotypic Synonym
+command.label.11 = Synonym In Homotypical Group
+menu.label.0 = Change To
+command.label.12 = Accepted Taxon
+command.label.13 = Synonym
+command.label.14 = Misapplication
+command.label.15 = Delete
+command.label.16 = Delete All Empty Names
+command.label.17 = Swap Synonym With Accepted
+command.label.18 = Show Details
+command.label.19 = Save
+command.label.20 = New Node
+command.label.21 = Delete
+command.label.22 = Apply Layout
+command.label.23 = New Key Number
+command.label.24 = New Alternative
+command.label.25 = Refresh Nodes
+command.label.26 = Delete
+command.label.27 = New Factual Data
+menu.label.1 = New
+command.label.28 = Move Description to Taxon
+command.label.29 = Move Elements to Taxon
+command.label.30 = Delete
+command.label.31 = Save
+menu.label.2 = New Derivative
+command.label.32 = New Use
+command.label.33 = New Use Summary
+command.label.34 = New Use Record
+command.label.35 = Delete
+command.label.36 = Save
+command.label.37 = New Image Gallery
+command.label.38 = New Image
+command.label.39 = Move Image Up In List
+command.label.40 = Move Image Down In List
+command.label.41 = Delete
+command.label.42 = Save
+menu.label.3 = New
+command.label.43 = Open Related Concept
+command.label.44 = Delete
+command.label.45 = Edit Authorities
+extension.name = Name Commands
+category.name.0 = -- Name Editor
+command.name = Open Parent
+command.name.0 = Create Homotypic Synonym
+command.name.1 = Create Heterotypic Synonym
+command.name.2 = Create Synonym In Homotypical Group
+command.name.3 = Change To Synonym
+command.name.4 = Change To Accepted Taxon
+command.name.5 = Change To Misapplication
+command.name.6 = Swap Synonym With Accepted
+
+command.name.7 = Set Basionym / Original Combination
+command.name.8 = Remove Basionym / Original Combination
+command.name.9 = Delete All Empty Names
+category.name.1 = -- Factual
+command.name.10 = Create Description Element
+command.name.11 = New Description
+command.name.12 = Move Description Elements to Taxon
+command.name.13 = Move Description to Taxon
+category.name.2 = -- New Uses
+command.name.14 = New Use
+command.name.15 = New Use Summary
+command.name.16 = New Use Record
+category.name.3 = -- Media
+command.name.19 = Move Image Down In List
+command.name.20 = New Image Gallery
+command.name.21 = New Image
+command.name.22 = Move Image Up In List
+category.name.4 = -- New Entity
+command.name.23 = New Reference
+command.name.24 = New Name
+command.name.25 = New Team
+command.name.26 = New Person
+command.name.27 = New Specimen
+category.name.5 = -- Polytomous Keys
+command.name.28 = New Child Node
+command.name.29 = New Sibling Node
+command.name.30 = Refresh Node Numbering
+command.name.31 = Apply Layout
+category.name.6 = -- Concept Relations
+command.name.32 = Create Concept Relation
+command.name.33 = Open Related Concept
+category.name.7 = -- Group
+command.name.34 = Edit CDM Authorities
+command.name.35 = Open Derivative View
+scheme.description = The default key binding scheme for the Taxonomic Editor
+scheme.name = Taxonomic Editor Default Key Bindings
+editor.name.6 = Specimen Import Editor
+editor.name.7 = Gbif Import Editor
+editor.name.8 = Checklist Editor
+view.name.4 = Specimen Import
+view.name.5 = GBIF Specimen Import
+command.label.46 = Name
+command.label.47 = Reference
+command.label.48 = Datasource
+command.label.49 = Misapplication
+command.label.50 = Use Existing Image
+command.name.36 = Create Misapplication
+command.name.37 = Use Existing Image
+command.name.38 = Open Checklist Editor
+command.name.39 = New Datasource
+wizard.name = Specimen Search/Import
+wizard.description = Queries data provider for specimens with specified parameters.\nNote: Query results are currently limited to 100.
+command.name.40 = Validation
+view.name.6 = Validation
+marker.field.0 = Object Type
+marker.field.1 = Object
+marker.field.2 = Attribute
+marker.field.3 = Problematic Value
+marker.field.4 = Problem description
+marker.field.5 = Validator
+marker.field.6 = Entity Class
+marker.field.7 = Entity Id
+extension.name.0 = Validation Error
+command.label.51 = Open in Specimen Editor
+command.label.52 = Delete
+command.label.53 = Create Field Unit
+command.label.54 = Delete (with children)
+command.tooltip = Show Only Individuals Associations
+command.label.55 = Open Associated Specimens
+command.name.41 = Show Only Individual Associations
+command.name.42 = Open Taxon Editor
+command.name.43 = Create Field Unit
+command.name.44 = Deep Delete
+command.name.46 = Move Synonym (Homotypical Group) to another Accepted Taxon
+command.label.56 = Move Synonym (Homotypical Group) to another Accepted Taxon
+markerContentGenerator.name = Validation Problems Marker Generator
+command.name.45 = Delete
+command.name.47 = Delete
+commandParameter.name = taxonUUID
+Bundle-Name = Editor Bundle
+command.name.48 = delete
+command.name.49 = delete
+command.name.50 = delete
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/plugin_de.properties b/eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/plugin_de.properties
new file mode 100644 (file)
index 0000000..8c098c3
--- /dev/null
@@ -0,0 +1,156 @@
+# Properties file for taxeditor-editor
+Bundle-Vendor.0 = EDIT
+Bundle-Name.0 = EDIT Taxonomischer Editor - Editor Bundle
+command.name.17 = Setze Basionym
+command.name.18 = Entferne Basionym
+editor.name = Multipage Taxon Editor
+editor.name.0 = Editor Taxonname
+editor.name.1 = Bestimmungsschl\u00fcssel
+editor.name.2 = Polytomer Bestimmungsschl\u00fcssel Graph Editor
+editor.name.3 = Polytomer Bestimmungsschl\u00fcssel List Editor
+editor.name.4 = CDM Rechtemanagement
+editor.name.5 = Ansicht Derivate
+view.name = Faktendaten
+view.name.0 = Nutzung
+view.name.1 = Medien
+view.name.2 = Konzeptrelationen
+view.name.3 = Konzeptgraph
+category.name = Taxonomischer Editor
+command.label = Referenz
+command.label.0 = Name
+command.label.1 = Team
+command.label.2 = Person
+command.label.3 = Beleg
+command.label.4 = Faktendaten
+command.label.5 = Medien
+command.label.6 = Konzeptrelationen
+command.label.7 = Konzeptgraph
+command.label.8 = \u00d6ffne Parent
+menu.label = Neue
+command.label.9 = Heterotypisches Synonym
+command.label.10 = Homotypisches Synonym
+command.label.11 = Synonym in Homotypischer Gruppe
+menu.label.0 = \u00c4ndere zu
+command.label.12 = Akzeptiertes Taxon
+command.label.13 = Synonym
+command.label.14 = Misapplication
+command.label.15 = L\u00f6schen
+command.label.16 = L\u00f6sche alle leeren Namen
+command.label.17 = Tausche Synonym mit akzeptiertem Namen
+command.label.18 = Zeige Details
+command.label.19 = Speichern
+command.label.20 = Neue Knoten
+command.label.21 = L\u00f6schen
+command.label.22 = Wende Layout an
+command.label.23 = Neue Bestimmungsschl\u00fcsselnummer
+command.label.24 = Neue Alternative
+command.label.25 = Erneuere Knoten
+command.label.26 = L\u00f6schen
+command.label.27 = Neue Faktendaten
+menu.label.1 = Neue
+command.label.28 = Verschiebe Eigenschaften zu Taxon
+command.label.29 = Verschiebe Elemente zu Taxon
+command.label.30 = L\u00f6schen
+command.label.31 = Speichern
+menu.label.2 = Neue Derivate
+command.label.32 = Neue Nutzung
+command.label.33 = Neue Zusammenfassung
+command.label.34 = Neuer Nutzungsdatensatz
+command.label.35 = L\u00f6schen
+command.label.36 = Speichern
+command.label.37 = Neue Bildergalerie
+command.label.38 = Neues Bild
+command.label.39 = Bild nach oben
+command.label.40 = Bild nach unten
+command.label.41 = L\u00f6schen
+command.label.42 = Speichern
+menu.label.3 = Neue
+command.label.43 = \u00d6ffne verbundenes Konzept
+command.label.44 = L\u00f6schen
+command.label.45 = Bearbeite Rechte
+extension.name = Namensbefehle
+category.name.0 = -- Namenseditor
+command.name = \u00d6ffne Elter
+command.name.0 = Erstelle homotypisches Synonym
+command.name.1 = Erstelle heterotypisches Synonym
+command.name.2 = Erstelle Synonym in homotypischer Gruppe
+command.name.3 = \u00c4ndere zu Synonym
+command.name.4 = \u00c4ndere zu akzeptiertem Taxon
+command.name.5 = \u00c4ndere zu Misapplication
+command.name.6 = Tausche Synonym mit akzeptiertem Namen
+
+command.name.7 = Setze Basionym / Originalkombination
+command.name.8 = Entferne Basionym / Originalkombination
+command.name.9 = L\u00f6sche alle leeren Namen
+category.name.1 = -- Fakten
+command.name.10 = Erstelle Beschreibungselement
+command.name.11 = Neue Beschreibung
+command.name.12 = Bewege Beschreibungselement zu Taxon
+command.name.13 = Bewege Beschreibung zu Taxon
+category.name.2 = -- Neue Nutzung
+command.name.14 = Neue Nutzung
+command.name.15 = Neue Zusammenfassung
+command.name.16 = Neuer Nutzungsdatensatz
+category.name.3 = -- Media
+command.name.19 = Bewege Bild nach unten
+command.name.20 = Neue Bildergalerie
+command.name.21 = Neues Bild
+command.name.22 = Bewege Bild nach oben
+category.name.4 = -- Neue Entit\u00e4t
+command.name.23 = Neue Referenz
+command.name.24 = Neuer Name
+command.name.25 = Neues Team
+command.name.26 = Neue Person
+command.name.27 = Neuer Beleg
+category.name.5 = -- Polytomer Bestimmungsschl\u00fcssel
+command.name.28 = Neue Kinderknoten
+command.name.29 = Neuer Geschwisterknoten
+command.name.30 = Knotennummerierung aktualisieren
+command.name.31 = Layout anwenden
+category.name.6 = -- Konzeptbeziehungen
+command.name.32 = Erstelle Konzeptrelationen
+command.name.33 = \u00d6ffne verbundenes Konzept
+category.name.7 = -- Gruppe
+command.name.34 = Bearbeite CDM Rechte
+command.name.35 = \u00d6ffne Derivate Ansicht
+scheme.description = Die Standard Tastenkombinationsschema f\u00fcr den Taxonomischen Editor
+scheme.name = Taxonomic Editor Standard Tastenkombinationen
+editor.name.6 = Specimen Import Editor
+editor.name.7 = GBIF Import Editor
+editor.name.8 = Checklist Editor
+view.name.4 = Specimen Import
+view.name.5 = GBIF Specimen Import
+command.label.46 = Name
+command.label.47 = Referenz
+command.label.48 = Datenquelle
+command.label.49 = Misapplication
+command.label.50 = Benutze vorhandenes Bild
+command.name.36 = Erstelle Misapplication
+command.name.37 = Benutze vorhandenes Bild
+command.name.38 = \u00d6ffne Checklist Editor
+command.name.39 = Neue Datenquelle
+wizard.name = Specimen Suche/Import
+wizard.description = Sendet eine Anfrage mit den eingegebenen Parametern an den Datenprovider.\nHinweis: Die Anzahl der Anfrageergebnisse sind auf 100 begrenzt.
+command.name.40 = Validierung
+view.name.6 = Validierung
+marker.field.0 = Objekttyp
+marker.field.1 = Objekt
+marker.field.2 = Attribut
+marker.field.3 = Problematischer Wert
+marker.field.4 = Problembeschreibung
+marker.field.5 = Validierer
+marker.field.6 = Entit�tsklasse
+marker.field.7 = Entit�ts ID
+extension.name.0 = Validierungs-Fehler
+command.label.51 = \u00d6ffne Specimen-Editor
+command.label.52 = L\u00f6schen
+command.label.53 = Neue Field Unit
+command.label.54 = L\u00f6schen (mit Kindern)
+command.tooltip = Nur Individuals Associations anzeigen
+command.label.55 = \u00d6ffne zugeh\u00f6rige Specimens
+command.name.41 = Nur Individuals Associations anzeigen
+command.name.42 = \u00d6ffne Taxon Editor
+command.name.43 = Neue Field Unit
+command.name.44 = L\u00f6schen (mit Kindern)
+command.name.46 = Verschiebe Synonym(Homotypische Gruppe) zu neuem Akzeptierten Taxon
+command.label.56 = Verschiebe Synonym(Homotypische Gruppe) zu neuem Akzeptierten Taxon
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/plugin_en.properties b/eu.etaxonomy.taxeditor.molecular/OSGI-INF/l10n/plugin_en.properties
new file mode 100644 (file)
index 0000000..897175a
--- /dev/null
@@ -0,0 +1,141 @@
+#Properties file for taxeditor-editor
+Bundle-Vendor.0 = EDIT
+Bundle-Name.0 = EDIT Taxonomic Editor - Editor Bundle
+command.name.17 = Set Basionym
+command.name.18 = Remove Basionym
+editor.name = Multipage Taxon Editor
+editor.name.0 = Taxon Name Editor
+editor.name.1 = Key
+editor.name.2 = Polytomous Key Graph Editor
+editor.name.3 = Polytomous Key List Editor
+editor.name.4 = Cdm Authority Editor
+editor.name.5 = Derivate View
+view.name = Factual Data
+view.name.0 = Uses
+view.name.1 = Media
+view.name.2 = Concept Relations
+view.name.3 = Concept Graph
+category.name = Taxonomic Editor
+command.label = Reference
+command.label.0 = Name
+command.label.1 = Team
+command.label.2 = Person
+command.label.3 = Specimen
+command.label.4 = Factual Data
+command.label.5 = Media
+command.label.6 = Concept
+command.label.7 = Concept Graph
+command.label.8 = Open Parent
+menu.label = New
+command.label.9 = Heterotypic Synonym
+command.label.10 = Homotypic Synonym
+command.label.11 = Synonym In Homotypical Group
+menu.label.0 = Change To
+command.label.12 = Accepted Taxon
+command.label.13 = Synonym
+command.label.14 = Misapplication
+command.label.15 = Delete
+command.label.16 = Delete All Empty Names
+command.label.17 = Swap Synonym With Accepted
+command.label.18 = Show Details
+command.label.19 = Save
+command.label.20 = New Node
+command.label.21 = Delete
+command.label.22 = Apply Layout
+command.label.23 = New Key Number
+command.label.24 = New Alternative
+command.label.25 = Refresh Nodes
+command.label.26 = Delete
+command.label.27 = New Factual Data
+menu.label.1 = New
+command.label.28 = Move Description to Taxon
+command.label.29 = Move Elements to Taxon
+command.label.30 = Delete
+command.label.31 = Save
+menu.label.2 = New Derivate
+command.label.32 = New Use
+command.label.33 = New Use Summary
+command.label.34 = New Use Record
+command.label.35 = Delete
+command.label.36 = Save
+command.label.37 = New Image Gallery
+command.label.38 = New Image
+command.label.39 = Move Image Up In List
+command.label.40 = Move Image Down In List
+command.label.41 = Delete
+command.label.42 = Save
+menu.label.3 = New
+command.label.43 = Open Related Concept
+command.label.44 = Delete
+command.label.45 = Edit Authorities
+extension.name = Name Commands
+category.name.0 = -- Name Editor
+command.name = Open Parent
+command.name.0 = Create Homotypic Synonym
+command.name.1 = Create Heterotypic Synonym
+command.name.2 = Create Synonym In Homotypical Group
+command.name.3 = Change To Synonym
+command.name.4 = Change To Accepted Taxon
+command.name.5 = Change To Misapplication
+command.name.6 = Swap Synonym With Accepted
+command.name.7 = Set Basionym / Original Combination
+command.name.8 = Remove Basionym / Original Combination
+command.name.9 = Delete All Empty Names
+category.name.1 = -- Factual
+command.name.10 = Create Description Element
+command.name.11 = New Description
+command.name.12 = Move Description Elements to Taxon
+command.name.13 = Move Description to Taxon
+category.name.2 = -- New Uses
+command.name.14 = New Use
+command.name.15 = New Use Summary
+command.name.16 = New Use Record
+category.name.3 = -- Media
+command.name.19 = Move Image Down In List
+command.name.20 = New Image Gallery
+command.name.21 = New Image
+command.name.22 = Move Image Up In List
+category.name.4 = -- New Entity
+command.name.23 = New Reference
+command.name.24 = New Name
+command.name.25 = New Team
+command.name.26 = New Person
+command.name.27 = New Specimen
+category.name.5 = -- Polytomous Keys
+command.name.28 = New Child Node
+command.name.29 = New Sibling Node
+command.name.30 = Refresh Node Numbering
+command.name.31 = Apply Layout
+category.name.6 = -- Concept Relations
+command.name.32 = Create Concept Relation
+command.name.33 = Open Related Concept
+category.name.7 = -- Group
+command.name.34 = Edit CDM Authorities
+command.name.35 = Open Derivate View
+scheme.description = The default key binding scheme for the Taxonomic Editor
+scheme.name = Taxonomic Editor Default Key Bindingseditor.name.6 = Specimen Import Editor
+editor.name.7 = Gbif Import Editor
+editor.name.8 = Checklist Editor
+view.name.4 = Specimen Import
+view.name.5 = GBIF Specimen Import
+command.label.46 = Name
+command.label.47 = Reference
+command.label.48 = Datasource
+command.label.49 = Misapplication
+command.label.50 = Use Existing Image
+command.name.36 = Create Misapplication
+command.name.37 = Use Existing Image
+command.name.38 = Open Checklist Editor
+command.name.39 = New Datasource
+wizard.name = Specimen Search/Import
+wizard.description = Queries data provider for specimens with specified parameters.\nNote: Query results are currently limited to 100.
+command.name.40 = Validation
+view.name.6 = Validation
+marker.field.0 = Object Type
+marker.field.1 = Object
+marker.field.2 = Attribute
+marker.field.3 = Problematic Value
+marker.field.4 = Problem description
+marker.field.5 = Validator
+marker.field.6 = Entity Class
+marker.field.7 = Entity Id
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.molecular/build.properties b/eu.etaxonomy.taxeditor.molecular/build.properties
new file mode 100644 (file)
index 0000000..bdd1c23
--- /dev/null
@@ -0,0 +1,6 @@
+bin.includes = .,\
+                          META-INF/,\
+               plugin.xml,\
+               icons/,\
+               OSGI-INF/
+source.. = src/main/java/
diff --git a/eu.etaxonomy.taxeditor.molecular/icons/insert-16x16.png b/eu.etaxonomy.taxeditor.molecular/icons/insert-16x16.png
new file mode 100644 (file)
index 0000000..6c9bce7
Binary files /dev/null and b/eu.etaxonomy.taxeditor.molecular/icons/insert-16x16.png differ
diff --git a/eu.etaxonomy.taxeditor.molecular/icons/overwrite-16x16.png b/eu.etaxonomy.taxeditor.molecular/icons/overwrite-16x16.png
new file mode 100644 (file)
index 0000000..d2aa9e2
Binary files /dev/null and b/eu.etaxonomy.taxeditor.molecular/icons/overwrite-16x16.png differ
diff --git a/eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-left-16x16.png b/eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-left-16x16.png
new file mode 100644 (file)
index 0000000..d36e479
Binary files /dev/null and b/eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-left-16x16.png differ
diff --git a/eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-left-disabled-16x16.png b/eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-left-disabled-16x16.png
new file mode 100644 (file)
index 0000000..b7a23fa
Binary files /dev/null and b/eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-left-disabled-16x16.png differ
diff --git a/eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-right-16x16.png b/eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-right-16x16.png
new file mode 100644 (file)
index 0000000..4d10fb1
Binary files /dev/null and b/eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-right-16x16.png differ
diff --git a/eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-right-disabled-16x16.png b/eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-right-disabled-16x16.png
new file mode 100644 (file)
index 0000000..3f9fa7c
Binary files /dev/null and b/eu.etaxonomy.taxeditor.molecular/icons/pherogram-insert-right-disabled-16x16.png differ
diff --git a/eu.etaxonomy.taxeditor.molecular/plugin.xml b/eu.etaxonomy.taxeditor.molecular/plugin.xml
new file mode 100644 (file)
index 0000000..20e8aca
--- /dev/null
@@ -0,0 +1,309 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.editors">
+      <editor
+            class="eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor"
+            default="false"
+            id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor"
+            name="Alignment Editor">
+      </editor>
+   </extension>
+      <extension
+            point="org.eclipse.ui.views">
+         <view
+               allowMultiple="true"
+               class="eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart"
+               id="eu.etaxonomy.taxeditor.molecular.PherogramView"
+               name="PherogramView"
+               restorable="true">
+         </view>
+      </extension>
+      <extension
+            point="org.eclipse.ui.commands">
+         <command
+               defaultHandler="eu.etaxonomy.taxeditor.molecular.handler.EditSequenceHandler"
+               id="eu.etaxonomy.taxeditor.molecular.editSequence"
+               name="Edit Sequence">
+         </command>
+         <command
+               defaultHandler="eu.etaxonomy.taxeditor.molecular.handler.ShowPherogramHandler"
+               id="eu.etaxonomy.taxeditor.molecular.showPherogram"
+               name="Show Pherogram">
+         </command>
+         <command
+               id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramLeft"
+               name="Cut pherogram left">
+         </command>
+         <command
+               id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramRight"
+               name="Cut pherogram right">
+         </command>
+         <command
+               id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.reverseComplementRows"
+               name="Reverse complement selected rows">
+         </command>
+         <command
+               id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.createConsensus"
+               name="(Re)create consensus sequence">
+         </command>
+         <command
+               id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.updateConsensus"
+               name="Update consensus sequence">
+         </command>
+         <command
+               id="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowProbabilities"
+               name="Toggle show probability values">
+         </command>
+         <command
+               id="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowBaseCallLines"
+               name="Toggle show base call lines">
+         </command>
+         <command
+               id="eu.etaxonomy.taxeditor.molecular.pherogramComponent.changeQualityOutput"
+               name="Change quality output">
+         </command>
+         <command
+               id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.loadPherogram"
+               name="Load Pherogram">
+         </command>
+         <command
+               id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite"
+               name="Toggle insert/overwrite">
+         </command>
+         <command
+               id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion"
+               name="Toggle left/right insertion in base call sequence">
+         </command>
+      </extension>
+      <extension
+            point="org.eclipse.ui.menus">
+         <menuContribution
+               locationURI="toolbar:org.eclipse.ui.main.toolbar?after=eu.etaxonomy.taxeditor.navigation.search.toolbar">
+            <toolbar
+                  id="eu.etaxonomy.taxeditor.molecular.alignmentToolbar">
+               <command
+                     commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite"
+                     label="Toggle insert/overwrite"
+                     style="push">
+                  <visibleWhen
+                        checkEnabled="true">
+                     <with
+                           variable="activePartId">
+                        <equals
+                              value="eu.etaxonomy.taxeditor.molecular.AlignmentEditor">
+                        </equals>
+                     </with>
+                  </visibleWhen>
+               </command>
+               <command
+                     commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion"
+                     icon="icons/pherogram-insert-left-16x16.png"
+                     style="push">
+                  <visibleWhen
+                        checkEnabled="true">
+                     <with
+                           variable="activePartId">
+                        <equals
+                              value="eu.etaxonomy.taxeditor.molecular.AlignmentEditor">
+                        </equals>
+                     </with>
+                  </visibleWhen>
+               </command>
+            </toolbar>
+         </menuContribution>
+         <menuContribution
+               allPopups="false"
+               locationURI="menu:org.eclipse.ui.main.menu">
+            <menu
+                  label="Alignment Editor">
+               <command
+                     commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.loadPherogram"
+                     style="push">
+               </command>
+               <command
+                     commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramLeft"
+                     id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramLeft"
+                     name="Cut pherogram left">
+               </command>
+               <command
+                     commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramRight"
+                     id="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramRight"
+                     style="push">
+               </command>
+               <command
+                     commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.reverseComplementRows"
+                     mnemonic="r"
+                     style="push">
+               </command>
+               <command
+                     commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.createConsensus"
+                     style="push">
+               </command>
+               <command
+                     commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.updateConsensus"
+                     style="push">
+               </command>
+               <visibleWhen
+                     checkEnabled="true">
+                  <with
+                        variable="activePartId">
+                     <equals
+                           value="eu.etaxonomy.taxeditor.molecular.AlignmentEditor">
+                     </equals>
+                  </with>
+               </visibleWhen>
+            </menu>
+            <menu
+                  label="Pherogram View">
+               <command
+                     commandId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.changeQualityOutput"
+                     style="push">
+               </command>
+               <command
+                     commandId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowProbabilities"
+                     style="push">
+               </command>
+               <command
+                     commandId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowBaseCallLines"
+                     style="push">
+               </command>
+               <visibleWhen
+                     checkEnabled="true">
+                  <with
+                        variable="activePartId">
+                     <equals
+                           value="eu.etaxonomy.taxeditor.molecular.PherogramView">
+                     </equals>
+                  </with>
+               </visibleWhen>
+            </menu>
+         </menuContribution>
+         <menuContribution
+               locationURI="popup:eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView?before=eu.etaxonomy.taxeditor.editor.view.derivate.DerivateContextMenu">
+            <command
+                  commandId="eu.etaxonomy.taxeditor.molecular.editSequence"
+                  label="Edit Sequence"
+                  style="push">
+               <visibleWhen
+                     checkEnabled="true">
+                  <reference
+                        definitionId="isSequence">
+                  </reference>
+               </visibleWhen>
+            </command>
+            <command
+                  commandId="eu.etaxonomy.taxeditor.molecular.showPherogram"
+                  label="Show Pherogram"
+                  style="push">
+               <visibleWhen
+                     checkEnabled="true">
+                  <reference
+                        definitionId="isSingleRead">
+                  </reference>
+               </visibleWhen>
+            </command>
+         </menuContribution>
+      </extension>
+      <extension
+            point="org.eclipse.ui.handlers">
+         <handler
+               class="eu.etaxonomy.taxeditor.molecular.handler.LoadPherogramHandler"
+               commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.loadPherogram">
+            <activeWhen>
+               <with
+                     variable="activePartId">
+                  <equals
+                        value="eu.etaxonomy.taxeditor.molecular.AlignmentEditor">
+                  </equals>
+               </with>
+            </activeWhen>
+         </handler>
+         <handler
+               class="eu.etaxonomy.taxeditor.molecular.handler.ToggleInsertOverwriteHandler"
+               commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite">
+         </handler>
+         <handler
+               class="eu.etaxonomy.taxeditor.molecular.handler.ToggleLeftRightInsertionHandler"
+               commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion">
+         </handler>
+         <handler
+               class="eu.etaxonomy.taxeditor.molecular.handler.CutPherogramLeftHandler"
+               commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramLeft">
+         </handler>
+         <handler
+               class="eu.etaxonomy.taxeditor.molecular.handler.CutPherogramRightHandler"
+               commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.cutPherogramRight">
+         </handler>
+         <handler
+               class="eu.etaxonomy.taxeditor.molecular.handler.ReverseComplementHandler"
+               commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.reverseComplementRows">
+         </handler>
+         <handler
+               class="eu.etaxonomy.taxeditor.molecular.handler.CreateConsensusSequenceHandler"
+               commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.createConsensus">
+         </handler>
+         <handler
+               class="eu.etaxonomy.taxeditor.molecular.handler.UpdateConsensusSequenceHandler"
+               commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.updateConsensus">
+         </handler>
+         <handler
+               class="eu.etaxonomy.taxeditor.molecular.handler.ToggleShowPherogramProbabilitiesHandler"
+               commandId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowProbabilities">
+         </handler>
+         <handler
+               class="eu.etaxonomy.taxeditor.molecular.handler.ToggleShowPherogramBaseCallLinesHandler"
+               commandId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.toggleShowBaseCallLines">
+         </handler>
+         <handler
+               class="eu.etaxonomy.taxeditor.molecular.handler.ChangePherogramQualityOutputType"
+               commandId="eu.etaxonomy.taxeditor.molecular.pherogramComponent.changeQualityOutput">
+         </handler>
+      </extension>
+      <extension
+            point="org.eclipse.core.expressions.definitions">
+         <definition
+               id="isSequence">
+            <with
+                  variable="selection">
+               <test
+                     property="eu.etaxonomy.taxeditor.molecular.SpecimenPropertyTester.isSequence">
+               </test>
+            </with>
+         </definition>
+         <definition
+               id="isSingleRead">
+            <with
+                  variable="selection">
+               <test
+                     property="eu.etaxonomy.taxeditor.molecular.SpecimenPropertyTester.isSingleRead">
+               </test>
+            </with>
+         </definition>
+      </extension>
+      <extension
+            point="org.eclipse.core.expressions.propertyTesters">
+         <propertyTester
+               class="eu.etaxonomy.taxeditor.molecular.handler.SpecimenPropertyTester"
+               id="eu.etaxonomy.taxeditor.molecular.SpecimenPropertyTester"
+               namespace="eu.etaxonomy.taxeditor.molecular.SpecimenPropertyTester"
+               properties="isSequence,isSingleRead"
+               type="org.eclipse.jface.viewers.IStructuredSelection">
+         </propertyTester>
+      </extension>
+      <extension
+            point="org.eclipse.ui.bindings">
+         <scheme
+               description="%scheme.description"
+               id="eu.etaxonomy.taxeditor.bindings.scheme.default"
+               name="%scheme.name">
+         </scheme>
+         <key
+               commandId="eu.etaxonomy.taxeditor.molecular.AlignmentEditor.loadPherogram"
+               schemeId="eu.etaxonomy.taxeditor.bindings.scheme.default"
+               sequence="M1+O">
+         </key>
+      </extension>
+      
+</plugin>
diff --git a/eu.etaxonomy.taxeditor.molecular/pom.xml b/eu.etaxonomy.taxeditor.molecular/pom.xml
new file mode 100644 (file)
index 0000000..1e91c23
--- /dev/null
@@ -0,0 +1,17 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <parent>
+    <groupId>eu.etaxonomy</groupId>
+    <artifactId>taxeditor-parent</artifactId>
+    <version>3.8.0-SNAPSHOT</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>eu.etaxonomy.taxeditor.molecular</artifactId>
+  <packaging>eclipse-plugin</packaging>
+
+  <name>Molecular Bundle</name>
+  <description>Provides editors, views and operations for handling molecular data and alignments</description>
+
+</project>
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/TaxeditorMolecularPlugin.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/TaxeditorMolecularPlugin.java
new file mode 100644 (file)
index 0000000..77818ed
--- /dev/null
@@ -0,0 +1,44 @@
+package eu.etaxonomy.taxeditor.molecular;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class TaxeditorMolecularPlugin extends AbstractUIPlugin {
+
+       // The plug-in ID
+       public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.molecular"; //$NON-NLS-1$
+
+       // The shared instance
+       private static TaxeditorMolecularPlugin plugin;
+
+       /**
+        * The constructor
+        */
+       public TaxeditorMolecularPlugin() {
+       }
+
+       @Override
+    public void start(BundleContext context) throws Exception {
+               super.start(context);
+               plugin = this;
+       }
+
+       @Override
+    public void stop(BundleContext context) throws Exception {
+               plugin = null;
+               super.stop(context);
+       }
+
+       /**
+        * Returns the shared instance
+        *
+        * @return the shared instance
+        */
+       public static TaxeditorMolecularPlugin getDefault() {
+               return plugin;
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java
new file mode 100644 (file)
index 0000000..315e92d
--- /dev/null
@@ -0,0 +1,721 @@
+// $Id$
+/**
+* Copyright (C) 2014 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.molecular.editor;
+
+
+import info.bioinfweb.libralign.alignmentarea.AlignmentArea;
+import info.bioinfweb.libralign.alignmentarea.selection.SelectionModel;
+import info.bioinfweb.libralign.alignmentarea.tokenpainter.NucleotideTokenPainter;
+import info.bioinfweb.libralign.dataarea.implementations.ConsensusSequenceArea;
+import info.bioinfweb.libralign.dataarea.implementations.SequenceIndexArea;
+import info.bioinfweb.libralign.dataarea.implementations.pherogram.PherogramArea;
+import info.bioinfweb.libralign.editsettings.EditSettingsChangeEvent;
+import info.bioinfweb.libralign.editsettings.EditSettingsListener;
+import info.bioinfweb.libralign.model.AlignmentModel;
+import info.bioinfweb.libralign.model.AlignmentModelChangeListener;
+import info.bioinfweb.libralign.model.AlignmentModelUtils;
+import info.bioinfweb.libralign.model.adapters.StringAdapter;
+import info.bioinfweb.libralign.model.events.SequenceChangeEvent;
+import info.bioinfweb.libralign.model.events.SequenceRenamedEvent;
+import info.bioinfweb.libralign.model.events.TokenChangeEvent;
+import info.bioinfweb.libralign.model.implementations.PackedAlignmentModel;
+import info.bioinfweb.libralign.model.tokenset.CharacterTokenSet;
+import info.bioinfweb.libralign.model.tokenset.TokenSet;
+import info.bioinfweb.libralign.multiplealignments.AlignmentAreaList;
+import info.bioinfweb.libralign.multiplealignments.MultipleAlignmentsContainer;
+import info.bioinfweb.libralign.pherogram.model.PherogramAreaModel;
+import info.bioinfweb.libralign.pherogram.model.ShiftChange;
+import info.bioinfweb.libralign.pherogram.provider.BioJavaPherogramProvider;
+import info.bioinfweb.libralign.pherogram.provider.PherogramProvider;
+import info.bioinfweb.libralign.pherogram.provider.ReverseComplementPherogramProvider;
+import info.bioinfweb.tic.SWTComponentFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.biojava.bio.chromatogram.ChromatogramFactory;
+import org.biojava.bio.chromatogram.UnsupportedChromatogramFormatException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.part.EditorPart;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
+import eu.etaxonomy.cdm.model.media.MediaUtils;
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SequenceString;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.cdm.model.molecular.SingleReadAlignment;
+import eu.etaxonomy.cdm.model.molecular.SingleReadAlignment.Shift;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.handler.ToggleInsertOverwriteHandler;
+import eu.etaxonomy.taxeditor.molecular.handler.ToggleLeftRightInsertionHandler;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
+
+
+
+/**
+ * Editor component to edit a contig alignment used to combine different overlapping pherograms from Sanger sequencing to
+ * a consensus sequence.
+ * <p>
+ * The contained GUI components used to edit the alignment come from <a href="http://bioinfweb.info/LibrAlign/">LibrAlign</a>.
+ *
+ * @author Ben Stöver
+ * @author pplitzner
+ * @date 04.08.2014
+ */
+public class AlignmentEditor extends EditorPart {
+    public static final String ID = "eu.etaxonomy.taxeditor.molecular.AlignmentEditor";
+
+       public static final int READS_AREA_INDEX = 1;
+    public static final int EDITABLE_CONSENSUS_AREA_INDEX = READS_AREA_INDEX + 1;
+    public static final int CONSENSUS_HINT_AREA_INDEX = EDITABLE_CONSENSUS_AREA_INDEX + 1;
+       public static final int PHEROGRAM_AREA_INDEX = 0;
+       public static final int CONSENSUS_DATA_AREA_INDEX = 0;
+       public static final String DEFAULT_READ_NAME_PREFIX = "Read ";
+       public static final String CONSENSUS_NAME = "Consensus";
+
+
+    private final ConversationHolder conversationHolder;
+
+       private final AlignmentModelChangeListener DIRTY_LISTENER = new AlignmentModelChangeListener() {
+                               @Override
+                               public <T> void afterTokenChange(TokenChangeEvent<T> e) {
+                                       setDirty();
+                               }
+
+                               @Override
+                               public <T> void afterSequenceRenamed(SequenceRenamedEvent<T> e) {
+                                       setDirty();
+                               }
+
+                               @Override
+                               public <T> void afterSequenceChange(SequenceChangeEvent<T> e) {
+                                       setDirty();
+                               }
+
+                               @Override
+                               public <T, U> void afterProviderChanged(AlignmentModel<T> oldProvider,
+                                               AlignmentModel<U> newProvider) {  // Not expected.
+
+                                       setDirty();
+                               }
+                       };
+
+    private MultipleAlignmentsContainer alignmentsContainer = null;
+    private final Map<Integer, SingleReadAlignment> cdmMap = new TreeMap<Integer, SingleReadAlignment>();  //TODO Move this to ContigSequenceDataProvider
+    private boolean dirty = false;
+
+
+    public AlignmentEditor() {
+       super();
+       conversationHolder = CdmStore.createConversation();
+       //conversationHolder = null;
+    }
+
+
+    private void refreshToolbarElement(String id) {
+               ICommandService commandService =
+                               (ICommandService)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(ICommandService.class);
+               if (commandService != null) {
+                       commandService.refreshElements(id, Collections.EMPTY_MAP);
+               }
+    }
+
+
+    private void registerEditSettingListener(MultipleAlignmentsContainer container) {
+       container.getEditSettings().addListener(new EditSettingsListener() {
+                                       @Override
+                                       public void workingModeChanged(EditSettingsChangeEvent e) {}  // Currently nothing to do
+
+                                       @Override
+                                       public void insertLeftInDataAreaChanged(EditSettingsChangeEvent e) {
+                                               updateStatusBar();
+                                       refreshToolbarElement(ToggleLeftRightInsertionHandler.COMMAND_ID);
+                                       }
+
+                                       @Override
+                                       public void insertChanged(EditSettingsChangeEvent e) {
+                                               updateStatusBar();
+                                       refreshToolbarElement(ToggleInsertOverwriteHandler.COMMAND_ID);
+                                       }
+                               });
+    }
+
+
+  private AlignmentArea createIndexArea(MultipleAlignmentsContainer container, AlignmentArea labeledArea) {
+               AlignmentArea result = new AlignmentArea(container);
+               result.setAllowVerticalScrolling(false);
+               result.getDataAreas().getTopAreas().add(new SequenceIndexArea(result.getContentArea(), labeledArea));
+               return result;
+  }
+
+
+  private AlignmentArea createEditableAlignmentArea(MultipleAlignmentsContainer container, boolean allowVerticalScrolling) {
+               AlignmentArea result = new AlignmentArea(container);
+               result.setAllowVerticalScrolling(allowVerticalScrolling);
+
+               CharacterTokenSet tokenSet = CharacterTokenSet.newDNAInstance();  //TODO Should NUCLEOTIDE be used instead?
+               AlignmentModel<Character> provider = new PackedAlignmentModel<Character>(tokenSet);
+               result.setAlignmentModel(provider, false);
+               provider.getChangeListeners().add(DIRTY_LISTENER);
+               result.getPaintSettings().getTokenPainterList().set(0, new NucleotideTokenPainter());
+
+               return result;
+       }
+
+
+    private AlignmentArea createConsensusHintArea(MultipleAlignmentsContainer container,
+               AlignmentArea labeledArea) {
+
+               AlignmentArea result = new AlignmentArea(container);
+               result.setAllowVerticalScrolling(false);
+               result.getDataAreas().getBottomAreas().add(
+                               new ConsensusSequenceArea(result.getContentArea(), labeledArea));
+               return result;
+         }
+
+
+    private MultipleAlignmentsContainer getAlignmentsContainer() {
+       if (alignmentsContainer == null) {
+               alignmentsContainer = new MultipleAlignmentsContainer();
+
+               AlignmentAreaList list = alignmentsContainer.getAlignmentAreas();
+               AlignmentArea readsArea = createEditableAlignmentArea(alignmentsContainer, true);
+           list.add(createIndexArea(alignmentsContainer, readsArea));
+               list.add(readsArea);  // Make sure READS_AREA_INDEX is correct.
+               list.add(createEditableAlignmentArea(alignmentsContainer, false));  // Make sure COMSENSUS_AREA_INDEX is correct.
+               list.add(createConsensusHintArea(alignmentsContainer, readsArea));
+
+               registerEditSettingListener(alignmentsContainer);
+               }
+               return alignmentsContainer;
+       }
+
+
+    public AlignmentArea getReadsArea() {
+       return getAlignmentsContainer().getAlignmentAreas().get(READS_AREA_INDEX);
+    }
+
+
+    private AlignmentArea getEditableConsensusArea() {
+       return getAlignmentsContainer().getAlignmentAreas().get(EDITABLE_CONSENSUS_AREA_INDEX);
+    }
+
+
+    public boolean hasPherogram(int sequenceID) {
+        return getReadsArea().getDataAreas().getSequenceAreas(sequenceID).size() > PHEROGRAM_AREA_INDEX;
+    }
+
+
+    public PherogramArea getPherogramArea(int sequenceID) {
+        if (hasPherogram(sequenceID)) {
+            return (PherogramArea)getReadsArea().getDataAreas().getSequenceAreas(sequenceID).get(PHEROGRAM_AREA_INDEX);
+        }
+        else {
+            return null;
+        }
+    }
+
+
+    private ConsensusSequenceArea getConsensusHintDataArea() {
+        return (ConsensusSequenceArea)getAlignmentsContainer().getAlignmentAreas().
+                get(CONSENSUS_HINT_AREA_INDEX).getDataAreas().getBottomAreas().
+                get(CONSENSUS_DATA_AREA_INDEX);
+    }
+
+
+    @Deprecated  //TODO Remove as soon as testing period is over
+    private void createTestContents() {
+               // Just for testing:
+               try {
+                       addRead(new File("D:/Users/BenStoever/ownCloud/Dokumente/Projekte/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/JR430_JR-P01.ab1").toURI(), false);
+            //addRead(new File("D:/Users/BenStoever/ownCloud/Dokumente/Projekte/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/JR444_JR-P05.ab1").toURI(), false);
+            addRead(new File("D:/Users/BenStoever/ownCloud/Dokumente/Projekte/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/Test_qualityScore.scf").toURI(), false);
+
+                       // Add test consensus sequence:
+                       AlignmentModel consensusModel = getEditableConsensusArea().getAlignmentModel();
+                       int id = consensusModel.addSequence(CONSENSUS_NAME);
+                       Collection<Object> tokens = new ArrayList<Object>();  // First save tokens in a collection to avoid GUI updated for each token.
+                       tokens.add(consensusModel.getTokenSet().tokenByRepresentation("A"));
+                       tokens.add(consensusModel.getTokenSet().tokenByRepresentation("C"));
+                       tokens.add(consensusModel.getTokenSet().tokenByRepresentation("G"));
+                       tokens.add(consensusModel.getTokenSet().tokenByRepresentation("T"));
+                       consensusModel.insertTokensAt(id, 0, tokens);
+               }
+               catch (Exception e) {
+                       throw new RuntimeException(e);
+               }
+    }
+
+
+    private void readCDMData(Sequence sequenceNode) {
+       //TODO If called from somewhere else than createPartControl() the editorInput needs to be checked and previous contents need to be cleared (or updated).
+
+               // Add reads:
+               for (SingleReadAlignment singleReadAlignment : sequenceNode.getSingleReadAlignments()) {
+                       try {
+                               SingleRead pherogramInfo = singleReadAlignment.getSingleRead();
+                               URI uri = null;
+                               if (pherogramInfo.getPherogram() != null) {
+                                   uri = MediaUtils.getFirstMediaRepresentationPart(pherogramInfo.getPherogram()).getUri();
+                               }
+                               int id = addRead(DerivateLabelProvider.getDerivateText(pherogramInfo, conversationHolder),
+                                               uri,
+                                               singleReadAlignment.isReverseComplement(),
+                                               singleReadAlignment.getEditedSequence(),
+                                               singleReadAlignment.getFirstSeqPosition(),
+                                               singleReadAlignment.getLeftCutPosition(),
+                                               singleReadAlignment.getRightCutPosition(),
+                                               singleReadAlignment.getShifts());
+                               cdmMap.put(id, singleReadAlignment);
+                       }
+                       catch (Exception e) {  // Usually due to an error while trying to read the pherogram (e.g. due to an unsupported format or an invalid URI).
+                MessagingUtils.errorDialog("Error", null, "A single read was skipped because of the following error:\n\n" +
+                        e.getLocalizedMessage(), TaxeditorMolecularPlugin.PLUGIN_ID, e, false);
+                       }
+               }
+
+               // Set consensus sequence:
+               AlignmentModel consensusProvider = getEditableConsensusArea().getAlignmentModel();
+               int id = consensusProvider.addSequence(CONSENSUS_NAME);
+               consensusProvider.insertTokensAt(id, 0, AlignmentModelUtils.charSequenceToTokenList(
+                               sequenceNode.getConsensusSequence().getString(), consensusProvider.getTokenSet()));
+               //TODO Can the consensus sequence also be null? / Should it be created here, if nothing is in the DB?
+    }
+
+
+       /* (non-Javadoc)
+     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+     */
+    @Override
+    public void createPartControl(Composite parent) {
+               SWTComponentFactory.getInstance().getSWTComponent(getAlignmentsContainer(), parent, SWT.NONE);
+               updateStatusBar();
+
+               if (getEditorInput() instanceof AlignmentEditorInput) {
+                       if (((AlignmentEditorInput)getEditorInput()).getSequenceNodeUuid() != null) {
+                           Sequence sequenceNode = CdmStore.getService(ISequenceService.class).load(((AlignmentEditorInput)getEditorInput()).getSequenceNodeUuid());
+                       //re-load into the current session if it is already persisted in the DB
+                       if(sequenceNode!=null && sequenceNode.getId()!=0){
+                           sequenceNode = CdmStore.getService(ISequenceService.class).load(sequenceNode.getUuid());
+                       }
+                               readCDMData(sequenceNode);
+                       }
+                       else {
+                               createTestContents();  // This case will removed after the test phase and an exception should probably be thrown.
+                       }
+               }
+               else {
+                       throw new IllegalArgumentException("The editor input must have the type " +
+                                       AlignmentEditorInput.class.getCanonicalName());  //TODO What should be done here?
+               }
+       }
+
+
+    private void updateStatusBar() {
+        IActionBars bars = getEditorSite().getActionBars();
+        bars.getStatusLineManager().setMessage("Edit mode: " +
+                       (getReadsArea().getEditSettings().isInsert() ? "Insert" : "Overwrite") + "  " +
+                       "Insertion in pherogram: " +
+                       (getReadsArea().getEditSettings().isInsertLeftInDataArea() ? "Left" : "Right"));
+    }
+
+
+    private SingleReadAlignment.Shift[] convertToCDMShifts(PherogramAreaModel model) {
+       Iterator<ShiftChange> iterator = model.shiftChangeIterator();
+       List<Shift> shifts = new ArrayList<SingleReadAlignment.Shift>();
+       while (iterator.hasNext()) {
+               ShiftChange shiftChange = iterator.next();
+               shifts.add(new SingleReadAlignment.Shift(shiftChange.getBaseCallIndex(), shiftChange.getShiftChange()));
+       }
+       return shifts.toArray(new Shift[]{});
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
+     */
+    @Override
+    public void doSave(IProgressMonitor monitor) {
+       if (getEditorInput() instanceof AlignmentEditorInput) {
+               String taskName = "Saving alignment";
+            monitor.beginTask(taskName, 3);
+
+            //re-loading sequence to avoid session conflicts
+               Sequence sequenceNode = CdmStore.getService(ISequenceService.class).load(((AlignmentEditorInput)getEditorInput()).getSequenceNodeUuid());
+               StringAdapter stringProvider = new StringAdapter(getEditableConsensusArea().getAlignmentModel(), false);  // Throws an exception if a token has more than one character.
+
+               // Write consensus sequence:
+               SequenceString consensusSequenceObj = sequenceNode.getConsensusSequence();
+               String newConsensusSequence = stringProvider.getSequence(
+                               getEditableConsensusArea().getAlignmentModel().sequenceIDByName(CONSENSUS_NAME));
+               if (consensusSequenceObj == null) {
+                       sequenceNode.setConsensusSequence(SequenceString.NewInstance(newConsensusSequence));
+               }
+               else {
+                       consensusSequenceObj.setString(newConsensusSequence);
+               }
+
+               // Write single reads:
+               stringProvider.setUnderlyingProvider(getReadsArea().getAlignmentModel());
+               sequenceNode.getSingleReadAlignments().retainAll(cdmMap.values());  // Remove all reads that are not in the alignment anymore.
+               Iterator<Integer> iterator = getReadsArea().getAlignmentModel().sequenceIDIterator();
+               while (iterator.hasNext()) {
+                       int id = iterator.next();
+                       SingleReadAlignment singleRead = cdmMap.get(id);
+                       if (singleRead == null) {
+                           throw new InternalError("Creating new reads from AlignmentEditor not implemented.");
+                               //TODO Create new read object. => Shall it be allowed to add reads in the alignment editor which are not represented in the CDM tree before the alignment editor is saved?
+                               //singleRead = SingleReadAlignment.NewInstance(consensusSequence, singleRead, shifts, editedSequence);
+                       }
+
+                       singleRead.setEditedSequence(stringProvider.getSequence(id));
+
+                       PherogramArea pherogramArea = getPherogramArea(id);
+                       if (pherogramArea != null) {
+                               PherogramAreaModel model = pherogramArea.getModel();
+                               singleRead.setReverseComplement(model.getPherogramProvider() instanceof ReverseComplementPherogramProvider);  // Works only if ReverseComplementPherogramProvider instances are not nested.
+                               singleRead.setShifts(convertToCDMShifts(getPherogramArea(id).getModel()));
+                               singleRead.setFirstSeqPosition(model.getFirstSeqPos());
+                               singleRead.setLeftCutPosition(model.getLeftCutPosition());
+                               singleRead.setRightCutPosition(model.getRightCutPosition());
+                       }
+               }
+
+               if (!conversationHolder.isBound()) {
+                conversationHolder.bind();
+            }
+            monitor.worked(1);
+
+            // Commit the conversation and start a new transaction immediately:
+            conversationHolder.commit(true);
+            monitor.worked(1);
+
+            dirty = false;
+            monitor.worked(1);
+            monitor.done();
+            firePropertyChange(PROP_DIRTY);
+       }
+       else {
+               //TODO Throw exception as soon as testing period which allows unlinked AlignmentEditor is over.
+       }
+    }
+
+
+    /* (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);
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.EditorPart#isDirty()
+     */
+    @Override
+    public boolean isDirty() {
+        return dirty;
+    }
+
+
+    private void setDirty() {
+       dirty = true;
+       firePropertyChange(IEditorPart.PROP_DIRTY);
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
+     */
+    @Override
+    public boolean isSaveAsAllowed() {
+        return false;  // "Save as" not allowed.
+    }
+
+
+    @Override
+    public void setFocus() {
+        if(conversationHolder!=null){
+            conversationHolder.bind();
+        }
+    }
+
+
+    public boolean isInsertMode() {
+        return getAlignmentsContainer().getEditSettings().isInsert();
+    }
+
+
+    public boolean isInsertLeftInPherogram() {
+        return getAlignmentsContainer().getEditSettings().isInsertLeftInDataArea();
+    }
+
+
+    public void toggleLeftRightInsertionInPherogram() {
+       getAlignmentsContainer().getEditSettings().toggleInsertLeftInDataArea();
+    }
+
+
+    public void toggleInsertOverwrite() {
+       getAlignmentsContainer().getEditSettings().toggleInsert();
+    }
+
+
+    private String cutPherogram(boolean left) {
+        SelectionModel selection = getReadsArea().getSelection();
+        if (selection.getCursorHeight() != 1) {
+            return "Cutting pherograms is only possible if exactly one row is selected.";
+        }
+        else {
+            PherogramArea pherogramArea =
+                    getPherogramArea(getReadsArea().getSequenceOrder().idByIndex(selection.getCursorRow()));
+            if (pherogramArea == null) {
+                return "There is no pherogram attached to the current sequence.";
+            }
+            else {
+                if (left) {
+                    if (pherogramArea.setLeftCutPositionBySelection()) {
+                        return null;
+                    }
+                    else {
+                        return "The left end of the selection lies outside the pherogram attached to this sequence.";
+                    }
+                }
+                else {
+                    if (pherogramArea.setRightCutPositionBySelection()) {
+                        return null;
+                    }
+                    else {
+                        return "The right end of the selection lies outside the pherogram attached to this sequence.";
+                    }
+                }
+            }
+        }
+    }
+
+
+    public String cutPherogramLeft() {
+        return cutPherogram(true);
+    }
+
+
+    public String cutPherogramRight() {
+        return cutPherogram(false);
+    }
+
+
+    public void reverseComplementSelectedSequences() {
+       SelectionModel selection = getReadsArea().getSelection();
+       AlignmentModel<?> model = getReadsArea().getAlignmentModel();
+       for (int row = selection.getFirstRow(); row < selection.getFirstRow() + selection.getCursorHeight(); row++) {
+                       int sequenceID = getReadsArea().getSequenceOrder().idByIndex(row);
+                       PherogramArea area = getPherogramArea(sequenceID);
+                       PherogramAreaModel pherogramAlignmentModel = area.getModel();
+                       AlignmentModelUtils.reverseComplement(model, sequenceID,
+                               pherogramAlignmentModel.editableIndexByBaseCallIndex(
+                                       pherogramAlignmentModel.getLeftCutPosition()).getBeforeValidIndex(),
+                               pherogramAlignmentModel.editableIndexByBaseCallIndex(
+                                       pherogramAlignmentModel.getRightCutPosition()).getAfterValidIndex());
+                       pherogramAlignmentModel.reverseComplement();
+               }
+    }
+
+
+    /**
+     * Recreates the whole consensus sequence from all single read sequences. The previous consensus
+     * sequence is overwritte.
+     */
+    @SuppressWarnings("unchecked")
+    public <T> void createConsensusSequence() {
+        ConsensusSequenceArea area = getConsensusHintDataArea();
+        AlignmentModel<T> model = (AlignmentModel<T>)getEditableConsensusArea().getAlignmentModel();
+        int sequenceID = model.sequenceIDIterator().next();  // There is always one sequence contained.
+        int length = getReadsArea().getAlignmentModel().getMaxSequenceLength();
+
+        Collection<T> tokens = new ArrayList<T>(length);
+        for (int column = 0; column < length; column++) {
+            tokens.add(model.getTokenSet().tokenByRepresentation(area.getConsensusToken(column)));
+        }
+
+        model.removeTokensAt(sequenceID, 0, model.getSequenceLength(sequenceID));
+        model.insertTokensAt(sequenceID, 0, tokens);
+    }
+
+
+    /**
+     * Updates the current consensus sequence by replacing gaps by the according consensus tokens
+     * calculated from the single read sequences and extends the consensus sequence if necessary.
+     */
+    @SuppressWarnings("unchecked")
+    public <T> void updateConsensusSequence() {
+        ConsensusSequenceArea area = getConsensusHintDataArea();
+        AlignmentModel<T> model = (AlignmentModel<T>)getEditableConsensusArea().getAlignmentModel();
+        TokenSet<T> tokenSet = model.getTokenSet();
+        int sequenceID = model.sequenceIDIterator().next();  // There is always one sequence contained.
+        int currentConsensusLength = model.getSequenceLength(sequenceID);
+        int overallLength = getReadsArea().getAlignmentModel().getMaxSequenceLength();
+
+        // Replace gaps by new information:
+        for (int column = 0; column < currentConsensusLength; column++) {
+            if (tokenSet.isGapToken(model.getTokenAt(sequenceID, column))) {
+                T newToken = tokenSet.tokenByRepresentation(area.getConsensusToken(column));
+                if (!tokenSet.isGapToken(newToken)) {
+                    model.setTokenAt(sequenceID, column, newToken);
+                }
+            }
+        }
+
+        // Append additional tokens:
+        if (overallLength > currentConsensusLength) {
+            Collection<T> tokens = new ArrayList<T>(overallLength);
+            for (int column = currentConsensusLength; column < overallLength; column++) {
+                tokens.add(tokenSet.tokenByRepresentation(area.getConsensusToken(column)));
+            }
+            model.appendTokens(sequenceID, tokens);
+        }
+    }
+
+
+       public static PherogramProvider readPherogram(URI uri) throws IOException, UnsupportedChromatogramFormatException {
+           PherogramProvider result;
+               InputStream stream = uri.toURL().openStream();
+               try {
+                       result = new BioJavaPherogramProvider(ChromatogramFactory.create(stream));
+               }
+               finally {
+                       stream.close();
+               }
+               return result;
+       }
+
+
+       private String newReadName() {
+               int index = 1;
+               while (getReadsArea().getAlignmentModel().sequenceIDByName(DEFAULT_READ_NAME_PREFIX + index)
+                               != AlignmentModel.NO_SEQUENCE_FOUND) {
+
+                       index++;
+               }
+               return DEFAULT_READ_NAME_PREFIX + index;
+       }
+
+
+    public void addRead(URI pherogramURI, boolean reverseComplemented) throws IOException, UnsupportedChromatogramFormatException {
+       addRead(newReadName(), pherogramURI, reverseComplemented, null, null, null, null, null);
+    }
+
+
+    /**
+     * Adds a new sequence with attached phergram data area to the reads alignment.
+     * <p>
+     * If {@code null} is specified as {@code editedSequence} the base call sequence from the pherogram will
+     * be set as the edited sequence. If {@code null} is specified as {@code shifts} no shifts between the edited
+     * and the base calls sequence are assumed.
+     *
+     * @param name the name of the new sequence
+     * @param pherogramURI the URI where the associated pherogram file is located
+     * @param reverseComplemented Specify {@code true} here, if the reverse complement of the pherogram data should
+     *        be added, {@code false} otherwise.
+     * @param editedSequence the edited version of the base call sequence (May be {@code null}.)
+     * @param shifts the alignment information that links the edited and the base call sequence (May be {@code null}.)
+     * @return the sequence ID of the added read
+     * @throws IOException if an error occurred when trying to read the pherogram file
+     * @throws UnsupportedChromatogramFormatException if the format of the pherogram file is not supported
+     */
+    public int addRead(String name, URI pherogramURI, boolean reverseComplemented, String editedSequence,
+            Integer firstSeqPos, Integer leftCutPos, Integer rightCutPos, SingleReadAlignment.Shift[] shifts)
+            throws IOException, UnsupportedChromatogramFormatException {
+
+               AlignmentModel provider = getReadsArea().getAlignmentModel();
+               PherogramProvider pherogramProvider = null;
+               if (pherogramURI != null) {
+                   pherogramProvider = readPherogram(pherogramURI);  // Must happen before a sequence is added, because it might throw an exception.
+            if (reverseComplemented) {
+                pherogramProvider = new ReverseComplementPherogramProvider(pherogramProvider);
+            }
+               }
+
+        // Create sequence:
+               provider.addSequence(name);
+               int id = provider.sequenceIDByName(name);
+
+               // Set edited sequence:
+               Collection<Object> tokens = null;  // First save tokens in a collection to avoid GUI updated for each token.
+               if (editedSequence != null) {
+                       tokens = AlignmentModelUtils.charSequenceToTokenList(editedSequence, provider.getTokenSet());
+               }
+               else if (pherogramProvider != null) {  // Copy base call sequence into alignment:
+                       tokens = new ArrayList<Object>();
+                       for (int i = 0; i < pherogramProvider.getSequenceLength(); i++) {
+                               tokens.add(provider.getTokenSet().tokenByRepresentation(
+                                       Character.toString(pherogramProvider.getBaseCall(i))));
+                       }
+                       setDirty();
+               }
+
+               if (tokens != null) {  // If either an edited sequence or a pherogram URI was provided.
+                   provider.insertTokensAt(id, 0, tokens);
+               // Create pherogram area:
+               PherogramArea pherogramArea = new PherogramArea(getReadsArea().getContentArea(),
+                       new PherogramAreaModel(pherogramProvider));
+
+               // Set position properties and shifts:
+               PherogramAreaModel model = pherogramArea.getModel();
+               if ((firstSeqPos != null) && (leftCutPos != null)) {
+                   model.setFirstSeqLeftCutPos(firstSeqPos, leftCutPos);
+               }
+               if (rightCutPos != null) {
+                   model.setRightCutPosition(rightCutPos);
+               }
+               if ((shifts != null) && (shifts.length > 0)) {
+                   for (int i = 0; i < shifts.length; i++) {
+                       model.addShiftChange(shifts[i].position, shifts[i].shift);
+                   }
+                   setDirty();
+               }
+
+               // Add pherogram area to GUI:
+               pherogramArea.addMouseListener(new PherogramMouseListener(pherogramArea));
+               getReadsArea().getDataAreas().getSequenceAreas(id).add(pherogramArea);
+               }
+
+               return id;
+       }
+}
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditorInput.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditorInput.java
new file mode 100644 (file)
index 0000000..b823625
--- /dev/null
@@ -0,0 +1,138 @@
+// $Id$
+/**
+* Copyright (C) 2014 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.molecular.editor;
+
+
+import java.util.UUID;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+
+
+/**
+ * @author pplitzner
+ * @author Ben Stöver
+ * @date 04.08.2014
+ */
+public class AlignmentEditorInput implements IEditorInput {
+    private static final String name = "AlignmentEditor";
+
+
+    private final UUID sequenceNodeUuid;
+
+
+    public AlignmentEditorInput(UUID sequenceNodeUuid) {
+               super();
+               this.sequenceNodeUuid = sequenceNodeUuid;
+       }
+
+
+       /* (non-Javadoc)
+     * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+     */
+    @Override
+    public Object getAdapter(Class adapter) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IEditorInput#exists()
+     */
+    @Override
+    public boolean exists() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
+     */
+    @Override
+    public ImageDescriptor getImageDescriptor() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IEditorInput#getName()
+     */
+    @Override
+    public String getName() {
+        return name;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IEditorInput#getPersistable()
+     */
+    @Override
+    public IPersistableElement getPersistable() {
+        return null;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IEditorInput#getToolTipText()
+     */
+    @Override
+    public String getToolTipText() {
+        return name;
+    }
+
+
+       /**
+        * Returns the {@link UUID} of the sequence CDM node that should be edited by the {@link AlignmentEditor} this object
+        * is used with.
+        *
+        * @return the uuid of the CDM node to work on
+        */
+       public UUID getSequenceNodeUuid() {
+               return sequenceNodeUuid;
+       }
+
+
+       @Override
+       public int hashCode() {
+               final int prime = 31;
+               int result = 1;
+               result = prime * result
+                               + ((sequenceNodeUuid == null) ? 0 : sequenceNodeUuid.hashCode());
+               return result;
+       }
+
+
+       @Override
+       public boolean equals(Object obj) {
+               if (this == obj) {
+            return true;
+        }
+               if (obj == null) {
+            return false;
+        }
+               if (getClass() != obj.getClass()) {
+            return false;
+        }
+               AlignmentEditorInput other = (AlignmentEditorInput) obj;
+               if (sequenceNodeUuid == null) {
+                       if (other.sequenceNodeUuid != null) {
+                return false;
+            }
+               } else if (!sequenceNodeUuid.equals(other.sequenceNodeUuid)) {
+            return false;
+        }
+               return true;
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramMouseListener.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramMouseListener.java
new file mode 100644 (file)
index 0000000..71e2c9a
--- /dev/null
@@ -0,0 +1,56 @@
+/**
+* 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.molecular.editor;
+
+
+import info.bioinfweb.libralign.dataarea.implementations.pherogram.PherogramArea;
+import info.bioinfweb.tic.input.TICMouseAdapter;
+import info.bioinfweb.tic.input.TICMouseEvent;
+
+import org.eclipse.ui.PartInitException;
+
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.handler.ShowPherogramHandler;
+
+
+
+/**
+ * Listens to mouse events on data areas displaying a pherogram in {@link AlignmentEditor}.
+ *
+ * @author Ben Stöver
+ * @date 25.11.2014
+ */
+public class PherogramMouseListener extends TICMouseAdapter {
+       private final PherogramArea area;
+
+
+       public PherogramMouseListener(PherogramArea area) {
+               super();
+               this.area = area;
+       }
+
+
+       @Override
+       public boolean mousePressed(TICMouseEvent event) {
+               if (event.getClickCount() == 2) {  // Double click
+                       try {
+                           ShowPherogramHandler.showPherogram(area.getModel());
+                       }
+                       catch (PartInitException e) {
+                MessagingUtils.errorDialog("Unable to create pherogram view", null, e.getLocalizedMessage(),
+                        TaxeditorMolecularPlugin.PLUGIN_ID,  e, false);  //TODO set pluginID
+                       }
+            return true;
+               }
+               else {
+                   return false;
+               }
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramViewPart.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramViewPart.java
new file mode 100644 (file)
index 0000000..40c0470
--- /dev/null
@@ -0,0 +1,68 @@
+/**
+* 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.molecular.editor;
+
+
+import info.bioinfweb.libralign.pherogram.PherogramFormats.QualityOutputType;
+import info.bioinfweb.libralign.pherogram.model.PherogramComponentModel;
+import info.bioinfweb.libralign.pherogram.view.PherogramView;
+import info.bioinfweb.tic.SWTComponentFactory;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+
+
+/**
+ * Component that allows to view a pherogram without the distortion due to aligning it to a sequence as in
+ * {@link AlignmentEditor}.
+ *
+ * @author Ben Stöver
+ * @date Nov 20, 2014
+ */
+public class PherogramViewPart extends ViewPart {
+    public static final String ID = "eu.etaxonomy.taxeditor.molecular.PherogramView";
+
+    private PherogramView pherogramView = null;
+
+
+    public static PherogramViewPart createView(PherogramComponentModel model) throws PartInitException {
+        PherogramViewPart view = (PherogramViewPart)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ID);
+        view.getPherogramView().getTraceCurveView().setModel(model);
+        view.getPherogramView().assignSize();
+        return view;
+    }
+
+
+       public PherogramView getPherogramView() {
+               if (pherogramView == null) {
+                       pherogramView = new PherogramView();
+                       pherogramView.getTraceCurveView().getFormats().setShowProbabilityValues(true);
+                       pherogramView.getTraceCurveView().setHorizontalScale(1);
+                       pherogramView.getTraceCurveView().setVerticalScale(100);
+                       pherogramView.getTraceCurveView().getFormats().setQualityOutputType(QualityOutputType.NONE);  //TODO Make this user defined
+                       pherogramView.getTraceCurveView().getFormats().setShowProbabilityValues(false);
+               }
+               return pherogramView;
+       }
+
+
+       @Override
+       public void createPartControl(Composite parent) {
+               SWTComponentFactory.getInstance().getSWTComponent(getPherogramView(), parent, SWT.NONE);
+               getPherogramView().assignSize();
+       }
+
+
+       @Override
+       public void setFocus() {}  // nothing to do
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractAlignmentEditorHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractAlignmentEditorHandler.java
new file mode 100644 (file)
index 0000000..0c8a6ed
--- /dev/null
@@ -0,0 +1,43 @@
+// $Id$
+/**
+* Copyright (C) 2015 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.molecular.handler;
+
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IEditorPart;
+
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+
+
+
+
+/**
+ * Abstract implementation for all handlers triggering actions in an active instance of
+ * {@link AlignmentEditor}.
+ *
+ * @author Ben Stöver
+ * @date 19.06.2015
+ */
+public abstract class AbstractAlignmentEditorHandler extends AbstractHandler {
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+        if (activeEditor instanceof AlignmentEditor) {
+            doExecute(event, (AlignmentEditor)activeEditor);
+        }
+        return null;
+    }
+
+
+    public abstract void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException;
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractPherogramComponentHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractPherogramComponentHandler.java
new file mode 100644 (file)
index 0000000..55c24e3
--- /dev/null
@@ -0,0 +1,60 @@
+// $Id$
+/**
+* Copyright (C) 2015 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.molecular.handler;
+
+
+import info.bioinfweb.libralign.alignmentarea.AlignmentArea;
+import info.bioinfweb.libralign.dataarea.implementations.pherogram.PherogramArea;
+import info.bioinfweb.libralign.pherogram.PherogramComponent;
+
+import java.util.Iterator;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IWorkbenchPart;
+
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart;
+
+
+
+/**
+ * Abstract handler implementation allows to performs the concrete operation either on an instance of
+ * {@link PherogramViewPart} or all {@link AlignmentArea}s inside an instance of {@link AlignmentEditor}.
+ *
+ * @author Ben Stöver
+ * @date 23.06.2015
+ */
+public abstract class AbstractPherogramComponentHandler extends AbstractHandler {
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        IWorkbenchPart activePart = AbstractUtility.getActivePart();
+
+        if (activePart instanceof AlignmentEditor) {
+            AlignmentEditor editor = (AlignmentEditor)activePart;
+            Iterator<Integer> idIterator = editor.getReadsArea().getAlignmentModel().sequenceIDIterator();
+            while (idIterator.hasNext()) {
+                PherogramArea area = editor.getPherogramArea(idIterator.next());
+                if (area != null) {
+                    doExecute(event, area);
+                }
+            }
+        }
+        else if (activePart instanceof PherogramViewPart) {
+            doExecute(event, ((PherogramViewPart)activePart).getPherogramView().getTraceCurveView());
+        }
+        return null;
+    }
+
+
+    public abstract void doExecute(ExecutionEvent event, PherogramComponent component) throws ExecutionException;
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ChangePherogramQualityOutputType.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ChangePherogramQualityOutputType.java
new file mode 100644 (file)
index 0000000..a5fba94
--- /dev/null
@@ -0,0 +1,31 @@
+// $Id$
+/**
+* Copyright (C) 2015 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.molecular.handler;
+
+
+import info.bioinfweb.libralign.pherogram.PherogramComponent;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+
+
+/**
+ * Switches between the quality output types available for components displaying pherograms.
+ *
+ * @author Ben Stöver
+ * @date 19.06.2015
+ */
+public class ChangePherogramQualityOutputType extends AbstractPherogramComponentHandler {
+    @Override
+    public void doExecute(ExecutionEvent event, PherogramComponent component) throws ExecutionException {
+        component.getFormats().changeQualityOutputType();
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CreateConsensusSequenceHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CreateConsensusSequenceHandler.java
new file mode 100644 (file)
index 0000000..a95de50
--- /dev/null
@@ -0,0 +1,34 @@
+/**
+* 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.molecular.handler;
+
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+
+
+
+
+/**
+ * Handler that creates the consensus sequence from all single read sequences in the active instance
+ * of {@link AlignmentEditor}. A previously present consensus sequence will be overwritten.
+ *
+ * @author Ben Stöver
+ * @date 19.06.2015
+ * @see UpdateConsensusSequenceHandler
+ * @see AlignmentEditor#createConsensusSequence()
+ */
+public class CreateConsensusSequenceHandler extends AbstractAlignmentEditorHandler {
+    @Override
+    public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {
+        editor.createConsensusSequence();
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramLeftHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramLeftHandler.java
new file mode 100644 (file)
index 0000000..955dbae
--- /dev/null
@@ -0,0 +1,37 @@
+// $Id$
+/**
+* Copyright (C) 2015 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.molecular.handler;
+
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+
+
+
+/**
+ * Handler that cuts the base call sequence of a pherogram attached to the current sequence on the left
+ * of the current selection or cursor position.
+ *
+ * @author Ben Stöver
+ * @date 15.06.2015
+ */
+public class CutPherogramLeftHandler extends AbstractAlignmentEditorHandler {
+    @Override
+    public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {
+        String errorMessage = editor.cutPherogramLeft();
+        if (errorMessage != null) {
+            MessagingUtils.errorDialog("Unable to cut base call sequence", this, errorMessage, TaxeditorMolecularPlugin.PLUGIN_ID, null, false);
+        }
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramRightHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramRightHandler.java
new file mode 100644 (file)
index 0000000..dd8bc90
--- /dev/null
@@ -0,0 +1,37 @@
+// $Id$
+/**
+* Copyright (C) 2015 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.molecular.handler;
+
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+
+
+
+/**
+ * Handler that cuts the base call sequence of a pherogram attached to the current sequence on the right
+ * of the current selection or cursor position.
+ *
+ * @author BenStoever
+ * @date 15.06.2015
+ */
+public class CutPherogramRightHandler extends AbstractAlignmentEditorHandler {
+    @Override
+    public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {
+        String errorMessage = editor.cutPherogramRight();
+        if (errorMessage != null) {
+            MessagingUtils.errorDialog("Unable to cut base call sequence", this, errorMessage, TaxeditorMolecularPlugin.PLUGIN_ID, null, false);
+        }
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/EditSequenceHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/EditSequenceHandler.java
new file mode 100644 (file)
index 0000000..69597f1
--- /dev/null
@@ -0,0 +1,46 @@
+package eu.etaxonomy.taxeditor.molecular.handler;
+
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditorInput;
+
+
+
+/**
+ * Opens the alignment editor from the CDM tree.
+ *
+ * @author Ben St&ouml;ver
+ * @author pplitzner
+ */
+public class EditSequenceHandler extends AbstractHandler {
+
+    org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(EditSequenceHandler.class);
+
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
+        TreeNode treeNodeOfSelection = EditorUtil.getTreeNodeOfSelection(currentSelection);
+        if(treeNodeOfSelection != null && treeNodeOfSelection.getValue() instanceof Sequence){
+            AlignmentEditorInput input = new AlignmentEditorInput(((Sequence)treeNodeOfSelection.getValue()).getUuid());  //TODO Should there always be a new instance created here? What if the specified CDM node is already opened in an AlignmentEditor? => Possible create Singleton that keeps instances by sequence objects in a map.
+            try {
+                TaxeditorMolecularPlugin.getDefault().getWorkbench()
+                .getActiveWorkbenchWindow().getActivePage().openEditor(input, AlignmentEditor.ID);
+            }
+            catch (PartInitException e) {
+                logger.error("Could not open AlignmentEditor", e);
+            }
+        }
+        return null;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/HandlerTools.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/HandlerTools.java
new file mode 100644 (file)
index 0000000..11d92e6
--- /dev/null
@@ -0,0 +1,40 @@
+// $Id$
+/**
+* Copyright (C) 2015 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.molecular.handler;
+
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+
+
+
+/**
+ * Implements shared functionality for handler implementations using tool bar icons.
+ *
+ * @author Ben Stöver
+ * @date 15.06.2015
+ */
+public class HandlerTools {  //TODO Move this class or method somewhere else?
+    public static ImageDescriptor createImageDescriptor(String iconName) {
+        URL url = FileLocator.find(TaxeditorMolecularPlugin.getDefault().getBundle(),
+                new Path("icons/" + iconName), null);
+        if (url != null) {
+            return ImageDescriptor.createFromURL(url);
+        }
+        else {
+            throw new InternalError("Icon \"" + iconName + "\" could not be loaded.");  //TODO Throw other type of exception?
+        }
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/LoadPherogramHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/LoadPherogramHandler.java
new file mode 100644 (file)
index 0000000..97e1b97
--- /dev/null
@@ -0,0 +1,70 @@
+/**
+* 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.molecular.handler;
+
+
+import java.io.File;
+import java.io.IOException;
+
+import org.biojava.bio.chromatogram.UnsupportedChromatogramFormatException;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.ui.IEditorPart;
+
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+
+
+
+/**
+ * Handler that loads an additional read into the contig alignment displayed by an instance of {@link AlignmentEditor}.
+ *
+ * @author Ben Stöver
+ * @author pplitzner
+ */
+public class LoadPherogramHandler extends AbstractHandler {
+       //TODO Change so that also URIs which do not point to files can be specified.
+
+       /* (non-Javadoc)
+     * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+     */
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+        if (activeEditor instanceof AlignmentEditor) {
+            AlignmentEditor alignmentEditor = (AlignmentEditor)activeEditor;
+
+            FileDialog fileDialog = new FileDialog(alignmentEditor.getSite().getShell());
+            fileDialog.setText("Import pherogram into contig alignment");
+            fileDialog.setFilterNames(new String[]{"All supported formats", "AB1 pherogram files", "SCF pherogram files", "All files"});
+            fileDialog.setFilterExtensions(new String[]{"*.ab1;*.scf", "*.ab1", "*.scf", "*.*"});
+
+            String path = fileDialog.open();
+            if (path != null) {
+               try {
+                       alignmentEditor.addRead(new File(path).toURI(), false);
+               }
+               catch (UnsupportedChromatogramFormatException e) {
+                    MessagingUtils.errorDialog("Unsupported format", this, "The format of the pherogram file \"" + path +
+                               "\" is not supported. (Only AB1 and SCF are supported.)", TaxeditorMolecularPlugin.PLUGIN_ID, e, false);  //TODO set pluginID
+               }
+               catch (IOException e) {
+                    MessagingUtils.errorDialog("Unsupported format", this,
+                               "An IO error occurred while trying to read the file \"" + path + "\".",
+                               TaxeditorMolecularPlugin.PLUGIN_ID, e, false);  //TODO set pluginID
+               }
+            }
+        }
+        return null;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ReverseComplementHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ReverseComplementHandler.java
new file mode 100644 (file)
index 0000000..99e7388
--- /dev/null
@@ -0,0 +1,31 @@
+/**
+* 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.molecular.handler;
+
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+
+
+
+
+/**
+ * Reverse complements the single read sequence in an active {@link AlignmentEditor}, where the alignment cursor
+ * is currently located.
+ *
+ * @author Ben Stöver
+ */
+public class ReverseComplementHandler extends AbstractAlignmentEditorHandler {
+    @Override
+    public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {
+        editor.reverseComplementSelectedSequences();
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ShowPherogramHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ShowPherogramHandler.java
new file mode 100644 (file)
index 0000000..f4c6580
--- /dev/null
@@ -0,0 +1,66 @@
+package eu.etaxonomy.taxeditor.molecular.handler;
+
+
+import info.bioinfweb.libralign.pherogram.model.PherogramComponentModel;
+
+import java.net.URI;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.cdm.model.media.MediaUtils;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart;
+
+
+
+/**
+ * Displays an undistorted pherogram with {@link PherogramViewPart}.
+ *
+ * @author Ben Stöver
+ *
+ */
+public class ShowPherogramHandler extends AbstractHandler {
+       public static void showPherogram(PherogramComponentModel model) throws PartInitException {
+               PherogramViewPart.createView(model);
+       }
+
+
+       @Override
+       public Object execute(ExecutionEvent event) throws ExecutionException {
+               ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
+               TreeNode treeNodeOfSelection = EditorUtil.getTreeNodeOfSelection(currentSelection);
+               if (treeNodeOfSelection != null && treeNodeOfSelection.getValue() instanceof SingleRead) {
+                   //TODO Can the parent node (containing the cut positions) be extracted from SingleRead?
+                       try {
+                           SingleRead singleRead = (SingleRead)treeNodeOfSelection.getValue();
+                           URI uri = null;
+                           if (singleRead.getPherogram() != null) {  // Pherogram objects without URI are possible.
+                               uri = MediaUtils.getFirstMediaRepresentationPart(singleRead.getPherogram()).getUri();
+                           }
+
+                           if (uri == null) {
+                       MessagingUtils.messageDialog("No pherogram available", this,
+                               "The selected read does not have an associated pherogram.");
+                           }
+                           else {
+                     showPherogram(new PherogramComponentModel(AlignmentEditor.readPherogram(uri)));
+                           }
+                       }
+               catch (Exception e) {
+                   MessagingUtils.errorDialog("Error", null, e.getLocalizedMessage(), TaxeditorMolecularPlugin.PLUGIN_ID,
+                           e, false);
+               }
+        }
+        return null;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/SpecimenPropertyTester.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/SpecimenPropertyTester.java
new file mode 100644 (file)
index 0000000..0a59a70
--- /dev/null
@@ -0,0 +1,58 @@
+package eu.etaxonomy.taxeditor.molecular.handler;
+
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeNode;
+
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+
+
+
+/**
+ * Tests types of specimens to add items to the context menu.
+ *
+ * @author pplitzner
+ * @author BenStoever
+ */
+public class SpecimenPropertyTester extends PropertyTester {
+    private static final String SEQUENCE = "isSequence";
+    private static final String SINGLE_READ = "isSingleRead";
+
+
+    public SpecimenPropertyTester() {}
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+     */
+    /** {@inheritDoc} */
+    @Override
+    public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+        if (receiver instanceof IStructuredSelection) {
+            IStructuredSelection selection = (IStructuredSelection) receiver;
+            TreeNode treeNodeOfSelection = EditorUtil.getTreeNodeOfSelection(selection);
+            if (treeNodeOfSelection!=null) {
+                if (SEQUENCE.equals(property)) {
+                    return isSequence(treeNodeOfSelection.getValue());
+                }
+                else if (SINGLE_READ.equals(property)) {
+                       return isSingleReadAlignment(treeNodeOfSelection.getValue());
+                }
+            }
+        }
+        return false;
+    }
+
+
+       private boolean isSequence(Object object) {
+       return (object instanceof Sequence);
+       }
+
+
+       private boolean isSingleReadAlignment(Object object) {
+       return (object instanceof SingleRead);
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleInsertOverwriteHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleInsertOverwriteHandler.java
new file mode 100644 (file)
index 0000000..e94a290
--- /dev/null
@@ -0,0 +1,68 @@
+/**
+* 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.molecular.handler;
+
+
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.commands.IElementUpdater;
+import org.eclipse.ui.menus.UIElement;
+
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+
+
+
+/**
+ * Switches an {@link AlignmentEditor} between insertion and overwrite mode.
+ *
+ * @author Ben Stöver
+ * @date 04.12.2014
+ */
+public class ToggleInsertOverwriteHandler extends AbstractAlignmentEditorHandler implements IElementUpdater {
+       public static final String COMMAND_ID =
+                       "eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleInsertOverwrite";
+
+
+    private final ImageDescriptor INSERT_DESCRIPTOR = HandlerTools.createImageDescriptor("insert-16x16.png");
+    private final ImageDescriptor OVERWRITE_DESCRIPTOR = HandlerTools.createImageDescriptor("overwrite-16x16.png");
+
+
+    @Override
+    public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {
+        editor.toggleInsertOverwrite();
+    }
+
+
+       @Override
+       public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
+        IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+               if (activeEditor instanceof AlignmentEditor) {
+                       if (((AlignmentEditor)activeEditor).isInsertMode()) {
+                           element.setIcon(INSERT_DESCRIPTOR);
+                               element.setText("INS");
+                               element.setTooltip("Click to switch to overwrite mode");
+                       }
+                       else {
+                element.setIcon(OVERWRITE_DESCRIPTOR);
+                               element.setText("OVR");
+                               element.setTooltip("Click to switch to insertion mode");
+                       }
+            ((ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class)).refreshElements(
+                    ToggleLeftRightInsertionHandler.COMMAND_ID, null);
+               }
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleLeftRightInsertionHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleLeftRightInsertionHandler.java
new file mode 100644 (file)
index 0000000..291e72c
--- /dev/null
@@ -0,0 +1,72 @@
+/**
+ * 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.molecular.handler;
+
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.commands.IElementUpdater;
+import org.eclipse.ui.menus.UIElement;
+
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+
+
+
+/**
+ * Switches an {@link AlignmentEditor} between insertion in the base sequence to
+ * the left or to the right.
+ *
+ * @author Ben Stöver
+ * @date 04.12.2014
+ */
+public class ToggleLeftRightInsertionHandler extends AbstractAlignmentEditorHandler implements IElementUpdater {
+    public static final String COMMAND_ID = "eu.etaxonomy.taxeditor.molecular.AlignmentEditor.toggleLeftRightInsertion";
+
+
+    private final ImageDescriptor INSERT_LEFT_DESCRIPTOR =
+            HandlerTools.createImageDescriptor("pherogram-insert-left-16x16.png");
+    private final ImageDescriptor INSERT_RIGHT_DESCRIPTOR =
+            HandlerTools.createImageDescriptor("pherogram-insert-right-16x16.png");
+    private final ImageDescriptor INSERT_LEFT_DISABLED_DESCRIPTOR =
+            HandlerTools.createImageDescriptor("pherogram-insert-left-disabled-16x16.png");
+    private final ImageDescriptor INSERT_RIGHT_DISABLED_DESCRIPTOR =
+            HandlerTools.createImageDescriptor("pherogram-insert-right-disabled-16x16.png");
+
+
+    @Override
+    public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {
+        editor.toggleLeftRightInsertionInPherogram();
+    }
+
+
+    @Override
+    public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
+        IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+        if (activeEditor instanceof AlignmentEditor) {
+            setBaseEnabled(((AlignmentEditor)activeEditor).isInsertMode());
+            if (((AlignmentEditor)activeEditor).isInsertLeftInPherogram()) {
+                element.setIcon(INSERT_LEFT_DESCRIPTOR);
+                element.setDisabledIcon(INSERT_LEFT_DISABLED_DESCRIPTOR);
+                element.setText("Left");
+                element.setTooltip("Switch to insert pherogram distorsions right of future edits.");
+            }
+            else {
+                element.setIcon(INSERT_RIGHT_DESCRIPTOR);
+                element.setDisabledIcon(INSERT_RIGHT_DISABLED_DESCRIPTOR);
+                element.setText("Right");
+                element.setTooltip("Switch to insert pherogram distorsions left of future edits.");
+            }
+        }
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleShowPherogramBaseCallLinesHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleShowPherogramBaseCallLinesHandler.java
new file mode 100644 (file)
index 0000000..c8663eb
--- /dev/null
@@ -0,0 +1,30 @@
+// $Id$
+/**
+* Copyright (C) 2015 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.molecular.handler;
+
+
+import info.bioinfweb.libralign.pherogram.PherogramComponent;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+
+
+/**
+ * @author BenStoever
+ * @date 23.06.2015
+ *
+ */
+public class ToggleShowPherogramBaseCallLinesHandler extends AbstractPherogramComponentHandler {
+    @Override
+    public void doExecute(ExecutionEvent event, PherogramComponent component) throws ExecutionException {
+        component.getFormats().toggleShowBaseCallLines();
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleShowPherogramProbabilitiesHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleShowPherogramProbabilitiesHandler.java
new file mode 100644 (file)
index 0000000..50d45d6
--- /dev/null
@@ -0,0 +1,36 @@
+// $Id$
+/**
+* Copyright (C) 2015 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.molecular.handler;
+
+
+import info.bioinfweb.libralign.pherogram.PherogramComponent;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart;
+
+
+
+
+/**
+ * Toggles whether probability values (substitution, overcall and undercall) should be displayed
+ * in pherogram areas of {@link AlignmentEditor} or {@link PherogramViewPart}.
+ *
+ * @author Ben Stöver
+ * @date 23.06.2015
+ */
+public class ToggleShowPherogramProbabilitiesHandler extends AbstractPherogramComponentHandler {
+    @Override
+    public void doExecute(ExecutionEvent event, PherogramComponent component) throws ExecutionException {
+        component.getFormats().toggleShowProbabilityValues();
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/UpdateConsensusSequenceHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/UpdateConsensusSequenceHandler.java
new file mode 100644 (file)
index 0000000..50cc1b1
--- /dev/null
@@ -0,0 +1,25 @@
+/**
+* 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.molecular.handler;
+
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+
+
+
+
+public class UpdateConsensusSequenceHandler extends AbstractAlignmentEditorHandler {
+    @Override
+    public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {
+        editor.updateConsensusSequence();
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/package-info.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/package-info.java
new file mode 100644 (file)
index 0000000..64bc123
--- /dev/null
@@ -0,0 +1,17 @@
+// $Id$
+/**
+ * Copyright (C) 2015 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.
+ */
+/**
+ * Contains handlers that trigger actions in an active instance of
+ * {@link main.java.eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor}. Handlers opening
+ * an alignment editor or pherogram view are not contained in here.
+ *
+ * @author Ben Stöver
+ */
+package eu.etaxonomy.taxeditor.molecular.handler;
\ No newline at end of file
index e1c69d80461f332d00ad94cc01049dda471806ea..643d3aa8ee9c80c20746b016f9dcca61743ea83d 100644 (file)
@@ -266,6 +266,8 @@ public class PolytomousKeyViewPart extends ViewPart implements
         */
        @Override
        public boolean postOperation(CdmBase objectAffectedByOperation) {
+               getConversationHolder().bind();
+               getConversationHolder().commit(true);
                viewer.refresh();
                return true;
        }
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorContentService.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorContentService.java
new file mode 100644 (file)
index 0000000..46c659b
--- /dev/null
@@ -0,0 +1,30 @@
+package eu.etaxonomy.taxeditor.navigation.navigator;
+
+import org.eclipse.ui.internal.navigator.NavigatorContentService;
+import org.eclipse.ui.navigator.INavigatorDnDService;
+
+public class TaxonNavigatorContentService extends NavigatorContentService {
+
+       private TaxonNavigatorDnDService navigatorDnDService;
+
+       public TaxonNavigatorContentService(String viewerID) {
+               super(viewerID);
+               
+               
+       }
+       
+       public TaxonNavigatorContentService(String aViewerId,
+                       TaxonNavigatorViewer taxonNavigatorViewer) {
+               super(aViewerId, taxonNavigatorViewer);
+               getDnDService();
+       }
+
+       @Override
+       public TaxonNavigatorDnDService getDnDService() {
+               if (navigatorDnDService == null) {
+                       navigatorDnDService = new TaxonNavigatorDnDService(this);
+               }
+               return navigatorDnDService;
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorDnDService.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorDnDService.java
new file mode 100644 (file)
index 0000000..5de170c
--- /dev/null
@@ -0,0 +1,170 @@
+package eu.etaxonomy.taxeditor.navigation.navigator;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.ui.internal.navigator.dnd.CommonDropAdapterDescriptor;
+import org.eclipse.ui.internal.navigator.dnd.CommonDropDescriptorManager;
+import org.eclipse.ui.internal.navigator.extensions.CommonDragAssistantDescriptor;
+import org.eclipse.ui.internal.navigator.extensions.NavigatorViewerDescriptor;
+import org.eclipse.ui.navigator.CommonDragAdapterAssistant;
+import org.eclipse.ui.navigator.CommonDropAdapter;
+import org.eclipse.ui.navigator.CommonDropAdapterAssistant;
+import org.eclipse.ui.navigator.INavigatorContentService;
+import org.eclipse.ui.navigator.INavigatorDnDService;
+
+import eu.etaxonomy.taxeditor.navigation.navigator.dnd.TaxonNavigatorDragAdapterAssistant;
+
+public class TaxonNavigatorDnDService implements INavigatorDnDService {
+       private static final CommonDropAdapterAssistant[] NO_ASSISTANTS = new CommonDropAdapterAssistant[0];
+
+       private INavigatorContentService contentService;
+
+       private TaxonNavigatorDragAdapterAssistant[] dragAssistants;
+       
+       private TreeNodeDropAdapter dropAdapter;
+
+       private final Map dropAssistants = new HashMap();
+       
+       public TaxonNavigatorDnDService(INavigatorContentService contentService){
+               this.contentService = contentService;
+       }
+       
+       
+       @Override
+       public CommonDragAdapterAssistant[] getCommonDragAssistants() {
+               
+               return dragAssistants;
+       }
+
+       @Override
+       public void bindDragAssistant(CommonDragAdapterAssistant anAssistant) {
+               if(dragAssistants == null) 
+                       initializeDragAssistants(); 
+               TaxonNavigatorDragAdapterAssistant[] newDragAssistants = new TaxonNavigatorDragAdapterAssistant[dragAssistants.length + 1];
+               System.arraycopy(dragAssistants, 0, newDragAssistants, 0, dragAssistants.length);
+               newDragAssistants[dragAssistants.length] = (TaxonNavigatorDragAdapterAssistant) anAssistant;
+               dragAssistants = newDragAssistants;             
+
+       }
+       
+       private void initializeDragAssistants() {
+               int i = 0;
+               Set dragDescriptors = ((NavigatorViewerDescriptor) contentService
+                               .getViewerDescriptor()).getDragAssistants();
+               dragAssistants = new TaxonNavigatorDragAdapterAssistant[dragDescriptors
+                               .size()];
+               for (Iterator iter = dragDescriptors.iterator(); iter.hasNext();) {
+                       CommonDragAssistantDescriptor descriptor = (CommonDragAssistantDescriptor) iter
+                                       .next();
+                       dragAssistants[i++] = (TaxonNavigatorDragAdapterAssistant) descriptor.createDragAssistant();
+               }
+       }
+
+       @Override
+       public CommonDropAdapterAssistant[] findCommonDropAdapterAssistants(
+                       Object aDropTarget, TransferData aTransferType) {
+               CommonDropAdapterDescriptor[] descriptors = CommonDropDescriptorManager
+                               .getInstance().findCommonDropAdapterAssistants(aDropTarget,
+                                               contentService);
+
+               if (descriptors.length == 0) {
+                       return NO_ASSISTANTS;
+               }
+
+               if (LocalSelectionTransfer.getTransfer().isSupportedType(aTransferType)  
+                                               && LocalSelectionTransfer.getTransfer().getSelection() instanceof IStructuredSelection) {
+                       return getAssistantsBySelection(descriptors, (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection());
+               } 
+               return getAssistantsByTransferData(descriptors, aTransferType);
+       }
+       
+       private CommonDropAdapterAssistant[] getAssistantsByTransferData(
+                       CommonDropAdapterDescriptor[] descriptors,
+                       TransferData aTransferType) {
+
+               Set assistants = new LinkedHashSet();
+               for (int i = 0; i < descriptors.length; i++) {
+                       CommonDropAdapterAssistant asst = getAssistant(descriptors[i]);
+                       if (asst.isSupportedType(aTransferType)) {
+                               assistants.add(asst);
+                       }
+               }
+               return sortAssistants((CommonDropAdapterAssistant[]) assistants
+                               .toArray(new CommonDropAdapterAssistant[assistants.size()]));
+
+       }
+       
+       private CommonDropAdapterAssistant[] getAssistantsBySelection(
+                       CommonDropAdapterDescriptor[] descriptors, IStructuredSelection aSelection) {
+
+               Set assistants = new LinkedHashSet(); 
+                       
+               for (int i = 0; i < descriptors.length; i++) {
+                       if(descriptors[i].areDragElementsSupported(aSelection)) {
+                               assistants.add(getAssistant(descriptors[i]));
+                       }
+               }  
+
+               return sortAssistants((CommonDropAdapterAssistant[]) assistants
+                               .toArray(new CommonDropAdapterAssistant[assistants.size()]));
+       }
+       
+       private CommonDropAdapterAssistant getAssistant(
+                       CommonDropAdapterDescriptor descriptor) {
+               TreeNodeDropAdapterAssistant asst = (TreeNodeDropAdapterAssistant) dropAssistants
+                               .get(descriptor);
+               if (asst != null) {
+                       return asst;
+               }
+               synchronized (dropAssistants) {
+                       asst = (TreeNodeDropAdapterAssistant) dropAssistants.get(descriptor);
+                       if (asst == null) {
+                               dropAssistants.put(descriptor, (asst = (TreeNodeDropAdapterAssistant) descriptor
+                                               .createDropAssistant()));
+                               asst.init(contentService);
+                               //asst.setCommonDropAdapter(dropAdapter);
+                       }
+               }
+               return asst;
+       }
+
+
+       private CommonDropAdapterAssistant[] sortAssistants(CommonDropAdapterAssistant[] array) {
+               Arrays.sort(array, new Comparator() {
+                       public int compare(Object arg0, Object arg1) {
+                               CommonDropAdapterAssistant a = (CommonDropAdapterAssistant) arg0;
+                               CommonDropAdapterAssistant b = (CommonDropAdapterAssistant) arg1;
+                               // This is to ensure that the navigator resources drop assistant will
+                               // always be first on the list of drop assistant, if a conflict ever 
+                               // occurs.
+                               String id = "org.eclipse.ui.navigator.resources."; //$NON-NLS-1$
+                               if (a.getClass().getName().startsWith(id))
+                                       return -1;
+                               if (b.getClass().getName().startsWith(id))
+                                       return 1;
+                               return a.getClass().getName().compareTo(b.getClass().getName());
+                       }
+               });
+               return array;
+       }
+
+       @Override
+       public CommonDropAdapterAssistant[] findCommonDropAdapterAssistants(
+                       Object aDropTarget, IStructuredSelection theDragSelection) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       public void setDropAdaptor(TreeNodeDropAdapter da) {
+               dropAdapter = da;
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorViewer.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorViewer.java
new file mode 100644 (file)
index 0000000..8fdabb8
--- /dev/null
@@ -0,0 +1,54 @@
+package eu.etaxonomy.taxeditor.navigation.navigator;
+
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.internal.navigator.NavigatorContentService;
+import org.eclipse.ui.internal.navigator.dnd.NavigatorDnDService;
+import org.eclipse.ui.navigator.CommonDragAdapter;
+import org.eclipse.ui.navigator.CommonDropAdapter;
+import org.eclipse.ui.navigator.CommonViewer;
+import org.eclipse.ui.navigator.INavigatorContentService;
+
+import eu.etaxonomy.taxeditor.dnd.transfer.TaxonNodeTransfer;
+
+public class TaxonNavigatorViewer extends CommonViewer {
+
+       private NavigatorContentService contentService;
+       String viewerId;
+
+       public TaxonNavigatorViewer(String aViewerId, Composite aParent, int aStyle) {
+               super(aViewerId, aParent, aStyle);
+               contentService = new TaxonNavigatorContentService(aViewerId, this);
+               viewerId = aViewerId;
+       }
+
+       @Override
+       protected void initDragAndDrop() {
+
+               int operations =  DND.DROP_MOVE ;
+
+               CommonDragAdapter dragAdapter = createDragAdapter();
+               addDragSupport(operations, dragAdapter.getSupportedDragTransfers(),
+                               dragAdapter);
+               Transfer[] transfers = new Transfer[] { TaxonNodeTransfer.getInstance() };
+               TreeNodeDropAdapter dropAdapter = createTreeNodeDropAdapter();
+               addDropSupport(operations, transfers, dropAdapter);
+
+               TaxonNavigatorDnDService dnd = (TaxonNavigatorDnDService)getNavigatorContentService().getDnDService();
+               dnd.setDropAdaptor(dropAdapter);
+       }
+       
+       
+       protected TreeNodeDropAdapter createTreeNodeDropAdapter() {
+               return new TreeNodeDropAdapter(this);
+       }
+       
+       public NavigatorContentService getNavigatorContentService(){
+               if (contentService == null){
+                       contentService = new TaxonNavigatorContentService(viewerId);
+               } 
+               return contentService;
+       }
+       
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDragListener.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDragListener.java
new file mode 100644 (file)
index 0000000..9cd02f9
--- /dev/null
@@ -0,0 +1,83 @@
+// $Id$
+/**
+* Copyright (C) 2015 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.navigation.navigator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.dnd.DragSourceAdapter;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.ui.navigator.CommonViewer;
+
+
+import eu.etaxonomy.cdm.model.common.DefinedTermBase;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.dnd.transfer.TaxonNodeTransfer;
+import eu.etaxonomy.taxeditor.editor.definedterm.TermTransfer;
+
+/**
+ * @author k.luther
+ * @date 02.06.2015
+ *
+ */
+public class TreeNodeDragListener extends DragSourceAdapter {
+       private CommonViewer viewer;
+
+       /**
+        * 
+        */
+       public TreeNodeDragListener(CommonViewer viewer) {
+               this.viewer = viewer;
+       }
+
+       
+       public void setViewer(CommonViewer viewer){
+               this.viewer = viewer;
+       }
+       /* (non-Javadoc)
+        * @see org.eclipse.swt.dnd.DragSourceAdapter#dragStart(org.eclipse.swt.dnd.DragSourceEvent)
+        */
+       @Override
+       public void dragStart(DragSourceEvent event) {
+               
+               event.doit = true;// set to false if needed - default is true
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.swt.dnd.DragSourceAdapter#dragFinished(org.eclipse.swt.dnd.DragSourceEvent)
+        */
+       @Override
+       public void dragFinished(DragSourceEvent event) {
+               // TODO Auto-generated method stub
+               super.dragFinished(event);
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.swt.dnd.DragSourceAdapter#dragSetData(org.eclipse.swt.dnd.DragSourceEvent)
+        */
+       @Override
+       public void dragSetData(DragSourceEvent event) {
+               
+               IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+               List<ITaxonTreeNode> taxonNodes = new ArrayList<ITaxonTreeNode>();
+               
+               for (Object object : selection.toList()){
+                       taxonNodes.add((ITaxonTreeNode)object);
+                       }
+                       
+               if (TaxonNodeTransfer.getInstance().isSupportedType(
+                               event.dataType)) {
+                       event.data = taxonNodes.toArray(new TaxonNode[taxonNodes.size()]);
+               }
+       }
+}
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapter.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapter.java
new file mode 100644 (file)
index 0000000..448da05
--- /dev/null
@@ -0,0 +1,284 @@
+// $Id$
+/**
+* Copyright (C) 2015 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.navigation.navigator;
+
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.IconAndMessageDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerDropAdapter;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.navigator.CommonDropAdapter;
+import org.eclipse.ui.navigator.CommonDropAdapterAssistant;
+import org.eclipse.ui.navigator.CommonViewer;
+
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.OrderedTermBase;
+import eu.etaxonomy.cdm.model.common.TermBase;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
+import eu.etaxonomy.taxeditor.editor.definedterm.DefinedTermEditor;
+import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+import eu.etaxonomy.taxeditor.navigation.navigator.operation.MoveTaxonOperation;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * <p>TreeNodeDropAdapter class.</p>
+ *
+ * @author k.luther
+ * @date 02.06.2015
+ * @version 1.0
+ */
+public class TreeNodeDropAdapter extends ViewerDropAdapter implements IPostOperationEnabled {
+
+       /**
+        * @param viewer
+        */
+       protected TreeNodeDropAdapter(TaxonNavigatorViewer navigatorViewer) {
+               super(navigatorViewer);
+               this.navigatorViewer = navigatorViewer;
+               
+       }
+       
+       private final TaxonNavigatorViewer navigatorViewer;
+       private static final Logger logger = Logger.getLogger(TreeNodeDropAdapter.class);
+
+       /** Constant <code>ID="eu.etaxonomy.taxeditor.navigation.navig"{trunked}</code> */
+       public static final String ID = "eu.etaxonomy.taxeditor.navigation.navigator.dropassistant"; //$NON-NLS-1$
+
+       private static final EnumSet<CRUD> UPDATE = EnumSet.of(CRUD.UPDATE);
+       
+       
+       
+       /* (non-Javadoc)
+        * @see org.eclipse.ui.navigator.CommonDropAdapterAssistant#handleDrop(org.eclipse.ui.navigator.CommonDropAdapter, org.eclipse.swt.dnd.DropTargetEvent, java.lang.Object)
+        */
+       /** {@inheritDoc} */
+       @Override
+       public boolean performDrop(Object target) {
+
+               
+               if (target instanceof ITaxonTreeNode) {
+                       Set<TaxonNode> taxonNodes = getSelectedTaxa();
+                       ITaxonTreeNode targetTreeNode = (ITaxonTreeNode) target;
+                       if (targetTreeNode instanceof Classification){
+                               targetTreeNode = ((Classification)targetTreeNode).getRootNode();
+                               targetTreeNode = HibernateProxyHelper.deproxy(targetTreeNode, TaxonNode.class);
+                       }
+                       if(taxonNodes != null) {
+                               if (taxonNodes.size() == 1){
+                                       return moveTaxon(taxonNodes.iterator().next(), targetTreeNode);
+                               } else{
+                                       if( MessageDialog.openConfirm(null, "Moving taxon", "The operation move accepted taxon to other parent is available only for a single taxon.")){
+                                               return true;
+                                       }
+                               }
+            }
+               }
+               
+               return false;
+       }
+
+       private Set<TaxonNode> getSelectedTaxa(){
+               HashSet<TaxonNode> taxonNodes = new HashSet<TaxonNode>();
+
+               ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
+               if (selection instanceof TreeSelection) {
+
+                       Iterator selectionIterator = ((TreeSelection) selection).iterator();
+
+                       while (selectionIterator.hasNext()){
+                               Object object = selectionIterator.next();
+                               if(object instanceof TaxonNode){
+                                       TaxonNode taxonNode = (TaxonNode) object;
+                                       taxonNodes.add(taxonNode);
+                               }
+                       }
+               }
+               return taxonNodes.size() > 0 ? taxonNodes : null;
+       }
+
+       /* (non-Javadoc)
+        * @see org.eclipse.ui.navigator.CommonDropAdapter#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
+        */
+       /** {@inheritDoc} */
+       @Override
+       public boolean validateDrop(Object target, int operation,
+                       TransferData transferType) {
+               
+               if (target instanceof ITaxonTreeNode) {
+                       
+                   // check users permissions with target taxonnode and taxon
+                   if (target instanceof TaxonNode) {
+                       TaxonNode targetNode = (TaxonNode)target;
+                       Boolean hasTargetNodePermission = CdmStore.currentAuthentiationHasPermission(targetNode, UPDATE);
+                Boolean hasTargetTaxonPermission = CdmStore.currentAuthentiationHasPermission(targetNode.getTaxon(), UPDATE);
+
+                if(logger.isDebugEnabled()){
+                    logger.debug("target: " + targetNode.getTaxon().getTitleCache());
+                }
+
+                       if(!hasTargetNodePermission || ! hasTargetNodePermission){
+                           if(logger.isDebugEnabled()){
+                               logger.debug("CANCEL_STATUS for target node: " + hasTargetNodePermission.toString() + " " + hasTargetTaxonPermission.toString() + " ");
+                           }
+                           return false;
+                       }
+                   }
+
+                   // do not allow to drop onto itself and
+                   // check users permissions with all selected taxon nodes and taxa
+                   for(TaxonNode taxonNode : getSelectedTaxa()){
+                           logger.debug("selectedTaxa: " + taxonNode.getTaxon().getTitleCache());
+                               Boolean isSameTaxonNode = taxonNode.equals(target);
+                               Boolean hasTaxonNodePermission = CdmStore.currentAuthentiationHasPermission(taxonNode, UPDATE);
+                               Boolean hasTaxonPermission = CdmStore.currentAuthentiationHasPermission(taxonNode.getTaxon(), UPDATE);
+                if (
+                               isSameTaxonNode
+                               || !hasTaxonNodePermission
+                   || !hasTaxonPermission
+                       ) {
+                    if(logger.isDebugEnabled()){
+                        logger.debug("CANCEL_STATUS for selected  " + isSameTaxonNode.toString() + " " + hasTaxonNodePermission.toString() + " " + hasTaxonPermission.toString() + " ");
+                    }
+                                       return false;
+                               }
+                       }
+                       logger.debug("OK_STATUS");
+                       return true;
+               }
+               logger.debug("CANCEL_STATUS");
+               return false;
+       }
+
+
+       /**
+        * @param childTaxonNode
+        * @param parentTaxon
+        * @return
+        */
+       private boolean moveTaxon(TaxonNode taxonNode, ITaxonTreeNode targetITaxonTreeNode) {
+
+               TaxonNavigator taxonNavigator;
+               taxonNavigator = (TaxonNavigator) NavigationUtil.showView(TaxonNavigator.ID);
+
+               if(targetITaxonTreeNode instanceof TaxonNode){
+
+                       TaxonNode targetTaxonNode = (TaxonNode) targetITaxonTreeNode;
+               // Make sure parent taxon does not have unsaved changes
+                       if (NavigationUtil.isDirty(targetTaxonNode)){
+                               MessageDialog.openWarning(NavigationUtil.getShell(), "Unsaved Parent Taxon", "There are unsaved " +
+                               "changes in the parent taxon. Pleas save first.");
+                               return false;
+                       }
+
+               }
+               if (!PreferencesUtil.getSortNodesNaturally()){
+                       IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+                       if (workspaceUndoContext == null) {
+                               logger.error("Workspace undo context is null. DND operation cancelled");
+                               return false;
+                       }
+       
+                       AbstractPostOperation operation = new MoveTaxonOperation
+                                       ("Move Taxon", workspaceUndoContext, taxonNode, targetITaxonTreeNode, this, taxonNavigator, true);
+                       NavigationUtil.executeOperation(operation);
+                       
+                       logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
+                       return true;
+               }else{
+                       String[] buttonLables = {"Parent", "Predecessor", "Cancel"};
+                       MessageDialog dialog = new MessageDialog(null, "Target node", null, "Do you want to use the target node as parent or do you want to move the taxon below the target.", MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0);
+                       dialog.open();
+                       int returnCode = dialog.getReturnCode();
+                       if (returnCode == 0){
+                               IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+                               if (workspaceUndoContext == null) {
+                                       logger.error("Workspace undo context is null. DND operation cancelled");
+                                       return false;
+                               }
+               
+                               AbstractPostOperation operation = new MoveTaxonOperation
+                                               ("Move Taxon", workspaceUndoContext, taxonNode, targetITaxonTreeNode, this, taxonNavigator, true);
+                               NavigationUtil.executeOperation(operation);
+                               
+                               logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
+                               return true;
+                       }else if (returnCode == 1){
+                               IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+                               if (workspaceUndoContext == null) {
+                                       logger.error("Workspace undo context is null. DND operation cancelled");
+                                       return false;
+                               }
+               
+                               AbstractPostOperation operation = new MoveTaxonOperation
+                                               ("Move Taxon", workspaceUndoContext, taxonNode, targetITaxonTreeNode, this, taxonNavigator, false);
+                               NavigationUtil.executeOperation(operation);
+                               
+                               logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
+                               return true;
+                       } else{
+                               return false;
+                       }
+                       
+                       
+               }
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
+        */
+       /** {@inheritDoc} */
+       @Override
+    public boolean postOperation(CdmBase objectAffectedByOperation) {
+               return true;
+       }
+
+       /**
+        * <p>onComplete</p>
+        *
+        * @return a boolean.
+        */
+       @Override
+    public boolean onComplete() {
+               // TODO Auto-generated method stub
+               return false;
+       }
+       @Override
+       public void dragOver(DropTargetEvent event) {
+               super.dragOver(event);
+               event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_INSERT_AFTER;
+               
+       }
+       
+}
index 4a90ff4705fd1ddc87ff40dc18ca6d30c322ae79..2f71b0aee3c47b88adc98f395bd25d2a585693ca 100644 (file)
@@ -92,6 +92,7 @@ public class DeleteHandler extends AbstractHandler{
                                ITaxonTreeNode treeNode = treeNodes.iterator().next();
                                ITaxonTreeNode taxonNode =treeNode;
                                TaxonNodeDeletionConfigurator configNodes = new TaxonNodeDeletionConfigurator();
+                               //configNodes.setDeleteTaxon(false);
                                if (taxonNode instanceof Classification && taxonNode.hasChildNodes()){
                                        if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the classification? The tree has children, they will be deleted, too.")){
                                                return null;
@@ -127,9 +128,10 @@ public class DeleteHandler extends AbstractHandler{
 
                                                }
                                        }else{
-                                               if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(config, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the selected node?")){
+                                               if(!DeleteConfiguratorDialog.openConfirmWithConfigurator(configNodes, HandlerUtil.getActiveShell(event), "Confirm Deletion", "Do you really want to delete the selected node?")){
                                                        return null;
-                                               }
+                                               } 
+                                               config.setTaxonNodeConfig(configNodes);
                                        }
                                }
 
index eb36edac26f314ac4853c445ef28331754b62449..647addd10ccaea42b89725ac4b201456b51c25e5 100644 (file)
@@ -20,6 +20,7 @@ import org.eclipse.swt.widgets.Shell;
 import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
 import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
 import eu.etaxonomy.cdm.api.service.config.TaxonBaseDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
 
 /**
  * Abstract subclass of MessageDialog providing the functionality to configure
@@ -49,7 +50,10 @@ public class DeleteConfiguratorDialog extends MessageDialog{
         }
         else if(configurator instanceof SpecimenDeleteConfigurator){
             composite.addConfiguratorComposite(new DeleteSpecimenConfiguratorComposite((SpecimenDeleteConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
+        } else if(configurator instanceof TaxonNodeDeletionConfigurator){
+            composite.addConfiguratorComposite(new DeleteNodeConfiguratorComposite((TaxonNodeDeletionConfigurator) configurator, composite.getSectionConfigure(), SWT.NONE));
         }
+        
         return composite;
     }
 
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteNodeConfiguratorComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/deleteConfigurator/DeleteNodeConfiguratorComposite.java
new file mode 100644 (file)
index 0000000..4901526
--- /dev/null
@@ -0,0 +1,76 @@
+package eu.etaxonomy.taxeditor.ui.dialog.deleteConfigurator;
+/**
+* Copyright (C) 2015 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.
+*/
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.beans.PojoProperties;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.layout.RowLayout;
+
+import eu.etaxonomy.cdm.api.service.config.TaxonDeletionConfigurator;
+import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator;
+/**
+ * @author kluther
+ * @date Jul 13, 2015
+ *
+ */
+public class DeleteNodeConfiguratorComposite extends Composite {
+       // $Id$
+       
+       private final DataBindingContext m_bindingContext;
+
+       private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
+       private final TaxonNodeDeletionConfigurator configurator;
+       private final Button btnDeleteTaxon;
+
+
+           /**
+            * Create the composite.
+            * @param parent
+            * @param style
+            */
+           public DeleteNodeConfiguratorComposite(TaxonNodeDeletionConfigurator configurator, Composite parent, int style) {
+               super(parent, style);
+               this.configurator = configurator;
+               addDisposeListener(new DisposeListener() {
+                   @Override
+                   public void widgetDisposed(DisposeEvent e) {
+                       toolkit.dispose();
+                   }
+               });
+               toolkit.paintBordersFor(this);
+               setLayout(new RowLayout(SWT.VERTICAL));
+               setBackground(getBackground());
+
+               btnDeleteTaxon = new Button(this, SWT.CHECK);
+               btnDeleteTaxon.setText("Delete taxon if possible");
+            
+               m_bindingContext = initDataBindings();
+
+           }
+
+           protected DataBindingContext initDataBindings() {
+               DataBindingContext bindingContext = new DataBindingContext();
+               //
+               IObservableValue observeSelectionBtnDeleteTaxonObserveWidget = WidgetProperties.selection().observe(btnDeleteTaxon);
+               IObservableValue deleteTaxonIfPossibleConfiguratorObserveValue = PojoProperties.value("deleteTaxon").observe(configurator);
+               bindingContext.bindValue(observeSelectionBtnDeleteTaxonObserveWidget, deleteTaxonIfPossibleConfiguratorObserveValue, null, null);
+               //
+               return bindingContext;
+           }
+       }
+
+
index c76a96279b295e40e4cf90c1fb2ba1a7cacac40c..d82f7fe444204affe3e9a0ea78794442cec94cfc 100644 (file)
@@ -51,8 +51,11 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
        private ITaxonTreeNode parentTreeNode;
 
        private EntitySelectionElement<Taxon> selection_reuseExistingTaxon;
+       private EntitySelectionElement<Reference> selection_SecRef;
 
        private Taxon taxon;
+       
+       private Reference secReference;
 
        private TextWithLabelElement textNewTaxonName;
 
@@ -92,6 +95,9 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
                selection_parentTaxonNode = formFactory
                                .createTaxonNodeSelectionElement(getConversationHolder(), formElement, "Parent", null,
                                                EntitySelectionElement.DELETABLE, style);
+               selection_SecRef = formFactory
+                               .createSelectionElement(Reference.class,getConversationHolder(), formElement, "Secundum Reference", null,
+                                               EntitySelectionElement.DELETABLE, style);
                selection_reuseExistingTaxon = formFactory
                                .createSelectionElement(Taxon.class,
                                                getConversationHolder(), formElement,
@@ -150,12 +156,16 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
                        setClassification(selection_classification.getEntity());
                } else if (eventSource == selection_parentTaxonNode) {
                        setParentTreeNode(selection_parentTaxonNode.getEntity());
+               } else if (eventSource == selection_SecRef) {
+                       setSecReference(selection_SecRef.getEntity());
                } else if (eventSource == selection_reuseExistingTaxon) {
                        boolean enabled = selection_reuseExistingTaxon.getEntity() == null;
                        selection_reuseExistingName.setEnabled(enabled);
                        textNewTaxonName.setEnabled(enabled);
 
                        setTaxon(selection_reuseExistingTaxon.getEntity());
+                       complete = !textNewTaxonName.getText().isEmpty();
+                       
                } else if (eventSource == selection_reuseExistingName) {
                        boolean enabled = selection_reuseExistingName.getEntity() == null;
                        selection_reuseExistingTaxon.setEnabled(enabled);
@@ -234,9 +244,16 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
                        this.parentTreeNode = selection_classification.getEntity();
                }
        }
+       
+       private void setSecReference(Reference secRef){
+               this.secReference = secRef;
+               setTaxon(textNewTaxonName.getText());
+       }
 
        private void setTaxon(Taxon taxon) {
                this.taxon = taxon;
+               textNewTaxonName.setText(taxon.getName().getTitleCache());
+               
        }
 
        private void setTaxon(String taxonNameString) {
@@ -248,7 +265,9 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<ITaxonTreeN
        private void setTaxon(TaxonNameBase taxonName) {
                Reference secundum = null;
                if (getParentTreeNode() != null) {
-                       if (getParentTreeNode() instanceof Classification) {
+                       if (this.secReference != null){
+                               secundum = this.secReference;
+                       } else if (getParentTreeNode() instanceof Classification) {
                                secundum = ((Classification) getParentTreeNode())
                                                .getReference();
                        } else if (getParentTreeNode() instanceof TaxonNode) {
index be33fcb1029f0e39218ecb5e447a69c07e3fa686..3f4b2b5815296710cea7e4df5156f18ea3169554 100644 (file)
@@ -111,10 +111,10 @@ public class FeatureDistributionDetailElement extends AbstractCdmDetailElement<F
 
                String parameter = CdmStore.getGeoService().getDistributionServiceRequestParameterString(
                                getTaxonDescriptions(),
-                false, 
-                false, 
+                false,
+                false,
                 null,
-                presenceAbsenceTermColors, 
+                presenceAbsenceTermColors,
                 languages);
 
                String mapUriString = String.format("%s?%s&ms=1000&bbox=-180,-90,180,90&l=earth", accessPoint, parameter);
index b11a177a5c0b2dc1e137b3d51692c9012709bbf2..46c95c83d6c2a41313356e78855b29ded5eeaa1a 100644 (file)
@@ -64,13 +64,19 @@ public class PolytomousKeyNodeDetailElement extends
                element_statement = formFactory.createKeyStatementElement(formElement,
                                "State(ment)", entity.getStatement(), 50, style);
 
-               //if (entity.isLeaf()) {
+               if (entity.isLeaf()) {
                        selection_taxon = formFactory
                                        .createSelectionElement(Taxon.class,
                                                        getConversationHolder(), formElement, "Taxon",
                                                        entity.getTaxon(), EntitySelectionElement.NOTHING,
                                                        style);
-               //}
+               } else{
+                       selection_taxon = formFactory
+                                       .createSelectionElement(Taxon.class,
+                                                       getConversationHolder(), formElement, "Taxon",
+                                                       entity.getTaxon(), EntitySelectionElement.DELETABLE,
+                                                       style);
+               }
 
                selection_subkey = formFactory
                                .createSelectionElement(PolytomousKey.class,
diff --git a/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product.with.jre b/eu.etaxonomy.taxeditor/eu.etaxonomy.taxeditor.product.with.jre
new file mode 100644 (file)
index 0000000..7998db3
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?pde version="3.5"?>
+
+<product name="EDIT Taxonomic Editor" uid="eu.etaxonomy.taxeditor.product.jre" id="eu.etaxonomy.taxeditor.application.eu_etaxonomy_taxeditor_product" application="eu.etaxonomy.taxeditor.application.application" version="3.8.0.qualifier" useFeatures="true" includeLaunchers="true">
+
+   <aboutInfo>
+      <image path="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
+      <text>
+         %productBlurb
+      </text>
+   </aboutInfo>
+
+   <configIni use="default">
+   </configIni>
+
+   <launcherArgs>
+      <programArgs>-data @user.home/.cdmLibrary -Dserver_port=58080
+      </programArgs>
+      <programArgsLin>-vm jre/bin
+      </programArgsLin>
+      <programArgsMac>-vm ../../../jre/Contents/Home/jre/lib/jli/libjli.dylib
+      </programArgsMac>
+      <programArgsSol>-vm jre/bin
+      </programArgsSol>
+      <programArgsWin>-vm jre/bin
+      </programArgsWin>
+      <vmArgs>-Xmx512M -XX:MaxPermSize=256M -Dorg.eclipse.update.reconcile=false -Declipse.p2.unsignedPolicy=allow
+      </vmArgs>
+      <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
+      </vmArgsMac>
+   </launcherArgs>
+
+   <windowImages i16="/eu.etaxonomy.taxeditor.application/icons/256color_16x16.gif" i32="/eu.etaxonomy.taxeditor.application/icons/256color_32x32.gif" i48="/eu.etaxonomy.taxeditor.application/icons/256color_48x48.gif"/>
+
+   <splash
+      location="eu.etaxonomy.taxeditor.application"
+      startupProgressRect="5,447,366,15"
+      startupMessageRect="7,432,360,20"
+      startupForegroundColor="000000" />
+   <launcher name="TaxonomicEditor">
+      <solaris/>
+      <win useIco="false">
+         <bmp/>
+      </win>
+   </launcher>
+
+   <vm>
+   </vm>
+
+   <plugins>
+   </plugins>
+
+   <features>
+      <feature id="eu.etaxonomy.taxeditor.feature"/>
+   </features>
+
+   <configurations>
+      <plugin id="eu.etaxonomy.taxeditor.application" autoStart="true" startLevel="5" />
+      <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="4" />
+      <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
+      <plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="2" />
+      <plugin id="org.eclipse.equinox.p2.transport.ecf" autoStart="true" startLevel="4" />
+      <plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
+   </configurations>
+
+</product>
diff --git a/pom.xml b/pom.xml
index 0ffb9d953d1980747b9fd665350c09aeaf80d371..a8e60f966bfd7e7ae74ffab0b89f8e8d3b83d99d 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -19,6 +19,7 @@
     <java.codelevel>1.6</java.codelevel>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <cdmlib.version>3.8.0-SNAPSHOT</cdmlib.version>
+    <!-- TODO can we use project.version ????? -->
     <tycho.version>0.22.0</tycho.version>
     <taxeditor.version>3.8.0-SNAPSHOT</taxeditor.version>
     <update.dir>snapshot</update.dir>
@@ -32,6 +33,8 @@
     <module>eu.etaxonomy.taxeditor.bulkeditor</module>
     <module>eu.etaxonomy.taxeditor.printpublisher</module>
     <module>eu.etaxonomy.taxeditor.help</module>
+    <module>eu.etaxonomy.taxeditor.molecular</module>
+    <module>eu.etaxonomy.taxeditor.molecular.lib</module>
     <module>eu.etaxonomy.taxeditor.application</module>
     <module>eu.etaxonomy.taxeditor.feature.platform</module>
     <module>eu.etaxonomy.taxeditor.feature</module>