nothing
[taxeditor.git] / eu.etaxonomy.taxeditor.application / src / main / java / eu / etaxonomy / taxeditor / ApplicationWorkbenchWindowAdvisor.java
1 package eu.etaxonomy.taxeditor;
2
3 import org.eclipse.swt.graphics.Point;
4 import org.eclipse.swt.widgets.Shell;
5 import org.eclipse.ui.application.ActionBarAdvisor;
6 import org.eclipse.ui.application.IActionBarConfigurer;
7 import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
8 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
9
10 import eu.etaxonomy.taxeditor.model.MessagingUtils;
11 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
12 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
13 import eu.etaxonomy.taxeditor.store.CdmStore;
14 import eu.etaxonomy.taxeditor.ui.dialog.LoginDialog;
15 import eu.etaxonomy.taxeditor.update.P2Util;
16
17 /**
18 * <p>ApplicationWorkbenchWindowAdvisor class.</p>
19 *
20 * @author n.hoffmann
21 * @version $Id: $
22 */
23 public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
24
25 /**
26 * <p>Constructor for ApplicationWorkbenchWindowAdvisor.</p>
27 *
28 * @param configurer a {@link org.eclipse.ui.application.IWorkbenchWindowConfigurer} object.
29 */
30 public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
31 super(configurer);
32 }
33
34 /** {@inheritDoc} */
35 @Override
36 public ActionBarAdvisor createActionBarAdvisor(
37 IActionBarConfigurer configurer) {
38 return new ApplicationActionBarAdvisor(configurer);
39 }
40
41 /**
42 * <p>preWindowOpen</p>
43 */
44 @Override
45 public void preWindowOpen() {
46 IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
47 configurer.setInitialSize(new Point(963, 637));
48 configurer.setShowCoolBar(true);
49 configurer.setShowStatusLine(true);
50 configurer.setShowPerspectiveBar(true);
51 configurer.setTitle("EDIT Taxonomic Editor " + ApplicationUtil.getVersion());
52 configurer.setShowProgressIndicator(true);
53 }
54
55 /**
56 * <p>postWindowOpen</p>
57 */
58 @Override
59 public void postWindowOpen() {
60 PreferencesUtil.checkNomenclaturalCode();
61
62 if(PreferencesUtil.shouldConnectAtStartUp()) {
63 CdmStore.connect();
64 }
65
66
67 try {
68 if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_AUTO_UPDATE_AT_STARTUP)) {
69 P2Util.checkForUpdates();
70 }
71 } catch (Exception e) {
72 MessagingUtils.error(this.getClass(), e);
73 }
74 }
75
76 private int authenticate(){
77 Shell shell = TaxonomicEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
78
79 LoginDialog loginDialog = new LoginDialog(shell);
80 return loginDialog.open();
81 }
82 }
83