Project

General

Profile

« Previous | Next » 

Revision 91333bc6

Added by Patrick Plitzner over 6 years ago

ref #6908 Migrate remaining polytomous context menus and handlers

View differences:

eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/key/polytomous/e4/handler/RemotingEditPolytomousKeyNodesHandlerE4.java
14 14
import org.eclipse.core.runtime.IStatus;
15 15
import org.eclipse.core.runtime.Status;
16 16
import org.eclipse.core.runtime.jobs.Job;
17
import org.eclipse.e4.core.di.annotations.CanExecute;
17 18
import org.eclipse.e4.core.di.annotations.Execute;
18 19
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
20
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
19 21
import org.eclipse.e4.ui.services.IServiceConstants;
20 22
import org.eclipse.e4.ui.workbench.modeling.EPartService;
21 23
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
24
import org.eclipse.jface.viewers.IStructuredSelection;
22 25
import org.eclipse.jface.viewers.StructuredSelection;
23 26
import org.eclipse.swt.widgets.Display;
24 27

  
......
90 93
        }
91 94
    }
92 95

  
96
    @CanExecute
97
    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
98
            MHandledMenuItem menuItem){
99
        boolean canExecute = false;
100
        canExecute = ((IStructuredSelection)selection).getFirstElement() instanceof PolytomousKey;
101
        menuItem.setVisible(canExecute);
102
        return canExecute;
103
    }
104

  
93 105
}

Also available in: Unified diff