label="Specimen"
style="push">
</command>
+ <separator
+ name="eu.etaxonomy.navigation.menu.new.separator3">
+ </separator>
+ <command
+ commandId="eu.etaxonomy.taxeditor.editor.command.new.datasource"
+ label="Datasource"
+ style="push">
+ </command>
</menuContribution>
<menuContribution
locationURI="menu:eu.etaxonomy.taxeditor.menu.showView?before=eu.etaxonomy.taxeditor.store.showViewMenu.details">
id="eu.etaxonomy.taxeditor.editor.handler.openDerivateView"
name="Open Derivate View">
</command>
+ <command
+ categoryId="eu.etaxonomy.taxeditor.editor.new.category"
+ defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.CreateDataSourceHandler"
+ id="eu.etaxonomy.taxeditor.editor.command.new.datasource"
+ name="New Datasource">
+ </command>
</extension>
<extension
commandId="eu.etaxonomy.taxeditor.store.datasource.change"
label="Connect"
style="push">
+ <visibleWhen>
+ <with
+ variable="selection">
+ <not>
+ <test
+ property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
+ </test>
+ </not>
+ </with>
+ </visibleWhen>
</command>
<command
commandId="eu.etaxonomy.taxeditor.store.datasource.create"
commandId="eu.etaxonomy.taxeditor.store.datasource.edit"
label="Edit"
style="push">
+ <visibleWhen>
+ <with
+ variable="selection">
+ <not>
+ <test
+ property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
+ </test>
+ </not>
+ </with>
+ </visibleWhen>
</command>
<command
commandId="eu.etaxonomy.taxeditor.store.datasource.clone"
label="Clone"
style="push">
+ <visibleWhen>
+ <with
+ variable="selection">
+ <not>
+ <test
+ property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
+ </test>
+ </not>
+ </with>
+ </visibleWhen>
</command>
<separator
name="eu.etaxonomy.taxeditor.store.datasource.separator"
commandId="org.eclipse.ui.edit.delete"
label="Delete"
style="push">
+ <visibleWhen>
+ <with
+ variable="selection">
+ <not>
+ <test
+ property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
+ </test>
+ </not>
+ </with>
+ </visibleWhen>
</command>
<separator
name="eu.etaxonomy.taxeditor.store.datasource.separator2"
commandId="eu.etaxonomy.taxeditor.store.datasource.close"
label="Close Active Connection"
style="push">
+ <visibleWhen>
+ <with
+ variable="selection">
+ <not>
+ <test
+ property="eu.etaxonomy.taxeditor.datasource.propertyTester.test">
+ </test>
+ </not>
+ </with>
+ </visibleWhen>
</command>
<command
commandId="eu.etaxonomy.taxeditor.store.datasource.update"
</reference>
</not>
</visibleWhen>
+
</command>
</menuContribution>
<menuContribution
</reference></enabledWhen>
</handler>
</extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.ChangeConnectionHandler"
+ id="eu.etaxonomy.taxeditor.datasource.connect"
+ name="Connect">
+ </command>
+ </extension>
<extension
name="Popup Menu Commands"
point="org.eclipse.ui.commands">
namespace="eu.etaxonomy.taxeditor.datasource.propertyTester"
properties="isCompatible"
type="org.eclipse.jface.viewers.IStructuredSelection">
+ </propertyTester>
+ <propertyTester
+ class="eu.etaxonomy.taxeditor.view.datasource.handler.DataSourceMenuPropertyTester"
+ id="eu.etaxonomy.taxeditor.datasource.propertyTester"
+ namespace="eu.etaxonomy.taxeditor.datasource.propertyTester"
+ properties="test"
+ type="org.eclipse.jface.viewers.IStructuredSelection">
</propertyTester>
<propertyTester
class="eu.etaxonomy.taxeditor.preference.PreferencePropertyTester"
public class DataSourceMenuPropertyTester extends PropertyTester {
private static final String COMPATIBLE = "isCompatible";
+ private static final String TEST = "test";
/*
* (non-Javadoc)
Object[] selectedElements = ((IStructuredSelection) receiver).toArray();
- if (selectedElements.length == 0) {
+ if (selectedElements.length == 0 && property.equals(TEST)) {
// nothing selected so all tests should fail
- return false;
+ return true;
+ }
+ if (selectedElements.length == 0 && COMPATIBLE.equals(property)) {
+ // nothing selected so all tests should fail
+ return true;
}
if (COMPATIBLE.equals(property)) {
return isCompatible(selectedElements);
}
+
+
return false;
}
* @return
*/
private boolean isCompatible(Object[] selectedElements) {
+
+ if (selectedElements.length == 0 ) {
+ // nothing selected so all tests should fail
+ return false;
+ }
for (Object object : selectedElements) {
if (object instanceof CdmMetaDataAwareDataSourceContainer) {
}
}
return false;
+
}
}