6fb5415185ca56a64f98db13fbf10152fa4d12d6
[taxeditor.git] / taxeditor-application / src / main / java / eu / etaxonomy / taxeditor / ApplicationWorkbenchAdvisor.java
1 package eu.etaxonomy.taxeditor;
2
3 import org.eclipse.ui.PlatformUI;
4 import org.eclipse.ui.application.IWorkbenchConfigurer;
5 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
6 import org.eclipse.ui.application.WorkbenchAdvisor;
7 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
8
9 public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
10
11 private static final String PERSPECTIVE_ID = Perspective.ID;
12
13 /*
14 * (non-Javadoc)
15 * @see org.eclipse.ui.application.WorkbenchAdvisor#createWorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer)
16 */
17 public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
18 IWorkbenchWindowConfigurer configurer) {
19 return new ApplicationWorkbenchWindowAdvisor(configurer);
20 }
21
22
23 /*
24 * (non-Javadoc)
25 * @see org.eclipse.ui.application.WorkbenchAdvisor#getInitialWindowPerspectiveId()
26 */
27 public String getInitialWindowPerspectiveId() {
28 return PERSPECTIVE_ID;
29 }
30
31 /*
32 * (non-Javadoc)
33 * @see org.eclipse.ui.application.WorkbenchAdvisor#initialize(org.eclipse.ui.application.IWorkbenchConfigurer)
34 */
35 public void initialize(IWorkbenchConfigurer configurer) {
36 super.initialize(configurer);
37
38 // Remembers the user's view layout, window size, window location etc.
39 // for the next time application is started
40 configurer.setSaveAndRestore(true);
41 }
42
43 /* (non-Javadoc)
44 * @see org.eclipse.ui.application.WorkbenchAdvisor#preStartup()
45 */
46 @Override
47 public void preStartup() {
48 // TODO Auto-generated method stub
49 super.preStartup();
50 // XXX check for updates before starting up.
51 // If an update is performed, restart.
52 // if (P2Util.checkForUpdates())
53 // PlatformUI.getWorkbench().restart();
54 }
55
56 /**
57 * see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=234252
58 */
59 // public void initialize(IWorkbenchConfigurer configurer) {
60 //
61 // WorkbenchAdapterBuilder.registerAdapters();
62 //
63 // final String ICONS_PATH = "icons/full/";
64 // final String PATH_OBJECT = ICONS_PATH + "obj16/";
65 // Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH);
66 // declareWorkbenchImage(configurer, ideBundle,
67 // IDE.SharedImages.IMG_OBJ_PROJECT, PATH_OBJECT + "prj_obj.gif",
68 // true);
69 // declareWorkbenchImage(configurer, ideBundle,
70 // IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT
71 // + "cprj_obj.gif", true);
72 //
73 // }
74 //
75 // private void declareWorkbenchImage(IWorkbenchConfigurer configurer_p,
76 // Bundle ideBundle, String symbolicName, String path, boolean shared) {
77 // URL url = ideBundle.getEntry(path);
78 // ImageDescriptor desc = ImageDescriptor.createFromURL(url);
79 // configurer_p.declareImage(symbolicName, desc, shared);
80 // }
81 //
82 // public IAdaptable getDefaultPageInput() {
83 // IWorkspace workspace = ResourcesPlugin.getWorkspace();
84 // return workspace.getRoot();
85 // }
86
87
88
89 }