Revision 0858c777
Added by Katja Luther almost 3 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/CreateDescriptionElementHandlerE4.java | ||
---|---|---|
82 | 82 |
public boolean canExecute(MHandledMenuItem menuItem, |
83 | 83 |
@Named(IServiceConstants.ACTIVE_SELECTION)IStructuredSelection selection){ |
84 | 84 |
boolean canExecute = false; |
85 |
canExecute = selection.size()==1 |
|
86 |
&& |
|
87 |
(selection.getFirstElement() instanceof DescriptionBase |
|
88 |
|| selection.getFirstElement() instanceof DescriptionElementBase |
|
89 |
|| selection.getFirstElement() instanceof FeatureNodeContainer); |
|
85 |
DescriptionBase description = null; |
|
86 |
Object object = selection.getFirstElement(); |
|
87 |
if(object instanceof FeatureNodeContainer){ |
|
88 |
description = ((FeatureNodeContainer) object).getDescription(); |
|
89 |
} |
|
90 |
else if(object instanceof DescriptionElementBase){ |
|
91 |
DescriptionElementBase elementBase = HibernateProxyHelper.deproxy(object, DescriptionElementBase.class); |
|
92 |
description = elementBase.getInDescription(); |
|
93 |
} |
|
94 |
else if (object instanceof DescriptionBase) { |
|
95 |
description = HibernateProxyHelper.deproxy(object, DescriptionBase.class); |
|
96 |
} |
|
97 |
if (description.isComputed()){ |
|
98 |
canExecute = false; |
|
99 |
menuItem.getParent().setVisible(false); |
|
100 |
}else{ |
|
101 |
canExecute = selection.size()==1 |
|
102 |
&& |
|
103 |
(selection.getFirstElement() instanceof DescriptionBase |
|
104 |
|| selection.getFirstElement() instanceof DescriptionElementBase |
|
105 |
|| selection.getFirstElement() instanceof FeatureNodeContainer); |
|
106 |
} |
|
90 | 107 |
menuItem.setVisible(canExecute); |
91 | 108 |
return canExecute; |
92 | 109 |
|
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/DeleteHandlerE4.java | ||
---|---|---|
205 | 205 |
MHandledMenuItem menuItem){ |
206 | 206 |
FactualDataPartE4 factualDataPart = (FactualDataPartE4) activePart.getObject(); |
207 | 207 |
ISelection selection = factualDataPart.getViewer().getSelection(); |
208 |
boolean canExecute = selection instanceof IStructuredSelection && !selection.isEmpty() && !(((IStructuredSelection)selection).getFirstElement() instanceof FeatureNodeContainer); |
|
208 |
boolean canExecute = true; |
|
209 |
if (selection instanceof IStructuredSelection && !selection.isEmpty()){ |
|
210 |
IStructuredSelection sel = (IStructuredSelection) selection; |
|
211 |
if (sel.getFirstElement() instanceof FeatureNodeContainer){ |
|
212 |
canExecute = false; |
|
213 |
}else if (sel.getFirstElement() instanceof DescriptionBase){ |
|
214 |
if (((DescriptionBase)sel.getFirstElement()).isComputed()){ |
|
215 |
canExecute = false; |
|
216 |
} |
|
217 |
}else if (sel.getFirstElement() instanceof DescriptionElementBase){ |
|
218 |
if (((DescriptionElementBase)sel.getFirstElement()).getInDescription().isComputed()){ |
|
219 |
canExecute = false; |
|
220 |
} |
|
221 |
} |
|
222 |
|
|
223 |
} |
|
224 |
canExecute &= selection instanceof IStructuredSelection && !selection.isEmpty() && !(((IStructuredSelection)selection).getFirstElement() instanceof FeatureNodeContainer); |
|
209 | 225 |
|
210 | 226 |
menuItem.setVisible(canExecute); |
211 | 227 |
return canExecute; |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/DynamicFeatureMenuE4.java | ||
---|---|---|
55 | 55 |
Object selectedElement = selection.getFirstElement(); |
56 | 56 |
|
57 | 57 |
if (selectedElement instanceof DescriptionBase<?>) { |
58 |
if (((DescriptionBase<?>) selectedElement).isComputed()){ |
|
59 |
items.remove(menu); |
|
60 |
return; |
|
61 |
} |
|
58 | 62 |
TermTree<?> featureTree = getFeatureTree((DescriptionBase<?>) selectedElement); |
59 | 63 |
|
60 | 64 |
for (TermNode<?> childNode : featureTree.getRootChildren()) { |
61 | 65 |
createMenuItem(menu, childNode.getTerm(), globalLanguage); |
62 | 66 |
} |
63 | 67 |
} else if (selectedElement instanceof FeatureNodeContainer) { |
68 |
if (((FeatureNodeContainer) selectedElement).getDescription().isComputed()){ |
|
69 |
items.remove(menu); |
|
70 |
return; |
|
71 |
} |
|
64 | 72 |
TermNode<?> featureNode = ((FeatureNodeContainer) selectedElement) |
65 | 73 |
.getFeatureNode(); |
66 | 74 |
|
... | ... | |
78 | 86 |
} |
79 | 87 |
|
80 | 88 |
} else if (selectedElement instanceof DescriptionElementBase) { |
89 |
if (((DescriptionElementBase) selectedElement).getInDescription().isComputed()){ |
|
90 |
items.remove(menu); |
|
91 |
return; |
|
92 |
} |
|
81 | 93 |
Feature feature = ((DescriptionElementBase) selectedElement) |
82 | 94 |
.getFeature(); |
83 | 95 |
createMenuItem(menu, feature, globalLanguage); |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionElementsHandlerE4.java | ||
---|---|---|
234 | 234 |
if(selection instanceof IStructuredSelection){ |
235 | 235 |
boolean selectionProviding = factualDataPart.getSelectionProvidingPart().getObject() instanceof TaxonNameEditorE4; |
236 | 236 |
Object firstElement = ((IStructuredSelection) selection).getFirstElement(); |
237 |
canExecute = (firstElement instanceof FeatureNodeContainer && !(((FeatureNodeContainer)firstElement).getContainerTree().getDescription() instanceof TaxonNameDescription)) |
|
238 |
|| (firstElement instanceof DescriptionElementBase && !(((DescriptionElementBase)firstElement).getInDescription() instanceof TaxonNameDescription)) ; |
|
237 |
|
|
238 |
canExecute = ((firstElement instanceof FeatureNodeContainer && !(((FeatureNodeContainer)firstElement).getContainerTree().getDescription() instanceof TaxonNameDescription)) |
|
239 |
|| (firstElement instanceof DescriptionElementBase && !(((DescriptionElementBase)firstElement).getInDescription() instanceof TaxonNameDescription))) |
|
240 |
&& ((firstElement instanceof FeatureNodeContainer && !(((FeatureNodeContainer)firstElement).getDescription().isComputed())) |
|
241 |
|| (firstElement instanceof DescriptionElementBase && !(((DescriptionElementBase)firstElement).getInDescription().isComputed()))) ; |
|
239 | 242 |
menuItem.setVisible(canExecute); |
240 | 243 |
} |
241 | 244 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionElementsSetNameInSourceHandlerE5.java | ||
---|---|---|
234 | 234 |
if(selection instanceof IStructuredSelection){ |
235 | 235 |
boolean selectionProviding = factualDataPart.getSelectionProvidingPart().getObject() instanceof TaxonNameEditorE4; |
236 | 236 |
Object firstElement = ((IStructuredSelection) selection).getFirstElement(); |
237 |
canExecute = (firstElement instanceof FeatureNodeContainer && !(((FeatureNodeContainer)firstElement).getContainerTree().getDescription() instanceof TaxonNameDescription)) |
|
238 |
|| (firstElement instanceof DescriptionElementBase && !(((DescriptionElementBase)firstElement).getInDescription() instanceof TaxonNameDescription)) ; |
|
237 |
canExecute = ((firstElement instanceof FeatureNodeContainer && !(((FeatureNodeContainer)firstElement).getContainerTree().getDescription() instanceof TaxonNameDescription)) |
|
238 |
|| (firstElement instanceof DescriptionElementBase && !(((DescriptionElementBase)firstElement).getInDescription() instanceof TaxonNameDescription))) |
|
239 |
&& ((firstElement instanceof FeatureNodeContainer && !(((FeatureNodeContainer)firstElement).getDescription().isComputed())) |
|
240 |
|| (firstElement instanceof DescriptionElementBase && !(((DescriptionElementBase)firstElement).getInDescription().isComputed()))) ; |
|
239 | 241 |
menuItem.setVisible(canExecute); |
240 | 242 |
} |
241 | 243 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionToOtherTaxonHandlerE4.java | ||
---|---|---|
184 | 184 |
if(selection instanceof IStructuredSelection){ |
185 | 185 |
Object firstElement = ((IStructuredSelection) selection).getFirstElement(); |
186 | 186 |
canExecute = ((IStructuredSelection) selection).size()==1 |
187 |
&& firstElement instanceof DescriptionBase && !(firstElement instanceof TaxonNameDescription); |
|
187 |
&& firstElement instanceof DescriptionBase && !(firstElement instanceof TaxonNameDescription) && !((DescriptionBase)firstElement).isComputed();
|
|
188 | 188 |
menuItem.setVisible(canExecute); |
189 | 189 |
} |
190 | 190 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/e4/handler/MoveDescriptionToOtherTaxonSetNameInSourceHandlerE5.java | ||
---|---|---|
186 | 186 |
if(selection instanceof IStructuredSelection){ |
187 | 187 |
Object firstElement = ((IStructuredSelection) selection).getFirstElement(); |
188 | 188 |
canExecute = ((IStructuredSelection) selection).size()==1 |
189 |
&& firstElement instanceof DescriptionBase && !(firstElement instanceof TaxonNameDescription); |
|
189 |
&& firstElement instanceof DescriptionBase && !(firstElement instanceof TaxonNameDescription) && !((DescriptionBase)firstElement).isComputed();
|
|
190 | 190 |
menuItem.setVisible(canExecute); |
191 | 191 |
} |
192 | 192 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionDetailElement.java | ||
---|---|---|
51 | 51 |
.collect(Collectors.joining(",")); |
52 | 52 |
txtDescriptionTypes = formFactory.createTextWithLabelElement(formElement, "Types", typesString, style); |
53 | 53 |
txtDescriptionTypes.setEnabled(false); |
54 |
|
|
54 | 55 |
} |
55 | 56 |
|
57 |
@Override |
|
58 |
protected void updateControlStates(){ |
|
59 |
|
|
60 |
if (getEntity().isComputed()){ |
|
61 |
enabled = false; |
|
62 |
}else{ |
|
63 |
enabled = true; |
|
64 |
} |
|
65 |
setEnabled(enabled); |
|
66 |
} |
|
67 |
|
|
56 | 68 |
@Override |
57 | 69 |
protected void updateContent() { |
58 | 70 |
super.updateContent(); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementDetailElement.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.taxeditor.ui.section.description; |
11 | 11 |
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.Collection; |
|
14 |
|
|
12 | 15 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
13 | 16 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
14 | 17 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
18 |
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement; |
|
15 | 19 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; |
16 | 20 |
|
17 | 21 |
/** |
... | ... | |
35 | 39 |
ICdmFormElement formElement, int style) { |
36 | 40 |
super(cdmFormFactory, formElement); |
37 | 41 |
} |
38 |
|
|
42 |
|
|
39 | 43 |
/** {@inheritDoc} */ |
40 | 44 |
@Override |
41 | 45 |
protected void createControls(ICdmFormElement formElement, DescriptionElementBase entity, int style) { |
42 | 46 |
formFactory.createDetailedDescriptionDetailElement(formElement, entity, style, isEnabled()); |
43 | 47 |
} |
44 |
|
|
48 |
|
|
45 | 49 |
/** {@inheritDoc} */ |
46 | 50 |
@Override |
47 | 51 |
public void handleEvent(Object eventSource) { |
48 |
|
|
52 |
|
|
49 | 53 |
} |
54 |
|
|
55 |
@Override |
|
56 |
protected void updateControlStates(){ |
|
57 |
Collection<Object> except = new ArrayList<Object>(); |
|
58 |
for(ICdmFormElement formElement:getElements()){ |
|
59 |
if(formElement instanceof IEnableableFormElement && !((IEnableableFormElement) formElement).isEnabled()){ |
|
60 |
except.add(formElement); |
|
61 |
} |
|
62 |
} |
|
63 |
if (getEntity().getInDescription().isComputed()){ |
|
64 |
enabled = false; |
|
65 |
}else{ |
|
66 |
enabled = true; |
|
67 |
} |
|
68 |
setEnabled(enabled, except); |
|
69 |
} |
|
50 | 70 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementMediaSection.java | ||
---|---|---|
43 | 43 |
this.setVisible(false); |
44 | 44 |
} |
45 | 45 |
super.setEntity(entity); |
46 |
if (entity.getInDescription().isComputed()){ |
|
47 |
this.setEnabled(false); |
|
48 |
} |
|
46 | 49 |
} |
47 | 50 |
|
48 | 51 |
/** {@inheritDoc} */ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/DescriptionElementSourceSection.java | ||
---|---|---|
58 | 58 |
Collection<OriginalSourceBase> sources = new HashSet<>(); |
59 | 59 |
sources.addAll(entity.getSources()); |
60 | 60 |
sources.addAll(entity.getInDescription().getSources()); |
61 |
if (entity.getInDescription().isComputed()){ |
|
62 |
this.setEnabled(false); |
|
63 |
} |
|
61 | 64 |
return sources; |
62 | 65 |
} |
63 | 66 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/detail/DistributionDetailElement.java | ||
---|---|---|
108 | 108 |
} |
109 | 109 |
CdmPreference pref = CdmPreferenceCache.instance().get(key); |
110 | 110 |
// if there is no preference for the area, look for the general |
111 |
if (pref == null || pref.isAllowOverride()){
|
|
111 |
if (pref == null ){ |
|
112 | 112 |
pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionStatus.getKey())); |
113 | 113 |
} |
114 | 114 |
|
Also available in: Unified diff
ref #8471: disable computed descriptions