01: /*******************************************************************************
02: * Copyright (c) 2005, 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.internal.ui.text.java;
11:
12: import java.util.Arrays;
13: import java.util.List;
14:
15: import org.eclipse.core.runtime.IProgressMonitor;
16:
17: import org.eclipse.ui.texteditor.HippieProposalProcessor;
18:
19: import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
20: import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer;
21:
22: /**
23: * A computer wrapper for the hippie processor.
24: *
25: * @since 3.2
26: */
27: public final class HippieProposalComputer implements
28: IJavaCompletionProposalComputer {
29: /** The wrapped processor. */
30: private final HippieProposalProcessor fProcessor = new HippieProposalProcessor();
31:
32: /**
33: * Default ctor to make it instantiatable via the extension mechanism.
34: */
35: public HippieProposalComputer() {
36: }
37:
38: /*
39: * @see org.eclipse.jface.text.contentassist.ICompletionProposalComputer#computeCompletionProposals(org.eclipse.jface.text.contentassist.TextContentAssistInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
40: */
41: public List computeCompletionProposals(
42: ContentAssistInvocationContext context,
43: IProgressMonitor monitor) {
44: return Arrays.asList(fProcessor.computeCompletionProposals(
45: context.getViewer(), context.getInvocationOffset()));
46: }
47:
48: /*
49: * @see org.eclipse.jface.text.contentassist.ICompletionProposalComputer#computeContextInformation(org.eclipse.jface.text.contentassist.TextContentAssistInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
50: */
51: public List computeContextInformation(
52: ContentAssistInvocationContext context,
53: IProgressMonitor monitor) {
54: return Arrays.asList(fProcessor.computeContextInformation(
55: context.getViewer(), context.getInvocationOffset()));
56: }
57:
58: /*
59: * @see org.eclipse.jface.text.contentassist.ICompletionProposalComputer#getErrorMessage()
60: */
61: public String getErrorMessage() {
62: return fProcessor.getErrorMessage();
63: }
64:
65: /*
66: * @see org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer#sessionStarted()
67: */
68: public void sessionStarted() {
69: }
70:
71: /*
72: * @see org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer#sessionEnded()
73: */
74: public void sessionEnded() {
75: }
76: }
|