001: /*******************************************************************************
002: * Copyright (c) 2004, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui.themes;
011:
012: import java.util.Set;
013:
014: import org.eclipse.jface.resource.ColorRegistry;
015: import org.eclipse.jface.resource.FontRegistry;
016: import org.eclipse.jface.util.IPropertyChangeListener;
017:
018: /**
019: * A theme is a collection of colors, fonts and supporting data that may
020: * be used by plugins to help provide uniform look and feel to their components.
021: * The workbench has a default theme (one whos id has the value {@link org.eclipse.ui.themes.IThemeManager#DEFAULT_THEME})
022: * that defines the initial values for a collection of fonts and colors. Other
023: * themes may extend and override the default theme to provide new values.
024: *
025: * <p>
026: * Clients may obtain themes via {@link org.eclipse.ui.themes.IThemeManager#getTheme(String)}.
027: * </p>
028: *
029: * <p>
030: * This interface is not intended to be implemented or extended by clients.
031: * </p>
032: *
033: * @see org.eclipse.ui.IWorkbench#getThemeManager()
034: * @since 3.0
035: */
036: public interface ITheme {
037:
038: /**
039: * Adds a property listener to the theme. Any events fired by the
040: * underlying registries will cause an event to be fired. This event is the
041: * same event that was fired by the registry. As such, the "source"
042: * attribute of the event will not be this theme, but rather the color or
043: * font registry.
044: *
045: * @param listener the listener to add
046: */
047: void addPropertyChangeListener(IPropertyChangeListener listener);
048:
049: /**
050: * Dispose of this theme. This method is called by the workbench when
051: * appropriate and should never be called by a user.
052: */
053: void dispose();
054:
055: /**
056: * Get arbitrary data associated with this theme.
057: *
058: * @param key the key
059: * @return the data, or the default value <code>false</code> if none exists
060: * or if the value cannot be treated as a boolean.
061: */
062: boolean getBoolean(String key);
063:
064: /**
065: * Return this themes color registry.
066: *
067: * @return this themes color registry
068: */
069: ColorRegistry getColorRegistry();
070:
071: /**
072: * Return this themes font registry.
073: *
074: * @return this themes font registry
075: */
076: FontRegistry getFontRegistry();
077:
078: /**
079: * Returns the id of this theme.
080: *
081: * @return the id of this theme. Guaranteed not to be <code>null</code>.
082: */
083: String getId();
084:
085: /**
086: * Get arbitrary data associated with this theme.
087: *
088: * @param key the key
089: * @return the data, or the default value <code>0</code> if none exists or
090: * if the value cannot be treated as an integer.
091: */
092: public int getInt(String key);
093:
094: /**
095: * Returns the label of this theme.
096: *
097: * @return the label of this theme. Guaranteed not be <code>null</code>.
098: */
099: String getLabel();
100:
101: /**
102: * Get arbitrary data associated with this theme.
103: *
104: * @param key the key
105: * @return the data, or <code>null</code> if none exists.
106: */
107: String getString(String key);
108:
109: /**
110: * Get the set of keys associated with this theme.
111: *
112: * @return the Set of keys
113: */
114: Set keySet();
115:
116: /**
117: * Removes a property listener from the theme.
118: *
119: * @param listener the listener to remove
120: */
121: void removePropertyChangeListener(IPropertyChangeListener listener);
122: }
|