Project

General

Profile

Download (1.59 KB) Statistics
| Branch: | Tag: | Revision:
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.Messages;
20
import eu.etaxonomy.taxeditor.molecular.TaxeditorMolecularPlugin;
21
import eu.etaxonomy.taxeditor.molecular.handler.ShowPherogramHandler;
22

    
23

    
24

    
25
/**
26
 * Listens to mouse events on data areas displaying a pherogram in {@link AlignmentEditor}.
27
 *
28
 * @author Ben Stöver
29
 * @date 25.11.2014
30
 */
31
public class PherogramMouseListener extends TICMouseAdapter {
32
	private final PherogramArea area;
33

    
34

    
35
	public PherogramMouseListener(PherogramArea area) {
36
		super();
37
		this.area = area;
38
	}
39

    
40

    
41
	@Override
42
	public boolean mousePressed(TICMouseEvent event) {
43
		if (event.getClickCount() == 2) {  // Double click
44
			try {
45
			    ShowPherogramHandler.showPherogram(area.getModel());
46
			}
47
			catch (PartInitException e) {
48
                MessagingUtils.errorDialog(Messages.PherogramMouseListener_UNABLE_TO_CREATE_VIEW, null, e.getLocalizedMessage(),
49
                        TaxeditorMolecularPlugin.PLUGIN_ID,  e, false);  //TODO set pluginID
50
			}
51
            return true;
52
		}
53
		else {
54
		    return false;
55
		}
56
	}
57
}
(4-4/5)