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 info
.bioinfweb
.libralign
.alignmentarea
.AlignmentArea
;
13 import info
.bioinfweb
.libralign
.dataarea
.implementations
.pherogram
.PherogramArea
;
14 import info
.bioinfweb
.libralign
.pherogram
.PherogramComponent
;
16 import java
.util
.Iterator
;
18 import org
.eclipse
.core
.commands
.AbstractHandler
;
19 import org
.eclipse
.core
.commands
.ExecutionEvent
;
20 import org
.eclipse
.core
.commands
.ExecutionException
;
21 import org
.eclipse
.ui
.IWorkbenchPart
;
23 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
24 import eu
.etaxonomy
.taxeditor
.molecular
.editor
.AlignmentEditor
;
25 import eu
.etaxonomy
.taxeditor
.molecular
.editor
.PherogramViewPart
;
30 * Abstract handler implementation allows to performs the concrete operation either on an instance of
31 * {@link PherogramViewPart} or all {@link AlignmentArea}s inside an instance of {@link AlignmentEditor}.
36 public abstract class AbstractPherogramComponentHandler
extends AbstractHandler
{
38 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
39 IWorkbenchPart activePart
= AbstractUtility
.getActivePart();
41 if (activePart
instanceof AlignmentEditor
) {
42 AlignmentEditor editor
= (AlignmentEditor
)activePart
;
43 Iterator
<String
> idIterator
= editor
.getReadsArea().getAlignmentModel().sequenceIDIterator();
44 while (idIterator
.hasNext()) {
45 PherogramArea area
= editor
.getPherogramArea(idIterator
.next());
47 doExecute(event
, area
);
51 else if (activePart
instanceof PherogramViewPart
) {
52 doExecute(event
, ((PherogramViewPart
)activePart
).getPherogramView().getTraceCurveView());
58 public abstract void doExecute(ExecutionEvent event
, PherogramComponent component
) throws ExecutionException
;