fixes #783
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / preference / FeatureMenuPreferences.java
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.preference;
10
11 import org.eclipse.jface.viewers.StructuredSelection;
12 import org.eclipse.jface.wizard.WizardDialog;
13 import org.eclipse.swt.events.MouseAdapter;
14 import org.eclipse.swt.events.MouseEvent;
15
16 import eu.etaxonomy.cdm.model.common.VocabularyEnum;
17 import eu.etaxonomy.cdm.model.description.Feature;
18 import eu.etaxonomy.taxeditor.preference.wizards.VocabularyTermWizard;
19 import eu.etaxonomy.taxeditor.store.StoreUtil;
20 import eu.etaxonomy.taxeditor.store.VocabularyStore;
21
22 /**
23 * @author p.ciardelli
24 * @created 17.09.2008
25 * @version 1.0
26 * @author n.hoffmann
27 */
28 public class FeatureMenuPreferences extends AbstractMenuPreferences<Feature> {
29
30 public static final String PLUGIN_ID = "eu.etaxonomy.taxeditor.preferences.feature";
31
32 public FeatureMenuPreferences() {
33 super(VocabularyStore.getFeatures(),
34 "Feature Preferences",
35 "Choose which features you would like to use for descriptive elements.",
36 true);
37 }
38
39 /* (non-Javadoc)
40 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences#addEditButtonListeners()
41 *
42 * TODO refactor into superclass
43 */
44 @Override
45 protected void addNewButtonListeners() {
46 newButton.addMouseListener(new MouseAdapter(){
47
48 /* (non-Javadoc)
49 * @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
50 */
51 @Override
52 public void mouseUp(MouseEvent e) {
53 super.mouseUp(e);
54 VocabularyTermWizard<Feature> wizard = new VocabularyTermWizard<Feature>(VocabularyEnum.Feature);
55
56 WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard);
57 dialog.open();
58
59 tableViewer.setInput(VocabularyStore.getFeatures());
60 }
61
62 });
63 }
64
65 /* (non-Javadoc)
66 * @see eu.etaxonomy.taxeditor.preference.AbstractMenuPreferences#addEditButtonListeners()
67 *
68 * TODO refactor into superclass
69 */
70 // @Override
71 // protected void addDeleteButtonListeners() {
72 // removeButton.addMouseListener(new MouseAdapter(){
73 //
74 // /* (non-Javadoc)
75 // * @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
76 // */
77 // @Override
78 // public void mouseUp(MouseEvent e) {
79 // super.mouseUp(e);
80 //
81 // Feature selected = (Feature) ((StructuredSelection) tableViewer.getSelection()).getFirstElement();
82 //
83 // VocabularyStore.delete(selected);
84 //
85 //
86 // tableViewer.setInput(VocabularyStore.getFeatures());
87 // }
88 //
89 // });
90 // }
91 }