1 package eu
.etaxonomy
.taxeditor
;
3 import org
.apache
.log4j
.Logger
;
4 import org
.eclipse
.jface
.dialogs
.Dialog
;
5 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
6 import org
.eclipse
.swt
.graphics
.Point
;
7 import org
.eclipse
.swt
.widgets
.Shell
;
8 import org
.eclipse
.ui
.application
.ActionBarAdvisor
;
9 import org
.eclipse
.ui
.application
.IActionBarConfigurer
;
10 import org
.eclipse
.ui
.application
.IWorkbenchWindowConfigurer
;
11 import org
.eclipse
.ui
.application
.WorkbenchWindowAdvisor
;
13 import eu
.etaxonomy
.taxeditor
.store
.preference
.InitNomenclaturalCodePrefDialog
;
14 import eu
.etaxonomy
.taxeditor
.store
.preference
.PreferencesUtil
;
16 public class ApplicationWorkbenchWindowAdvisor
extends WorkbenchWindowAdvisor
{
17 private static final Logger logger
= Logger
.getLogger(ApplicationWorkbenchWindowAdvisor
.class);
19 public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer
) {
23 public ActionBarAdvisor
createActionBarAdvisor(
24 IActionBarConfigurer configurer
) {
25 return new ApplicationActionBarAdvisor(configurer
);
28 public void preWindowOpen() {
29 IWorkbenchWindowConfigurer configurer
= getWindowConfigurer();
30 configurer
.setInitialSize(new Point(963, 637));
31 configurer
.setShowCoolBar(true);
32 configurer
.setShowStatusLine(true);
33 configurer
.setShowPerspectiveBar(true);
34 configurer
.setTitle("EDIT Taxonomic Editor");
37 public void postWindowOpen() {
38 checkNomenclaturalCode();
41 private void checkNomenclaturalCode() {
43 // First time Editor is opened, no nomenclatural code has been set
44 if (PreferencesUtil
.getPreferredNomenclaturalCode() == null) {
46 logger
.debug("No nomencatural code set.");
48 Shell shell
= TaxonomicEditorPlugin
.getDefault().getWorkbench()
49 .getActiveWorkbenchWindow().getShell();
51 // Query user re: preferred nom. code
52 Dialog dialog
= new InitNomenclaturalCodePrefDialog(shell
);
55 // Short message confirming user's choice
56 String code
= PreferencesUtil
.getPreferredNomenclaturalCodeAsString();
57 MessageDialog
.openInformation(shell
, "Nomenclatural code set",
58 "The following has been set as your preferred nomenclatural code:\n\n\t" +
59 code
+ "\n\nYou can change the nomenclatural code at any time in the \"Preferences\" menu.");