KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > themes > IThemeManager


1 /*******************************************************************************
2  * Copyright (c) 2004, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.themes;
12
13 import org.eclipse.jface.util.IPropertyChangeListener;
14
15 /**
16  * A theme manager is an object that contains references to usable
17  * <code>ITheme</code> objects and maintains a reference to the currently active
18  * theme. This theme will be used by the workbench to decorate tab folders and
19  * other controls where possible. The workbench implementation of this
20  * interface will push the values of the current theme into the underlying jface
21  * registries ({@link org.eclipse.jface.resource.ColorRegistry} and
22  * {@link org.eclipse.jface.resource.FontRegistry} whenever the current theme
23  * changes. Clients who do not need access to specific themes may instead
24  * attach listeners to these registries directly.
25  *
26  * <p>
27  * This interface is not intended to be implemented or extended by clients.
28  * </p>
29  *
30  * @see org.eclipse.ui.IWorkbench#getThemeManager()
31  * @since 3.0
32  */

33 public interface IThemeManager {
34
35     /**
36      * Indicates that the current theme has changed to a new theme.
37      */

38     public static final String JavaDoc CHANGE_CURRENT_THEME = "CHANGE_CURRENT_THEME"; //$NON-NLS-1$
39

40     /**
41      * The default theme id.
42      */

43     public static final String JavaDoc DEFAULT_THEME = "org.eclipse.ui.defaultTheme"; //$NON-NLS-1$
44

45     /**
46      * Adds a property listener to the manager. Any events fired by the
47      * underlying registries of the current theme will cause an event to be
48      * fired. This event is the same event that was fired by the registry.
49      * As such, the "source" attribute of the event will not be this manager,
50      * but rather the color or font registry. Additionally, an event is fired
51      * when the current theme changes to a new theme. The "property" attribute
52      * of such an event will have the value {@link IThemeManager#CHANGE_CURRENT_THEME}.
53      *
54      * @param listener the listener to add
55      */

56     void addPropertyChangeListener(IPropertyChangeListener listener);
57
58     /**
59      * Get the currently active theme.
60      *
61      * @return the current theme. This will never be <code>null</code>.
62      */

63     ITheme getCurrentTheme();
64
65     /**
66      * Get a theme.
67      *
68      * @param id the theme to find.
69      * @return the <code>ITheme</code> or <code>null</code> if it cannot be found.
70      */

71     ITheme getTheme(String JavaDoc id);
72
73     /**
74      * Removes a property listener from the workbench.
75      *
76      * @param listener the listener to remove
77      */

78     void removePropertyChangeListener(IPropertyChangeListener listener);
79
80     /**
81      * Set the currently active theme.
82      *
83      * @param id the id of the new active theme
84      */

85     void setCurrentTheme(String JavaDoc id);
86 }
87
Popular Tags