129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2006, 2008 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 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.jface.text.quickassist.IQuickFixableAnnotation;
|
|
14
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17
|
|
18 import dwtx.core.runtime.AssertionFailedException;
|
|
19 import dwtx.jface.text.source.Annotation;
|
|
20
|
|
21
|
|
22 /**
|
|
23 * Allows an annotation to tell whether there are quick fixes
|
|
24 * for it and to cache that state.
|
|
25 * <p>
|
|
26 * Caching the state is important to improve overall performance as calling
|
|
27 * {@link dwtx.jface.text.quickassist.IQuickAssistAssistant#canFix(Annotation)}
|
|
28 * can be expensive.
|
|
29 * </p>
|
|
30 * <p>
|
|
31 * This interface can be implemented by clients.</p>
|
|
32 *
|
|
33 * @since 3.2
|
|
34 */
|
|
35 public interface IQuickFixableAnnotation {
|
|
36
|
|
37 /**
|
|
38 * Sets whether there are quick fixes available for
|
|
39 * this annotation.
|
|
40 *
|
|
41 * @param state <code>true</code> if there are quick fixes available, false otherwise
|
|
42 */
|
|
43 void setQuickFixable(bool state);
|
|
44
|
|
45 /**
|
|
46 * Tells whether the quick fixable state has been set.
|
|
47 * <p>
|
|
48 * Normally this means {@link #setQuickFixable(bool)} has been
|
|
49 * called at least once but it can also be hard-coded, e.g. always
|
|
50 * return <code>true</code>.
|
|
51 * </p>
|
|
52 *
|
|
53 * @return <code>true</code> if the state has been set
|
|
54 */
|
|
55 bool isQuickFixableStateSet();
|
|
56
|
|
57 /**
|
|
58 * Tells whether there are quick fixes for this annotation.
|
|
59 * <p>
|
|
60 * <strong>Note:</strong> This method must only be called
|
|
61 * if {@link #isQuickFixableStateSet()} returns <code>true</code>.</p>
|
|
62 *
|
|
63 * @return <code>true</code> if this annotation offers quick fixes
|
|
64 * @throws AssertionFailedException if called when {@link #isQuickFixableStateSet()} is <code>false</code>
|
|
65 */
|
|
66 bool isQuickFixable() throws AssertionFailedException;
|
|
67
|
|
68 }
|