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
.handler
.update
.P2Util
;
18 import eu
.etaxonomy
.taxeditor
.util
.ApplicationUtil
;
23 public class ApplicationWorkbenchWindowAdvisor
extends WorkbenchWindowAdvisor
{
25 public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer
) {
30 public ActionBarAdvisor
createActionBarAdvisor(
31 IActionBarConfigurer configurer
) {
32 return new ApplicationActionBarAdvisor(configurer
);
36 public void preWindowOpen() {
37 IWorkbenchWindowConfigurer configurer
= getWindowConfigurer();
38 configurer
.setInitialSize(new Point(1280, 720));
39 configurer
.setShowCoolBar(true);
40 configurer
.setShowStatusLine(true);
41 configurer
.setShowPerspectiveBar(true);
42 configurer
.setTitle(ApplicationUtil
.getTitle());
43 configurer
.setShowProgressIndicator(true);
45 // CdmDataSourceRepository.createDefaultH2DataSource();
49 public void postWindowOpen() {
50 IWorkbenchWindow workbenchWindow
= PlatformUI
.getWorkbench().getActiveWorkbenchWindow();
52 List
<MTrimElement
> elements
= ((WorkbenchWindow
) workbenchWindow
).getTopTrim().getChildren();
53 for (MTrimElement item
: elements
) {
54 if (item
instanceof ToolBarImpl
){
55 ToolBarImpl toolBar
= (ToolBarImpl
)item
;
56 List
<MToolBarElement
> children
= toolBar
.getChildren();
57 for (MToolBarElement element
: children
){
58 if (element
.getElementId().equals("eu.etaxonomy.taxeditor.workbench.menu.toolbar.new")) {
59 element
.setVisible(false);
65 P2Util
.setP2UpdateRepositories();
66 // TODO: think about how to implement this with
67 // if(PreferencesUtil.shouldConnectAtStartUp()) {
68 // CdmStore.connect();
73 public void postWindowClose() {
74 P2Util
.saveP2RepositoryPreferences();