1
/*******************************************************************************
2
* Copyright (c) 2007, 2008 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
9
* IBM Corporation - initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.ui.text.contentassist;
13
import org.eclipse.jface.text.BadLocationException;
14
import org.eclipse.jface.text.IDocument;
15
import org.eclipse.jface.text.ITextViewer;
16
import org.eclipse.ui.IEditorPart;
18
import org.eclipse.cdt.core.dom.ast.IASTCompletionNode;
19
import org.eclipse.cdt.core.model.ICProject;
20
import org.eclipse.cdt.core.model.ITranslationUnit;
23
* Describes the context of a content assist invocation in a C/C++ editor.
25
* @noextend This interface is not intended to be extended by clients.
26
* @noimplement This interface is not intended to be implemented by clients.
28
public interface ICEditorContentAssistInvocationContext {
31
* Returns the translation unit that content assist is invoked in, <code>null</code> if there
34
* @return the translation unit that content assist is invoked in, possibly <code>null</code>
36
ITranslationUnit getTranslationUnit();
39
* Returns the project of the translation unit that content assist is invoked in,
40
* <code>null</code> if none.
42
* @return the current C project, possibly <code>null</code>
44
ICProject getProject();
47
* Returns the IASTCompletionNode of the location where content assist was invoked.
48
* @return the IASTCompletionNode of the location where context assist was invoked.
50
IASTCompletionNode getCompletionNode();
53
* Returns the offset which was used to compute the IASTCompletionNode when content
55
* @return the offset used to compute the IASTCompletionNode.
60
* Returns the offset where context information starts.
61
* @return the offset where context information (parameter hints) starts.
63
int getContextInformationOffset();
66
* Get the editor content assist is invoked in.
68
* @return the editor, may be <code>null</code>
70
IEditorPart getEditor();
73
* Returns the viewer, <code>null</code> if not available.
75
* @return the viewer, possibly <code>null</code>
77
ITextViewer getViewer();
80
* Returns the invocation offset.
82
* @return the invocation offset
84
int getInvocationOffset();
87
* Returns <code>true</code> if the current content assist invocation
88
* is for revealing context information, or <code>false</code> otherwise.
90
* @return <code>true</code> if the current content assist invocation
91
* is for revealing context information.
93
boolean isContextInformationStyle();
96
* Returns the document that content assist is invoked on, or <code>null</code> if not known.
98
* @return the document or <code>null</code>
100
IDocument getDocument();
103
* Computes the identifier (as specified by {@link Character#isJavaIdentifierPart(char)}) that
104
* immediately precedes the invocation offset.
106
* @return the prefix preceding the content assist invocation offset, <code>null</code> if
107
* there is no document
108
* @throws BadLocationException if accessing the document fails
110
CharSequence computeIdentifierPrefix() throws BadLocationException;
b'\\ No newline at end of file'