Project

General

Profile

Revision cdc15f8a

IDcdc15f8accf74799ae8c30dc10e3f105eb41a053
Parent 8b30f1cf
Child d4adfe28

Added by Katja Luther over 2 years ago

ref #7227: disable setMarker in bulkeditor if no entity is selected

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/command/DynamicMarkerTypeEditingMenuE4.java
13 13

  
14 14
import javax.inject.Named;
15 15

  
16
import org.eclipse.e4.core.di.annotations.CanExecute;
16 17
import org.eclipse.e4.ui.di.AboutToShow;
17 18
import org.eclipse.e4.ui.model.application.commands.MCommand;
18 19
import org.eclipse.e4.ui.model.application.commands.MCommandsFactory;
20
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
19 21
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
20 22
import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
21 23
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
22 24
import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
23 25
import org.eclipse.e4.ui.services.IServiceConstants;
26
import org.eclipse.jface.viewers.StructuredSelection;
24 27

  
28
import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
25 29
import eu.etaxonomy.cdm.model.common.MarkerType;
30
import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
26 31
import eu.etaxonomy.taxeditor.l10n.Messages;
27 32
import eu.etaxonomy.taxeditor.store.CdmStore;
28 33

  
......
79 84
	    subMenu.getChildren().add(subMenuItemNo);
80 85
	}
81 86

  
87
	 @CanExecute
88
	    public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
89
	            MHandledMenuItem menuItem){
90
	        boolean canExecute = false;
91
	        StructuredSelection selection = (StructuredSelection)((BulkEditorE4)activePart.getObject()).getViewer().getSelection();
92
	        canExecute = !selection.isEmpty() && selection.getFirstElement() instanceof IAnnotatableEntity;
93
	        menuItem.setVisible(canExecute);
94
	        return canExecute;
95
	    }
96

  
82 97
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)