01: /*******************************************************************************
02: * Copyright (c) 2000, 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.ui.text.java;
11:
12: import org.eclipse.jdt.core.ICompilationUnit;
13:
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: public interface IInvocationContext {
26:
27: /**
28: * @return Returns the current compilation unit.
29: */
30: ICompilationUnit getCompilationUnit();
31:
32: /**
33: * @return Returns the offset of the current selection
34: */
35: int getSelectionOffset();
36:
37: /**
38: * @return Returns the length of the current selection
39: */
40: int getSelectionLength();
41:
42: /**
43: * Returns an AST of the compilation unit, possibly only a partial AST focused on the selection
44: * offset (see {@link org.eclipse.jdt.core.dom.ASTParser#setFocalPosition(int)}).
45: * The returned AST is shared and therefore protected and cannot be modified.
46: * The client must check the AST API level and do nothing if they are given an AST
47: * they can't handle. (see {@link org.eclipse.jdt.core.dom.AST#apiLevel()}).
48: * @return Returns the root of the AST corresponding to the current compilation unit.
49: */
50: CompilationUnit getASTRoot();
51:
52: /**
53: * Convenience method to evaluate the AST node covering the current selection.
54: * @return Returns the node that covers the location of the problem
55: */
56: ASTNode getCoveringNode();
57:
58: /**
59: * Convenience method to evaluate the AST node that is covered by the current selection.
60: * @return Returns the node that is covered by the location of the problem
61: */
62: ASTNode getCoveredNode();
63:
64: }
|