01: /*
02: * uDig - User Friendly Desktop Internet GIS client http://udig.refractions.net (C) 2004,
03: * Refractions Research Inc. This library is free software; you can redistribute it and/or modify it
04: * under the terms of the GNU Lesser General Public License as published by the Free Software
05: * Foundation; version 2.1 of the License. This library is distributed in the hope that it will be
06: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
07: * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
08: */
09: package net.refractions.udig.internal.ui;
10:
11: import net.refractions.udig.ui.ShutdownTaskList;
12: import net.refractions.udig.ui.preferences.PreferenceConstants;
13:
14: import org.eclipse.jface.preference.IPreferenceStore;
15: import org.eclipse.ui.PlatformUI;
16: import org.eclipse.ui.application.IWorkbenchConfigurer;
17: import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
18: import org.eclipse.ui.application.WorkbenchAdvisor;
19: import org.eclipse.ui.application.WorkbenchWindowAdvisor;
20:
21: /**
22: * Public base class for configuring the UDIG workbench.
23: * <p>
24: * Note that the workbench advisor object is created in advance of creating the workbench. However,
25: * by the time the workbench starts calling methods on this class,
26: * <code>PlatformUI.getWorkbench</code> is guaranteed to have been properly initialized.
27: * </p>
28: *
29: * @author rgould
30: * @version $Revision: 1.9 $
31: */
32: public class UDIGWorkbenchAdvisor extends WorkbenchAdvisor {
33:
34: @Override
35: public void initialize(IWorkbenchConfigurer configurer) {
36: super .initialize(configurer);
37:
38: // make sure we always save and restore workspace state
39: configurer.setSaveAndRestore(true);
40: PlatformUI.getWorkbench().addWorkbenchListener(
41: ShutdownTaskList.instance());
42: }
43:
44: @Override
45: public String getInitialWindowPerspectiveId() {
46: IPreferenceStore preferenceStore = UiPlugin.getDefault()
47: .getPreferenceStore();
48: return preferenceStore
49: .getString(PreferenceConstants.P_DEFAULT_PERSPECTIVE);
50: }
51:
52: @Override
53: public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
54: IWorkbenchWindowConfigurer configurer) {
55: return new UDIGWorkbenchWindowAdvisor(configurer);
56: }
57:
58: }
|