KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > text > javadoc > JavadocCompletionProcessor


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.jdt.internal.ui.text.javadoc;
12
13
14 import org.eclipse.jface.text.ITextViewer;
15 import org.eclipse.jface.text.contentassist.ContentAssistant;
16 import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
17 import org.eclipse.jface.text.contentassist.IContextInformationValidator;
18
19 import org.eclipse.ui.IEditorPart;
20
21 import org.eclipse.jdt.ui.text.IJavaPartitions;
22 import org.eclipse.jdt.ui.text.java.IJavadocCompletionProcessor;
23 import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
24
25 import org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor;
26
27 /**
28  * Javadoc completion processor.
29  *
30  * @since 3.2
31  */

32 public class JavadocCompletionProcessor extends JavaCompletionProcessor {
33
34     private int fSubProcessorFlags;
35
36     public JavadocCompletionProcessor(IEditorPart editor, ContentAssistant assistant) {
37         super(editor, assistant, IJavaPartitions.JAVA_DOC);
38         fSubProcessorFlags= 0;
39     }
40
41     /**
42      * Tells this processor to restrict is proposals to those
43      * starting with matching cases.
44      *
45      * @param restrict <code>true</code> if proposals should be restricted
46      */

47     public void restrictProposalsToMatchingCases(boolean restrict) {
48         fSubProcessorFlags= restrict ? IJavadocCompletionProcessor.RESTRICT_TO_MATCHING_CASE : 0;
49     }
50
51     /**
52      * @see IContentAssistProcessor#getContextInformationValidator()
53      */

54     public IContextInformationValidator getContextInformationValidator() {
55         return null;
56     }
57
58     /*
59      * @see org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor#createContext(org.eclipse.jface.text.ITextViewer, int)
60      */

61     protected ContentAssistInvocationContext createContext(ITextViewer viewer, int offset) {
62         return new JavadocContentAssistInvocationContext(viewer, offset, fEditor, fSubProcessorFlags);
63     }
64
65 }
66
Popular Tags