Revision 43ed2498
Added by Katja Luther over 4 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/SetExcludedHandler.java | ||
---|---|---|
20 | 20 |
import org.eclipse.swt.widgets.Shell; |
21 | 21 |
|
22 | 22 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto; |
23 |
import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetUnplacedExcludedOperation; |
|
23 |
import eu.etaxonomy.taxeditor.navigation.navigator.operation.SetUnplacedExcludedDoubtfulOperation;
|
|
24 | 24 |
|
25 | 25 |
/** |
26 | 26 |
* @author k.luther |
27 | 27 |
* @since 11.10.2018 |
28 | 28 |
* |
29 | 29 |
*/ |
30 |
public class SetExcludedHandler extends UnplacedExcludedHandler { |
|
30 |
public class SetExcludedHandler extends UnplacedExcludedDoubtfulHandler {
|
|
31 | 31 |
|
32 | 32 |
@Override |
33 | 33 |
public AbstractOperation prepareOperation(IStructuredSelection selection, |
34 | 34 |
Shell shell, |
35 | 35 |
MPart activePart, |
36 | 36 |
MHandledMenuItem menuItem) { |
37 |
SetUnplacedExcludedOperation operation = |
|
38 |
new SetUnplacedExcludedOperation(getTrigger(), |
|
37 |
SetUnplacedExcludedDoubtfulOperation operation =
|
|
38 |
new SetUnplacedExcludedDoubtfulOperation(getTrigger(),
|
|
39 | 39 |
true, |
40 | 40 |
taxonNodes, |
41 |
null, true); |
|
41 |
null, true, null);
|
|
42 | 42 |
|
43 | 43 |
return operation; |
44 | 44 |
} |
... | ... | |
47 | 47 |
private boolean canExecute(@Named(IServiceConstants.ACTIVE_SELECTION)TreeSelection selection, MHandledMenuItem menuItem){ |
48 | 48 |
boolean canExecute = !selection.isEmpty(); |
49 | 49 |
Object[] array = selection.toArray(); |
50 |
boolean isClassification = false; |
|
50 | 51 |
for (Object object : array) { |
51 |
canExecute &= (object instanceof TaxonNodeDto) && (((TaxonNodeDto)object).getUuid() != null) && !((TaxonNodeDto)object).isExcluded(); |
|
52 |
canExecute &= (object instanceof TaxonNodeDto) && (((TaxonNodeDto)object).getUuid() != null) && !((TaxonNodeDto)object).isExcluded() && ((TaxonNodeDto)object).getTaxonUuid() != null; |
|
53 |
isClassification = isClassification || ((TaxonNodeDto)object).getTaxonUuid() == null; |
|
52 | 54 |
} |
53 |
menuItem.setVisible(canExecute); |
|
55 |
menuItem.setVisible(canExecute || isClassification);
|
|
54 | 56 |
return canExecute; |
55 | 57 |
} |
56 | 58 |
|
Also available in: Unified diff
ref #8282: add setDoubtful to setFlag menu in navigator