+++ /dev/null
-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());
- }
-}