KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > ui > text > java > IInvocationContext


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.ui.text.java;
12
13 import org.eclipse.jdt.core.ICompilationUnit;
14
15 import org.eclipse.jdt.core.dom.ASTNode;
16 import org.eclipse.jdt.core.dom.CompilationUnit;
17
18 /**
19  * Context information for quick fix and quick assist processors.
20  * <p>
21  * Note: this interface is not intended to be implemented.
22  * </p>
23  *
24  * @since 3.0
25  */

26 public interface IInvocationContext {
27
28     /**
29      * @return Returns the current compilation unit.
30      */

31     ICompilationUnit getCompilationUnit();
32
33     /**
34      * @return Returns the offset of the current selection
35      */

36     int getSelectionOffset();
37
38     /**
39      * @return Returns the length of the current selection
40      */

41     int getSelectionLength();
42
43     /**
44      * Returns an AST of the compilation unit, possibly only a partial AST focused on the selection
45      * offset (see {@link org.eclipse.jdt.core.dom.ASTParser#setFocalPosition(int)}).
46      * The returned AST is shared and therefore protected and cannot be modified.
47      * The client must check the AST API level and do nothing if they are given an AST
48      * they can't handle. (see {@link org.eclipse.jdt.core.dom.AST#apiLevel()}).
49      * @return Returns the root of the AST corresponding to the current compilation unit.
50      */

51     CompilationUnit getASTRoot();
52
53     /**
54      * Convenience method to evaluate the AST node covering the current selection.
55      * @return Returns the node that covers the location of the problem
56      */

57     ASTNode getCoveringNode();
58
59     /**
60      * Convenience method to evaluate the AST node that is covered by the current selection.
61      * @return Returns the node that is covered by the location of the problem
62      */

63     ASTNode getCoveredNode();
64
65 }
66
Popular Tags