3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.model
;
13 import org
.eclipse
.jface
.resource
.ColorRegistry
;
14 import org
.eclipse
.jface
.resource
.FontRegistry
;
15 import org
.eclipse
.swt
.SWT
;
16 import org
.eclipse
.swt
.widgets
.MessageBox
;
17 import org
.eclipse
.swt
.widgets
.Shell
;
18 import org
.eclipse
.ui
.IWorkbenchPage
;
19 import org
.eclipse
.ui
.themes
.ITheme
;
20 import org
.eclipse
.ui
.themes
.IThemeManager
;
22 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
23 import eu
.etaxonomy
.taxeditor
.store
.internal
.TaxeditorStorePlugin
;
30 public abstract class AbstractUtility
{
35 public static Shell
getShell() {
36 return TaxeditorStorePlugin
.getDefault().getWorkbench()
37 .getActiveWorkbenchWindow().getShell();
40 public static IWorkbenchPage
getActivePage(){
41 return TaxeditorStorePlugin
.getDefault().getWorkbench()
42 .getActiveWorkbenchWindow().getActivePage();
45 public static boolean closeAll() {
46 return getActivePage().closeAllEditors(true);
49 public static ITheme
getCurrentTheme(){
50 IThemeManager themeManager
= TaxeditorStorePlugin
.getDefault().getWorkbench().getThemeManager();
51 return themeManager
.getCurrentTheme();
55 * Fonts registered to the plugin may be obtained with the Eclipse themeing functionality.
56 * Thus fonts are chooseable by the user via Preferences->General->Appearance->Colors and Fonts
58 * @return the FontRegistry for the current theme
60 public static FontRegistry
getFontRegistry(){
61 return getCurrentTheme().getFontRegistry();
65 * Color registered to the plugin may be obtained with the Eclipse themeing functionality.
66 * Thus colors are editable by the user via Preferences->General->Appearance->Colors and Fonts
68 * @return the ColorRegistry for the current theme
70 public static ColorRegistry
getColorRegistry(){
71 return getCurrentTheme().getColorRegistry();
75 * Open a message box that informs the user about unimplemented functionality.
76 * This method is for developer convenience.
78 public static void notImplementedMessage(){
79 MessageBox messageBox
= new MessageBox(getShell(), SWT
.ICON_WARNING
| SWT
.OK
);
80 messageBox
.setText("Not yet implemented");