Project

General

Profile

Revision 74b82668

ID74b82668914fd10a19dc731b4f93ecbb494e2442
Parent 46b99314
Child 87ee3959

Added by Katja Luther over 2 years ago

fix name editor menu for synonyms and misapplications

View differences:

eu.etaxonomy.taxeditor.editor/fragment.e4xmi
152 152
      <handlers xmi:id="_lv9GYIvQEee7R4eqeQiXZg" elementId="eu.etaxonomy.taxeditor.editor.name.e4.handler.MoveSynonymToAnotherAcceptedTaxonHandlerE4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.name.e4.handler.MoveSynonymToAnotherAcceptedTaxonHandlerE4" command="_jNvBQIvQEee7R4eqeQiXZg"/>
153 153
      <menus xsi:type="menu:PopupMenu" xmi:id="_tLceQYl4Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.popupmenu.nameeditor">
154 154
        <children xsi:type="menu:Menu" xmi:id="_R6buoIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menu.new" label="%menu.label">
155
          <children xsi:type="menu:HandledMenuItem" xmi:id="_FjdDgIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newHeterotypicSynonym" label="%command.label.9" command="_ult4EIvOEee7R4eqeQiXZg"/>
156
          <children xsi:type="menu:HandledMenuItem" xmi:id="_Gsr8cIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newHomotypicSynonym" label="%command.label.10" command="_KpUFsIvPEee7R4eqeQiXZg"/>
155
          <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_X1lWsEoREeiEhr9v9h_MoA" coreExpressionId="isNotMisapplication"/>
156
          <children xsi:type="menu:HandledMenuItem" xmi:id="_FjdDgIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newHeterotypicSynonym" label="%command.label.9" command="_ult4EIvOEee7R4eqeQiXZg">
157
            <visibleWhen xsi:type="ui:CoreExpression" xmi:id="__6Cq8EoNEeiEhr9v9h_MoA" coreExpressionId="isAcceptedTaxon"/>
158
          </children>
159
          <children xsi:type="menu:HandledMenuItem" xmi:id="_Gsr8cIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newHomotypicSynonym" label="%command.label.10" command="_KpUFsIvPEee7R4eqeQiXZg">
160
            <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_C-LKUEoOEeiEhr9v9h_MoA" coreExpressionId="isAcceptedTaxon"/>
161
          </children>
157 162
          <children xsi:type="menu:HandledMenuItem" xmi:id="_I6FoIIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newSynonymInHomotypicGroup" label="%command.label.11" command="_VPLRIIvPEee7R4eqeQiXZg"/>
158 163
          <children xsi:type="menu:MenuSeparator" xmi:id="_LGspoIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.16"/>
159
          <children xsi:type="menu:HandledMenuItem" xmi:id="_MCsX0Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newMisapplication" label="%command.label.49" command="_c0byUIvPEee7R4eqeQiXZg"/>
164
          <children xsi:type="menu:HandledMenuItem" xmi:id="_MCsX0Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.newMisapplication" label="%command.label.49" command="_c0byUIvPEee7R4eqeQiXZg">
165
            <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_G1zjMEoOEeiEhr9v9h_MoA" coreExpressionId="isAcceptedTaxon"/>
166
          </children>
160 167
        </children>
161 168
        <children xsi:type="menu:Menu" xmi:id="_ZXIJsIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menu.changeTo" label="%menu.label.0">
162 169
          <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_eERMsEn0EeiEhr9v9h_MoA" coreExpressionId="isNotAcceptedTaxon"/>
163
          <children xsi:type="menu:HandledMenuItem" xmi:id="_Nt_cAIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.changeToAccepted" label="%command.label.12" command="_oBnccIvPEee7R4eqeQiXZg"/>
164
          <children xsi:type="menu:HandledMenuItem" xmi:id="_POj24Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.nameEditor.menuItem.changeToSynonym" label="%command.label.13" command="_yh49QIvPEee7R4eqeQiXZg"/>
165
          <children xsi:type="menu:HandledMenuItem" xmi:id="_QbC4IIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.changeToMisapplication" label="%command.label.14" command="_56AaUIvPEee7R4eqeQiXZg"/>
170
          <children xsi:type="menu:HandledMenuItem" xmi:id="_Nt_cAIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.changeToAccepted" label="%command.label.12" command="_oBnccIvPEee7R4eqeQiXZg">
171
            <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_lSby0EoQEeiEhr9v9h_MoA" coreExpressionId="isSynonym"/>
172
          </children>
173
          <children xsi:type="menu:HandledMenuItem" xmi:id="_POj24Il8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.nameEditor.menuItem.changeToSynonym" label="%command.label.13" command="_yh49QIvPEee7R4eqeQiXZg">
174
            <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_h6hb0EoQEeiEhr9v9h_MoA" coreExpressionId="isMisapplication"/>
175
          </children>
176
          <children xsi:type="menu:HandledMenuItem" xmi:id="_QbC4IIl8Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.changeToMisapplication" label="%command.label.14" command="_56AaUIvPEee7R4eqeQiXZg">
177
            <visibleWhen xsi:type="ui:CoreExpression" xmi:id="_fYbSgEoQEeiEhr9v9h_MoA" coreExpressionId="isSynonym"/>
178
          </children>
166 179
        </children>
167 180
        <children xsi:type="menu:MenuSeparator" xmi:id="_a0anEIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.menuseparator.13"/>
168 181
        <children xsi:type="menu:HandledMenuItem" xmi:id="_bu3dIIl5Eeeox7omhvOBWg" elementId="eu.etaxonomy.taxeditor.editor.nameEditor.menuItem.delete" label="%command.label.15" command="_CoVcYIvQEee7R4eqeQiXZg"/>
eu.etaxonomy.taxeditor.editor/plugin.xml
311 311
            </test>
312 312
         </with>
313 313
      </definition>
314
           <definition
315
            id="isNotMisapplication">
316
         <with
317
               variable="selection">
318
            <test
319
                  property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isNotMisapplication">
320
            </test>
321
         </with>
322
      </definition>
314 323
      <definition
315 324
            id="isTaxonBase">
316 325
         <with
......
514 523
            class="eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester"
515 524
            id="eu.etaxonomy.taxeditor.editor.name.propertyTester"
516 525
            namespace="eu.etaxonomy.taxeditor.editor.name.propertyTester"
517
            properties="isAcceptedTaxon,isSynonym,isMisapplication,isTaxonBase,hasEmptyNames,isAcceptedAndHasNoHomotypicSynonyms,isNotHomotypicSynonymOfAcceptedTaxon,isNotAcceptedTaxon,isSynonymInHomotypicalGroupWithMoreSynonyms,isOrphaned"
526
            properties="isAcceptedTaxon,isSynonym,isMisapplication,isNotMisapplication,isTaxonBase,hasEmptyNames,isAcceptedAndHasNoHomotypicSynonyms,isNotHomotypicSynonymOfAcceptedTaxon,isNotAcceptedTaxon,isSynonymInHomotypicalGroupWithMoreSynonyms,isOrphaned"
518 527
            type="java.lang.Object">
519 528
      </propertyTester>
520 529
      <propertyTester
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/NameEditorMenuPropertyTester.java
34 34
	private static final String NOT_ACCEPTED = "isNotAcceptedTaxon"; //$NON-NLS-1$
35 35
	private static final String SYNONYM = "isSynonym"; //$NON-NLS-1$
36 36
	private static final String MISAPPLICATION = "isMisapplication"; //$NON-NLS-1$
37
	private static final String NOT_MISAPPLICATION = "isNotMisapplication"; //$NON-NLS-1$
37 38
	private static final String TAXONBASE = "isTaxonBase"; //$NON-NLS-1$
38 39
	private static final String CONCEPT = "isConceptRelation"; //$NON-NLS-1$
39 40
	private static final String EMPTY_NAMES = "hasEmptyNames"; //$NON-NLS-1$
......
75 76
			else if(MISAPPLICATION.equals(property)){
76 77
				return isMisapplication(selectedElement);
77 78
			}
79
			else if(NOT_MISAPPLICATION.equals(property)){
80
                return isNotMisapplication(selectedElement);
81
            }
78 82
			else if(TAXONBASE.equals(property)){
79 83
				return isTaxonBase(selectedElement);
80 84
			}
......
115 119
        return !isAccepted(selectedElement);
116 120
    }
117 121

  
122
	public static boolean isNotMisapplication(Object selectedElement) {
123

  
124
        return !isMisapplication(selectedElement);
125
    }
126

  
118 127
	public static boolean isSynonymInHomotypicalGroupWithMoreSynonyms(Object selectedElement) {
119 128
		if (isSynonym(selectedElement)){
120 129
			Synonym synonym = (Synonym) selectedElement;
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties
190 190
page.name.44 = Name Details
191 191
extension-point.name = Cdm Viewer
192 192
extension-point.name.0 = Preference Page
193
extension-point.name.1 = Admin Preference Page
193
extension-point.name.1 = Admin Preference Page
194
page.name.45 = Specimen Preferences
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties
189 189
page.name.43 = Nomenklatorischer Code
190 190
page.name.44 = Detailsview f?r wissenschaftliche Namen
191 191
extension-point.name = Cdm Viewer
192
extension-point.name.0 = Preference Page
193
extension-point.name.1 = Admin Preference Page
192
extension-point.name.0 = Pr?ferenzen
193
extension-point.name.1 = Admin Pr?ferenzen
194
page.name.45 = Specimen Pr?ferenzen
eu.etaxonomy.taxeditor.store/plugin.xml
590 590
         id="eu.etaxonomy.taxeditor.store.abcdImportProvider"
591 591
         name="%page.name.41">
592 592
   </page>
593
    <page
594
         category="eu.etaxonomy.taxeditor.preferences.general"
595
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.SpecimenAdminPreferences"
596
         id="eu.etaxonomy.taxeditor.store.specimenAdminPreferences"
597
         name="%page.name.45">
598
   </page>
593 599
   <page
594 600
        
595 601
         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.PublishFlagPreference"
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/ListComponent.java
55 55
        list.setBounds (clientArea.x, clientArea.y, 100, 500);
56 56

  
57 57
        CdmPreference providerListPreference = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.BioCaseProvider);
58
        String allProviderString = providerListPreference.getValue();
58
        String allProviderString = "";
59
        if (providerListPreference != null){
60
            allProviderString  = providerListPreference.getValue();
61
        }
59 62
//         = PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.BIOCASE_PROVIDER_LIST);
60 63
        //the string is structured like this: http://ww3.bgbm.org/biocase/pywrapper.cgi?dsa=DNA_Bank;http:...;
61 64
        String[] providerArray = allProviderString.split(";");
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NomenclaturalCodePreferences.java
129 129
              if (pref != null){
130 130
                  actualCode = pref.getValue();
131 131

  
132
              }else{
133
                  actualCode = PreferencesUtil.getPreferenceKey(PreferencesUtil.getPreferredNomenclaturalCode());
132 134
              }
133 135
          }
134 136

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/SpecimenAdminPreferences.java
1
/**
2
* Copyright (C) 2018 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
10

  
11
import org.eclipse.swt.SWT;
12
import org.eclipse.swt.events.SelectionAdapter;
13
import org.eclipse.swt.events.SelectionEvent;
14
import org.eclipse.swt.layout.GridData;
15
import org.eclipse.swt.widgets.Button;
16
import org.eclipse.swt.widgets.Composite;
17
import org.eclipse.swt.widgets.Control;
18

  
19
import eu.etaxonomy.cdm.api.application.ICdmRepository;
20
import eu.etaxonomy.cdm.api.service.IPreferenceService;
21
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
22
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
23
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
24
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
25
import eu.etaxonomy.taxeditor.l10n.Messages;
26
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
27
import eu.etaxonomy.taxeditor.store.CdmStore;
28

  
29
/**
30
 * @author k.luther
31
 * @since 27.04.2018
32
 *
33
 */
34
public class SpecimenAdminPreferences extends CdmPreferencePage implements IE4AdminPreferencePage {
35

  
36

  
37

  
38
    boolean isShowCollectingAreaInGeneralSection = false;
39
    boolean isDeterminationOnlyForFieldUnits = false;
40
    boolean isShowTaxonAssociation = false;
41
    boolean isShowLifeForm = false;
42
    boolean isUseLocalPreference = false;
43

  
44

  
45
    @Override
46
    protected Control createContents(Composite parent) {
47
        Composite composite = new Composite(parent, SWT.NULL);
48

  
49
        final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK);
50

  
51
        showCollectingAreaInGeneralSectionButton.setText(Messages.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section);
52

  
53
        showCollectingAreaInGeneralSectionButton.setSelection(isShowCollectingAreaInGeneralSection);
54
        showCollectingAreaInGeneralSectionButton.addSelectionListener(new SelectionAdapter(){
55
             @Override
56
             public void widgetSelected(SelectionEvent e) {
57
                 isShowCollectingAreaInGeneralSection = showCollectingAreaInGeneralSectionButton.getSelection();
58

  
59
              }
60
         });
61

  
62
        final Button determinationOnlyForFieldUnitsButton = new Button(composite, SWT.CHECK);
63

  
64
        determinationOnlyForFieldUnitsButton.setText(Messages.DatabasePreferncesPage_Determination_only_for_field_unnits);
65

  
66
        determinationOnlyForFieldUnitsButton.setSelection(isDeterminationOnlyForFieldUnits);
67
        determinationOnlyForFieldUnitsButton.addSelectionListener(new SelectionAdapter(){
68
             @Override
69
             public void widgetSelected(SelectionEvent e) {
70
                 isDeterminationOnlyForFieldUnits = determinationOnlyForFieldUnitsButton.getSelection();
71
                               }
72
         });
73

  
74
        final Button showTaxonAssociationButton = new Button(composite, SWT.CHECK);
75

  
76
        showTaxonAssociationButton.setText(Messages.DatabasePreferncesPage_Taxon_Associations);
77

  
78
        showTaxonAssociationButton.setSelection(isShowTaxonAssociation);
79
        showTaxonAssociationButton.addSelectionListener(new SelectionAdapter(){
80
             @Override
81
             public void widgetSelected(SelectionEvent e) {
82
                 isShowTaxonAssociation = showTaxonAssociationButton.getSelection();
83

  
84
              }
85
         });
86

  
87
        final Button showLifeFormButton = new Button(composite, SWT.CHECK);
88
        showLifeFormButton.setText(Messages.DatabasePreferncesPage_Life_Form);
89
        showLifeFormButton.setSelection(isShowLifeForm);
90
        showLifeFormButton.addSelectionListener(new SelectionAdapter(){
91
             @Override
92
             public void widgetSelected(SelectionEvent e) {
93
                 isShowLifeForm = showLifeFormButton.getSelection();
94

  
95
              }
96
         });
97

  
98
    //    Composite useLocalComp = new Composite(composite, SWT.NONE);
99

  
100

  
101
        final Button useLocalPreference = new Button(composite, SWT.CHECK);
102

  
103
        useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
104
        GridData gridData = new GridData(SWT.FILL, SWT.BOTTOM, false, false);
105
        gridData.verticalIndent = 10;
106
        useLocalPreference.setLayoutData(gridData);
107

  
108
        useLocalPreference.setSelection(isUseLocalPreference);
109
        useLocalPreference.addSelectionListener(new SelectionAdapter(){
110
             @Override
111
             public void widgetSelected(SelectionEvent e) {
112
                 isUseLocalPreference = useLocalPreference.getSelection();
113

  
114
              }
115
         });
116
        return composite;
117
    }
118

  
119
    @Override
120
    public void init() {
121
        super.init();
122
        if(!CdmStore.isActive()){
123
            return;
124
        }
125
          ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
126
          if (controller != null){
127
              IPreferenceService service = controller.getPreferenceService();
128
              PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowCollectingAreasInGeneralSection);
129
              CdmPreference isShowCollectingAreaInGeneralSectionPref = service.find(key);
130
              if (isShowCollectingAreaInGeneralSectionPref != null){
131
                  this.isShowCollectingAreaInGeneralSection = Boolean.valueOf(isShowCollectingAreaInGeneralSectionPref.getValue());
132
              }
133
              key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.DeterminationOnlyForFieldUnits);
134
              CdmPreference isDeterminationOnlyForFieldUnitsPref = service.find(key);
135
              if (isDeterminationOnlyForFieldUnitsPref != null){
136
                  this.isDeterminationOnlyForFieldUnits = Boolean.valueOf(isDeterminationOnlyForFieldUnitsPref.getValue());
137
              }
138
              key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowTaxonAssociations);
139
              CdmPreference isShowTaxonAssociationPref = service.find(key);
140
              if (isShowTaxonAssociationPref != null){
141
                  this.isShowTaxonAssociation = Boolean.valueOf(isShowTaxonAssociationPref.getValue());
142
                  isUseLocalPreference = isShowTaxonAssociationPref.isAllowOverride();
143
              }
144

  
145
              key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowLifeForm);
146
              CdmPreference isShowLifeFormPref = service.find(key);
147
              if (isShowLifeFormPref != null){
148
                  this.isShowLifeForm = Boolean.valueOf(isShowLifeFormPref.getValue());
149
              }
150

  
151

  
152

  
153

  
154
          }
155

  
156

  
157
    }
158

  
159
    @Override
160
     public boolean performOk() {
161

  
162

  
163
        return true;
164
    }
165

  
166
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)