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