KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > texteditor > ReadOnlyAnnotationPreference


1 /*******************************************************************************
2  * Copyright (c) 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.texteditor;
12
13 import org.eclipse.swt.graphics.RGB;
14
15 import org.eclipse.core.runtime.IConfigurationElement;
16
17 import org.eclipse.jface.resource.ImageDescriptor;
18
19 /**
20  * Copy of {@link AnnotationPreference} which can be
21  * marked as read-only in which state no modification
22  * is allowed.
23  * <p>
24  * In the read-only state a {@link UnsupportedOperationException}
25  * is thrown by methods that modify the preference.
26  * </p>
27  *
28  * @since 3.2
29  */

30 class ReadOnlyAnnotationPreference extends AnnotationPreference {
31
32     private boolean fIsReadOnly;
33
34     public void merge(AnnotationPreference preference) {
35         if (fIsReadOnly)
36             throw new UnsupportedOperationException JavaDoc();
37         super.merge(preference);
38     }
39
40     public void setAnnotationImageProvider(IAnnotationImageProvider provider) {
41         if (fIsReadOnly)
42             throw new UnsupportedOperationException JavaDoc();
43         super.setAnnotationImageProvider(provider);
44     }
45
46     public void setAnnotationImageProviderData(IConfigurationElement configurationElement, String JavaDoc annotationImageProviderAttribute) {
47         if (fIsReadOnly)
48             throw new UnsupportedOperationException JavaDoc();
49         super.setAnnotationImageProviderData(configurationElement,
50                 annotationImageProviderAttribute);
51     }
52
53     public void setAnnotationType(Object JavaDoc annotationType) {
54         if (fIsReadOnly)
55             throw new UnsupportedOperationException JavaDoc();
56         super.setAnnotationType(annotationType);
57     }
58
59     public void setColorPreferenceKey(String JavaDoc colorKey) {
60         if (fIsReadOnly)
61             throw new UnsupportedOperationException JavaDoc();
62         super.setColorPreferenceKey(colorKey);
63     }
64
65     public void setColorPreferenceValue(RGB colorValue) {
66         if (fIsReadOnly)
67             throw new UnsupportedOperationException JavaDoc();
68         super.setColorPreferenceValue(colorValue);
69     }
70
71     public void setContributesToHeader(boolean contributesToHeader) {
72         if (fIsReadOnly)
73             throw new UnsupportedOperationException JavaDoc();
74         super.setContributesToHeader(contributesToHeader);
75     }
76
77     public void setHighlightPreferenceKey(String JavaDoc highlightKey) {
78         if (fIsReadOnly)
79             throw new UnsupportedOperationException JavaDoc();
80         super.setHighlightPreferenceKey(highlightKey);
81     }
82
83     public void setHighlightPreferenceValue(boolean highlightValue) {
84         if (fIsReadOnly)
85             throw new UnsupportedOperationException JavaDoc();
86         super.setHighlightPreferenceValue(highlightValue);
87     }
88
89     public void setImageDescriptor(ImageDescriptor descriptor) {
90         if (fIsReadOnly)
91             throw new UnsupportedOperationException JavaDoc();
92         super.setImageDescriptor(descriptor);
93     }
94
95     public void setIncludeOnPreferencePage(boolean includeOnPreferencePage) {
96         if (fIsReadOnly)
97             throw new UnsupportedOperationException JavaDoc();
98         super.setIncludeOnPreferencePage(includeOnPreferencePage);
99     }
100
101     public void setIsGoToNextNavigationTarget(boolean isGoToNextNavigationTarget) {
102         if (fIsReadOnly)
103             throw new UnsupportedOperationException JavaDoc();
104         super.setIsGoToNextNavigationTarget(isGoToNextNavigationTarget);
105     }
106
107     public void setIsGoToNextNavigationTargetKey(String JavaDoc isGoToNextNavigationTargetKey) {
108         if (fIsReadOnly)
109             throw new UnsupportedOperationException JavaDoc();
110         super.setIsGoToNextNavigationTargetKey(isGoToNextNavigationTargetKey);
111     }
112
113     public void setIsGoToPreviousNavigationTarget(boolean isGoToPreviousNavigationTarget) {
114         if (fIsReadOnly)
115             throw new UnsupportedOperationException JavaDoc();
116         super.setIsGoToPreviousNavigationTarget(isGoToPreviousNavigationTarget);
117     }
118
119     public void setIsGoToPreviousNavigationTargetKey(String JavaDoc isGoToPreviousNavigationTargetKey) {
120         if (fIsReadOnly)
121             throw new UnsupportedOperationException JavaDoc();
122         super.setIsGoToPreviousNavigationTargetKey(isGoToPreviousNavigationTargetKey);
123     }
124
125     public void setMarkerType(String JavaDoc markerType) {
126         if (fIsReadOnly)
127             throw new UnsupportedOperationException JavaDoc();
128         super.setMarkerType(markerType);
129     }
130
131     public void setOverviewRulerPreferenceKey(String JavaDoc overviewRulerKey) {
132         if (fIsReadOnly)
133             throw new UnsupportedOperationException JavaDoc();
134         super.setOverviewRulerPreferenceKey(overviewRulerKey);
135     }
136
137     public void setOverviewRulerPreferenceValue(boolean overviewRulerValue) {
138         if (fIsReadOnly)
139             throw new UnsupportedOperationException JavaDoc();
140         super.setOverviewRulerPreferenceValue(overviewRulerValue);
141     }
142
143     public void setPreferenceLabel(String JavaDoc label) {
144         if (fIsReadOnly)
145             throw new UnsupportedOperationException JavaDoc();
146         super.setPreferenceLabel(label);
147     }
148
149     public void setPresentationLayer(int presentationLayer) {
150         if (fIsReadOnly)
151             throw new UnsupportedOperationException JavaDoc();
152         super.setPresentationLayer(presentationLayer);
153     }
154
155     public void setQuickFixImageDescriptor(ImageDescriptor descriptor) {
156         if (fIsReadOnly)
157             throw new UnsupportedOperationException JavaDoc();
158         super.setQuickFixImageDescriptor(descriptor);
159     }
160
161     public void setSeverity(int severity) {
162         if (fIsReadOnly)
163             throw new UnsupportedOperationException JavaDoc();
164         super.setSeverity(severity);
165     }
166
167     public void setShowInNextPrevDropdownToolbarAction(boolean showInNextPrevDropdownToolbarAction) {
168         if (fIsReadOnly)
169             throw new UnsupportedOperationException JavaDoc();
170         super.setShowInNextPrevDropdownToolbarAction(showInNextPrevDropdownToolbarAction);
171     }
172
173     public void setShowInNextPrevDropdownToolbarActionKey(String JavaDoc showInNextPrevDropdownToolbarActionKey) {
174         if (fIsReadOnly)
175             throw new UnsupportedOperationException JavaDoc();
176         super.setShowInNextPrevDropdownToolbarActionKey(showInNextPrevDropdownToolbarActionKey);
177     }
178
179     public void setSymbolicImageName(String JavaDoc symbolicImageName) {
180         if (fIsReadOnly)
181             throw new UnsupportedOperationException JavaDoc();
182         super.setSymbolicImageName(symbolicImageName);
183     }
184
185     public void setTextPreferenceKey(String JavaDoc textKey) {
186         if (fIsReadOnly)
187             throw new UnsupportedOperationException JavaDoc();
188         super.setTextPreferenceKey(textKey);
189     }
190
191     public void setTextPreferenceValue(boolean textValue) {
192         if (fIsReadOnly)
193             throw new UnsupportedOperationException JavaDoc();
194         super.setTextPreferenceValue(textValue);
195     }
196
197     public void setTextStylePreferenceKey(String JavaDoc key) {
198         if (fIsReadOnly)
199             throw new UnsupportedOperationException JavaDoc();
200         super.setTextStylePreferenceKey(key);
201     }
202
203     public void setTextStyleValue(String JavaDoc value) {
204         if (fIsReadOnly)
205             throw new UnsupportedOperationException JavaDoc();
206         super.setTextStyleValue(value);
207     }
208
209     protected void setValue(Object JavaDoc attribute, boolean value) {
210         if (fIsReadOnly)
211             throw new UnsupportedOperationException JavaDoc();
212         super.setValue(attribute, value);
213     }
214
215     protected void setValue(Object JavaDoc attribute, int value) {
216         if (fIsReadOnly)
217             throw new UnsupportedOperationException JavaDoc();
218         super.setValue(attribute, value);
219     }
220
221     protected void setValue(Object JavaDoc attribute, Object JavaDoc value) {
222         if (fIsReadOnly)
223             throw new UnsupportedOperationException JavaDoc();
224         super.setValue(attribute, value);
225     }
226
227     public void setVerticalRulerPreferenceKey(String JavaDoc verticalRulerKey) {
228         if (fIsReadOnly)
229             throw new UnsupportedOperationException JavaDoc();
230         super.setVerticalRulerPreferenceKey(verticalRulerKey);
231     }
232
233     public void setVerticalRulerPreferenceValue(boolean verticalRulerValue) {
234         if (fIsReadOnly)
235             throw new UnsupportedOperationException JavaDoc();
236         super.setVerticalRulerPreferenceValue(verticalRulerValue);
237     }
238
239     public void markReadOnly() {
240         fIsReadOnly= true;
241     }
242     
243 }
244
Popular Tags