Project

General

Profile

« Previous | Next » 

Revision 686d4023

Added by Katja Luther over 6 years ago

remove SelectionViewMenu because it is not used anymore

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionViewMenu.java
1
// $Id$
2
/**
3
* Copyright (C) 2017 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
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.
9
*/
10
package eu.etaxonomy.taxeditor.ui.dialog.selection;
11

  
12
import java.util.List;
13

  
14
import org.eclipse.e4.ui.di.AboutToShow;
15
import org.eclipse.e4.ui.model.application.commands.MCommand;
16
import org.eclipse.e4.ui.model.application.commands.MCommandsFactory;
17
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
18
import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
19
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
20
import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
21

  
22
import eu.etaxonomy.cdm.model.common.TermVocabulary;
23
import eu.etaxonomy.cdm.model.location.NamedArea;
24
import eu.etaxonomy.taxeditor.l10n.Messages;
25

  
26
/**
27
 * @author k.luther
28
 * @date 20.11.2017
29
 *
30
 */
31
public class SelectionViewMenu {
32

  
33
    public static final String COMMAND_ID = "taxeditor-selection.command.selectViewMenu"; //$NON-NLS-1$
34
    public static final String COMMAND_PARAMETER_VOCABULARY = COMMAND_ID+".vocabulary"; //$NON-NLS-1$
35
    public static final String COMMAND_PARAMETER_VOCABULARY_STATE = COMMAND_ID+".state"; //$NON-NLS-1$
36

  
37
    @AboutToShow
38
    public void aboutToShow(List<MMenuElement> items, List<TermVocabulary> vocabularies) {
39

  
40
        MMenu menu = MMenuFactory.INSTANCE.createMenu();
41
        menu.setLabel(Messages.SelectionViewMenu_selectVocabulary);
42
        items.add(menu);
43
        for(TermVocabulary<NamedArea> vocabulary: vocabularies){
44
            createMenuItem(menu, vocabulary);
45
        }
46
    }
47

  
48

  
49
    private void createMenuItem(MMenu menu, final TermVocabulary<NamedArea> vocabulary) {
50

  
51
        MMenu subMenu = MMenuFactory.INSTANCE.createMenu();
52
        subMenu.setLabel(String.format(Messages.SelectionViewMenu_SET_FLAG, vocabulary.getLabel()));
53
        menu.getChildren().add(subMenu);
54

  
55
        MHandledMenuItem subMenuItemYes = MMenuFactory.INSTANCE.createHandledMenuItem();
56
        subMenuItemYes.setLabel(Messages.SelectionViewMenu_4_YES);
57
        MCommand mCommandYes = MCommandsFactory.INSTANCE.createCommand();
58
        mCommandYes.setElementId(COMMAND_ID);
59
        //set params
60
        subMenuItemYes.getTransientData().put(COMMAND_PARAMETER_VOCABULARY, vocabulary);
61
        subMenuItemYes.getTransientData().put(COMMAND_PARAMETER_VOCABULARY_STATE, true);
62
        subMenuItemYes.setCommand(mCommandYes);
63
        subMenu.getChildren().add(subMenuItemYes);
64

  
65
        MHandledMenuItem subMenuItemNo = MMenuFactory.INSTANCE.createHandledMenuItem();
66
        subMenuItemNo.setLabel(Messages.SelectionViewMenu_NO);
67
        MCommand mCommandNo = MCommandsFactory.INSTANCE.createCommand();
68
        mCommandNo.setElementId(COMMAND_ID);
69
//        //set params
70
//        subMenuItemNo.getTransientData().put(COMMAND_PARAMETER_MARKER_TYPE, markerType);
71
//        subMenuItemNo.getTransientData().put(COMMAND_PARAMETER_MARKER_STATE, false);
72
//        subMenuItemNo.setCommand(mCommandNo);
73
//        subMenu.getChildren().add(subMenuItemNo);
74
    }
75
}

Also available in: Unified diff