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
.preference
.InitNomenclaturalCodePrefDialog
;
24 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
31 public class ApplicationWorkbenchWindowAdvisor
extends WorkbenchWindowAdvisor
{
32 private static final Logger logger
= Logger
.getLogger(ApplicationWorkbenchWindowAdvisor
.class);
34 public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer
) {
38 public ActionBarAdvisor
createActionBarAdvisor(
39 IActionBarConfigurer configurer
) {
40 return new ApplicationActionBarAdvisor(configurer
);
43 public void preWindowOpen() {
44 IWorkbenchWindowConfigurer configurer
= getWindowConfigurer();
45 configurer
.setInitialSize(new Point(963, 637));
46 configurer
.setShowCoolBar(true);
47 configurer
.setShowStatusLine(true);
48 configurer
.setShowPerspectiveBar(true);
49 configurer
.setTitle("EDIT Taxonomic Editor");
52 public void postWindowOpen() {
53 checkNomenclaturalCode();
56 private void checkNomenclaturalCode() {
58 // First time Editor is opened, no nomenclatural code has been set
59 if (PreferencesUtil
.getPreferredNomenclaturalCode() == null) {
61 // Query user re: preferred nom. code
62 Dialog dialog
= new InitNomenclaturalCodePrefDialog(UiUtil
.getShell());
63 int returnCode
= dialog
.open();
65 // Short message confirming user's choice
66 String code
= PreferencesUtil
.getPreferredNomenclaturalCodeAsString();
67 MessageDialog
.openInformation(UiUtil
.getShell(), "Nomenclatural code set",
68 "The following has been set as your preferred nomenclatural code:\n\n\t" +
69 code
+ "\n\nYou can change the botanical code at any time in the \"Preferences\" menu.");