129
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2006, 2007 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.IQuickAssistProcessor;
|
|
14
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17 import dwtx.jface.text.contentassist.ICompletionProposal;
|
|
18 import dwtx.jface.text.source.Annotation;
|
|
19
|
|
20
|
|
21 /**
|
|
22 * Quick assist processor for quick fixes and quick assists.
|
|
23 * <p>
|
|
24 * A processor can provide just quick fixes, just quick assists
|
|
25 * or both.
|
|
26 * </p>
|
|
27 * <p>
|
|
28 * This interface can be implemented by clients.</p>
|
|
29 *
|
|
30 * @since 3.2
|
|
31 */
|
|
32 public interface IQuickAssistProcessor {
|
|
33
|
|
34 /**
|
|
35 * Returns the reason why this quick assist processor
|
|
36 * was unable to produce any completion proposals.
|
|
37 *
|
|
38 * @return an error message or <code>null</code> if no error occurred
|
|
39 */
|
|
40 String getErrorMessage();
|
|
41
|
|
42 /**
|
|
43 * Tells whether this processor has a fix for the given annotation.
|
|
44 * <p>
|
|
45 * <strong>Note:</strong> This test must be fast and optimistic i.e. it is OK to return
|
|
46 * <code>true</code> even though there might be no quick fix.
|
|
47 * </p>
|
|
48 *
|
|
49 * @param annotation the annotation
|
|
50 * @return <code>true</code> if the assistant has a fix for the given annotation
|
|
51 */
|
|
52 bool canFix(Annotation annotation);
|
|
53
|
|
54 /**
|
|
55 * Tells whether this assistant has assists for the given invocation context.
|
|
56 *
|
|
57 * @param invocationContext the invocation context
|
|
58 * @return <code>true</code> if the assistant has a fix for the given annotation
|
|
59 */
|
|
60 bool canAssist(IQuickAssistInvocationContext invocationContext);
|
|
61
|
|
62 /**
|
|
63 * Returns a list of quick assist and quick fix proposals for the
|
|
64 * given invocation context.
|
|
65 *
|
|
66 * @param invocationContext the invocation context
|
|
67 * @return an array of completion proposals or <code>null</code> if no proposals are available
|
|
68 */
|
|
69 ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext);
|
|
70
|
|
71 }
|