1 package eu
.etaxonomy
.taxeditor
;
5 import org
.eclipse
.e4
.ui
.model
.application
.ui
.basic
.MTrimElement
;
6 import org
.eclipse
.e4
.ui
.model
.application
.ui
.menu
.MToolBarElement
;
7 import org
.eclipse
.e4
.ui
.model
.application
.ui
.menu
.impl
.ToolBarImpl
;
8 import org
.eclipse
.swt
.graphics
.Point
;
9 import org
.eclipse
.ui
.IWorkbenchWindow
;
10 import org
.eclipse
.ui
.PlatformUI
;
11 import org
.eclipse
.ui
.application
.ActionBarAdvisor
;
12 import org
.eclipse
.ui
.application
.IActionBarConfigurer
;
13 import org
.eclipse
.ui
.application
.IWorkbenchWindowConfigurer
;
14 import org
.eclipse
.ui
.application
.WorkbenchWindowAdvisor
;
15 import org
.eclipse
.ui
.internal
.WorkbenchWindow
;
17 import eu
.etaxonomy
.taxeditor
.datasource
.CdmDataSourceRepository
;
18 import eu
.etaxonomy
.taxeditor
.handler
.update
.P2Util
;
19 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
20 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
21 import eu
.etaxonomy
.taxeditor
.util
.ApplicationUtil
;
26 public class ApplicationWorkbenchWindowAdvisor
extends WorkbenchWindowAdvisor
{
28 public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer
) {
33 public ActionBarAdvisor
createActionBarAdvisor(
34 IActionBarConfigurer configurer
) {
35 return new ApplicationActionBarAdvisor(configurer
);
39 public void preWindowOpen() {
40 IWorkbenchWindowConfigurer configurer
= getWindowConfigurer();
41 configurer
.setInitialSize(new Point(1280, 720));
42 configurer
.setShowCoolBar(true);
43 configurer
.setShowStatusLine(true);
44 configurer
.setShowPerspectiveBar(true);
45 configurer
.setTitle(ApplicationUtil
.getTitle());
46 configurer
.setShowProgressIndicator(true);
48 CdmDataSourceRepository
.createDefaultH2DataSource();
52 public void postWindowOpen() {
53 IWorkbenchWindow workbenchWindow
= PlatformUI
.getWorkbench().getActiveWorkbenchWindow();
55 List
<MTrimElement
> elements
= ((WorkbenchWindow
) workbenchWindow
).getTopTrim().getChildren();
56 for (MTrimElement item
: elements
) {
57 if (item
instanceof ToolBarImpl
){
58 ToolBarImpl toolBar
= (ToolBarImpl
)item
;
59 List
<MToolBarElement
> children
= toolBar
.getChildren();
60 for (MToolBarElement element
: children
){
61 if (element
.getElementId().equals("eu.etaxonomy.taxeditor.workbench.menu.toolbar.new")) {
62 element
.setVisible(false);
68 P2Util
.setP2UpdateRepositories();
70 if(PreferencesUtil
.shouldConnectAtStartUp()) {
76 public void postWindowClose() {
77 P2Util
.saveP2RepositoryPreferences();