001: /*******************************************************************************
002: * Copyright (c) 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.texteditor;
011:
012: import org.eclipse.swt.graphics.RGB;
013:
014: import org.eclipse.core.runtime.IConfigurationElement;
015:
016: import org.eclipse.jface.resource.ImageDescriptor;
017:
018: /**
019: * Copy of {@link AnnotationPreference} which can be
020: * marked as read-only in which state no modification
021: * is allowed.
022: * <p>
023: * In the read-only state a {@link UnsupportedOperationException}
024: * is thrown by methods that modify the preference.
025: * </p>
026: *
027: * @since 3.2
028: */
029: class ReadOnlyAnnotationPreference extends AnnotationPreference {
030:
031: private boolean fIsReadOnly;
032:
033: public void merge(AnnotationPreference preference) {
034: if (fIsReadOnly)
035: throw new UnsupportedOperationException();
036: super .merge(preference);
037: }
038:
039: public void setAnnotationImageProvider(
040: IAnnotationImageProvider provider) {
041: if (fIsReadOnly)
042: throw new UnsupportedOperationException();
043: super .setAnnotationImageProvider(provider);
044: }
045:
046: public void setAnnotationImageProviderData(
047: IConfigurationElement configurationElement,
048: String annotationImageProviderAttribute) {
049: if (fIsReadOnly)
050: throw new UnsupportedOperationException();
051: super .setAnnotationImageProviderData(configurationElement,
052: annotationImageProviderAttribute);
053: }
054:
055: public void setAnnotationType(Object annotationType) {
056: if (fIsReadOnly)
057: throw new UnsupportedOperationException();
058: super .setAnnotationType(annotationType);
059: }
060:
061: public void setColorPreferenceKey(String colorKey) {
062: if (fIsReadOnly)
063: throw new UnsupportedOperationException();
064: super .setColorPreferenceKey(colorKey);
065: }
066:
067: public void setColorPreferenceValue(RGB colorValue) {
068: if (fIsReadOnly)
069: throw new UnsupportedOperationException();
070: super .setColorPreferenceValue(colorValue);
071: }
072:
073: public void setContributesToHeader(boolean contributesToHeader) {
074: if (fIsReadOnly)
075: throw new UnsupportedOperationException();
076: super .setContributesToHeader(contributesToHeader);
077: }
078:
079: public void setHighlightPreferenceKey(String highlightKey) {
080: if (fIsReadOnly)
081: throw new UnsupportedOperationException();
082: super .setHighlightPreferenceKey(highlightKey);
083: }
084:
085: public void setHighlightPreferenceValue(boolean highlightValue) {
086: if (fIsReadOnly)
087: throw new UnsupportedOperationException();
088: super .setHighlightPreferenceValue(highlightValue);
089: }
090:
091: public void setImageDescriptor(ImageDescriptor descriptor) {
092: if (fIsReadOnly)
093: throw new UnsupportedOperationException();
094: super .setImageDescriptor(descriptor);
095: }
096:
097: public void setIncludeOnPreferencePage(
098: boolean includeOnPreferencePage) {
099: if (fIsReadOnly)
100: throw new UnsupportedOperationException();
101: super .setIncludeOnPreferencePage(includeOnPreferencePage);
102: }
103:
104: public void setIsGoToNextNavigationTarget(
105: boolean isGoToNextNavigationTarget) {
106: if (fIsReadOnly)
107: throw new UnsupportedOperationException();
108: super .setIsGoToNextNavigationTarget(isGoToNextNavigationTarget);
109: }
110:
111: public void setIsGoToNextNavigationTargetKey(
112: String isGoToNextNavigationTargetKey) {
113: if (fIsReadOnly)
114: throw new UnsupportedOperationException();
115: super
116: .setIsGoToNextNavigationTargetKey(isGoToNextNavigationTargetKey);
117: }
118:
119: public void setIsGoToPreviousNavigationTarget(
120: boolean isGoToPreviousNavigationTarget) {
121: if (fIsReadOnly)
122: throw new UnsupportedOperationException();
123: super
124: .setIsGoToPreviousNavigationTarget(isGoToPreviousNavigationTarget);
125: }
126:
127: public void setIsGoToPreviousNavigationTargetKey(
128: String isGoToPreviousNavigationTargetKey) {
129: if (fIsReadOnly)
130: throw new UnsupportedOperationException();
131: super
132: .setIsGoToPreviousNavigationTargetKey(isGoToPreviousNavigationTargetKey);
133: }
134:
135: public void setMarkerType(String markerType) {
136: if (fIsReadOnly)
137: throw new UnsupportedOperationException();
138: super .setMarkerType(markerType);
139: }
140:
141: public void setOverviewRulerPreferenceKey(String overviewRulerKey) {
142: if (fIsReadOnly)
143: throw new UnsupportedOperationException();
144: super .setOverviewRulerPreferenceKey(overviewRulerKey);
145: }
146:
147: public void setOverviewRulerPreferenceValue(
148: boolean overviewRulerValue) {
149: if (fIsReadOnly)
150: throw new UnsupportedOperationException();
151: super .setOverviewRulerPreferenceValue(overviewRulerValue);
152: }
153:
154: public void setPreferenceLabel(String label) {
155: if (fIsReadOnly)
156: throw new UnsupportedOperationException();
157: super .setPreferenceLabel(label);
158: }
159:
160: public void setPresentationLayer(int presentationLayer) {
161: if (fIsReadOnly)
162: throw new UnsupportedOperationException();
163: super .setPresentationLayer(presentationLayer);
164: }
165:
166: public void setQuickFixImageDescriptor(ImageDescriptor descriptor) {
167: if (fIsReadOnly)
168: throw new UnsupportedOperationException();
169: super .setQuickFixImageDescriptor(descriptor);
170: }
171:
172: public void setSeverity(int severity) {
173: if (fIsReadOnly)
174: throw new UnsupportedOperationException();
175: super .setSeverity(severity);
176: }
177:
178: public void setShowInNextPrevDropdownToolbarAction(
179: boolean showInNextPrevDropdownToolbarAction) {
180: if (fIsReadOnly)
181: throw new UnsupportedOperationException();
182: super
183: .setShowInNextPrevDropdownToolbarAction(showInNextPrevDropdownToolbarAction);
184: }
185:
186: public void setShowInNextPrevDropdownToolbarActionKey(
187: String showInNextPrevDropdownToolbarActionKey) {
188: if (fIsReadOnly)
189: throw new UnsupportedOperationException();
190: super
191: .setShowInNextPrevDropdownToolbarActionKey(showInNextPrevDropdownToolbarActionKey);
192: }
193:
194: public void setSymbolicImageName(String symbolicImageName) {
195: if (fIsReadOnly)
196: throw new UnsupportedOperationException();
197: super .setSymbolicImageName(symbolicImageName);
198: }
199:
200: public void setTextPreferenceKey(String textKey) {
201: if (fIsReadOnly)
202: throw new UnsupportedOperationException();
203: super .setTextPreferenceKey(textKey);
204: }
205:
206: public void setTextPreferenceValue(boolean textValue) {
207: if (fIsReadOnly)
208: throw new UnsupportedOperationException();
209: super .setTextPreferenceValue(textValue);
210: }
211:
212: public void setTextStylePreferenceKey(String key) {
213: if (fIsReadOnly)
214: throw new UnsupportedOperationException();
215: super .setTextStylePreferenceKey(key);
216: }
217:
218: public void setTextStyleValue(String value) {
219: if (fIsReadOnly)
220: throw new UnsupportedOperationException();
221: super .setTextStyleValue(value);
222: }
223:
224: protected void setValue(Object attribute, boolean value) {
225: if (fIsReadOnly)
226: throw new UnsupportedOperationException();
227: super .setValue(attribute, value);
228: }
229:
230: protected void setValue(Object attribute, int value) {
231: if (fIsReadOnly)
232: throw new UnsupportedOperationException();
233: super .setValue(attribute, value);
234: }
235:
236: protected void setValue(Object attribute, Object value) {
237: if (fIsReadOnly)
238: throw new UnsupportedOperationException();
239: super .setValue(attribute, value);
240: }
241:
242: public void setVerticalRulerPreferenceKey(String verticalRulerKey) {
243: if (fIsReadOnly)
244: throw new UnsupportedOperationException();
245: super .setVerticalRulerPreferenceKey(verticalRulerKey);
246: }
247:
248: public void setVerticalRulerPreferenceValue(
249: boolean verticalRulerValue) {
250: if (fIsReadOnly)
251: throw new UnsupportedOperationException();
252: super .setVerticalRulerPreferenceValue(verticalRulerValue);
253: }
254:
255: public void markReadOnly() {
256: fIsReadOnly = true;
257: }
258:
259: }
|