Project

General

Profile

« Previous | Next » 

Revision 90cf660a

Added by Patrick Plitzner over 6 years ago

ref #6595 Set visibility of context menu items in name editor

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/SwapSynonymAndAcceptedHandlerE4.java
11 11

  
12 12
import javax.inject.Named;
13 13

  
14
import org.eclipse.e4.core.di.annotations.CanExecute;
14 15
import org.eclipse.e4.core.di.annotations.Execute;
15 16
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
16 17
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
......
26 27
import eu.etaxonomy.taxeditor.editor.EditorUtil;
27 28
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
28 29
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4;
30
import eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester;
29 31
import eu.etaxonomy.taxeditor.editor.name.operation.SwapSynonymAndAcceptedOperation;
30 32
import eu.etaxonomy.taxeditor.model.AbstractUtility;
31 33
import eu.etaxonomy.taxeditor.model.MessagingUtils;
......
68 70

  
69 71
    }
70 72

  
73
    @CanExecute
74
    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection,
75
            MHandledMenuItem menuItem){
76
        boolean canExecute = false;
77
        Object selectedElement = selection.getFirstElement();
78
        canExecute =
79
                NameEditorMenuPropertyTester.isSynonym(selectedElement);
80
        menuItem.setVisible(canExecute);
81
        return canExecute;
82
    }
83

  
71 84
    @Override
72 85
    public boolean postOperation(CdmBase objectAffectedByOperation) {
73 86
        // Redraw existing editor

Also available in: Unified diff