Project

General

Profile

Revision 0bd095d9

ID0bd095d9fbccd25ce847af780892633284b314f9
Parent af45abb8
Child 84ab8cb0

Added by Katja Luther over 4 years ago

fix #5971: admin menu is visible only if connected and user has role manager

View differences:

eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin.properties
14 14
perspective.name.0 = Polytomous Key
15 15
perspective.name.1 = Uses
16 16
perspective.name.2 = Derivatives
17
perspective.name.3 = Checklist
17 18
menu.label = General
18 19
menu.label.0 = Edit
19 20
menu.label.1 = Window
20 21
menu.label.2 = Help
21 22
menu.label.3 = New
23
menu.label.4 = Admin
22 24
command.label = Close
23 25
command.label.0 = Close All
24 26
command.label.1 = Save
......
43 45
command.label.20 = About the EDIT Platform
44 46
command.label.21 = New
45 47
command.label.22 = Save
48
command.label.23 = Database Preferences
46 49
product.name = EDIT Taxonomic Editor
47 50
command.name = Parser Help
48 51
command.name.0 = About the EDIT Platform
eu.etaxonomy.taxeditor.application/OSGI-INF/l10n/plugin_de.properties
14 14
perspective.name.0 = Polytomer Schl?ssel
15 15
perspective.name.1 = Nutzung
16 16
perspective.name.2 = Derivate
17
perspective.name.3 = Checklisten
17 18
menu.label = Datei
18 19
menu.label.0 = Bearbeiten
19 20
menu.label.1 = Extras
20 21
menu.label.2 = Hilfe
21 22
menu.label.3 = Neu
23
menu.label.4 = Admin
22 24
command.label = Schlie\u00dfen
23 25
command.label.0 = Schlie\u00dfe alle
24 26
command.label.1 = Speichern
......
43 45
command.label.20 = \u00dcber die EDIT Platform
44 46
command.label.21 = Neu
45 47
command.label.22 = Speichern
48
command.label.23 = Datenbank Pr?ferenzen
46 49
product.name = EDIT Taxonomischer Editor
47 50
command.name = Parser Hilfe
48 51
command.name.0 = \u00dcber die EDIT Platform
eu.etaxonomy.taxeditor.application/plugin.xml
41 41
            class="eu.etaxonomy.taxeditor.perspective.ChecklistPerspective"
42 42
            icon="icons/check.png"
43 43
            id="eu.etaxonomy.taxeditor.perspective.checklistperspective"
44
            name="Checklist">
44
            name="%perspective.name.3">
45 45
      </perspective>
46 46
     
47 47
   </extension>
......
82 82
         </menu>
83 83
         <menu
84 84
               id="org.eclipse.ui.main.menu.admin"
85
               label="Admin">
85
               label="%menu.label.4">
86 86
         </menu>
87 87
      </menuContribution>
88 88
      <menuContribution
......
281 281
                  locationURI="menu:org.eclipse.ui.main.menu.admin">
282 282
               <command
283 283
                     commandId="eu.etaxonomy.taxeditor.application.DatabaseSettings"
284
                     label="Database Preferences"
284
                     label="%command.label.23"
285 285
                     style="push">
286
                  <visibleWhen
287
                        checkEnabled="true">
288
                     <and>
289
                        <reference
290
                              definitionId="hasROLE_PROJECT_MANAGER">
291
                        </reference>
292
                        <reference
293
                              definitionId="isCdmStoreConnected">
294
                        </reference>
295
                     </and>
296
                  </visibleWhen>
286 297
               </command>
287 298
            </menuContribution>
288 299
   </extension>
......
351 362
            id="eu.etaxonomy.taxeditor.install"
352 363
            name="%command.label.18">
353 364
      </command>
354
      <command
355
            defaultHandler="eu.etaxonomy.taxeditor.handler.OpenDatabasePreferencesWizardHandler"
356
            id="eu.etaxonomy.taxeditor.application.DatabaseSettings"
357
            name="databaseSettings">
358
            
359
      </command>
360 365
   </extension>
361 366
   
362 367
   
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchWindowAdvisor.java
61 61
    public void postWindowOpen() {
62 62
		PreferencesUtil.checkNomenclaturalCode();
63 63

  
64

  
65

  
66 64
		if(PreferencesUtil.shouldConnectAtStartUp()) {
67 65
            CdmStore.connect();
68 66
        }
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties
162 162
command.name.13 = delete
163 163
command.name.14 = delete
164 164
command.name.15 = Open
165
command.name.16 = Database Preferences
165 166
view.name.SESSIONS = Sessions
166 167
command.label.SESSION = Sessions
167 168
command.label.CONNECT = Connect
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties
162 162
command.name.13 = L\u00f6schen
163 163
command.name.14 = L\u00f6schen
164 164
command.name.15 = \u00d6ffnen
165
command.name.16 = Datenbank Pr?ferenzen
166

  
165 167
view.name.SESSIONS = Sessions
166 168
command.label.SESSION = Sessions
167 169
command.label.CONNECT = Verbinden
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/messages_de.properties
22 22

  
23 23
ChangeConnectionHandler_ALREADY_CONNECTING=Datenmodell wird erstellt
24 24
ChangeConnectionHandler_CURRENTLY_CONNECTING_ALREADY=Es wird schon das Datenmodell f?r eine Datenquelle erstellt
25
ChangeConnectionHandler_DATASOURCE_NOT_AVAILABLE=Gew?hlte Datenquelle nicht verf?gbar
25
ChangeConnectionHandler_DATASOURCE_NOT_AVAILABLE=Gew?hlte Datenquelle ist nicht verf?gbar
26 26
ChangeConnectionHandler_NOT_AVAILABLE_REASONS=Eventuell ist der Server nicht verf?gbar oder erreichbar.\n\nStellen Sie bitte auch sicher, dass sie Netzzugang haben, wenn sie sich zu einer Remote-Datenquelle verbinden.
27 27
ChangeConnectionHandler_CREATE_DATAMODEL=Datenmodell erstellen
28 28
ChangeConnectionHandler_REALLY_CREATE_DATAMODEL=Wollen sie wirklich das Datenmodell f?r %s erstellen?\n\nACHTUNG: Existierende Daten werden gel?scht!\n\nHinweis: Die Erstellung kann einige Zeit dauern.
eu.etaxonomy.taxeditor.store/plugin.xml
675 675
      <handler
676 676
            class="eu.etaxonomy.taxeditor.handler.OpenDatabasePreferencesWizardHandler"
677 677
            commandId="eu.etaxonomy.taxeditor.store.open.OpenDatabasePreferencesWizardHandler">
678
            <activeWhen>
679
            <reference
680
                  definitionId="hasROLE_PROJECT_MANAGER">
681
            </reference>
682
         </activeWhen>
678 683
      </handler>
679 684
      <handler
680 685
            class="eu.etaxonomy.taxeditor.handler.SwitchUserHandler"
......
765 770
            id="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler"
766 771
            name="%command.name.11">
767 772
      </command>
773
       <command
774
            id="eu.etaxonomy.taxeditor.store.open.OpenDatabasePreferencesWizardHandler"
775
            name="%command.name.15">
776
      </command>
777
      
768 778
      <command
769 779
            defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.ChangeConnectionHandler"
770 780
            id="eu.etaxonomy.taxeditor.datasource.connect"
......
807 817
               typeId="eu.etaxonomy.taxeditor.uuidParameterType">
808 818
         </commandParameter>
809 819
      </command>
820
      <command
821
            defaultHandler="eu.etaxonomy.taxeditor.handler.OpenDatabasePreferencesWizardHandler"
822
            id="eu.etaxonomy.taxeditor.application.DatabaseSettings"
823
            name="%command.label.23">
824
      </command>
810 825
   </extension>
811 826
   <extension
812 827
         point="org.eclipse.ui.commands">
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/MessagingUtils.java
559 559
        .warningDialog(
560 560
                "The datasource is not available",
561 561
                source,
562
                "The choosen datasource is not available, please contact the administrator.");
562
                "The editor is not connected to a datasource. Maybe the datasource is not available.");
563 563
    }
564 564

  
565 565

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java
124 124
     *
125 125
     * @return a {@link eu.etaxonomy.taxeditor.store.CdmStore} object.
126 126
     */
127
    protected static CdmStore getDefault() {
127
    protected static CdmStore getDefault(boolean connecting){
128 128
        if (instance != null && instance.isConnected) {
129 129
            return instance;
130 130
        } else{// if (instance == null || !instance.isConnected) {
131

  
132
            MessagingUtils.dataSourceNotAvailableWarningDialog(instance);
131
            if (connecting){
132
                MessagingUtils.dataSourceNotAvailableWarningDialog(instance);
133
            }else{
134
                MessagingUtils.noDataSourceWarningDialog(instance);
135
            }
133 136

  
134 137

  
135 138
            return null;
136 139
        }
137 140
    }
141
    /**
142
     * <p>
143
     * getDefault
144
     * </p>
145
     *
146
     * @return a {@link eu.etaxonomy.taxeditor.store.CdmStore} object.
147
     */
148
    protected static CdmStore getDefault(){
149
       return getDefault(false);
150
    }
138 151

  
139 152
    /**
140 153
     * Initialize the with the last edited datasource
......
200 213
        if(isActive()) {
201 214
            // before we connect we clear the entity caches and the sessions
202 215
            CdmRemoteCacheManager.removeEntityCaches();
203
            if(getCurrentSessionManager() != null) {
204
                getCurrentSessionManager().disposeAll();
216
            if(getCurrentSessionManager(true) != null) {
217
                getCurrentSessionManager(true).disposeAll();
205 218
            }
206 219
        }
207 220
        MessagingUtils.info("Connecting to datasource: " + cdmSource);
......
342 355
            return mockCdmEntitySessionManager;
343 356
        }
344 357
    }
345

  
346 358
    public static  ICdmEntitySessionManager getCurrentSessionManager() {
347
        if (getDefault() != null) {
348
            return getDefault().getSessionManager();
359
        return getCurrentSessionManager(false);
360
    }
361

  
362

  
363
    public static  ICdmEntitySessionManager getCurrentSessionManager(boolean connecting) {
364
        if (getDefault(connecting) != null) {
365
            return getDefault(connecting).getSessionManager();
349 366
        }
350 367
        return null;
351 368

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)