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
.store
.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
.IEditorReference
;
17 import org
.eclipse
.ui
.IWorkbenchPage
;
18 import org
.eclipse
.ui
.themes
.ITheme
;
19 import org
.eclipse
.ui
.themes
.IThemeManager
;
21 import eu
.etaxonomy
.taxeditor
.store
.internal
.TaxeditorStorePlugin
;
28 public abstract class AbstractUtility
{
33 public static Shell
getShell() {
34 return TaxeditorStorePlugin
.getDefault().getWorkbench()
35 .getActiveWorkbenchWindow().getShell();
38 public static IWorkbenchPage
getActivePage(){
39 return TaxeditorStorePlugin
.getDefault().getWorkbench()
40 .getActiveWorkbenchWindow().getActivePage();
43 public static boolean closeAll() {
44 for (IEditorReference reference
: getActivePage().getEditorReferences()) {
45 if (!getActivePage().closeEditor(reference
.getEditor(false), true)) {
52 public static ITheme
getCurrentTheme(){
53 IThemeManager themeManager
= TaxeditorStorePlugin
.getDefault().getWorkbench().getThemeManager();
54 return themeManager
.getCurrentTheme();
58 * Fonts registered to the plugin may be obtained with the Eclipse themeing functionality.
59 * Thus fonts are chooseable by the user via Preferences->General->Appearance->Colors and Fonts
61 * @return the FontRegistry for the current theme
63 public static FontRegistry
getFontRegistry(){
64 return getCurrentTheme().getFontRegistry();
68 * Color registered to the plugin may be obtained with the Eclipse themeing functionality.
69 * Thus colors are editable by the user via Preferences->General->Appearance->Colors and Fonts
71 * @return the ColorRegistry for the current theme
73 public static ColorRegistry
getColorRegistry(){
74 return getCurrentTheme().getColorRegistry();