Revision 369d3230
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RemotingChangeAcceptedTaxonToSynonymHandlerE4.java | ||
---|---|---|
7 | 7 |
import java.util.List; |
8 | 8 |
import java.util.UUID; |
9 | 9 |
|
10 |
import javax.inject.Named; |
|
11 |
|
|
10 | 12 |
import org.eclipse.core.commands.operations.AbstractOperation; |
11 | 13 |
import org.eclipse.core.runtime.IStatus; |
12 | 14 |
import org.eclipse.core.runtime.Status; |
15 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
|
13 | 16 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
14 | 17 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
18 |
import org.eclipse.e4.ui.services.IServiceConstants; |
|
15 | 19 |
import org.eclipse.jface.viewers.TreeSelection; |
16 | 20 |
import org.eclipse.swt.widgets.Shell; |
17 | 21 |
|
... | ... | |
113 | 117 |
return rcattso; |
114 | 118 |
} |
115 | 119 |
|
120 |
@CanExecute |
|
121 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){ |
|
122 |
boolean canExecute = false; |
|
123 |
menuItem.setVisible(canExecute); |
|
124 |
canExecute = selection.getFirstElement() instanceof TaxonNode; |
|
125 |
System.out.println(canExecute); |
|
126 |
return canExecute; |
|
127 |
} |
|
128 |
|
|
116 | 129 |
@Override |
117 | 130 |
public void onComplete() { |
118 | 131 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RemotingDeleteTaxonNodeHandlerE4.java | ||
---|---|---|
12 | 12 |
import java.util.Iterator; |
13 | 13 |
import java.util.Set; |
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; |
... | ... | |
27 | 31 |
import eu.etaxonomy.cdm.api.service.config.TaxonNodeDeletionConfigurator; |
28 | 32 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
29 | 33 |
import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode; |
34 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
|
30 | 35 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
31 | 36 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
32 | 37 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
... | ... | |
148 | 153 |
config); |
149 | 154 |
} |
150 | 155 |
|
156 |
@CanExecute |
|
157 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){ |
|
158 |
boolean canExecute = false; |
|
159 |
menuItem.setVisible(canExecute); |
|
160 |
canExecute = !selection.isEmpty() && !(selection.getFirstElement() instanceof Synonym); |
|
161 |
return canExecute; |
|
162 |
} |
|
163 |
|
|
151 | 164 |
@Override |
152 | 165 |
public void onComplete() { |
153 | 166 |
} |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RemotingMoveFactualDataHandlerE4.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.viewers.TreeSelection; |
21 | 25 |
import org.eclipse.swt.widgets.Display; |
22 | 26 |
import org.eclipse.swt.widgets.Shell; |
... | ... | |
114 | 118 |
targetTaxonNode.getTaxon().getUuid()); |
115 | 119 |
} |
116 | 120 |
|
121 |
@CanExecute |
|
122 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){ |
|
123 |
boolean canExecute = false; |
|
124 |
menuItem.setVisible(canExecute); |
|
125 |
canExecute = selection.getFirstElement() instanceof TaxonNode; |
|
126 |
return canExecute; |
|
127 |
} |
|
128 |
|
|
117 | 129 |
@Override |
118 | 130 |
public void onComplete() { |
119 | 131 |
Display.getDefault().asyncExec(new Runnable(){ |
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 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/e4/RemotingCdmHandlerE4.java | ||
---|---|---|
33 | 33 |
public abstract class RemotingCdmHandlerE4 { |
34 | 34 |
|
35 | 35 |
private final String label; |
36 |
|
|
36 | 37 |
@Inject |
37 | 38 |
protected EPartService partService; |
38 | 39 |
|
Also available in: Unified diff
ref #6909 Implement canExecute() for remoting handler