1 /*******************************************************************************
2 * Copyright (c) 2008 Symbian Software Systems 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
9 * Andrew Ferguson (Symbian) - Initial implementation
10 *******************************************************************************/
11 package org.eclipse.cdt.ui.text;
13 import org.eclipse.jface.preference.IPreferenceStore;
14 import org.eclipse.jface.text.rules.IToken;
16 import org.eclipse.cdt.ui.IPropertyChangeParticipant;
17 import org.eclipse.cdt.ui.PreferenceConstants;
20 * An ITokenStore manages a set of tokens for a specified set of color property identifiers. Responsibilities include
22 * <li> Reacting to changes to preferences in a specified {@link IPreferenceStore}
23 * <li> Managing whether further styles (bold, italic, strikethrough, underline) should be applied
27 * ITokenStore assumes style preferences are stored under the following names
29 * Preference color key + {@link PreferenceConstants#EDITOR_BOLD_SUFFIX} are used
30 * to retrieve whether the token is rendered in bold.
33 * Preference color key + {@link PreferenceConstants#EDITOR_ITALIC_SUFFIX} are used
34 * to retrieve whether the token is rendered in italic.
37 * Preference color key + {@link PreferenceConstants#EDITOR_STRIKETHROUGH_SUFFIX} are used
38 * to retrieve whether the token is rendered in strikethrough.
41 * Preference color key + {@link PreferenceConstants#EDITOR_UNDERLINE_SUFFIX} are used
42 * to retrieve whether the token is rendered in underline.
45 * Clients may implement this interface.
48 * @see ITokenStoreFactory
51 public interface ITokenStore extends IPropertyChangeParticipant {
53 * Ensures any IToken objects that will be <em>or have been</em> returned are
54 * initialized for display.
56 void ensureTokensInitialised();
60 * @return a token for the specified property. The Token may not be suitable for use if the
61 * current Display is null. Clients should call ITokenStoreFactory#ensureTokensInitialised() at the
62 * point of token use in case this token store was originally initialized before a display was available.
64 IToken getToken(String property);
67 * @return The preference store used to read token styling preferences from.
69 IPreferenceStore getPreferenceStore();