Revision 369d3230
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RemotingMoveTaxonNodeHandlerE4.java | ||
---|---|---|
12 | 12 |
import java.util.List; |
13 | 13 |
import java.util.UUID; |
14 | 14 |
|
15 |
import javax.inject.Named; |
|
16 |
|
|
15 | 17 |
import org.eclipse.core.commands.operations.AbstractOperation; |
16 | 18 |
import org.eclipse.core.runtime.IStatus; |
17 | 19 |
import org.eclipse.core.runtime.Status; |
20 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
18 | 21 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
19 | 22 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
23 |
import org.eclipse.e4.ui.services.IServiceConstants; |
|
20 | 24 |
import org.eclipse.jface.dialogs.MessageDialog; |
21 | 25 |
import org.eclipse.jface.viewers.TreeSelection; |
22 | 26 |
import org.eclipse.swt.widgets.Shell; |
... | ... | |
133 | 137 |
return null; |
134 | 138 |
} |
135 | 139 |
|
140 |
@CanExecute |
|
141 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){ |
|
142 |
boolean canExecute = false; |
|
143 |
menuItem.setVisible(canExecute); |
|
144 |
canExecute = selection.getFirstElement() instanceof TaxonNode; |
|
145 |
return canExecute; |
|
146 |
} |
|
147 |
|
|
136 | 148 |
@Override |
137 | 149 |
public void onComplete() { |
138 | 150 |
} |
Also available in: Unified diff
ref #6909 Implement canExecute() for remoting handler