]>
Commit | Line | Data |
---|---|---|
1b2798f6 EK |
1 | /******************************************************************************* |
2 | * Copyright (c) 2000, 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 | |
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 | import org.eclipse.jdt.core.dom.ASTNode; | |
15 | import org.eclipse.jdt.core.dom.CompilationUnit; | |
16 | ||
17 | /** | |
18 | * Context information for quick fix and quick assist processors. | |
19 | * <p> | |
20 | * Note: this interface is not intended to be implemented. | |
21 | * </p> | |
22 | * | |
23 | * @since 3.0 | |
24 | * | |
25 | * @noimplement This interface is not intended to be implemented by clients. | |
26 | * @noextend This interface is not intended to be extended by clients. | |
27 | */ | |
28 | public interface IInvocationContext { | |
29 | ||
30 | /** | |
31 | * @return Returns the current compilation unit. | |
32 | */ | |
33 | ICompilationUnit getCompilationUnit(); | |
34 | ||
35 | /** | |
36 | * @return Returns the offset of the current selection | |
37 | */ | |
38 | int getSelectionOffset(); | |
39 | ||
40 | /** | |
41 | * @return Returns the length of the current selection | |
42 | */ | |
43 | int getSelectionLength(); | |
44 | ||
45 | /** | |
46 | * Returns an AST of the compilation unit, possibly only a partial AST focused on the selection | |
47 | * offset (see {@link org.eclipse.jdt.core.dom.ASTParser#setFocalPosition(int)}). | |
48 | * The returned AST is shared and therefore protected and cannot be modified. | |
49 | * The client must check the AST API level and do nothing if they are given an AST | |
50 | * they can't handle. (see {@link org.eclipse.jdt.core.dom.AST#apiLevel()}). | |
51 | * @return Returns the root of the AST corresponding to the current compilation unit. | |
52 | */ | |
53 | CompilationUnit getASTRoot(); | |
54 | ||
55 | /** | |
56 | * Convenience method to evaluate the AST node covering the current selection. | |
57 | * @return Returns the node that covers the location of the problem | |
58 | */ | |
59 | ASTNode getCoveringNode(); | |
60 | ||
61 | /** | |
62 | * Convenience method to evaluate the AST node that is covered by the current selection. | |
63 | * @return Returns the node that is covered by the location of the problem | |
64 | */ | |
65 | ASTNode getCoveredNode(); | |
66 | ||
67 | } |