Project

General

Profile

« Previous | Next » 

Revision 38b32a1d

Added by Patrick Plitzner almost 6 years ago

ref #7010 Adapt name editor handlers for multiple selection

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeSynonymToAcceptedTaxonHandlerE4.java
135 135
    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
136 136
            MHandledMenuItem menuItem){
137 137
        boolean canExecute = false;
138
        Object selectedElement = selection.getFirstElement();
139
        canExecute =
140
                NameEditorMenuPropertyTester.isNotHomotypicSynonymOfAcceptedTaxon(selectedElement)
141
                && !NameEditorMenuPropertyTester.isAccepted(selectedElement)
142
                && !NameEditorMenuPropertyTester.isMisapplication(selectedElement)
143
                && !NameEditorMenuPropertyTester.isProparteSynonym(selectedElement);
144
        menuItem.setVisible(canExecute);
138
        if(selection.size()==1){
139
            Object selectedElement = selection.getFirstElement();
140
            canExecute =
141
                    NameEditorMenuPropertyTester.isNotHomotypicSynonymOfAcceptedTaxon(selectedElement)
142
                    && !NameEditorMenuPropertyTester.isAccepted(selectedElement)
143
                    && !NameEditorMenuPropertyTester.isMisapplication(selectedElement)
144
                    && !NameEditorMenuPropertyTester.isProparteSynonym(selectedElement);
145
            menuItem.setVisible(canExecute);
146
        }
145 147
        return canExecute;
146 148
    }
147 149

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeToMisapplicationHandlerE4.java
73 73
    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
74 74
            MHandledMenuItem menuItem){
75 75
        boolean canExecute = false;
76
        Object selectedElement = selection.getFirstElement();
77
        canExecute =
78
                !NameEditorMenuPropertyTester.isAccepted(selectedElement)
79
                && !NameEditorMenuPropertyTester.isMisapplication(selectedElement);
76
        if(selection.size()==1){
77
            Object selectedElement = selection.getFirstElement();
78
            canExecute =
79
                    !NameEditorMenuPropertyTester.isAccepted(selectedElement)
80
                    && !NameEditorMenuPropertyTester.isMisapplication(selectedElement);
81
        }
82
        menuItem.setVisible(canExecute);
80 83
        return canExecute;
81 84
    }
82 85

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeToProParteSynonymHandlerE5.java
72 72
    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
73 73
            MHandledMenuItem menuItem){
74 74
        boolean canExecute = false;
75
        Object selectedElement = selection.getFirstElement();
76
        canExecute =
77
                !NameEditorMenuPropertyTester.isAccepted(selectedElement)
78
                && !NameEditorMenuPropertyTester.isProparteSynonym(selectedElement);
75
        if(selection.size()==1){
76
            Object selectedElement = selection.getFirstElement();
77
            canExecute =
78
                    !NameEditorMenuPropertyTester.isAccepted(selectedElement)
79
                    && !NameEditorMenuPropertyTester.isProparteSynonym(selectedElement);
80
        }
81
        menuItem.setVisible(canExecute);
79 82
        return canExecute;
80 83
    }
81 84

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeToSynonymHandlerE4.java
57 57
    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
58 58
            MHandledMenuItem menuItem){
59 59
        boolean canExecute = false;
60
        Object selectedElement = selection.getFirstElement();
61
        canExecute =
62
                !NameEditorMenuPropertyTester.isAccepted(selectedElement)
63
                && !NameEditorMenuPropertyTester.isSynonym(selectedElement);
60
        if(selection.size()==1){
61
            Object selectedElement = selection.getFirstElement();
62
            canExecute =
63
                    !NameEditorMenuPropertyTester.isAccepted(selectedElement)
64
                    && !NameEditorMenuPropertyTester.isSynonym(selectedElement);
65
        }
66
        menuItem.setVisible(canExecute);
64 67
        return canExecute;
65 68
    }
66 69

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/DeleteAllEmptyNamesHandlerE4.java
34 34
    @Override
35 35
    @Execute
36 36
    public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
37
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selectedElement,
37
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
38 38
            @Named(IServiceConstants.ACTIVE_SHELL)Shell shell,
39 39
            MHandledMenuItem menuItem,
40 40
            UISynchronize sync) {
......
58 58
        editor = (TaxonNameEditorE4) activePart.getObject();
59 59

  
60 60
        boolean canExecute = false;
61
        Object selectedElement = selection.getFirstElement();
62 61
        canExecute = editor.checkForEmptyNames();
63 62
        menuItem.setVisible(canExecute);
64 63
        return canExecute;
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/DeleteTaxonBaseHandlerE4.java
151 151

  
152 152
    @CanExecute
153 153
    public boolean canExecute(
154
            @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
154
            @SuppressWarnings("unused") @Named(IServiceConstants.ACTIVE_PART)MPart activePart,
155 155
            @Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
156 156
            MHandledMenuItem menuItem){
157 157
        boolean canExecute = false;
158
        Object selectedElement = selection.getFirstElement();
159
        canExecute =
160
                NameEditorMenuPropertyTester.isSynonym(selectedElement)
161
                || NameEditorMenuPropertyTester.isMisapplication(selectedElement)
162
                || NameEditorMenuPropertyTester.isRelatedConcept(selectedElement);
158
        if(selection.size()==1){
159
            Object selectedElement = selection.getFirstElement();
160
            canExecute =
161
                    NameEditorMenuPropertyTester.isSynonym(selectedElement)
162
                    || NameEditorMenuPropertyTester.isMisapplication(selectedElement)
163
                    || NameEditorMenuPropertyTester.isRelatedConcept(selectedElement);
164
        }
163 165
        menuItem.setVisible(canExecute);
164 166
        return canExecute;
165 167
    }
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/MoveSynonymToAnotherAcceptedTaxonHandlerE4.java
98 98
    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
99 99
            MHandledMenuItem menuItem){
100 100
        boolean canExecute = false;
101
        Object selectedElement = selection.getFirstElement();
102
        canExecute =
103
                NameEditorMenuPropertyTester.isSynonym(selectedElement)
104
                        && NameEditorMenuPropertyTester.isNotHomotypicSynonymOfAcceptedTaxon(selectedElement);
105

  
101
        if(selection.size()==1){
102
            Object selectedElement = selection.getFirstElement();
103
            canExecute =
104
                    NameEditorMenuPropertyTester.isSynonym(selectedElement)
105
                    && NameEditorMenuPropertyTester.isNotHomotypicSynonymOfAcceptedTaxon(selectedElement);
106
        }
106 107
        menuItem.setVisible(canExecute);
107 108
        return canExecute;
108 109
    }
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/SetBasionymHandlerE4.java
55 55
    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
56 56
            MHandledMenuItem menuItem){
57 57
        boolean canExecute = false;
58
        Object selectedElement = selection.getFirstElement();
59
        canExecute =
60
                NameEditorMenuPropertyTester.isSynonymInHomotypicalGroupWithMoreSynonyms(selectedElement);
58
        if(selection.size()==1){
59
            Object selectedElement = selection.getFirstElement();
60
            canExecute = NameEditorMenuPropertyTester.isSynonymInHomotypicalGroupWithMoreSynonyms(selectedElement);
61
        }
61 62
        menuItem.setVisible(canExecute);
62 63
        return canExecute;
63 64
    }
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/SwapSynonymAndAcceptedHandlerE4.java
83 83
    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
84 84
            MHandledMenuItem menuItem){
85 85
        boolean canExecute = false;
86
        Object selectedElement = selection.getFirstElement();
87
        canExecute =
88
                NameEditorMenuPropertyTester.isSynonym(selectedElement);
86
        if(selection.size()==1){
87
            Object selectedElement = selection.getFirstElement();
88
            canExecute = NameEditorMenuPropertyTester.isSynonym(selectedElement);
89
        }
89 90
        menuItem.setVisible(canExecute);
90 91
        return canExecute;
91 92
    }

Also available in: Unified diff