01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 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.ui.examples.javaeditor.javadoc;
11:
12: import org.eclipse.jface.text.ITextViewer;
13: import org.eclipse.jface.text.contentassist.*;
14:
15: /**
16: * Example Java doc completion processor.
17: */
18: public class JavaDocCompletionProcessor implements
19: IContentAssistProcessor {
20:
21: protected final static String[] fgProposals = {
22: "@author", "@deprecated", "@exception", "@param", "@return", "@see", "@serial", "@serialData", "@serialField", "@since", "@throws", "@version" }; //$NON-NLS-12$ //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-7$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
23:
24: /* (non-Javadoc)
25: * Method declared on IContentAssistProcessor
26: */
27: public ICompletionProposal[] computeCompletionProposals(
28: ITextViewer viewer, int documentOffset) {
29: ICompletionProposal[] result = new ICompletionProposal[fgProposals.length];
30: for (int i = 0; i < fgProposals.length; i++)
31: result[i] = new CompletionProposal(fgProposals[i],
32: documentOffset, 0, fgProposals[i].length());
33: return result;
34: }
35:
36: /* (non-Javadoc)
37: * Method declared on IContentAssistProcessor
38: */
39: public IContextInformation[] computeContextInformation(
40: ITextViewer viewer, int documentOffset) {
41: return null;
42: }
43:
44: /* (non-Javadoc)
45: * Method declared on IContentAssistProcessor
46: */
47: public char[] getCompletionProposalAutoActivationCharacters() {
48: return null;
49: }
50:
51: /* (non-Javadoc)
52: * Method declared on IContentAssistProcessor
53: */
54: public char[] getContextInformationAutoActivationCharacters() {
55: return null;
56: }
57:
58: /* (non-Javadoc)
59: * Method declared on IContentAssistProcessor
60: */
61: public IContextInformationValidator getContextInformationValidator() {
62: return null;
63: }
64:
65: /* (non-Javadoc)
66: * Method declared on IContentAssistProcessor
67: */
68: public String getErrorMessage() {
69: return null;
70: }
71: }
|