KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2005 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 import org.eclipse.jface.text.ITextViewer;
14
15 import org.eclipse.ui.IEditorPart;
16
17 import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
18
19
20 /**
21  *
22  * @since 3.2
23  */

24 public final class JavadocContentAssistInvocationContext extends JavaContentAssistInvocationContext {
25
26     private final int fFlags;
27     
28     /**
29      * @param viewer
30      * @param offset
31      * @param editor
32      * @param flags see {@link org.eclipse.jdt.ui.text.java.IJavadocCompletionProcessor#RESTRICT_TO_MATCHING_CASE}
33      */

34     public JavadocContentAssistInvocationContext(ITextViewer viewer, int offset, IEditorPart editor, int flags) {
35         super(viewer, offset, editor);
36         fFlags= flags;
37     }
38     
39     /**
40      * Returns the flags for this content assist invocation.
41      *
42      * @return the flags for this content assist invocation
43      * @see org.eclipse.jdt.ui.text.java.IJavadocCompletionProcessor#RESTRICT_TO_MATCHING_CASE
44      */

45     public int getFlags() {
46         return fFlags;
47     }
48     
49     /**
50      * Returns the selection length of the viewer.
51      *
52      * @return the selection length of the viewer
53      */

54     public int getSelectionLength() {
55         return getViewer().getSelectedRange().y;
56     }
57     
58     /*
59      * @see org.eclipse.jface.text.contentassist.TextContentAssistInvocationContext#equals(java.lang.Object)
60      */

61     public boolean equals(Object JavaDoc obj) {
62         if (!super.equals(obj))
63             return false;
64         
65         return fFlags == ((JavadocContentAssistInvocationContext) obj).fFlags;
66     }
67     
68     /*
69      * @see org.eclipse.jface.text.contentassist.TextContentAssistInvocationContext#hashCode()
70      */

71     public int hashCode() {
72         return super.hashCode() << 2 | fFlags;
73     }
74
75 }
76
Popular Tags