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