01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.ui.text.java;
11:
12: import java.util.List;
13:
14: import org.eclipse.core.runtime.IProgressMonitor;
15:
16: import org.eclipse.jface.text.contentassist.ICompletionProposal;
17: import org.eclipse.jface.text.contentassist.IContextInformation;
18:
19: /**
20: * Computes completions and context information displayed by the Java editor content assistant.
21: * Contributions to the <tt>org.eclipse.jdt.ui.javaCompletionProposalComputer</tt> extension point
22: * must implement this interface.
23: *
24: * @since 3.2
25: */
26: public interface IJavaCompletionProposalComputer {
27: /**
28: * Informs the computer that a content assist session has started. This call will always be
29: * followed by a {@link #sessionEnded()} call, but not necessarily by calls to
30: * {@linkplain #computeCompletionProposals(ContentAssistInvocationContext, IProgressMonitor) computeCompletionProposals}
31: * or
32: * {@linkplain #computeContextInformation(ContentAssistInvocationContext, IProgressMonitor) computeContextInformation}.
33: */
34: void sessionStarted();
35:
36: /**
37: * Returns a list of completion proposals valid at the given invocation context.
38: *
39: * @param context the context of the content assist invocation
40: * @param monitor a progress monitor to report progress. The monitor is private to this
41: * invocation, i.e. there is no need for the receiver to spawn a sub monitor.
42: * @return a list of completion proposals (element type: {@link ICompletionProposal})
43: */
44: List computeCompletionProposals(
45: ContentAssistInvocationContext context,
46: IProgressMonitor monitor);
47:
48: /**
49: * Returns context information objects valid at the given invocation context.
50: *
51: * @param context the context of the content assist invocation
52: * @param monitor a progress monitor to report progress. The monitor is private to this
53: * invocation, i.e. there is no need for the receiver to spawn a sub monitor.
54: * @return a list of context information objects (element type: {@link IContextInformation})
55: */
56: List computeContextInformation(
57: ContentAssistInvocationContext context,
58: IProgressMonitor monitor);
59:
60: /**
61: * Returns the reason why this computer was unable to produce any completion proposals or
62: * context information.
63: *
64: * @return an error message or <code>null</code> if no error occurred
65: */
66: String getErrorMessage();
67:
68: /**
69: * Informs the computer that a content assist session has ended. This call will always be after
70: * any calls to
71: * {@linkplain #computeCompletionProposals(ContentAssistInvocationContext, IProgressMonitor) computeCompletionProposals}
72: * and
73: * {@linkplain #computeContextInformation(ContentAssistInvocationContext, IProgressMonitor) computeContextInformation}.
74: */
75: void sessionEnded();
76: }
|