Project

General

Profile

« Previous | Next » 

Revision b11b49ce

Added by Patrick Plitzner over 6 years ago

ref #6597 Re-enable molecular handlers

View differences:

eu.etaxonomy.taxeditor.molecular/META-INF/MANIFEST.MF
18 18
 org.eclipse.jface.databinding;bundle-version="1.5.0",
19 19
 org.eclipse.core.databinding.property;bundle-version="1.4.0",
20 20
 org.eclipse.e4.core.di.annotations,
21
 org.eclipse.e4.ui.services
21
 org.eclipse.e4.ui.services,
22
 org.eclipse.e4.ui.model.workbench
22 23
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
23 24
Bundle-ActivationPolicy: lazy
24 25
Bundle-Vendor: EDIT
eu.etaxonomy.taxeditor.molecular/fragment.e4xmi
1 1
<?xml version="1.0" encoding="ASCII"?>
2
<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_OhwnQCTfEeeiN5lBIuqN3g">
2
<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:commands="http://www.eclipse.org/ui/2010/UIModel/application/commands" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_OhwnQCTfEeeiN5lBIuqN3g">
3 3
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="__mwtMDVpEee_b7RlBzTDRw" featurename="commands" parentElementId="xpath:/">
4 4
    <elements xsi:type="commands:Command" xmi:id="_JZdQ0H2sEeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.editSequence" commandName="%command.EDIT_SEQUENCE"/>
5 5
    <elements xsi:type="commands:Command" xmi:id="_IXQocH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.exportSequenceToFile" commandName="%command.label.EXPORT_SEQUENCE_TO_FILE"/>
......
11 11
    <elements xsi:type="commands:Handler" xmi:id="_reIrkH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.handler.ShowPherogramHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.molecular/eu.etaxonomy.taxeditor.molecular.handler.ShowPherogramHandler" command="_m9gZAH22EeeVL5aZ55YsWA"/>
12 12
  </fragments>
13 13
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_o08AQH2sEeeVL5aZ55YsWA" featurename="children" parentElementId="eu.etaxonomy.taxeditor.editor.popupmenu.specimeneditor" positionInList="before:eu.etaxonomy.taxeditor.editor.menuseparator.beforeDelete">
14
    <elements xsi:type="menu:HandledMenuItem" xmi:id="_txARoH2sEeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.commandlabeledit_sequence" label="%command.label.EDIT_SEQUENCE" command="_JZdQ0H2sEeeVL5aZ55YsWA">
15
      <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_wpbQQH2sEeeVL5aZ55YsWA" coreExpressionId="isSequence"/>
16
    </elements>
17
    <elements xsi:type="menu:HandledMenuItem" xmi:id="_VRC-UH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.commandlabelexport_sequence_to_file" label="%command.label.EXPORT_SEQUENCE_TO_FILE" command="_IXQocH22EeeVL5aZ55YsWA">
18
      <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_ZLzjsH22EeeVL5aZ55YsWA" coreExpressionId="isSequence"/>
19
    </elements>
20
    <elements xsi:type="menu:HandledMenuItem" xmi:id="_xftzgH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.commandnameshow_pherogram" label="%command.name.SHOW_PHEROGRAM" command="_m9gZAH22EeeVL5aZ55YsWA">
21
      <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_0tfXEH22EeeVL5aZ55YsWA" coreExpressionId="isSingleRead"/>
22
    </elements>
14
    <elements xsi:type="menu:HandledMenuItem" xmi:id="_txARoH2sEeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.commandlabeledit_sequence" label="%command.label.EDIT_SEQUENCE" command="_JZdQ0H2sEeeVL5aZ55YsWA"/>
15
    <elements xsi:type="menu:HandledMenuItem" xmi:id="_VRC-UH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.commandlabelexport_sequence_to_file" label="%command.label.EXPORT_SEQUENCE_TO_FILE" command="_IXQocH22EeeVL5aZ55YsWA"/>
16
    <elements xsi:type="menu:HandledMenuItem" xmi:id="_xftzgH22EeeVL5aZ55YsWA" elementId="eu.etaxonomy.taxeditor.molecular.handledmenuitem.commandnameshow_pherogram" label="%command.name.SHOW_PHEROGRAM" command="_m9gZAH22EeeVL5aZ55YsWA"/>
23 17
  </fragments>
24 18
</fragment:ModelFragments>
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/EditSequenceHandler.java
3 3

  
4 4
import javax.inject.Named;
5 5

  
6
import org.eclipse.e4.core.di.annotations.CanExecute;
6 7
import org.eclipse.e4.core.di.annotations.Execute;
7 8
import org.eclipse.e4.core.di.annotations.Optional;
9
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
8 10
import org.eclipse.e4.ui.services.IServiceConstants;
9 11
import org.eclipse.jface.viewers.TreeNode;
10 12
import org.eclipse.ui.PartInitException;
......
40 42
            }
41 43
        }
42 44
    }
45

  
46
    @CanExecute
47
    public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) TreeNode selectedTreeNode, MHandledMenuItem menuItem) {
48
        boolean canExecute = false;
49
        if(selectedTreeNode!=null){
50
            Object value = selectedTreeNode.getValue();
51
            canExecute = value instanceof Sequence;
52
        }
53
        menuItem.setVisible(canExecute);
54
        return canExecute;
55
    }
43 56
}
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ExportSequenceToFileHandler.java
16 16
import javax.inject.Named;
17 17

  
18 18
import org.eclipse.core.runtime.IStatus;
19
import org.eclipse.e4.core.di.annotations.CanExecute;
19 20
import org.eclipse.e4.core.di.annotations.Execute;
20 21
import org.eclipse.e4.core.di.annotations.Optional;
22
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
21 23
import org.eclipse.e4.ui.services.IServiceConstants;
22 24
import org.eclipse.jface.viewers.TreeNode;
23 25
import org.eclipse.jface.wizard.WizardDialog;
......
100 102
        }
101 103
        return null;
102 104
    }
105

  
106
    @CanExecute
107
    public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) TreeNode selectedTreeNode, MHandledMenuItem menuItem) {
108
        boolean canExecute = false;
109
        if(selectedTreeNode!=null){
110
            Object value = selectedTreeNode.getValue();
111
            canExecute = value instanceof Sequence;
112
        }
113
        menuItem.setVisible(canExecute);
114
        return canExecute;
115
    }
103 116
}
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/handler/ShowPherogramHandler.java
5 5

  
6 6
import javax.inject.Named;
7 7

  
8
import org.eclipse.e4.core.di.annotations.CanExecute;
8 9
import org.eclipse.e4.core.di.annotations.Execute;
9 10
import org.eclipse.e4.core.di.annotations.Optional;
11
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
10 12
import org.eclipse.e4.ui.services.IServiceConstants;
11 13
import org.eclipse.jface.viewers.TreeNode;
12 14
import org.eclipse.ui.PartInitException;
......
59 61
        }
60 62
        return null;
61 63
    }
64

  
65
    @CanExecute
66
    public boolean canExecute(@Optional @Named(IServiceConstants.ACTIVE_SELECTION) TreeNode selectedTreeNode, MHandledMenuItem menuItem) {
67
        boolean canExecute = false;
68
        if(selectedTreeNode!=null){
69
            Object value = selectedTreeNode.getValue();
70
            canExecute = value instanceof SingleRead;
71
        }
72
        menuItem.setVisible(canExecute);
73
        return canExecute;
74
    }
62 75
}

Also available in: Unified diff