Project

General

Profile

« Previous | Next » 

Revision 3699c749

Added by Katja Luther about 6 years ago

ref #7227: check for empty selection for menu creation

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/DeleteHandlerE4.java
23 23
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
24 24
import org.eclipse.e4.ui.services.IServiceConstants;
25 25
import org.eclipse.jface.dialogs.MessageDialog;
26
import org.eclipse.jface.viewers.StructuredSelection;
26 27
import org.eclipse.swt.widgets.Shell;
27 28

  
28 29
import eu.etaxonomy.cdm.api.application.ICdmRepository;
......
253 254
    }
254 255

  
255 256
    @CanExecute
256
    public boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)Object selection,
257
    public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
257 258
            MHandledMenuItem menuItem){
258 259
        boolean canExecute = false;
259
        canExecute = selection!=null;
260
        StructuredSelection selection = (StructuredSelection)((BulkEditorE4)activePart.getObject()).getViewer().getSelection();
261
        canExecute = !selection.isEmpty();
260 262
        menuItem.setVisible(canExecute);
261 263
        return canExecute;
262 264
    }

Also available in: Unified diff