ref #6913 Remove alignment editor
authorPatrick Plitzner <p.plitzner@bgbm.org>
Fri, 4 May 2018 14:03:45 +0000 (16:03 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Fri, 4 May 2018 14:03:45 +0000 (16:03 +0200)
35 files changed:
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditor.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/AlignmentEditorActionUpdater.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/PherogramMouseListener.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/AlignmentEditorE4.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/PherogramPartE4.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/AlignmentEditorPasteHandlerE4.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/CreateConsensusSequenceHandlerE4.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/LoadPherogramHandlerE4.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ReverseComplementHandlerE4.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ShowPherogramHandlerE4.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleInsertOverwriteHandlerE4.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleLeftRightInsertionHandlerE4.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/handler/ToggleShowPherogramProbabilitiesHandlerE4.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractAlignmentEditorHandler.java
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractFocusedAlignmentAreaHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractPherogramComponentHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AlignmentEditorCopyHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AlignmentEditorCutHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AlignmentEditorPasteHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ChangePherogramQualityOutputType.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CreateConsensusSequenceHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramLeftHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/CutPherogramRightHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/EditSequenceHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSequenceToFileHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/LoadPherogramHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ReverseComplementHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ShowPherogramHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleInsertOverwriteHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleLeftRightInsertionHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleShowPherogramBaseCallLinesHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ToggleShowPherogramProbabilitiesHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/UpdateConsensusSequenceHandler.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/package-info.java [deleted file]
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/CDMSequenceMatrixAdapter.java

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
deleted file mode 100644 (file)
index f1a7171..0000000
+++ /dev/null
@@ -1,778 +0,0 @@
-/**
-* 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.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.dnd.Clipboard;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-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.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.molecular.l10n.Messages;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
-import info.bioinfweb.commons.swt.SWTUtils;
-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.pherogram.PherogramArea;
-import info.bioinfweb.libralign.dataarea.implementations.sequenceindex.SequenceIndexArea;
-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.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.model.utils.AlignmentModelUtils;
-import info.bioinfweb.libralign.multiplealignments.AlignmentAreaList;
-import info.bioinfweb.libralign.multiplealignments.MultipleAlignmentsContainer;
-import info.bioinfweb.libralign.pherogram.model.PherogramAlignmentRelation;
-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;
-
-
-
-/**
- * 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"; //$NON-NLS-1$
-
-       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 "; //$NON-NLS-1$
-       public static final String CONSENSUS_NAME = "Consensus"; //$NON-NLS-1$
-
-
-    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 final AlignmentEditorActionUpdater ACTION_UPDATER = new AlignmentEditorActionUpdater();
-       public final Clipboard CLIPBOARD = new Clipboard(Display.getCurrent());  //TODO Move to global EDITor class.
-
-
-    private MultipleAlignmentsContainer alignmentsContainer = null;
-    private final Map<String, SingleReadAlignment> cdmMap = new TreeMap<String, 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> model = new PackedAlignmentModel<Character>(tokenSet);
-               result.setAlignmentModel(model, false);
-               model.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);
-               readsArea.getSelection().addSelectionListener(ACTION_UPDATER);
-           list.add(createIndexArea(alignmentsContainer, readsArea));
-               list.add(readsArea);  // Make sure READS_AREA_INDEX is correct.
-               AlignmentArea editableConsensusArea = createEditableAlignmentArea(alignmentsContainer, false);
-               editableConsensusArea.getSelection().addSelectionListener(ACTION_UPDATER);
-               list.add(editableConsensusArea);  // 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);
-    }
-
-
-    public AlignmentArea getEditableConsensusArea() {
-       return getAlignmentsContainer().getAlignmentAreas().get(EDITABLE_CONSENSUS_AREA_INDEX);
-    }
-
-
-    /**
-     * Checks whether {@link #getReadsArea()} or {@link #getEditableConsensusArea()} currently
-     * have the user focus and returns the according component.
-     *
-     * @return either the reads or the consensus alignment area or {@code null} if none of these
-     *         components is currently focused
-     */
-    public AlignmentArea getFocusedArea() {
-       AlignmentArea result = getReadsArea();
-       if (hasFocus(result)) {
-               return result;
-       }
-       else {
-               result = getEditableConsensusArea();
-               if (hasFocus(result)) {
-                       return result;
-               }
-               else {
-                       return null;
-               }
-       }
-    }
-
-
-    /**
-     * Checks whether the specified alignment area or one of its subcomponents currently has the
-     * focus.
-     *
-     * @param area the alignment area to be checked (Can only be {@link #getReadsArea()} or
-     *        {@link #getEditableConsensusArea()}.)
-     * @return {@code true} if the specified component is focused and is either equal to
-     *         {@link #getReadsArea()} or {@link #getEditableConsensusArea()}or {@code false} otherwise
-     */
-    private boolean hasFocus(AlignmentArea area) {
-       return SWTUtils.childHasFocus((Composite)area.getToolkitComponent());
-    }
-
-
-    public boolean hasPherogram(String sequenceID) {
-        return getReadsArea().getDataAreas().getSequenceAreas(sequenceID).size() > PHEROGRAM_AREA_INDEX;
-    }
-
-
-    public PherogramArea getPherogramArea(String 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); //$NON-NLS-1$
-            //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); //$NON-NLS-1$
-
-                       // Add test consensus sequence:
-                       AlignmentModel consensusModel = getEditableConsensusArea().getAlignmentModel();
-                       String 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")); //$NON-NLS-1$
-                       tokens.add(consensusModel.getTokenSet().tokenByRepresentation("C")); //$NON-NLS-1$
-                       tokens.add(consensusModel.getTokenSet().tokenByRepresentation("G")); //$NON-NLS-1$
-                       tokens.add(consensusModel.getTokenSet().tokenByRepresentation("T")); //$NON-NLS-1$
-                       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();
-                               String id = addRead(DerivateLabelProvider.getDerivateText(pherogramInfo, conversationHolder),
-                                               getPherogramURI(pherogramInfo),
-                                               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(Messages.AlignmentEditor_ERROR_SINGLE_READ, null, Messages.AlignmentEditor_ERROR_SINGLE_READ_MESSAGE +
-                        e.getLocalizedMessage(), TaxeditorMolecularPlugin.PLUGIN_ID, e, false);
-                       }
-               }
-
-               // Set consensus sequence:
-               AlignmentModel consensusModel = getEditableConsensusArea().getAlignmentModel();
-               String id = consensusModel.addSequence(CONSENSUS_NAME);
-               consensusModel.insertTokensAt(id, 0, AlignmentModelUtils.charSequenceToTokenList(
-                               sequenceNode.getConsensusSequence().getString(), consensusModel.getTokenSet()));
-               //TODO Can the consensus sequence also be null? / Should it be created here, if nothing is in the DB?
-    }
-
-
-    @Override
-    public void createPartControl(Composite parent) {
-               SWTComponentFactory.getInstance().getSWTComponent(getAlignmentsContainer(), parent, SWT.NONE);
-               Display.getCurrent().addFilter(SWT.FocusIn, ACTION_UPDATER);
-               Display.getCurrent().addFilter(SWT.FocusOut, ACTION_UPDATER);
-               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(String.format(Messages.AlignmentEditor_MUST_HAVE_TYPE,
-                                       AlignmentEditorInput.class.getCanonicalName()));  //TODO What should be done here?
-               }
-       }
-
-
-    @Override
-       public void dispose() {
-               Display.getCurrent().removeFilter(SWT.FocusIn, ACTION_UPDATER);
-               Display.getCurrent().removeFilter(SWT.FocusOut, ACTION_UPDATER);
-               CLIPBOARD.dispose();
-        ((AlignmentEditorInput)getEditorInput()).dispose();
-               super.dispose();
-       }
-
-
-       private void updateStatusBar() {
-        IActionBars bars = getEditorSite().getActionBars();
-        bars.getStatusLineManager().setMessage(
-                Messages.AlignmentEditor_EDIT_MODE + (getReadsArea().getEditSettings().isInsert() ? Messages.AlignmentEditor_INSERT : Messages.AlignmentEditor_OVERWRITE) + "  " + //$NON-NLS-1$
-                       Messages.AlignmentEditor_INSERTION_PHEROGRAM +
-                       (getReadsArea().getEditSettings().isInsertLeftInDataArea() ? Messages.AlignmentEditor_LEFT : Messages.AlignmentEditor_RIGHT));  //TODO multi language
-    }
-
-
-    private SingleReadAlignment.Shift[] convertToCDMShifts(PherogramAreaModel model) {
-       Iterator<ShiftChange> iterator = model.shiftChangeIterator();
-       List<SingleReadAlignment.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 SingleReadAlignment.Shift[shifts.size()]);
-    }
-
-
-    @Override
-    public void doSave(IProgressMonitor monitor) {
-       if (getEditorInput() instanceof AlignmentEditorInput) {
-               String taskName = Messages.AlignmentEditor_SAVING_ALIGNMENT;  //TODO multi language
-            monitor.beginTask(taskName, 3);
-
-            //re-loading sequence to avoid session conflicts
-               Sequence sequenceNode = CdmStore.getService(ISequenceService.class).load(((AlignmentEditorInput)getEditorInput()).getSequenceNodeUuid());
-               ((AlignmentEditorInput)getEditorInput()).setSequenceNode(sequenceNode);
-               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.setUnderlyingModel(getReadsArea().getAlignmentModel());
-               sequenceNode.getSingleReadAlignments().retainAll(cdmMap.values());  // Remove all reads that are not in the alignment anymore.
-               Iterator<String> iterator = getReadsArea().getAlignmentModel().sequenceIDIterator();
-               while (iterator.hasNext()) {
-                       String id = iterator.next();
-                       SingleReadAlignment singleRead = cdmMap.get(id);
-                       if (singleRead == null) {
-                           throw new InternalError(Messages.AlignmentEditor_NEW_READ_FAILURE);  //TODO multi language
-                               //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);
-
-            ((AlignmentEditorInput)getEditorInput()).merge();
-            // 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.
-       }
-    }
-
-
-    @Override
-    public void doSaveAs() {}
-
-
-    @Override
-    public void init(IEditorSite site, IEditorInput input) throws PartInitException {
-        setSite(site);
-        setInput(input);
-    }
-
-
-    @Override
-    public boolean isDirty() {
-        return dirty;
-    }
-
-
-    private void setDirty() {
-       dirty = true;
-       firePropertyChange(IEditorPart.PROP_DIRTY);
-    }
-
-
-    @Override
-    public boolean isSaveAsAllowed() {
-        return false;  // "Save as" not allowed.
-    }
-
-
-    @Override
-    public void setFocus() {
-        if(conversationHolder != null){
-            conversationHolder.bind();
-        }
-        ((AlignmentEditorInput)getEditorInput()).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 Messages.AlignmentEditor_CUTTING_FAILURE;  //TODO multi language
-        }
-        else {
-            PherogramArea pherogramArea =
-                    getPherogramArea(getReadsArea().getSequenceOrder().idByIndex(selection.getCursorRow()));
-            if (pherogramArea == null) {
-                return Messages.AlignmentEditor_NO_ATTACHED_PHEROGRAM;  //TODO multi language
-            }
-            else {
-                if (left) {
-                    if (pherogramArea.setLeftCutPositionBySelection()) {
-                        return null;
-                    }
-                    else {
-                        return Messages.AlignmentEditor_LEFT_END_OUTSIDE;  //TODO multi language
-                    }
-                }
-                else {
-                    if (pherogramArea.setRightCutPositionBySelection()) {
-                        return null;
-                    }
-                    else {
-                        return Messages.AlignmentEditor_RIGHT_END_OUTSIDE;  //TODO multi language
-                    }
-                }
-            }
-        }
-    }
-
-
-    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++) {
-               String sequenceID = getReadsArea().getSequenceOrder().idByIndex(row);
-                       PherogramArea area = getPherogramArea(sequenceID);
-                       PherogramAreaModel pherogramAlignmentModel = area.getModel();
-
-            PherogramAlignmentRelation rightRelation = pherogramAlignmentModel.editableIndexByBaseCallIndex(
-                    pherogramAlignmentModel.getRightCutPosition());
-            int rightBorder;
-            if (rightRelation.getCorresponding() == PherogramAlignmentRelation.OUT_OF_RANGE) {
-                rightBorder = rightRelation.getBeforeValidIndex() + 1;
-            }
-            else {
-                rightBorder = rightRelation.getAfterValidIndex();
-            }
-
-                       AlignmentModelUtils.reverseComplement(model, sequenceID,
-                               pherogramAlignmentModel.editableIndexByBaseCallIndex(
-                                       pherogramAlignmentModel.getLeftCutPosition()).getBeforeValidIndex(),
-                               rightBorder);
-                       pherogramAlignmentModel.reverseComplement();
-               }
-    }
-
-
-    /**
-     * Recreates the whole consensus sequence from all single read sequences. The previous consensus
-     * sequence is overwritten.
-     */
-    @SuppressWarnings("unchecked")
-    public <T> void createConsensusSequence() {
-        ConsensusSequenceArea area = getConsensusHintDataArea();
-        AlignmentModel<T> model = (AlignmentModel<T>)getEditableConsensusArea().getAlignmentModel();
-        String 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();
-        String 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) != null) {
-                       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 String addRead(String name, URI pherogramURI, boolean reverseComplemented, String editedSequence,
-            Integer firstSeqPos, Integer leftCutPos, Integer rightCutPos, SingleReadAlignment.Shift[] shifts)
-            throws IOException, UnsupportedChromatogramFormatException {
-
-               AlignmentModel model = 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:
-               model.addSequence(name);
-               String id = model.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, model.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(model.getTokenSet().tokenByRepresentation(
-                                       Character.toString(pherogramProvider.getBaseCall(i))));
-                       }
-                       setDirty();
-               }
-
-               if (tokens != null) {  // If either an edited sequence or a pherogram URI was provided.
-                   model.insertTokensAt(id, 0, tokens);
-
-                   if (pherogramProvider != null) {
-                       // Create pherogram area:
-                       PherogramArea pherogramArea = new PherogramArea(getReadsArea().getContentArea(),
-                               new PherogramAreaModel(pherogramProvider));
-
-                       // Set position properties and shifts:
-                       PherogramAreaModel phergramModel = pherogramArea.getModel();
-                       if ((firstSeqPos != null) && (leftCutPos != null)) {
-                           phergramModel.setFirstSeqLeftCutPos(firstSeqPos, leftCutPos);
-                       }
-                       if (rightCutPos != null) {
-                           phergramModel.setRightCutPosition(rightCutPos);
-                       }
-                       if ((shifts != null) && (shifts.length > 0)) {
-                           for (int i = 0; i < shifts.length; i++) {
-                               phergramModel.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;
-       }
-
-
-    public static URI getPherogramURI(SingleRead pherogramInfo) {
-        if (pherogramInfo.getPherogram() != null) {
-            return MediaUtils.getFirstMediaRepresentationPart(pherogramInfo.getPherogram()).getUri();
-        }
-        else {
-            return null;
-        }
-    }
-}
index 7993a08c4a52422149214f8835968145b76ac4d0..304b9f87ae6c1ccc27297f5af66c088747635583 100644 (file)
@@ -7,6 +7,7 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.ActionFactory;\r
 import org.eclipse.ui.commands.ICommandService;\r
 \r
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;\r
 import eu.etaxonomy.taxeditor.molecular.handler.AbstractAlignmentEditorHandler;\r
 import info.bioinfweb.libralign.alignmentarea.selection.SelectionChangeEvent;\r
 import info.bioinfweb.libralign.alignmentarea.selection.SelectionListener;\r
@@ -15,39 +16,39 @@ import info.bioinfweb.libralign.alignmentarea.selection.SelectionListener;
 \r
 /**\r
  * Listener used to update copy/paste events associated with {@link AlignmentEditor}.\r
- * \r
+ *\r
  * @author Ben Stöver\r
  * @date 25.08.2015\r
  */\r
 public class AlignmentEditorActionUpdater implements SelectionListener, Listener {\r
-       private static final String[] IDS = {ActionFactory.COPY.getCommandId(), ActionFactory.CUT.getCommandId(), \r
+       private static final String[] IDS = {ActionFactory.COPY.getCommandId(), ActionFactory.CUT.getCommandId(),\r
                ActionFactory.PASTE.getCommandId()};\r
-       \r
-       \r
+\r
+\r
        private void updateEvents() {\r
-               ICommandService service = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);\r
+               ICommandService service = PlatformUI.getWorkbench().getService(ICommandService.class);\r
                for (int i = 0; i < IDS.length; i++) {\r
                service.refreshElements(IDS[i], null);\r
                }\r
        }\r
-       \r
-       \r
+\r
+\r
        @Override\r
        public void handleEvent(Event event) {\r
-               AlignmentEditor editor = AbstractAlignmentEditorHandler.getActiveAlignmentEditor();\r
+               AlignmentEditorE4 editor = AbstractAlignmentEditorHandler.getActiveAlignmentEditor();\r
                if (editor != null) {\r
             updateEvents();\r
                }\r
        }\r
 \r
-       \r
+\r
        @Override\r
        public void selectionChanged(SelectionChangeEvent e) {\r
-               AlignmentEditor editor = AbstractAlignmentEditorHandler.getActiveAlignmentEditor();\r
+               AlignmentEditorE4 editor = AbstractAlignmentEditorHandler.getActiveAlignmentEditor();\r
                if (editor != null) {\r
-                       if ((e.getSource() == editor.getReadsArea().getSelection()) || \r
+                       if ((e.getSource() == editor.getReadsArea().getSelection()) ||\r
                                        (e.getSource() == editor.getEditableConsensusArea().getSelection())) {\r
-                               \r
+\r
                                updateEvents();\r
                        }\r
                }\r
index 592b922386c9edf272a01cebb27ff26005b43144..9369e3c9ce50fa8a4bf8ea720738a725b0fb9553 100644 (file)
@@ -13,13 +13,6 @@ 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;
-import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
-
 
 
 /**
@@ -40,18 +33,19 @@ public class PherogramMouseListener extends TICMouseAdapter {
 
        @Override
        public boolean mousePressed(TICMouseEvent event) {
-               if (event.getClickCount() == 2) {  // Double click
-                       try {
-                           ShowPherogramHandler.showPherogram(area.getModel());
-                       }
-                       catch (PartInitException e) {
-                MessagingUtils.errorDialog(Messages.PherogramMouseListener_UNABLE_TO_CREATE_VIEW, null, e.getLocalizedMessage(),
-                        TaxeditorMolecularPlugin.PLUGIN_ID,  e, false);  //TODO set pluginID
-                       }
-            return true;
-               }
-               else {
+//             if (event.getClickCount() == 2) {  // Double click
+//                     try {
+                           //FIXME E4 implement double click functionality
+//                         ShowPherogramHandler.showPherogram(area.getModel());
+//                     }
+//                     catch (PartInitException e) {
+//                MessagingUtils.errorDialog(Messages.PherogramMouseListener_UNABLE_TO_CREATE_VIEW, null, e.getLocalizedMessage(),
+//                        TaxeditorMolecularPlugin.PLUGIN_ID,  e, false);  //TODO set pluginID
+//                     }
+//            return true;
+//             }
+//             else {
                    return false;
-               }
+//             }
        }
 }
index 63fa5735833407e661c06075c741ed09047d7027..15213661d366bbeefca29f5e952538519712a2fe 100644 (file)
@@ -51,8 +51,8 @@ import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
 import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditorActionUpdater;
 import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditorInput;
 import eu.etaxonomy.taxeditor.molecular.editor.PherogramMouseListener;
-import eu.etaxonomy.taxeditor.molecular.handler.ToggleInsertOverwriteHandler;
-import eu.etaxonomy.taxeditor.molecular.handler.ToggleLeftRightInsertionHandler;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ToggleInsertOverwriteHandlerE4;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ToggleLeftRightInsertionHandlerE4;
 import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
@@ -168,13 +168,13 @@ public class AlignmentEditorE4 {
             @Override
             public void insertLeftInDataAreaChanged(EditSettingsChangeEvent e) {
                 updateStatusBar();
-                refreshToolbarElement(ToggleLeftRightInsertionHandler.COMMAND_ID);
+                refreshToolbarElement(ToggleLeftRightInsertionHandlerE4.COMMAND_ID);
             }
 
             @Override
             public void insertChanged(EditSettingsChangeEvent e) {
                 updateStatusBar();
-                refreshToolbarElement(ToggleInsertOverwriteHandler.COMMAND_ID);
+                refreshToolbarElement(ToggleInsertOverwriteHandlerE4.COMMAND_ID);
             }
         });
     }
index eb7a88ea149044db14e36688c0eef0785adea243..28c93ed6d6eab23707c9e9b8517a3f97c9f8ce54 100644 (file)
@@ -14,7 +14,6 @@ import javax.annotation.PostConstruct;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
 
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
 import info.bioinfweb.libralign.pherogram.PherogramFormats.QualityOutputType;
 import info.bioinfweb.libralign.pherogram.model.PherogramComponentModel;
 import info.bioinfweb.libralign.pherogram.view.PherogramView;
@@ -24,7 +23,7 @@ import info.bioinfweb.tic.SWTComponentFactory;
 
 /**
  * Component that allows to view a pherogram without the distortion due to aligning it to a sequence as in
- * {@link AlignmentEditor}.
+ * {@link AlignmentEditorE4}.
  *
  * @author Ben Stöver
  * @date Nov 20, 2014
index da49e7fbf68cc8b1ab15f7c1ea6f21377c4141f3..f2b29f13afd4d5b6f5e9193551a4f2bc56e6c1c5 100644 (file)
@@ -15,7 +15,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.dnd.TextTransfer;
 import org.eclipse.swt.widgets.Shell;
 
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
 import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
 import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
 import info.bioinfweb.libralign.alignmentarea.AlignmentArea;
@@ -27,7 +26,7 @@ import info.bioinfweb.libralign.model.utils.AlignmentModelUtils;
 
 
 /**
- * Handler that pastes the current contents of the clipboard into an active instance of {@link AlignmentEditor}.
+ * Handler that pastes the current contents of the clipboard into an active instance of {@link AlignmentEditorE4}.
  *
  * @author Ben Stöver
  * @date 26.08.2015
index a4424254f4bc2ca98f7135399e055abfe4abb72c..d3b686e4d84c66e1739bc40c19fa7966e81a6c48 100644 (file)
@@ -15,7 +15,6 @@ import org.eclipse.e4.core.di.annotations.Execute;
 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.e4.ui.services.IServiceConstants;
 
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
 import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
 
 
@@ -23,12 +22,12 @@ import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
 
 /**
  * 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.
+ * of {@link AlignmentEditorE4}. A previously present consensus sequence will be overwritten.
  *
  * @author Ben Stöver
  * @date 19.06.2015
  * @see UpdateConsensusSequenceHandlerE4
- * @see AlignmentEditor#createConsensusSequence()
+ * @see AlignmentEditorE4#createConsensusSequence()
  */
 public class CreateConsensusSequenceHandlerE4 {
 
index 455dd5bbd06c0a19af8e65c661465acad5b8fec4..05d5cda5ec3514ccdaa63d1e17db5ce0f00504bc 100644 (file)
@@ -23,14 +23,13 @@ import org.eclipse.swt.widgets.Shell;
 
 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.e4.AlignmentEditorE4;
 import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
 
 
 
 /**
- * Handler that loads an additional read into the contig alignment displayed by an instance of {@link AlignmentEditor}.
+ * Handler that loads an additional read into the contig alignment displayed by an instance of {@link AlignmentEditorE4}.
  *
  * @author Ben Stöver
  * @author pplitzner
index b168fa64581e0d340691482730ac51a0c17ab65a..af72b81c8a7bacd2ea717986a81e18a7ce09e59b 100644 (file)
@@ -15,14 +15,13 @@ import org.eclipse.e4.core.di.annotations.Execute;
 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.e4.ui.services.IServiceConstants;
 
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
 import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
 
 
 
 
 /**
- * Reverse complements the single read sequence in an active {@link AlignmentEditor}, where the alignment cursor
+ * Reverse complements the single read sequence in an active {@link AlignmentEditorE4}, where the alignment cursor
  * is currently located.
  *
  * @author Ben Stöver
index 9ce073f7a6d9b4e25295769e6c022f6dcea44fec..acd421205c207cc01af57591b66abd9a229864a2 100644 (file)
@@ -19,8 +19,7 @@ import eu.etaxonomy.cdm.model.media.MediaUtils;
 import eu.etaxonomy.cdm.model.molecular.SingleRead;
 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;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
 import eu.etaxonomy.taxeditor.molecular.editor.e4.PherogramPartE4;
 import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
 import info.bioinfweb.libralign.pherogram.model.PherogramComponentModel;
@@ -28,7 +27,7 @@ import info.bioinfweb.libralign.pherogram.model.PherogramComponentModel;
 
 
 /**
- * Displays an undistorted pherogram with {@link PherogramViewPart}.
+ * Displays an undistorted pherogram with {@link PherogramPartE4}.
  *
  * @author Ben Stöver
  */
@@ -54,7 +53,7 @@ public class ShowPherogramHandlerE4 {
                                MPart part = partService.createPart(eu.etaxonomy.taxeditor.molecular.AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_MOLECULAR_EDITOR_E4_PHEROGRAMPARTE4);
                                part = partService.showPart(part, PartState.ACTIVATE);
                                PherogramPartE4 pherogramPart = (PherogramPartE4) part.getObject();
-                               pherogramPart.init(new PherogramComponentModel(AlignmentEditor.readPherogram(uri)));
+                               pherogramPart.init(new PherogramComponentModel(AlignmentEditorE4.readPherogram(uri)));
                            }
                        }
                catch (Exception e) {
index f24895d4ae5685ae4661fcf9c8a64a38a2e9f58f..99f19375e2ac6bdea4a0019efa42228e461f06d6 100644 (file)
@@ -17,14 +17,13 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.e4.ui.services.IServiceConstants;
 import org.eclipse.jface.resource.ImageDescriptor;
 
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
 import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
 import eu.etaxonomy.taxeditor.molecular.handler.HandlerTools;
 
 
 
 /**
- * Switches an {@link AlignmentEditor} between insertion and overwrite mode.
+ * Switches an {@link AlignmentEditorE4} between insertion and overwrite mode.
  *
  * @author Ben Stöver
  * @date 04.12.2014
index ed4422ea65cdd22174cef4ddf210f51d4331f04e..c005b497dcfdc0cae85a459a647033863b2cbd8c 100644 (file)
@@ -16,14 +16,13 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.e4.ui.services.IServiceConstants;
 import org.eclipse.jface.resource.ImageDescriptor;
 
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
 import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
 import eu.etaxonomy.taxeditor.molecular.handler.HandlerTools;
 
 
 
 /**
- * Switches an {@link AlignmentEditor} between insertion in the base sequence to
+ * Switches an {@link AlignmentEditorE4} between insertion in the base sequence to
  * the left or to the right.
  *
  * @author Ben Stöver
index 81642a521d89178bb2269e3a855c2948923eee7d..9a45bf12741a3e427f683adc27142ee416f555ab 100644 (file)
@@ -15,8 +15,7 @@ import org.eclipse.e4.core.di.annotations.Execute;
 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.e4.ui.services.IServiceConstants;
 
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
-import eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
 import eu.etaxonomy.taxeditor.molecular.editor.e4.PherogramPartE4;
 
 
@@ -24,7 +23,7 @@ import eu.etaxonomy.taxeditor.molecular.editor.e4.PherogramPartE4;
 
 /**
  * Toggles whether probability values (substitution, overcall and undercall) should be displayed
- * in pherogram areas of {@link AlignmentEditor} or {@link PherogramViewPart}.
+ * in pherogram areas of {@link AlignmentEditorE4} or {@link PherogramPartE4}.
  *
  * @author Ben Stöver
  * @date 23.06.2015
index 2745ddeaf3cc8e5258a1eb750648efadde87f414..d4882525a6be65bf00f761aee353b860f89963d0 100644 (file)
@@ -14,23 +14,23 @@ import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;
 
 
 
 
 /**
  * Abstract implementation for all handlers triggering actions in an active instance of
- * {@link AlignmentEditor}.
+ * {@link AlignmentEditorE4}.
  *
  * @author Ben Stöver
  * @date 19.06.2015
  */
 public abstract class AbstractAlignmentEditorHandler extends AbstractHandler {
-       public static AlignmentEditor getActiveAlignmentEditor() {
+       public static AlignmentEditorE4 getActiveAlignmentEditor() {
            Object activeEditor = AbstractUtility.getActiveEditor();
-        if (activeEditor instanceof AlignmentEditor) {
-            return (AlignmentEditor)activeEditor;
+        if (activeEditor instanceof AlignmentEditorE4) {
+            return (AlignmentEditorE4)activeEditor;
         }
         else {
                return null;
@@ -40,7 +40,7 @@ public abstract class AbstractAlignmentEditorHandler extends AbstractHandler {
 
     @Override
     public Object execute(ExecutionEvent event) throws ExecutionException {
-       AlignmentEditor editor = getActiveAlignmentEditor();
+       AlignmentEditorE4 editor = getActiveAlignmentEditor();
         if (editor != null) {
             doExecute(event, editor);
         }
@@ -48,5 +48,5 @@ public abstract class AbstractAlignmentEditorHandler extends AbstractHandler {
     }
 
 
-    protected abstract void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException;
+    protected abstract void doExecute(ExecutionEvent event, AlignmentEditorE4 editor) throws ExecutionException;
 }
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractFocusedAlignmentAreaHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AbstractFocusedAlignmentAreaHandler.java
deleted file mode 100644 (file)
index 1fc418a..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-package eu.etaxonomy.taxeditor.molecular.handler;\r
-\r
-\r
-import info.bioinfweb.libralign.alignmentarea.AlignmentArea;\r
-\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-\r
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;\r
-\r
-\r
-\r
-public abstract class AbstractFocusedAlignmentAreaHandler extends AbstractAlignmentEditorHandler {\r
-       @Override\r
-       protected void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {\r
-       AlignmentArea focusedArea = editor.getFocusedArea();\r
-       if (focusedArea != null) {\r
-               doExecute2(event, editor, focusedArea);\r
-       }\r
-       }\r
-       \r
-       \r
-       protected abstract void doExecute2(ExecutionEvent event, AlignmentEditor editor, AlignmentArea focusedArea);\r
-}\r
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
deleted file mode 100644 (file)
index 201843d..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
-* 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.util.Iterator;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
-import eu.etaxonomy.taxeditor.molecular.editor.PherogramViewPart;
-import info.bioinfweb.libralign.alignmentarea.AlignmentArea;
-import info.bioinfweb.libralign.dataarea.implementations.pherogram.PherogramArea;
-import info.bioinfweb.libralign.pherogram.PherogramComponent;
-
-
-
-/**
- * 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 {
-        Object activePart = AbstractUtility.getActivePart();
-
-        if (activePart instanceof AlignmentEditor) {
-            AlignmentEditor editor = (AlignmentEditor)activePart;
-            Iterator<String> 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/AlignmentEditorCopyHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AlignmentEditorCopyHandler.java
deleted file mode 100644 (file)
index 95418e5..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-package eu.etaxonomy.taxeditor.molecular.handler;
-
-
-import info.bioinfweb.libralign.alignmentarea.AlignmentArea;
-import info.bioinfweb.libralign.alignmentarea.selection.SelectionModel;
-import info.bioinfweb.libralign.model.utils.AlignmentModelUtils;
-
-import java.util.Map;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.ui.commands.IElementUpdater;
-import org.eclipse.ui.menus.UIElement;
-
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
-
-
-
-/**
- * Handler that copies the currently selected nucleotides from an alignment editor to the clipboard.
- * <p>
- * The copied contents either come from the single reads or the consensus sequence alignment area,
- * depending on which component currently has the focus. If none of these components has the focus,
- * nothing will be copied, even if nucleotides are currently selected.
- * <p>
- * If the selection contains parts of multiple sequence, these are separated by the line separator
- * of the current operating system.
- *
- * @author Ben Stöver
- * @date 25.08.2015
- */
-public class AlignmentEditorCopyHandler extends AbstractFocusedAlignmentAreaHandler implements IElementUpdater {
-    @Override
-       @SuppressWarnings("unchecked")
-       protected void doExecute2(ExecutionEvent event, AlignmentEditor editor, AlignmentArea focusedArea) {
-       SelectionModel selection = focusedArea.getSelection();
-       if (!selection.isEmpty()) {
-               editor.CLIPBOARD.setContents(new Object[]{AlignmentModelUtils.selectionAsString(focusedArea, false)},
-                       new Transfer[]{TextTransfer.getInstance()});
-       }
-       }
-
-
-       @Override
-       public boolean isEnabled() {
-               AlignmentEditor editor = getActiveAlignmentEditor();
-               if (editor != null) {
-                       AlignmentArea focusedArea = editor.getFocusedArea();
-                       if (focusedArea != null) {
-                               return !focusedArea.getSelection().isEmpty();
-                       }
-               }
-               return false;
-       }
-
-
-       @Override
-       public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
-               setBaseEnabled(isEnabled());
-    }
-}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AlignmentEditorCutHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AlignmentEditorCutHandler.java
deleted file mode 100644 (file)
index 2236686..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-package eu.etaxonomy.taxeditor.molecular.handler;\r
-\r
-\r
-import info.bioinfweb.libralign.alignmentarea.AlignmentArea;\r
-\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-\r
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;\r
-\r
-\r
-\r
-/**\r
- * Handler that cuts the currently selected nucleotides from an alignment editor to the clipboard.\r
- * <p>\r
- * The cut contents either come from the single reads or the consensus sequence alignment area,\r
- * depending on which component currently has the focus. If none of these components has the focus,\r
- * nothing will be cut, even if nucleotides are currently selected.\r
- * <p>\r
- * If the selection contains parts of multiple sequence, these are separated by the line separator\r
- * of the current operating system.  \r
- * \r
- * @author Ben Stöver\r
- * @date 25.08.2015\r
- */\r
-public class AlignmentEditorCutHandler extends AlignmentEditorCopyHandler {\r
-       @Override\r
-       protected void doExecute2(ExecutionEvent event, AlignmentEditor editor, AlignmentArea focusedArea) {\r
-               super.doExecute2(event, editor, focusedArea);  // Copy selected contents.\r
-               focusedArea.getActionProvider().deleteSelection();\r
-       }\r
-}\r
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AlignmentEditorPasteHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/AlignmentEditorPasteHandler.java
deleted file mode 100644 (file)
index 53d3d7f..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-package eu.etaxonomy.taxeditor.molecular.handler;\r
-\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Scanner;\r
-\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.jface.dialogs.MessageDialog;\r
-import org.eclipse.swt.dnd.TextTransfer;\r
-import org.eclipse.ui.commands.IElementUpdater;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-import org.eclipse.ui.menus.UIElement;\r
-\r
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;\r
-import eu.etaxonomy.taxeditor.molecular.l10n.Messages;\r
-import info.bioinfweb.libralign.alignmentarea.AlignmentArea;\r
-import info.bioinfweb.libralign.alignmentarea.order.SequenceOrder;\r
-import info.bioinfweb.libralign.alignmentarea.selection.SelectionModel;\r
-import info.bioinfweb.libralign.model.AlignmentModel;\r
-import info.bioinfweb.libralign.model.utils.AlignmentModelUtils;\r
-\r
-\r
-\r
-/**\r
- * Handler that pastes the current contents of the clipboard into an active instance of {@link AlignmentEditor}.\r
- *\r
- * @author Ben Stöver\r
- * @date 26.08.2015\r
- */\r
-public class AlignmentEditorPasteHandler extends AbstractFocusedAlignmentAreaHandler implements IElementUpdater {\r
-       private void pasteString(AlignmentArea area, String sequenceID, String content) {\r
-               area.getActionProvider().deleteSelection();  // Overwrite selected tokens.\r
-               area.getActionProvider().elongateSequence(sequenceID, area.getSelection().getCursorColumn());\r
-\r
-               @SuppressWarnings("unchecked")\r
-               AlignmentModel<Object> alignmentModel = (AlignmentModel<Object>)area.getAlignmentModel();\r
-               alignmentModel.insertTokensAt(sequenceID, area.getSelection().getCursorColumn(),\r
-                               AlignmentModelUtils.charSequenceToTokenList(content, alignmentModel.getTokenSet(),\r
-                                               true, alignmentModel.getTokenSet().getGapToken()));\r
-       }\r
-\r
-\r
-       @Override\r
-       protected void doExecute2(ExecutionEvent event, AlignmentEditor editor, AlignmentArea focusedArea) {\r
-               SelectionModel selection = focusedArea.getSelection();\r
-               String clipboardText = (String)editor.CLIPBOARD.getContents(TextTransfer.getInstance());\r
-               if (clipboardText != null) {\r
-                       List<String> lines = new ArrayList<String>();\r
-                       Scanner scanner = new Scanner(clipboardText);\r
-                       try {\r
-                               while (scanner.hasNext()) {\r
-                                       lines.add(scanner.nextLine());\r
-                               }\r
-                               if (lines.get(lines.size() - 1).equals("")) { //$NON-NLS-1$\r
-                                       lines.remove(lines.size() - 1);\r
-                               }\r
-                       }\r
-                       finally {\r
-                               scanner.close();\r
-                       }\r
-\r
-                       if (!lines.isEmpty()) { //TODO Can lines be empty? (Can an empty string "" be copied to the clipboard?)\r
-                               if (selection.getCursorHeight() == 1) {  // If the consensus sequence is focused, this is the only possible case.\r
-                                       String sequenceID = focusedArea.getSequenceOrder().idByIndex(selection.getCursorRow());\r
-                                       if (lines.size() == 1) {\r
-                                               pasteString(focusedArea, sequenceID, lines.get(0));\r
-                                       }\r
-                                       else {\r
-                                               MessageDialog dialog = new MessageDialog(HandlerUtil.getActiveWorkbenchWindow(event).getShell(),  //TODO Can the window be null?\r
-                                                               Messages.AlignmentEditorPasteHandler_PASTING_LINES, null,\r
-                                                               String.format(Messages.AlignmentEditorPasteHandler_PASTING_LINES_QUESTION, lines.size()),\r
-                                                               MessageDialog.QUESTION,\r
-                                                               new String[]{Messages.AlignmentEditorPasteHandler_PASTING_LINES_IGNORE,\r
-                                                                               Messages.AlignmentEditorPasteHandler_PASTING_LINES_FIRST_LINE, Messages.AlignmentEditorPasteHandler_CANCEL},\r
-                                                               0);\r
-                                               //TODO Does the dialog have to be disposed in some way?\r
-\r
-                                               switch (dialog.open()) {\r
-                                                       case 0:  // Paste all lines in one sequence.\r
-                                                               pasteString(focusedArea, sequenceID, clipboardText);\r
-                                                               break;\r
-                                                       case 1:  // Paste only first line.\r
-                                                               pasteString(focusedArea, sequenceID, lines.get(0));\r
-                                                               break;\r
-                                               }\r
-                                       }\r
-                               }\r
-                               else {\r
-                                       if (selection.getCursorHeight() == lines.size()) {\r
-                                               SequenceOrder order = focusedArea.getSequenceOrder();\r
-                                               for (int i = 0; i < selection.getCursorHeight(); i++) {\r
-                                                       pasteString(focusedArea, order.idByIndex(selection.getCursorRow() + i), lines.get(i));  // Multiple calls of deleteSelection() in here are unnecessary, but should have no effect.\r
-                                               }\r
-                                       }\r
-                                       else {\r
-                                               MessageDialog.openError(HandlerUtil.getActiveWorkbenchWindow(event).getShell(),  //TODO Can the window be null?\r
-                                                               Messages.AlignmentEditorPasteHandler_PASTE_FAILURE,\r
-                                                               String.format(Messages.AlignmentEditorPasteHandler_PASTE_FAILURE_MESSAGE, selection.getCursorHeight(), lines.size(), System.getProperty("line.separator"))); //$NON-NLS-1$\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-\r
-       @Override\r
-       public boolean isEnabled() {\r
-               AlignmentEditor editor = getActiveAlignmentEditor();\r
-               if (editor != null) {\r
-                       AlignmentArea focusedArea = editor.getFocusedArea();\r
-                       return (focusedArea != null);\r
-               }\r
-               else {\r
-                       return false;\r
-               }\r
-       }\r
-\r
-\r
-       @Override\r
-       public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {\r
-               setBaseEnabled(isEnabled());\r
-    }\r
-}\r
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
deleted file mode 100644 (file)
index 2c9bf33..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
-* 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
deleted file mode 100644 (file)
index a95de50..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
-* 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
deleted file mode 100644 (file)
index 34ee748..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
-* 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;
-import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
-
-
-
-/**
- * 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(Messages.CutPherogramLeftHandler_CUT_FAILURE, 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
deleted file mode 100644 (file)
index 2c7896d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
-* 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;
-import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
-
-
-
-/**
- * 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(Messages.CutPherogramRightHandler_CUT_FAILURE, 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
deleted file mode 100644 (file)
index c76354a..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-package eu.etaxonomy.taxeditor.molecular.handler;
-
-
-import javax.inject.Named;
-
-import org.eclipse.e4.core.di.annotations.CanExecute;
-import org.eclipse.e4.core.di.annotations.Execute;
-import org.eclipse.e4.core.di.annotations.Optional;
-import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
-import org.eclipse.e4.ui.services.IServiceConstants;
-import org.eclipse.jface.viewers.TreeNode;
-
-import eu.etaxonomy.cdm.model.molecular.Sequence;
-
-
-
-/**
- * Opens the alignment editor from the CDM tree.
- *
- * @author Ben St&ouml;ver
- * @author pplitzner
- */
-public class EditSequenceHandler {
-    private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(EditSequenceHandler.class);
-
-
-    @Execute
-    public void execute(@Optional@Named(IServiceConstants.ACTIVE_SELECTION)TreeNode treeNodeOfSelection) {
-        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(Messages.EditSequenceHandler_COULD_NOT_OPEN, e);
-//            }
-        }
-    }
-
-    @CanExecute
-    public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) TreeNode selectedTreeNode, MHandledMenuItem menuItem) {
-        boolean canExecute = false;
-        if(selectedTreeNode!=null){
-            Object value = selectedTreeNode.getValue();
-            canExecute = value instanceof Sequence;
-        }
-        menuItem.setVisible(canExecute);
-        return canExecute;
-    }
-}
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSequenceToFileHandler.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSequenceToFileHandler.java
deleted file mode 100644 (file)
index 28d295b..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-// $Id$\r
-/**\r
-* Copyright (C) 2016 EDIT\r
-* European Distributed Institute of Taxonomy\r
-* http://www.e-taxonomy.eu\r
-*\r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
-package eu.etaxonomy.taxeditor.molecular.handler;\r
-\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-\r
-import javax.inject.Named;\r
-\r
-import org.eclipse.core.runtime.IStatus;\r
-import org.eclipse.e4.core.di.annotations.CanExecute;\r
-import org.eclipse.e4.core.di.annotations.Execute;\r
-import org.eclipse.e4.core.di.annotations.Optional;\r
-import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;\r
-import org.eclipse.e4.ui.services.IServiceConstants;\r
-import org.eclipse.jface.viewers.TreeNode;\r
-import org.eclipse.jface.wizard.WizardDialog;\r
-import org.eclipse.swt.widgets.Shell;\r
-\r
-import eu.etaxonomy.cdm.model.molecular.Sequence;\r
-import eu.etaxonomy.taxeditor.model.MessagingUtils;\r
-import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;\r
-import eu.etaxonomy.taxeditor.molecular.io.CDMPherogramAlignmentObjectTranslator;\r
-import eu.etaxonomy.taxeditor.molecular.io.CDMSequenceMatrixAdapter;\r
-import eu.etaxonomy.taxeditor.molecular.io.SingleReadAlignmentRDFXMLConstants;\r
-import eu.etaxonomy.taxeditor.molecular.io.wizard.ExportSingleReadAlignmentWizard;\r
-import eu.etaxonomy.taxeditor.molecular.l10n.Messages;\r
-import eu.etaxonomy.taxeditor.util.ApplicationUtil;\r
-import info.bioinfweb.jphyloio.JPhyloIOEventWriter;\r
-import info.bioinfweb.jphyloio.ReadWriteParameterMap;\r
-import info.bioinfweb.jphyloio.ReadWriteParameterNames;\r
-import info.bioinfweb.jphyloio.dataadapters.implementations.ListBasedDocumentDataAdapter;\r
-import info.bioinfweb.jphyloio.factory.JPhyloIOReaderWriterFactory;\r
-import info.bioinfweb.jphyloio.objecttranslation.ObjectTranslatorFactory;\r
-\r
-\r
-\r
-/**\r
- * Allows to export a single read alignment to various alignment formats using\r
- * <a href="http://bioinfweb.info/JPhyloIO/"><i>JPhyloIO</i></a>.\r
- *\r
- * @author Ben Stöver\r
- * @date 24.04.2016\r
- */\r
-public class ExportSequenceToFileHandler {\r
-    private static final JPhyloIOReaderWriterFactory factory = new JPhyloIOReaderWriterFactory();\r
-\r
-\r
-    @Execute\r
-    public Object execute(@Optional@Named(IServiceConstants.ACTIVE_SELECTION)TreeNode treeNodeOfSelection,\r
-            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {\r
-        if (treeNodeOfSelection != null && treeNodeOfSelection.getValue() instanceof Sequence) {\r
-            Sequence sequence = (Sequence)treeNodeOfSelection.getValue();\r
-\r
-            final ExportSingleReadAlignmentWizard wizard = new ExportSingleReadAlignmentWizard();\r
-            final WizardDialog dialog = new WizardDialog(shell, wizard);\r
-            if (dialog.open() == IStatus.OK) {\r
-                // Prepare writer parameters:\r
-                ReadWriteParameterMap parameters = new ReadWriteParameterMap();\r
-                parameters.put(ReadWriteParameterNames.KEY_APPLICATION_NAME, ApplicationUtil.getTitle());\r
-                //parameters.put(ReadWriteParameterNames.KEY_APPLICATION_VERSION, ApplicationUtil.getVersion());  // Setting the version unnecessary, since its already contained in the title.\r
-                parameters.put(ReadWriteParameterNames.KEY_APPLICATION_URL, "http://cybertaxonomy.eu/taxeditor/");  //TODO Specify URL obtained from a central class? //$NON-NLS-1$\r
-                parameters.put(ReadWriteParameterNames.KEY_SEQUENCE_EXTENSION_TOKEN, wizard.getModel().getElongationToken());\r
-\r
-                // Create and register object translator for writing pherogram alignment shifts:\r
-                ObjectTranslatorFactory translatorFactory = new ObjectTranslatorFactory();\r
-                translatorFactory.addXSDTranslators(true);\r
-                translatorFactory.addTranslator(new CDMPherogramAlignmentObjectTranslator(), true, SingleReadAlignmentRDFXMLConstants.DATA_TYPE_PHERORAGM_ALIGNMENT);\r
-                parameters.put(ReadWriteParameterNames.KEY_OBJECT_TRANSLATOR_FACTORY, translatorFactory);\r
-\r
-                // Create writer and document adapters:\r
-                JPhyloIOEventWriter writer = factory.getWriter(wizard.getModel().getFormatInfo().getFormatID());\r
-                ListBasedDocumentDataAdapter document = new ListBasedDocumentDataAdapter();\r
-                document.getMatrices().add(new CDMSequenceMatrixAdapter(sequence, wizard.getModel().getConsensusSequenceLabel(),\r
-                        wizard.getModel().isExportConsensusSequence(), wizard.getModel().isExportSingleReads()));\r
-\r
-                // Write document:\r
-                File file = new File(wizard.getModel().getFileName());\r
-                if (!file.exists() || MessagingUtils.confirmDialog(Messages.exportSequenceToFileHandlerOverwriteTitle, String.format(\r
-                        Messages.exportSequenceToFileHandlerOverwriteText, file.getAbsolutePath()))) {\r
-\r
-                    try {\r
-                        writer.writeDocument(document, file, parameters);\r
-                    }\r
-                    catch (IOException e) {\r
-                        e.printStackTrace();\r
-                        MessagingUtils.errorDialog(Messages.exportSequenceToFileHandlerIOErrorTitle, this,\r
-                                String.format(Messages.exportSequenceToFileHandlerIOErrorMessage,\r
-                                        file.getAbsolutePath()), TaxeditorMolecularPlugin.PLUGIN_ID, e, false);\r
-                    }\r
-                }\r
-\r
-            }\r
-        }\r
-        return null;\r
-    }\r
-\r
-    @CanExecute\r
-    public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) TreeNode selectedTreeNode, MHandledMenuItem menuItem) {\r
-        boolean canExecute = false;\r
-        if(selectedTreeNode!=null){\r
-            Object value = selectedTreeNode.getValue();\r
-            canExecute = value instanceof Sequence;\r
-        }\r
-        menuItem.setVisible(canExecute);\r
-        return canExecute;\r
-    }\r
-}\r
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
deleted file mode 100644 (file)
index b11cf21..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
-* 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 eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
-import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
-
-
-
-/**
- * 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.
-
-    @Override
-    public Object execute(ExecutionEvent event) throws ExecutionException {
-        Object activeEditor = AbstractUtility.getActiveEditor();
-        if (activeEditor instanceof AlignmentEditor) {
-            AlignmentEditor alignmentEditor = (AlignmentEditor)activeEditor;
-
-            FileDialog fileDialog = new FileDialog(alignmentEditor.getSite().getShell());
-            fileDialog.setText(Messages.LoadPherogramHandler_IMPORT_PHEROGRAM);
-            fileDialog.setFilterNames(new String[]{Messages.LoadPherogramHandler_ALL_FORMATS, Messages.LoadPherogramHandler_AB1, Messages.LoadPherogramHandler_SCF, Messages.LoadPherogramHandler_ALL});
-            fileDialog.setFilterExtensions(new String[]{"*.ab1;*.scf", "*.ab1", "*.scf", "*.*"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
-            String path = fileDialog.open();
-            if (path != null) {
-               try {
-                       alignmentEditor.addRead(new File(path).toURI(), false);
-               }
-               catch (UnsupportedChromatogramFormatException e) {
-                    MessagingUtils.errorDialog(Messages.LoadPherogramHandler_UNSUPPORTED_FORMAT, this,
-                            String.format(Messages.LoadPherogramHandler_UNSUPPORTED_FORMAT_MESSAGE, path), TaxeditorMolecularPlugin.PLUGIN_ID, e, false);  //TODO set pluginID
-               }
-               catch (IOException e) {
-                    MessagingUtils.errorDialog(Messages.LoadPherogramHandler_UNSUPPORTED_FORMAT_FILE, this,
-                               Messages.LoadPherogramHandler_UNSUPPORTED_FORMAT_FILE_MESSAGE + 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
deleted file mode 100644 (file)
index 99e7388..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
-* 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
deleted file mode 100644 (file)
index 6837216..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-package eu.etaxonomy.taxeditor.molecular.handler;
-
-
-import java.net.URI;
-
-import javax.inject.Named;
-
-import org.eclipse.e4.core.di.annotations.CanExecute;
-import org.eclipse.e4.core.di.annotations.Execute;
-import org.eclipse.e4.core.di.annotations.Optional;
-import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
-import org.eclipse.e4.ui.services.IServiceConstants;
-import org.eclipse.jface.viewers.TreeNode;
-import org.eclipse.ui.PartInitException;
-
-import eu.etaxonomy.cdm.model.media.MediaUtils;
-import eu.etaxonomy.cdm.model.molecular.SingleRead;
-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;
-import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
-import info.bioinfweb.libralign.pherogram.model.PherogramComponentModel;
-
-
-
-/**
- * Displays an undistorted pherogram with {@link PherogramViewPart}.
- *
- * @author Ben Stöver
- */
-public class ShowPherogramHandler {
-       public static void showPherogram(PherogramComponentModel model) throws PartInitException {
-               PherogramViewPart.createView(model);
-       }
-
-
-       @Execute
-       public Object execute(@Optional@Named(IServiceConstants.ACTIVE_SELECTION)TreeNode treeNodeOfSelection) {
-               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(Messages.ShowPherogramHandler_NO_PHEROGRAM, this,
-                               Messages.ShowPherogramHandler_NO_PHEROGRAM_MESSAGE);
-                           }
-                           else {
-                     showPherogram(new PherogramComponentModel(AlignmentEditor.readPherogram(uri)));
-                           }
-                       }
-               catch (Exception e) {
-                   MessagingUtils.errorDialog(Messages.ShowPherogramHandler_ERROR, null, e.getLocalizedMessage(), TaxeditorMolecularPlugin.PLUGIN_ID,
-                           e, false);
-               }
-        }
-        return null;
-    }
-
-    @CanExecute
-    public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) TreeNode selectedTreeNode, MHandledMenuItem menuItem) {
-        boolean canExecute = false;
-        if(selectedTreeNode!=null){
-            Object value = selectedTreeNode.getValue();
-            canExecute = value instanceof SingleRead;
-        }
-        menuItem.setVisible(canExecute);
-        return canExecute;
-    }
-}
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
deleted file mode 100644 (file)
index 1710c3b..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
-* 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.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;
-import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
-
-
-
-/**
- * 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"; //$NON-NLS-1$
-
-
-    private final ImageDescriptor INSERT_DESCRIPTOR = HandlerTools.createImageDescriptor("insert-16x16.png"); //$NON-NLS-1$
-    private final ImageDescriptor OVERWRITE_DESCRIPTOR = HandlerTools.createImageDescriptor("overwrite-16x16.png"); //$NON-NLS-1$
-
-
-    @Override
-    public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {
-        editor.toggleInsertOverwrite();
-    }
-
-
-       @Override
-       public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
-           Object activeEditor = AbstractUtility.getActiveEditor();
-               if (activeEditor instanceof AlignmentEditor) {
-                       if (((AlignmentEditor)activeEditor).isInsertMode()) {
-                           element.setIcon(INSERT_DESCRIPTOR);
-                               element.setText("INS"); //$NON-NLS-1$
-                               element.setTooltip(Messages.ToggleInsertOverwriteHandler_SWITCH_OVERWRITE);
-                       }
-                       else {
-                element.setIcon(OVERWRITE_DESCRIPTOR);
-                               element.setText("OVR"); //$NON-NLS-1$
-                               element.setTooltip(Messages.ToggleInsertOverwriteHandler_SWITCH_INSERTION);
-                       }
-            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
deleted file mode 100644 (file)
index 27bb959..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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.commands.IElementUpdater;
-import org.eclipse.ui.menus.UIElement;
-
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;
-import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
-
-
-
-/**
- * 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"; //$NON-NLS-1$
-
-
-    private final ImageDescriptor INSERT_LEFT_DESCRIPTOR =
-            HandlerTools.createImageDescriptor("pherogram-insert-left-16x16.png"); //$NON-NLS-1$
-    private final ImageDescriptor INSERT_RIGHT_DESCRIPTOR =
-            HandlerTools.createImageDescriptor("pherogram-insert-right-16x16.png"); //$NON-NLS-1$
-    private final ImageDescriptor INSERT_LEFT_DISABLED_DESCRIPTOR =
-            HandlerTools.createImageDescriptor("pherogram-insert-left-disabled-16x16.png"); //$NON-NLS-1$
-    private final ImageDescriptor INSERT_RIGHT_DISABLED_DESCRIPTOR =
-            HandlerTools.createImageDescriptor("pherogram-insert-right-disabled-16x16.png"); //$NON-NLS-1$
-
-
-    @Override
-    public void doExecute(ExecutionEvent event, AlignmentEditor editor) throws ExecutionException {
-        editor.toggleLeftRightInsertionInPherogram();
-    }
-
-
-    @Override
-    public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
-        Object 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(Messages.ToggleLeftRightInsertionHandler_LEFT);
-                element.setTooltip(Messages.ToggleLeftRightInsertionHandler_SWITCH_RIGHT);
-            }
-            else {
-                element.setIcon(INSERT_RIGHT_DESCRIPTOR);
-                element.setDisabledIcon(INSERT_RIGHT_DISABLED_DESCRIPTOR);
-                element.setText(Messages.ToggleLeftRightInsertionHandler_RIGHT);
-                element.setTooltip(Messages.ToggleLeftRightInsertionHandler_SWITCH_LEFT);
-            }
-        }
-    }
-}
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
deleted file mode 100644 (file)
index 5221387..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
-* 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
deleted file mode 100644 (file)
index a7c845d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
-* 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
deleted file mode 100644 (file)
index 50cc1b1..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
-* 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
deleted file mode 100644 (file)
index eea17cb..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- * 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 AlignmentEditorE4.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;
index 8f40acaad4b69167a455edd16c3ca65e0ea11b06..ed3da122d882cd842e4397666408ee2d3660951e 100644 (file)
@@ -21,7 +21,7 @@ import javax.xml.namespace.QName;
 \r
 import eu.etaxonomy.cdm.model.molecular.Sequence;\r
 import eu.etaxonomy.cdm.model.molecular.SingleReadAlignment;\r
-import eu.etaxonomy.taxeditor.molecular.editor.AlignmentEditor;\r
+import eu.etaxonomy.taxeditor.molecular.editor.e4.AlignmentEditorE4;\r
 import eu.etaxonomy.taxeditor.molecular.l10n.Messages;\r
 import info.bioinfweb.commons.bio.CharacterStateSetType;\r
 import info.bioinfweb.commons.io.W3CXSConstants;\r
@@ -238,7 +238,7 @@ public class CDMSequenceMatrixAdapter extends NoCharDefsNoSetsMatrixDataAdapter
                 writeMetadataEvents(receiver, sequenceID, PREDICATE_HAS_LEFT_CUT_POSITION, W3CXSConstants.DATA_TYPE_INT, singleRead.getLeftCutPosition());\r
                 writeMetadataEvents(receiver, sequenceID, PREDICATE_HAS_RIGHT_CUT_POSITION, W3CXSConstants.DATA_TYPE_INT, singleRead.getRightCutPosition());\r
 \r
-                URI pherogramURI = AlignmentEditor.getPherogramURI(singleRead.getSingleRead());\r
+                URI pherogramURI = AlignmentEditorE4.getPherogramURI(singleRead.getSingleRead());\r
                 if (pherogramURI != null) {\r
                     JPhyloIOWritingUtils.writeTerminalResourceMetadata(receiver, createMetadataID(sequenceID, PREDICATE_HAS_PHEROGRAM),\r
                             null, PREDICATE_HAS_PHEROGRAM, pherogramURI);\r