KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > quickassist > IQuickAssistProcessor


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  *******************************************************************************/

11 package org.eclipse.jface.text.quickassist;
12
13 import org.eclipse.jface.text.contentassist.ICompletionProposal;
14 import org.eclipse.jface.text.source.Annotation;
15
16
17 /**
18  * Quick assist processor for quick fixes and quick assists.
19  * <p>
20  * A processor can provide just quick fixes, just quick assists
21  * or both.
22  * </p>
23  * <p>
24  * This interface can be implemented by clients.</p>
25  *
26  * @since 3.2
27  */

28 public interface IQuickAssistProcessor {
29
30     /**
31      * Returns the reason why this quick assist processor
32      * was unable to produce any completion proposals.
33      *
34      * @return an error message or <code>null</code> if no error occurred
35      */

36     String JavaDoc getErrorMessage();
37
38     /**
39      * Tells whether this processor has a fix for the given annotation.
40      * <p>
41      * <strong>Note:</strong> This test must be fast and optimistic i.e. it is OK to return
42      * <code>true</code> even though there might be no quick fix.
43      * </p>
44      *
45      * @param annotation the annotation
46      * @return <code>true</code> if the assistant has a fix for the given annotation
47      */

48     boolean canFix(Annotation annotation);
49     
50     /**
51      * Tells whether this assistant has assists for the given invocation context.
52      *
53      * @param invocationContext the invocation context
54      * @return <code>true</code> if the assistant has a fix for the given annotation
55      */

56     boolean canAssist(IQuickAssistInvocationContext invocationContext);
57     
58     /**
59      * Returns a list of quick assist and quick fix proposals for the
60      * given invocation context.
61      *
62      * @param invocationContext the invocation context
63      * @return an array of completion proposals or <code>null</code> if no proposals are available
64      */

65     ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext invocationContext);
66     
67 }
68
Popular Tags