2 * Copyright (C) 2015 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
9 package eu
.etaxonomy
.taxeditor
.molecular
.handler
;
12 import java
.util
.Iterator
;
14 import org
.eclipse
.core
.commands
.AbstractHandler
;
15 import org
.eclipse
.core
.commands
.ExecutionEvent
;
16 import org
.eclipse
.core
.commands
.ExecutionException
;
18 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
19 import eu
.etaxonomy
.taxeditor
.molecular
.editor
.AlignmentEditor
;
20 import eu
.etaxonomy
.taxeditor
.molecular
.editor
.PherogramViewPart
;
21 import info
.bioinfweb
.libralign
.alignmentarea
.AlignmentArea
;
22 import info
.bioinfweb
.libralign
.dataarea
.implementations
.pherogram
.PherogramArea
;
23 import info
.bioinfweb
.libralign
.pherogram
.PherogramComponent
;
28 * Abstract handler implementation allows to performs the concrete operation either on an instance of
29 * {@link PherogramViewPart} or all {@link AlignmentArea}s inside an instance of {@link AlignmentEditor}.
34 public abstract class AbstractPherogramComponentHandler
extends AbstractHandler
{
36 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
37 Object activePart
= AbstractUtility
.getActiveE4Part();
39 if (activePart
instanceof AlignmentEditor
) {
40 AlignmentEditor editor
= (AlignmentEditor
)activePart
;
41 Iterator
<String
> idIterator
= editor
.getReadsArea().getAlignmentModel().sequenceIDIterator();
42 while (idIterator
.hasNext()) {
43 PherogramArea area
= editor
.getPherogramArea(idIterator
.next());
45 doExecute(event
, area
);
49 else if (activePart
instanceof PherogramViewPart
) {
50 doExecute(event
, ((PherogramViewPart
)activePart
).getPherogramView().getTraceCurveView());
56 public abstract void doExecute(ExecutionEvent event
, PherogramComponent component
) throws ExecutionException
;