Project

General

Profile

« Previous | Next » 

Revision cc4e78d1

Added by Katja Luther over 5 years ago

ref #7793: add preference to set checklist perspective as default

View differences:

eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchAdvisor.java
12 12
import org.springframework.remoting.RemoteConnectFailureException;
13 13

  
14 14
import eu.etaxonomy.taxeditor.model.MessagingUtils;
15
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
15 16
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
16 17

  
17 18

  
......
49 50
	 */
50 51
	@Override
51 52
    public String getInitialWindowPerspectiveId() {
53
	    if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_CHECKLIST_PERSPECTIVE)){
54
	        return "eu.etaxonomy.taxeditor.perspective.checklistperspective";
55
	    }
56

  
52 57
		return "eu.etaxonomy.taxeditor.application.perspective.taxonomic";
53 58
	}
54 59

  
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/LifeCycleManager.java
31 31
import org.eclipse.e4.ui.workbench.modeling.EModelService;
32 32
import org.eclipse.e4.ui.workbench.modeling.EPartService;
33 33
import org.eclipse.ui.IMemento;
34
import org.eclipse.ui.IPerspectiveRegistry;
35
import org.eclipse.ui.IWorkbench;
36
import org.eclipse.ui.IWorkbenchPage;
37
import org.eclipse.ui.IWorkbenchWindow;
38
import org.eclipse.ui.PlatformUI;
34 39
import org.osgi.service.event.Event;
35 40

  
36 41
import eu.etaxonomy.taxeditor.model.IContextListener;
42
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
37 43
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
38 44
import eu.etaxonomy.taxeditor.store.CdmStore;
39 45

  
......
104 110
                parent.getChildren().remove(part);
105 111
            }
106 112
        }
113

  
107 114
    }
108 115

  
109 116
    /**
......
128 135
    public void contextStart(IMemento memento, IProgressMonitor monitor) {
129 136
        PreferencesUtil.updateDBPreferences();
130 137
        hideParts();
138
        if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_CHECKLIST_PERSPECTIVE)){
139
            IWorkbench workbench = PlatformUI.getWorkbench();
140
            IWorkbenchWindow window = workbench
141
                    .getActiveWorkbenchWindow();
142

  
143
            IPerspectiveRegistry registry = workbench.getPerspectiveRegistry();
144
            IWorkbenchPage page = window.getActivePage();
145
            page.setPerspective(registry.findPerspectiveWithId("eu.etaxonomy.taxeditor.perspective.checklistperspective"));
146
        }
131 147
    }
132 148

  
133 149
    /**
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/perspective/ChecklistPerspective.java
32 32
	public void createInitialLayout(IPageLayout layout) {
33 33
		IFolderLayout navigationFolder = layout.createFolder("navigation",
34 34
				IPageLayout.LEFT, 0.25f, layout.getEditorArea());
35
//
36
//		navigationFolder.addView(NAVIGATOR);
37
//		navigationFolder.addPlaceholder(SEARCH_RESULTS);
38
//        navigationFolder.addPlaceholder(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_DESCRIPTIVEDATASET_DESCRIPTIVEDATASETNAVIGATOR);
39
//
40
//		IFolderLayout folder = layout.createFolder("Folder", IPageLayout.BOTTOM, 0.6f, layout.getEditorArea());
41
//		folder.addView(FACTUAL_DATA_VIEW);
42
//		folder.addView(DETAILS_VIEW);
43
//		folder.addView(MediaViewPart.ID);
44

  
45
//		createAdditionalFolder(layout, layout.getEditorArea());
46

  
35 47

  
36 48
		navigationFolder.addView(NAVIGATOR);
37
		navigationFolder.addPlaceholder(SEARCH_RESULTS);
49
        navigationFolder.addPlaceholder(SEARCH_RESULTS);
38 50
        navigationFolder.addPlaceholder(AppModelId.PARTDESCRIPTOR_EU_ETAXONOMY_TAXEDITOR_EDITOR_DESCRIPTIVEDATASET_DESCRIPTIVEDATASETNAVIGATOR);
39 51

  
40
		IFolderLayout folder = layout.createFolder("Folder", IPageLayout.BOTTOM, 0.6f, layout.getEditorArea());
41
		folder.addView(FACTUAL_DATA_VIEW);
42
		folder.addView(DETAILS_VIEW);
43
//		folder.addView(MediaViewPart.ID);
52
        layout.addPlaceholder(NAME_EDITOR, IPageLayout.BOTTOM, 0.25f, layout.getEditorArea());
53

  
54
        layout.addView(DETAILS_VIEW, IPageLayout.RIGHT, 0.6f, layout.getEditorArea());
55
        IFolderLayout supplementalFolder = layout.createFolder(SUPPLEMENTAL_VIEW+"stack", IPageLayout.BOTTOM, 0.6f, DETAILS_VIEW);
56
        supplementalFolder.addView(SUPPLEMENTAL_VIEW);
57

  
58
        supplementalFolder.addPlaceholder(REFERENCING_VIEW);
59

  
60
        layout.addView(FACTUAL_DATA_VIEW, IPageLayout.BOTTOM, 0.6f, layout.getEditorArea());
61

  
62

  
63
        createAdditionalFolder(layout, layout.getEditorArea());
44 64

  
45
//		createAdditionalFolder(layout, layout.getEditorArea());
46 65
	}
47 66
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java
77 77
import eu.etaxonomy.taxeditor.editor.view.checklist.listener.ChecklistModifyListener;
78 78
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
79 79
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
80
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
81 80
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
82 81
import eu.etaxonomy.taxeditor.preference.Resources;
83 82
import eu.etaxonomy.taxeditor.preference.wizard.AvailableDistributionWizard;
......
90 89
 * @author k.luther
91 90
 *
92 91
 */
93
public class ChecklistEditorE4 implements IPartContentHasFactualData, IConversationEnabled,
92
public class ChecklistEditorE4 implements  IConversationEnabled,
94 93
       IDirtyMarkable, IPartContentHasDetails, IE4SavablePart, IDistributionEditor{
95 94

  
96 95
    private static final String DISTRIBUTION_EDITOR = "Distribution Editor";
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/GeneralAdminPreferencePage.java
36 36

  
37 37

  
38 38
    boolean isShowIOMenu = true;
39
    boolean isShowMediaView = true;
40
    boolean isShowCheckListPerspective = false;
39 41
    /**
40 42
     * {@inheritDoc}
41 43
     */
......
53 55
            if (isShowSpecimenPref != null){
54 56
                this.isShowIOMenu = Boolean.valueOf(isShowSpecimenPref.getValue());
55 57
            }
58

  
59
            key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowMediaView);
60
            CdmPreference isShowMediaViewPref = service.find(key);
61
            if (isShowMediaViewPref != null){
62
                this.isShowMediaView = Boolean.valueOf(isShowMediaViewPref.getValue());
63
            }
64

  
65
            key = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowChecklistPerspective);
66
            CdmPreference isShowChecklistPref = service.find(key);
67
            if (isShowChecklistPref != null){
68
                this.isShowCheckListPerspective = Boolean.valueOf(isShowChecklistPref.getValue());
69
            }
56 70
        }
57 71
        final Button showIOMenuButton = new Button(composite, SWT.CHECK);
58 72

  
......
66 80

  
67 81
              }
68 82
         });
83

  
84
        final Button showMediaViewButton = new Button(composite, SWT.CHECK);
85

  
86
        showMediaViewButton.setText(Messages.DatabasePreferncesPage_Show_MediaView);
87

  
88
        showMediaViewButton.setSelection(isShowMediaView);
89
        showMediaViewButton.addSelectionListener(new SelectionAdapter(){
90
             @Override
91
             public void widgetSelected(SelectionEvent e) {
92
                 isShowMediaView = showIOMenuButton.getSelection();
93

  
94
              }
95
         });
96
        final Button showChecklistPerspectiveButton = new Button(composite, SWT.CHECK);
97

  
98
        showChecklistPerspectiveButton.setText(Messages.DatabasePreferncesPage_Show_ChecklistPerspective);
99

  
100
        showChecklistPerspectiveButton.setSelection(isShowCheckListPerspective);
101
        showChecklistPerspectiveButton.addSelectionListener(new SelectionAdapter(){
102
             @Override
103
             public void widgetSelected(SelectionEvent e) {
104
                 isShowCheckListPerspective = showChecklistPerspectiveButton.getSelection();
105

  
106
              }
107
         });
108

  
69 109
        return composite;
70 110
    }
71 111

  
......
84 124
           CdmPreference pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowImportExportMenu, Boolean.toString(this.isShowIOMenu));
85 125
           pref.setAllowOverride(false);
86 126
           service.set(pref);
127
           pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowMediaView, Boolean.toString(this.isShowMediaView));
128
           pref.setAllowOverride(false);
129
           service.set(pref);
130
           pref = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowChecklistPerspective, Boolean.toString(this.isShowCheckListPerspective));
131
           pref.setAllowOverride(false);
132
           service.set(pref);
87 133
           PreferencesUtil.updateDBPreferences();
88 134

  
89 135

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java
446 446

  
447 447
    public static String Distribution_status_selection;
448 448

  
449

  
450
    public static String DatabasePreferncesPage_Show_MediaView;
451

  
452

  
453
    public static String DatabasePreferncesPage_Show_ChecklistPerspective;
454

  
449 455
    static {
450 456
        // initialize resource bundle
451 457
        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties
337 337
SpecimenConfiguration_description=Select whether you want to edit specimen related data and how they should be displayed.
338 338
DatabasePreferncesPage_Show_IOMenu=Show Import/Export menu entries
339 339
Distribution_status_selection=Status Selection
340
DatabasePreferncesPage_Show_MediaView=Show Media View
341
DatabasePreferncesPage_Show_ChecklistPerspective=Show Checklist Perspective as default Perspective
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties
336 336
SpecimenConfiguration_description=W?hlen Sie aus, ob sie specimenbezogene Daten editieren wollen und wie diese angezeigt werden sollen.
337 337
DatabasePreferncesPage_Show_IOMenu=Zeige Import/Export Men? Eintr?ge an
338 338
Distribution_status_selection=Status Auswahl
339
DatabasePreferncesPage_Show_MediaView=Zeige den Media View an
340
DatabasePreferncesPage_Show_ChecklistPerspective=Zeige Checklist Perspektive als Default Perspektive an
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
243 243
    public static final String FILTER_COMMON_NAME_REFERENCES = "eu.etaxonomy.taxeditor.references.selection.filterCommonNameReferences";
244 244
    public static final String SHOW_IO_MENU = "eu.etaxonomy.taxeditor.menu.showIO";
245 245

  
246
    public static final String SHOW_MEDIA = "eu.etaxonomy.taxeditor.view.showMedia";
247
    public static final String SHOW_CHECKLIST_PERSPECTIVE = "eu.etaxonomy.taxeditor.perspective.showChecklist";
248

  
246 249

  
247 250

  
248 251

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
1614 1614
            prefStore.setValue(SHOW_IO_MENU, preference.getValue());
1615 1615
        }
1616 1616
    }
1617

  
1618
    preference = getPreferenceFromDB(PreferencePredicate.ShowMediaView);
1619
    if (preference != null){
1620
        if(!prefStore.getBoolean(SHOW_MEDIA) ||  !preference.isAllowOverride()){
1621
            prefStore.setValue(SHOW_MEDIA, preference.getValue());
1622
        }
1623
    }
1624

  
1625
    preference = getPreferenceFromDB(PreferencePredicate.ShowChecklistPerspective);
1626
    if (preference != null){
1627
        if(!prefStore.getBoolean(SHOW_CHECKLIST_PERSPECTIVE) ||  !preference.isAllowOverride()){
1628
            prefStore.setValue(SHOW_CHECKLIST_PERSPECTIVE, preference.getValue());
1629
        }
1630
    }
1631

  
1617 1632
    //Specimen Details
1618 1633
    preference = getPreferenceFromDB(PreferencePredicate.ShowSpecimen);
1619 1634
    if (preference != null){

Also available in: Unified diff