From: b.stoever Date: Sat, 21 Mar 2015 18:22:45 +0000 (+0000) Subject: Initial implementation of CDM data reading and writing in AlignmentEditor. X-Git-Tag: 3.8.0^2~59^2~83 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/173ebf21f2c050f1078673428c87af587ba09911 Initial implementation of CDM data reading and writing in AlignmentEditor. Minor changes. --- diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/EditSequenceHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/EditSequenceHandler.java index ea3dc5a40..d6aa37d47 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/EditSequenceHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/EditSequenceHandler.java @@ -1,4 +1,6 @@ package eu.etaxonomy.taxeditor.editor.handler; + + import java.net.URI; import java.util.ArrayList; import java.util.List; @@ -12,39 +14,34 @@ import org.eclipse.jface.viewers.TreeNode; import org.eclipse.ui.PartInitException; import org.eclipse.ui.handlers.HandlerUtil; -import eu.etaxonomy.cdm.model.media.Media; -import eu.etaxonomy.cdm.model.media.MediaRepresentationPart; -import eu.etaxonomy.cdm.model.media.MediaUtils; import eu.etaxonomy.cdm.model.molecular.Sequence; import eu.etaxonomy.taxeditor.editor.EditorUtil; import eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditorInput; -public class EditSequenceHandler extends AbstractHandler { +/** + * Opens the alignment editor from the CDM tree. + * + * @author Ben Stöver + * @author pplitzner + */ +public class EditSequenceHandler extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { ISelection currentSelection = HandlerUtil.getCurrentSelection(event); TreeNode treeNodeOfSelection = EditorUtil.getTreeNodeOfSelection(currentSelection); - if(treeNodeOfSelection!=null && treeNodeOfSelection.getValue() instanceof Sequence){ - Sequence sequence = (Sequence)treeNodeOfSelection.getValue(); - List pherogramUris = new ArrayList(); - Set pherograms = sequence.getPherograms(); - for (Media media : pherograms) { - MediaRepresentationPart firstMediaRepresentationPart = MediaUtils.getFirstMediaRepresentationPart(media); - if(firstMediaRepresentationPart!=null){ - pherogramUris.add(firstMediaRepresentationPart.getUri()); - } + if(treeNodeOfSelection != null && treeNodeOfSelection.getValue() instanceof Sequence){ + AlignmentEditorInput input = new AlignmentEditorInput((Sequence)treeNodeOfSelection.getValue()); //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 { + EditorUtil.open(input); + } + catch (PartInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } } - AlignmentEditorInput input = new AlignmentEditorInput(); - try { - EditorUtil.open(input); - } catch (PartInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + return null; } - } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/LoadPherogramHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/LoadPherogramHandler.java index 0d53ed313..a803a64d6 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/LoadPherogramHandler.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/LoadPherogramHandler.java @@ -51,7 +51,7 @@ public class LoadPherogramHandler extends AbstractHandler { String path = fileDialog.open(); if (path != null) { try { - alignmentEditor.addRead(new File(path).toURI()); + alignmentEditor.addRead(new File(path).toURI(), false); } catch (UnsupportedChromatogramFormatException e) { MessagingUtils.errorDialog("Unsupported format", this, "The format of the pherogram file \"" + path + diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenAlignmentEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenAlignmentEditor.java index 5fb415c8e..69c9d3456 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenAlignmentEditor.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenAlignmentEditor.java @@ -34,10 +34,11 @@ public class OpenAlignmentEditor extends AbstractHandler { */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { - AlignmentEditorInput input = new AlignmentEditorInput(); + AlignmentEditorInput input = new AlignmentEditorInput(null); //TODO Does it make sense to start an empty editor? try { EditorUtil.open(input); - } catch (PartInitException e) { + } + catch (PartInitException e) { MessagingUtils.error(OpenAlignmentEditor.class, "Could not open AlignmentEditor", e); } return null; diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/AlignmentEditor.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/AlignmentEditor.java index a2adc2ee8..e0025ccad 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/AlignmentEditor.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/AlignmentEditor.java @@ -11,17 +11,25 @@ package eu.etaxonomy.taxeditor.editor.molecular; import info.bioinfweb.libralign.alignmentarea.AlignmentArea; -import info.bioinfweb.libralign.alignmentarea.content.AlignmentContentArea; import info.bioinfweb.libralign.dataarea.implementations.ConsensusSequenceArea; import info.bioinfweb.libralign.dataarea.implementations.SequenceIndexArea; +import info.bioinfweb.libralign.dataarea.implementations.pherogram.PherogramAlignmentModel; import info.bioinfweb.libralign.dataarea.implementations.pherogram.PherogramArea; +import info.bioinfweb.libralign.dataarea.implementations.pherogram.ShiftChange; import info.bioinfweb.libralign.editsettings.EditSettingsChangeEvent; import info.bioinfweb.libralign.editsettings.EditSettingsListener; import info.bioinfweb.libralign.multiplealignments.AlignmentAreaList; import info.bioinfweb.libralign.multiplealignments.MultipleAlignmentsContainer; import info.bioinfweb.libralign.pherogram.provider.BioJavaPherogramProvider; import info.bioinfweb.libralign.pherogram.provider.PherogramProvider; +import info.bioinfweb.libralign.pherogram.provider.ReverseComplementPherogramProvider; +import info.bioinfweb.libralign.sequenceprovider.SequenceDataChangeListener; import info.bioinfweb.libralign.sequenceprovider.SequenceDataProvider; +import info.bioinfweb.libralign.sequenceprovider.SequenceUtils; +import info.bioinfweb.libralign.sequenceprovider.adapters.StringAdapter; +import info.bioinfweb.libralign.sequenceprovider.events.SequenceChangeEvent; +import info.bioinfweb.libralign.sequenceprovider.events.SequenceRenamedEvent; +import info.bioinfweb.libralign.sequenceprovider.events.TokenChangeEvent; import info.bioinfweb.libralign.sequenceprovider.implementations.PackedSequenceDataProvider; import info.bioinfweb.libralign.sequenceprovider.tokenset.BioJavaTokenSet; import info.bioinfweb.libralign.sequenceprovider.tokenset.TokenSet; @@ -33,6 +41,7 @@ import java.net.URI; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.Iterator; import java.util.Map; import java.util.TreeMap; @@ -51,6 +60,11 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.commands.ICommandService; import org.eclipse.ui.part.EditorPart; +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.editor.handler.ToggleInsertOverwriteHandler; import eu.etaxonomy.taxeditor.editor.handler.ToggleLeftRightInsertionHandler; @@ -70,11 +84,38 @@ public class AlignmentEditor extends EditorPart { public static final String ID = "eu.etaxonomy.taxeditor.editor.molecular.AlignmentEditor"; public static final int READS_AREA_INDEX = 1; public static final int CONSENSUS_AREA_INDEX = READS_AREA_INDEX + 1; + public static final int PHEROGRAM_AREA_INDEX = 0; public static final String DEFAULT_READ_NAME_PREFIX = "Read "; + public static final String CONSENSUS_NAME = "Consensus"; + private final SequenceDataChangeListener DIRTY_LISTENER = new SequenceDataChangeListener() { + @Override + public void afterTokenChange(TokenChangeEvent e) { + setDirty(); + } + + @Override + public void afterSequenceRenamed(SequenceRenamedEvent e) { + setDirty(); + } + + @Override + public void afterSequenceChange(SequenceChangeEvent e) { + setDirty(); + } + + @Override + public void afterProviderChanged(SequenceDataProvider oldProvider, + SequenceDataProvider newProvider) { // Not expected. + + setDirty(); + } + }; + private MultipleAlignmentsContainer alignmentsContainer = null; - private Map uriMap = new TreeMap(); //TODO Move this to ContigSequenceDataProvider + private Map cdmMap = new TreeMap(); //TODO Move this to ContigSequenceDataProvider + private boolean dirty = false; private void refreshToolbarElement(String id) { @@ -121,6 +162,7 @@ public class AlignmentEditor extends EditorPart { TokenSet tokenSet = new BioJavaTokenSet(new DNACompoundSet(), true); SequenceDataProvider provider = new PackedSequenceDataProvider(tokenSet); result.setSequenceProvider(provider, false); + provider.getChangeListeners().add(DIRTY_LISTENER); return result; } @@ -163,24 +205,22 @@ public class AlignmentEditor extends EditorPart { private AlignmentArea getConsensusArea() { return getAlignmentsContainer().getAlignmentAreas().get(CONSENSUS_AREA_INDEX); } - - - /* (non-Javadoc) - * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) - */ - @Override - public void createPartControl(Composite parent) { - getAlignmentsContainer().createSWTWidget(parent, SWT.NONE); - updateStatusBar(); - + + + private PherogramArea getPherogramArea(int sequenceID) { + return (PherogramArea)getReadsArea().getDataAreas().getSequenceAreas(sequenceID).get(PHEROGRAM_AREA_INDEX); + } + + + private void createTestContents() { // Just for testing: try { - addRead(new File("D:/Users/BenStoever/Documents/Studium/Projekte/Promotion/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/JR430_JR-P01.ab1").toURI()); - addRead(new File("D:/Users/BenStoever/Documents/Studium/Projekte/Promotion/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/JR444_JR-P05.ab1").toURI()); + addRead(new File("D:/Users/BenStoever/Documents/Studium/Projekte/Promotion/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/JR430_JR-P01.ab1").toURI(), false); + addRead(new File("D:/Users/BenStoever/Documents/Studium/Projekte/Promotion/EDITor/Quelltexte/LibrAlign branch/Repository/eu.etaxonomy.taxeditor.editor/src/main/resources/AlignmentTestData/JR444_JR-P05.ab1").toURI(), false); // Add test consensus sequence: SequenceDataProvider consensusProvider = getConsensusArea().getSequenceProvider(); - int id = consensusProvider.addSequence("Consensus"); + int id = consensusProvider.addSequence(CONSENSUS_NAME); Collection tokens = new ArrayList(); // First save tokens in a collection to avoid GUI updated for each token. tokens.add(consensusProvider.getTokenSet().tokenByKeyChar('A')); tokens.add(consensusProvider.getTokenSet().tokenByKeyChar('C')); @@ -192,6 +232,61 @@ public class AlignmentEditor extends EditorPart { throw new RuntimeException(e); } } + + + private void readCDMData() { + //TODO If called from somewhere else than createPartControl() the editorInput needs to be checked and previous contents need to be cleared (or updated). + Sequence sequenceNode = ((AlignmentEditorInput)getEditorInput()).getSequenceNode(); + + // Add reads: + for (SingleReadAlignment singleReadAlignment : sequenceNode.getSingleReadAlignments()) { + try { + SingleRead pherogramInfo = singleReadAlignment.getSingleRead(); + int id = addRead(pherogramInfo.getPrimer().getLabel(), //TODO Should the sequence name contain other/additional/alternative data? Can the same string as in the derivative tree be used here? + MediaUtils.getFirstMediaRepresentationPart(pherogramInfo.getPherogram()).getUri(), + singleReadAlignment.isReverseComplement(), + singleReadAlignment.getEditedSequence(), + singleReadAlignment.getShifts()); + cdmMap.put(id, singleReadAlignment); + } + catch (IOException e) { + e.printStackTrace(); //TODO Output to user (Possibly collect for all pherograms and display in the end.) + } + catch (UnsupportedChromatogramFormatException e) { + e.printStackTrace(); //TODO Output to user (Possibly collect for all pherograms and display in the end.) + } + } + + // Set consensus sequence: + SequenceDataProvider consensusProvider = getConsensusArea().getSequenceProvider(); + int id = consensusProvider.addSequence(CONSENSUS_NAME); + consensusProvider.insertTokensAt(id, 0, SequenceUtils.stringToTokenList( + sequenceNode.getConsensusSequence().getString(), consensusProvider.getTokenSet())); + //TODO Can the consensus sequence also be null? / Should it be created here, if nothing is in the DB? + } + + + /* (non-Javadoc) + * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) + */ + @Override + public void createPartControl(Composite parent) { + getAlignmentsContainer().createSWTWidget(parent, SWT.NONE); + updateStatusBar(); + + if (getEditorInput() instanceof AlignmentEditorInput) { + if (((AlignmentEditorInput)getEditorInput()).getSequenceNode() != null) { + readCDMData(); + } + else { + createTestContents(); //TODO What to do here instead in the final version? + } + } + else { + throw new IllegalArgumentException("The editor input must have the type " + + AlignmentEditorInput.class.getCanonicalName()); //TODO What should be done here? + } + } private void updateStatusBar() { @@ -203,13 +298,60 @@ public class AlignmentEditor extends EditorPart { } + private SingleReadAlignment.Shift[] convertToCDMShifts(PherogramAlignmentModel alignmentModel) { + SingleReadAlignment.Shift[] result = new SingleReadAlignment.Shift[alignmentModel.getShiftChangeCount()]; + Iterator iterator = alignmentModel.shiftChangeIterator(); + int pos = 0; + while (iterator.hasNext()) { + ShiftChange shiftChange = iterator.next(); + result[pos] = new SingleReadAlignment.Shift(shiftChange.getBaseCallIndex(), shiftChange.getShiftChange()); + } + return result; + } + + /* (non-Javadoc) * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor) */ @Override public void doSave(IProgressMonitor monitor) { - // TODO Auto-generated method stub - + System.out.println("save 1"); + if (getEditorInput() instanceof AlignmentEditorInput) { + System.out.println("save 2"); + Sequence sequenceNode = ((AlignmentEditorInput)getEditorInput()).getSequenceNode(); + StringAdapter stringProvider = new StringAdapter(getConsensusArea().getSequenceProvider(), false); // Throws an exception if a token has more than one character. + + // Write consensus sequence: + SequenceString consensusSequenceObj = sequenceNode.getConsensusSequence(); + String newConsensusSequence = stringProvider.getSequence( + getConsensusArea().getSequenceProvider().sequenceIDByName(CONSENSUS_NAME)); + if (consensusSequenceObj == null) { + sequenceNode.setConsensusSequence(SequenceString.NewInstance(newConsensusSequence)); + } + else { + consensusSequenceObj.setString(newConsensusSequence); + } + + // Write single reads: + stringProvider.setUnderlyingProvider(getReadsArea().getSequenceProvider()); + sequenceNode.getSingleReadAlignments().retainAll(cdmMap.values()); // Remove all reads that are not in the alignment anymore. + Iterator iterator = getReadsArea().getSequenceProvider().sequenceIDIterator(); + while (iterator.hasNext()) { + int id = iterator.next(); + System.out.println("Saving sequence " + id); + SingleReadAlignment singleRead = cdmMap.get(id); + if (singleRead == null) { + //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)); + singleRead.setReverseComplement(getPherogramArea(id).getProvider() instanceof ReverseComplementPherogramProvider); // Works only if ReverseComplementPherogramProvider instances are not nested. + singleRead.setShifts(convertToCDMShifts(getPherogramArea(id).getAlignmentModel())); + System.out.println(singleRead.getShifts()); + } + } + dirty = false; //TODO "*" is not removed from editor title. Why not? (Should be save action in the tool bar be disabled when isDirty() returns false? This is also not the case.) } @@ -217,10 +359,7 @@ public class AlignmentEditor extends EditorPart { * @see org.eclipse.ui.part.EditorPart#doSaveAs() */ @Override - public void doSaveAs() { - // TODO Auto-generated method stub - - } + public void doSaveAs() {} /* (non-Javadoc) @@ -238,8 +377,12 @@ public class AlignmentEditor extends EditorPart { */ @Override public boolean isDirty() { - // TODO Auto-generated method stub - return false; + return dirty; + } + + + private void setDirty() { + dirty = true; } @@ -248,8 +391,7 @@ public class AlignmentEditor extends EditorPart { */ @Override public boolean isSaveAsAllowed() { - // TODO Auto-generated method stub - return false; + return false; // "Save as" not allowed. } @@ -301,33 +443,73 @@ public class AlignmentEditor extends EditorPart { } - public void addRead(URI pherogramURI) throws IOException, UnsupportedChromatogramFormatException { - addRead(newReadName(), pherogramURI); + public void addRead(URI pherogramURI, boolean reverseComplemented) throws IOException, UnsupportedChromatogramFormatException { + addRead(newReadName(), pherogramURI, reverseComplemented, null, null); } - public void addRead(String name, URI pherogramURI) throws IOException, UnsupportedChromatogramFormatException { + /** + * Adds a new sequence with attached phergram data area to the reads alignment. + *

+ * If {@code null} is specified as {@code editedSequence} the base call sequence from the pherogram will + * be set as the edited sequence. If {@code null} is specified as {@code shifts} no shifts between the edited + * and the base calls sequence are assumed. + * + * @param name the name of the new sequence + * @param pherogramURI the URI where the associated pherogram file is located + * @param reverseComplemented Specify {@code true} here, if the reverse complement of the pherogram data should + * be added, {@code false} otherwise. + * @param editedSequence the edited version of the base call sequence (May be {@code null}.) + * @param shifts the alignment information that links the edited and the base call sequence (May be {@code null}.) + * @return the sequence ID of the added read + * @throws IOException if an error occurred when trying to read the pherogram file + * @throws UnsupportedChromatogramFormatException if the format of the pherogram file is not supported + */ + public int addRead(String name, URI pherogramURI, boolean reverseComplemented, String editedSequence, + SingleReadAlignment.Shift[] shifts) throws IOException, UnsupportedChromatogramFormatException { + SequenceDataProvider provider = getReadsArea().getSequenceProvider(); PherogramProvider pherogramProvider = readPherogram(pherogramURI); // Must happen before a sequence is added, because it might throw an exception. + if (reverseComplemented) { + pherogramProvider = new ReverseComplementPherogramProvider(pherogramProvider); + } // Create sequence: provider.addSequence(name); int id = provider.sequenceIDByName(name); - // Copy base call sequence into alignment: - Collection tokens = new ArrayList(); // First save tokens in a collection to avoid GUI updated for each token. - for (int i = 0; i < pherogramProvider.getSequenceLength(); i++) { - tokens.add(provider.getTokenSet().tokenByKeyChar( - pherogramProvider.getBaseCall(i).getUpperedBase().charAt(0))); + // Set edited sequence: + Collection tokens; // First save tokens in a collection to avoid GUI updated for each token. + if (editedSequence != null) { + tokens = SequenceUtils.stringToTokenList(editedSequence, provider.getTokenSet()); + } + else { // Copy base call sequence into alignment: + tokens = new ArrayList(); + for (int i = 0; i < pherogramProvider.getSequenceLength(); i++) { + tokens.add(provider.getTokenSet().tokenByKeyChar( + pherogramProvider.getBaseCall(i).getUpperedBase().charAt(0))); + } + setDirty(); } provider.insertTokensAt(id, 0, tokens); - // Add data area: + // Create pherogram area: PherogramArea pherogramArea = new PherogramArea(getReadsArea().getContentArea(), pherogramProvider); + + // Set shifts: + if (shifts != null) { + PherogramAlignmentModel alignmentModel = pherogramArea.getAlignmentModel(); + for (int i = 0; i < shifts.length; i++) { + alignmentModel.addShiftChange(shifts[i].position, shifts[i].shift); + } + setDirty(); + } + + // Add pherogram area to GUI: pherogramArea.addMouseListener(new PherogramMouseListener(pherogramURI)); getReadsArea().getDataAreas().getSequenceAreas(id).add(pherogramArea); // Save source URI: - uriMap.put(id, pherogramURI); + return id; } } \ No newline at end of file diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/AlignmentEditorInput.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/AlignmentEditorInput.java index 9d25d6677..1664a0895 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/AlignmentEditorInput.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/AlignmentEditorInput.java @@ -14,6 +14,8 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IPersistableElement; +import eu.etaxonomy.cdm.model.molecular.Sequence; + /** @@ -24,8 +26,17 @@ import org.eclipse.ui.IPersistableElement; public class AlignmentEditorInput implements IEditorInput { private static final String name = "AlignmentEditor"; + + private final Sequence sequenceNode; + - /* (non-Javadoc) + public AlignmentEditorInput(Sequence sequenceNode) { + super(); + this.sequenceNode = sequenceNode; + } + + + /* (non-Javadoc) * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) */ @Override @@ -80,4 +91,15 @@ public class AlignmentEditorInput implements IEditorInput { public String getToolTipText() { return name; } + + + /** + * Returns the sequence CDM node that should be edited by the {@link AlignmentEditor} this object + * is used with. + * + * @return the CDM node to work on + */ + public Sequence getSequenceNode() { + return sequenceNode; + } } diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/PherogramMouseListener.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/PherogramMouseListener.java index 2fce3dfb1..25a454c3e 100644 --- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/PherogramMouseListener.java +++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/molecular/PherogramMouseListener.java @@ -12,7 +12,6 @@ package eu.etaxonomy.taxeditor.editor.molecular; import info.bioinfweb.commons.tic.input.TICMouseAdapter; import info.bioinfweb.commons.tic.input.TICMouseEvent; -import java.io.File; import java.net.URI; import eu.etaxonomy.taxeditor.model.MessagingUtils; @@ -42,7 +41,8 @@ public class PherogramMouseListener extends TICMouseAdapter { PherogramViewPart.createView(uri); } catch (Exception e) { - MessagingUtils.errorDialog("Error", this, e.getLocalizedMessage(), "eu.etaxonomy.taxeditor.editor", e, false); //TODO set pluginID + MessagingUtils.errorDialog("Error", this, e.getLocalizedMessage(), "eu.etaxonomy.taxeditor.editor", + e, false); //TODO set pluginID } } }