1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.molecular.editor;
|
10
|
|
11
|
|
12
|
import info.bioinfweb.libralign.dataarea.implementations.pherogram.PherogramArea;
|
13
|
import info.bioinfweb.tic.input.TICMouseAdapter;
|
14
|
import info.bioinfweb.tic.input.TICMouseEvent;
|
15
|
|
16
|
import org.eclipse.ui.PartInitException;
|
17
|
|
18
|
import eu.etaxonomy.taxeditor.model.MessagingUtils;
|
19
|
import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
|
20
|
import eu.etaxonomy.taxeditor.molecular.handler.ShowPherogramHandler;
|
21
|
|
22
|
|
23
|
|
24
|
/**
|
25
|
* Listens to mouse events on data areas displaying a pherogram in {@link AlignmentEditor}.
|
26
|
*
|
27
|
* @author Ben Stöver
|
28
|
* @date 25.11.2014
|
29
|
*/
|
30
|
public class PherogramMouseListener extends TICMouseAdapter {
|
31
|
private final PherogramArea area;
|
32
|
|
33
|
|
34
|
public PherogramMouseListener(PherogramArea area) {
|
35
|
super();
|
36
|
this.area = area;
|
37
|
}
|
38
|
|
39
|
|
40
|
@Override
|
41
|
public boolean mousePressed(TICMouseEvent event) {
|
42
|
if (event.getClickCount() == 2) { // Double click
|
43
|
try {
|
44
|
ShowPherogramHandler.showPherogram(area.getModel());
|
45
|
}
|
46
|
catch (PartInitException e) {
|
47
|
MessagingUtils.errorDialog("Unable to create pherogram view", null, e.getLocalizedMessage(),
|
48
|
TaxeditorMolecularPlugin.PLUGIN_ID, e, false); //TODO set pluginID
|
49
|
}
|
50
|
return true;
|
51
|
}
|
52
|
else {
|
53
|
return false;
|
54
|
}
|
55
|
}
|
56
|
}
|