01: /*******************************************************************************
02: * Copyright (c) 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.jdt.internal.ui.text.javadoc;
11:
12: import org.eclipse.jface.text.ITextViewer;
13:
14: import org.eclipse.ui.IEditorPart;
15:
16: import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
17:
18: /**
19: *
20: * @since 3.2
21: */
22: public final class JavadocContentAssistInvocationContext extends
23: JavaContentAssistInvocationContext {
24:
25: private final int fFlags;
26:
27: /**
28: * @param viewer
29: * @param offset
30: * @param editor
31: * @param flags see {@link org.eclipse.jdt.ui.text.java.IJavadocCompletionProcessor#RESTRICT_TO_MATCHING_CASE}
32: */
33: public JavadocContentAssistInvocationContext(ITextViewer viewer,
34: 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 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: }
|