2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.eclipse
.jface
.dialogs
.Dialog
;
14 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
15 import org
.eclipse
.jface
.window
.Window
;
16 import org
.eclipse
.swt
.graphics
.Point
;
17 import org
.eclipse
.ui
.application
.ActionBarAdvisor
;
18 import org
.eclipse
.ui
.application
.IActionBarConfigurer
;
19 import org
.eclipse
.ui
.application
.IWorkbenchWindowConfigurer
;
20 import org
.eclipse
.ui
.application
.WorkbenchWindowAdvisor
;
22 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
23 import eu
.etaxonomy
.taxeditor
.controller
.GlobalController
;
24 import eu
.etaxonomy
.taxeditor
.preference
.InitNomenclaturalCodePrefDialog
;
25 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
32 public class ApplicationWorkbenchWindowAdvisor
extends WorkbenchWindowAdvisor
{
33 private static final Logger logger
= Logger
.getLogger(ApplicationWorkbenchWindowAdvisor
.class);
35 public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer
) {
39 public ActionBarAdvisor
createActionBarAdvisor(
40 IActionBarConfigurer configurer
) {
41 return new ApplicationActionBarAdvisor(configurer
);
44 public void preWindowOpen() {
45 IWorkbenchWindowConfigurer configurer
= getWindowConfigurer();
46 configurer
.setInitialSize(new Point(963, 637));
47 configurer
.setShowCoolBar(true);
48 configurer
.setShowStatusLine(true);
49 configurer
.setShowPerspectiveBar(true);
50 configurer
.setTitle("EDIT Taxonomic Editor");
53 public void postWindowOpen() {
54 checkNomenclaturalCode();
57 private void checkNomenclaturalCode() {
59 // First time Editor is opened, no nomenclatural code has been set
60 if (PreferencesUtil
.getPreferredNomenclaturalCode() == null) {
62 // Query user re: preferred nom. code
63 Dialog dialog
= new InitNomenclaturalCodePrefDialog(GlobalController
.getShell());
64 int returnCode
= dialog
.open();
66 // Short message confirming user's choice
67 String code
= PreferencesUtil
.getPreferredNomenclaturalCodeAsString();
68 MessageDialog
.openInformation(GlobalController
.getShell(), "Nomenclatural code set",
69 "The following has been set as your preferred nomenclatural code:\n\n\t" +
70 code
+ "\n\nYou can change the botanical code at any time in the \"Preferences\" menu.");