Revision b60e0894
Added by Patrick Plitzner about 8 years ago
eu.etaxonomy.taxeditor.editor/plugin.xml | ||
---|---|---|
787 | 787 |
class="eu.etaxonomy.taxeditor.editor.view.derivate.contextMenu.DerivateViewContextMenu" |
788 | 788 |
id="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateContextMenu"> |
789 | 789 |
</dynamic> |
790 |
<command |
|
791 |
commandId="eu.etaxonomy.taxeditor.editor.derivative.toggleLinkWithTaxonSelection" |
|
792 |
label="Link with taxon selection" |
|
793 |
style="push"> |
|
794 |
<visibleWhen |
|
795 |
checkEnabled="true"> |
|
796 |
<not> |
|
797 |
<reference |
|
798 |
definitionId="isDerivativeEditorLinkedToTaxonSelection"> |
|
799 |
</reference> |
|
800 |
</not> |
|
801 |
</visibleWhen> |
|
802 |
</command> |
|
803 |
<command |
|
804 |
commandId="eu.etaxonomy.taxeditor.editor.derivative.toggleLinkWithTaxonSelection" |
|
805 |
label="Unlink from taxon selection" |
|
806 |
style="push"> |
|
807 |
<visibleWhen |
|
808 |
checkEnabled="true"> |
|
809 |
<reference |
|
810 |
definitionId="isDerivativeEditorLinkedToTaxonSelection"> |
|
811 |
</reference> |
|
812 |
</visibleWhen> |
|
813 |
</command> |
|
790 | 814 |
<separator |
791 | 815 |
name="eu.etaxonomy.taxeditor.editor.separator3" |
792 | 816 |
visible="true"> |
... | ... | |
1579 | 1603 |
id="eu.etaxonomy.taxeditor.editor.derivative.removeSingleReadFromSequence" |
1580 | 1604 |
name="Remove SingleRead from sequence"> |
1581 | 1605 |
</command> |
1606 |
<command |
|
1607 |
defaultHandler="eu.etaxonomy.taxeditor.editor.view.derivate.handler.ToggleLinkWithTaxonSelectionHandler" |
|
1608 |
id="eu.etaxonomy.taxeditor.editor.derivative.toggleLinkWithTaxonSelection" |
|
1609 |
name="Toggle link with taxon selection"> |
|
1610 |
</command> |
|
1582 | 1611 |
|
1583 | 1612 |
</extension> |
1584 | 1613 |
<extension |
... | ... | |
1787 | 1816 |
</test> |
1788 | 1817 |
</with> |
1789 | 1818 |
</definition> |
1819 |
<definition |
|
1820 |
id="isDerivativeEditorLinkedToTaxonSelection"> |
|
1821 |
<with |
|
1822 |
variable="activeEditor"> |
|
1823 |
<test |
|
1824 |
property="eu.etaxonomy.taxeditor.editor.view.derivate.DerivativeEditorPropertyTester.isLinkedWithTaxonSelection"> |
|
1825 |
</test> |
|
1826 |
</with> |
|
1827 |
</definition> |
|
1790 | 1828 |
</extension> |
1791 | 1829 |
<extension |
1792 | 1830 |
point="org.eclipse.core.expressions.propertyTesters"> |
... | ... | |
1818 | 1856 |
properties="isSequence,isSingleRead,isSingleReadReusableHere,isSingleReadReused" |
1819 | 1857 |
type="org.eclipse.jface.viewers.IStructuredSelection"> |
1820 | 1858 |
</propertyTester> |
1859 |
<propertyTester |
|
1860 |
class="eu.etaxonomy.taxeditor.editor.view.derivate.DerivativeEditorPropertyTester" |
|
1861 |
id="eu.etaxonomy.taxeditor.editor.view.derivate.DerivativeEditorPropertyTester" |
|
1862 |
namespace="eu.etaxonomy.taxeditor.editor.view.derivate.DerivativeEditorPropertyTester" |
|
1863 |
properties="isLinkedWithTaxonSelection" |
|
1864 |
type="eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView"> |
|
1865 |
</propertyTester> |
|
1821 | 1866 |
</extension> |
1822 | 1867 |
<extension |
1823 | 1868 |
point="org.eclipse.ui.bindings"> |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivativeEditorPropertyTester.java | ||
---|---|---|
1 |
package eu.etaxonomy.taxeditor.editor.view.derivate; |
|
2 |
|
|
3 |
import org.eclipse.core.expressions.PropertyTester; |
|
4 |
|
|
5 |
public class DerivativeEditorPropertyTester extends PropertyTester { |
|
6 |
|
|
7 |
public DerivativeEditorPropertyTester() { |
|
8 |
// TODO Auto-generated constructor stub |
|
9 |
} |
|
10 |
|
|
11 |
@Override |
|
12 |
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { |
|
13 |
DerivateView derivateView = (DerivateView)receiver; |
|
14 |
if(property.equals("isLinkedWithTaxonSelection")){ |
|
15 |
return derivateView.isListenToSelectionChange(); |
|
16 |
} |
|
17 |
return false; |
|
18 |
} |
|
19 |
|
|
20 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/DerivateViewContextMenu.java | ||
---|---|---|
12 | 12 |
new CreateDerivateContextMenu(), |
13 | 13 |
new CreateFieldUnitContextMenu(), |
14 | 14 |
new Separator(), |
15 |
new ListenToSelectionChangeContextMenu(), |
|
15 |
// new ListenToSelectionChangeContextMenu(),
|
|
16 | 16 |
}; |
17 | 17 |
return contributionItems; |
18 | 18 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/ToggleLinkWithTaxonSelectionHandler.java | ||
---|---|---|
1 |
package eu.etaxonomy.taxeditor.editor.view.derivate.handler; |
|
2 |
|
|
3 |
import org.eclipse.core.commands.AbstractHandler; |
|
4 |
import org.eclipse.core.commands.ExecutionEvent; |
|
5 |
import org.eclipse.core.commands.ExecutionException; |
|
6 |
import org.eclipse.ui.handlers.HandlerUtil; |
|
7 |
|
|
8 |
import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView; |
|
9 |
|
|
10 |
public class ToggleLinkWithTaxonSelectionHandler extends AbstractHandler { |
|
11 |
|
|
12 |
@Override |
|
13 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
14 |
DerivateView derivateView = (DerivateView) HandlerUtil.getActiveEditor(event); |
|
15 |
derivateView.toggleListenToSelectionChange(); |
|
16 |
return null; |
|
17 |
} |
|
18 |
|
|
19 |
} |
Also available in: Unified diff
Refactor DerivativeEditor context menu