upload tizen1.0 source
[sdk/ide/product.git] / org.eclipse.cdt.ui / src / org / eclipse / cdt / internal / ui / editor / SemanticHighlighting.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2009 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  *     Anton Leherbauer (Wind River Systems) - Adapted for CDT
11  *     Markus Schorn (Wind River Systems)
12  *******************************************************************************/
13
14 package org.eclipse.cdt.internal.ui.editor;
15
16 import org.eclipse.swt.graphics.RGB;
17
18 /**
19  * Semantic highlighting.
20  * Cloned from JDT.
21  * 
22  * @since 4.0
23  */
24 public abstract class SemanticHighlighting {
25
26         /**
27          * @return the preference key, will be augmented by a prefix and a suffix for each preference
28          */
29         public abstract String getPreferenceKey();
30
31         /**
32          * @return the default text color
33          */
34         public RGB getDefaultTextColor() {
35                 return new RGB(0, 0, 0);
36         }
37
38         /**
39          * @return <code>true</code> if the text attribute bold is set by default
40          */
41         public boolean isBoldByDefault() {
42                 return false;
43         }
44
45         /**
46          * @return <code>true</code> if the text attribute italic is set by default
47          */
48         public boolean isItalicByDefault() {
49                 return false;
50         }
51
52         /**
53          * @return <code>true</code> if the text attribute strikethrough is set by default
54          */
55         public boolean isStrikethroughByDefault() {
56                 return false;
57         }
58
59         /**
60          * @return <code>true</code> if the text attribute underline is set by default
61          * @since 3.1
62          */
63         public boolean isUnderlineByDefault() {
64                 return false;
65         }
66
67         /**
68          * @return <code>true</code> if the text attribute italic is enabled by default
69          */
70         public abstract boolean isEnabledByDefault();
71
72         /**
73          * @return the display name
74          */
75         public abstract String getDisplayName();
76         
77         /**
78          * Indicates that the highlighting needs to visit implicit names 
79          * (e.g. overloaded operators)
80          */
81         public boolean requiresImplicitNames() {
82                 return false;
83         }
84
85         /**
86          * Returns <code>true</code> iff the semantic highlighting consumes the semantic token.
87          * <p>
88          * NOTE: Implementors are not allowed to keep a reference on the token or on any object
89          * retrieved from the token.
90          * </p>
91          *
92          * @param token the semantic token for a {@link org.eclipse.cdt.core.dom.ast.IASTName}
93          * @return <code>true</code> iff the semantic highlighting consumes the semantic token
94          */
95         public abstract boolean consumes(SemanticToken token);
96 }