3 * Copyright (C) 2015 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.molecular
.handler
;
13 import info
.bioinfweb
.libralign
.alignmentarea
.AlignmentArea
;
14 import info
.bioinfweb
.libralign
.dataarea
.implementations
.pherogram
.PherogramArea
;
15 import info
.bioinfweb
.libralign
.pherogram
.PherogramComponent
;
17 import java
.util
.Iterator
;
19 import org
.eclipse
.core
.commands
.AbstractHandler
;
20 import org
.eclipse
.core
.commands
.ExecutionEvent
;
21 import org
.eclipse
.core
.commands
.ExecutionException
;
22 import org
.eclipse
.ui
.IWorkbenchPart
;
24 import eu
.etaxonomy
.taxeditor
.model
.AbstractUtility
;
25 import eu
.etaxonomy
.taxeditor
.molecular
.editor
.AlignmentEditor
;
26 import eu
.etaxonomy
.taxeditor
.molecular
.editor
.PherogramViewPart
;
31 * Abstract handler implementation allows to performs the concrete operation either on an instance of
32 * {@link PherogramViewPart} or all {@link AlignmentArea}s inside an instance of {@link AlignmentEditor}.
37 public abstract class AbstractPherogramComponentHandler
extends AbstractHandler
{
39 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
40 IWorkbenchPart activePart
= AbstractUtility
.getActivePart();
42 if (activePart
instanceof AlignmentEditor
) {
43 AlignmentEditor editor
= (AlignmentEditor
)activePart
;
44 Iterator
<Integer
> idIterator
= editor
.getReadsArea().getAlignmentModel().sequenceIDIterator();
45 while (idIterator
.hasNext()) {
46 PherogramArea area
= editor
.getPherogramArea(idIterator
.next());
48 doExecute(event
, area
);
52 else if (activePart
instanceof PherogramViewPart
) {
53 doExecute(event
, ((PherogramViewPart
)activePart
).getPherogramView().getTraceCurveView());
59 public abstract void doExecute(ExecutionEvent event
, PherogramComponent component
) throws ExecutionException
;