Revision 459dc5dc
Added by Niels Hoffmann almost 13 years ago
eu.etaxonomy.taxeditor.editor/plugin.xml | ||
---|---|---|
465 | 465 |
commandId="taxeditor-editor.newimage" |
466 | 466 |
label="New Image" |
467 | 467 |
style="push"> |
468 |
<visibleWhen> |
|
469 |
<reference |
|
470 |
definitionId="isImageGallery"> |
|
471 |
</reference> |
|
472 |
</visibleWhen> |
|
468 | 473 |
</command> |
469 | 474 |
<command |
470 | 475 |
commandId="taxeditor-editor.command.moveimgdown" |
... | ... | |
918 | 923 |
</test> |
919 | 924 |
</with> |
920 | 925 |
</definition> |
926 |
<definition |
|
927 |
id="isImageGallery"> |
|
928 |
<with |
|
929 |
variable="selection"> |
|
930 |
<test |
|
931 |
property="eu.etaxonomy.taxeditor.descriptions.propertyTester.isImageGallery"> |
|
932 |
</test> |
|
933 |
</with> |
|
934 |
</definition> |
|
921 | 935 |
</extension> |
922 | 936 |
<extension |
923 | 937 |
point="org.eclipse.core.expressions.propertyTesters"> |
... | ... | |
932 | 946 |
class="eu.etaxonomy.taxeditor.editor.view.descriptive.handler.DescriptionsMenuPropertyTester" |
933 | 947 |
id="eu.etaxonomy.taxeditor.descriptions.PropertyTester" |
934 | 948 |
namespace="eu.etaxonomy.taxeditor.descriptions.propertyTester" |
935 |
properties="isMedia,isDescription,isDescriptionElement,isDeletable,isFeatureNodeContainer" |
|
949 |
properties="isMedia,isDescription,isDescriptionElement,isDeletable,isFeatureNodeContainer,isImageGallery"
|
|
936 | 950 |
type="org.eclipse.jface.viewers.TreeSelection"> |
937 | 951 |
</propertyTester> |
938 | 952 |
</extension> |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DescriptionsMenuPropertyTester.java | ||
---|---|---|
25 | 25 |
private static final String DESCRIPTION = "isDescription"; |
26 | 26 |
private static final String DESCRIPTION_ELEMENT = "isDescriptionElement"; |
27 | 27 |
private static final String DELETABLE = "isDeletable"; |
28 |
private static final String IMAGE_GALLERY = "isImageGallery"; |
|
28 | 29 |
|
29 | 30 |
/* (non-Javadoc) |
30 | 31 |
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object) |
... | ... | |
55 | 56 |
else if(DELETABLE.equals(property)){ |
56 | 57 |
return isDeletable(selectedElements); |
57 | 58 |
} |
59 |
else if(IMAGE_GALLERY.equals(property)){ |
|
60 |
return isImageGallery(selectedElements); |
|
61 |
} |
|
58 | 62 |
else{ |
59 | 63 |
return false; |
60 | 64 |
} |
61 | 65 |
} |
62 | 66 |
|
67 |
private boolean isImageGallery(Object[] selectedElements) { |
|
68 |
for (Object object : selectedElements){ |
|
69 |
if(!(object instanceof DescriptionBase) || !((DescriptionBase) object).isImageGallery()){ |
|
70 |
return false; |
|
71 |
} |
|
72 |
} |
|
73 |
return true; |
|
74 |
} |
|
75 |
|
|
63 | 76 |
private boolean isFeatureNodeContainer(Object[] selectedElements) { |
64 | 77 |
for (Object object : selectedElements){ |
65 | 78 |
if(!(object instanceof FeatureNodeContainer)){ |
Also available in: Unified diff
Fixes #2383