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
.widgets
.Shell
;
16 import org
.eclipse
.ui
.IWorkbenchPage
;
17 import org
.eclipse
.ui
.themes
.ITheme
;
18 import org
.eclipse
.ui
.themes
.IThemeManager
;
20 import eu
.etaxonomy
.taxeditor
.store
.internal
.TaxeditorStorePlugin
;
27 public abstract class AbstractUtility
{
32 public static Shell
getShell() {
33 return TaxeditorStorePlugin
.getDefault().getWorkbench()
34 .getActiveWorkbenchWindow().getShell();
37 public static IWorkbenchPage
getActivePage(){
38 return TaxeditorStorePlugin
.getDefault().getWorkbench()
39 .getActiveWorkbenchWindow().getActivePage();
42 public static boolean closeAll() {
43 return getActivePage().closeAllEditors(true);
46 public static ITheme
getCurrentTheme(){
47 IThemeManager themeManager
= TaxeditorStorePlugin
.getDefault().getWorkbench().getThemeManager();
48 return themeManager
.getCurrentTheme();
52 * Fonts registered to the plugin may be obtained with the Eclipse themeing functionality.
53 * Thus fonts are chooseable by the user via Preferences->General->Appearance->Colors and Fonts
55 * @return the FontRegistry for the current theme
57 public static FontRegistry
getFontRegistry(){
58 return getCurrentTheme().getFontRegistry();
62 * Color registered to the plugin may be obtained with the Eclipse themeing functionality.
63 * Thus colors are editable by the user via Preferences->General->Appearance->Colors and Fonts
65 * @return the ColorRegistry for the current theme
67 public static ColorRegistry
getColorRegistry(){
68 return getCurrentTheme().getColorRegistry();