Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Recommenders/Attic/ExtDoc"
Line 102: | Line 102: | ||
| colspan="4" | PackageDeclaration, ImportContainer, ImportDeclaration, SourceType, SourceField, SourceMethod | | colspan="4" | PackageDeclaration, ImportContainer, ImportDeclaration, SourceType, SourceField, SourceMethod | ||
|} | |} | ||
+ | |||
+ | |||
+ | == IJavaElementSelection == | ||
+ | |||
+ | <source lang="java"> | ||
+ | /** | ||
+ | * Contains all required information about the user's selection of a java | ||
+ | * element in the perspective (e.g. Editor, Package Explorer, Outline, ...). | ||
+ | */ | ||
+ | public interface IJavaElementSelection { | ||
+ | |||
+ | /** | ||
+ | * @return The selected java element. | ||
+ | */ | ||
+ | IJavaElement getJavaElement(); | ||
+ | |||
+ | /** | ||
+ | * @return The location type inside the compilation unit (e.g. | ||
+ | * "method declaration" or "block") if the selection occurs in the | ||
+ | * editor. | ||
+ | */ | ||
+ | ElementLocation getElementLocation(); | ||
+ | |||
+ | /** | ||
+ | * @return The invocation as if the selection in the editor was followed by | ||
+ | * a content assist invocation. | ||
+ | */ | ||
+ | JavaContentAssistInvocationContext getInvocationContext(); | ||
+ | |||
+ | /** | ||
+ | * @return The selected java element's AST node. | ||
+ | */ | ||
+ | ASTNode getAstNode(); | ||
+ | |||
+ | } | ||
+ | </source> |
Revision as of 09:52, 28 May 2011
Selection Context
Selection | JavaElement | AstNode / Parent | Location |
---|---|---|---|
CompilationUnitEditor | |||
package tes↓t; | PackageFragment | SimpleName / QualifiedName | PACKAGE_DECLARATION |
import org.eclipse.swt.widgets.But↓ton; | ResolvedBinaryType | SimpleName / QualifiedName | IMPORT_DECLARATION |
import org.eclipse.swt.widg↓ets.Button; | JarPackageFragment | SimpleName / QualifiedName | IMPORT_DECLARATION |
public class Tes↓t extends Button implements ISelectionListener | SourceType | SimpleName / TypeDeclaration | TYPE_DECLARATION |
public class Test extends Butto↓n implements ISelectionListener | ResolvedBinaryType | SimpleName / SimpleType | TYPE_DECLARATION_EXTENDS |
public class Test extends Button implements ISelectionListen↓er | ResolvedBinaryType | SimpleName / SimpleType | TYPE_DECLARATION_IMPLEMENTS |
private Button butto↓n; | ResolvedBinaryType | SimpleName / VariableDeclarationFragment | FIELD_DECLARATION |
private Butto↓n button; | ResolvedBinaryType | SimpleName / SimpleType | FIELD_DECLARATION |
public Button test(Composite arg0, int arg↓1) | LocalVariable | SingleName / SingleVariableDeclaration | METHOD_DECLARATION_PARAMETER |
public Button test(Composit↓e arg0, int arg1) | ResolvedBinaryType | SimpleName / SimpleType | METHOD_DECLARATION_PARAMETER |
public Button tes↓t(Composite arg0, int arg1) | SourceMethod | SimpleName / MethodDeclaration | METHOD_DECLARATION |
public Butto↓n test(Composite arg0, int arg1) | ResolvedBinaryType | SimpleName / SimpleType | METHOD_DECLARATION |
Button butto↓n = new Button(null, 0); | LocalVariable | SimpleName / VariableDeclarationFragment | BLOCK |
button.setEnabl↓e() | ResolvedBinaryMethod | SimpleName / MethodInvocation | BLOCK |
butto↓n.setEnable() | LocalVariable | SimpleName / MethodInvocation | BLOCK |
this.butto↓n.setEnable() | ResolvedSourceField | SimpleName / FieldAccess | BLOCK |
return butto↓n; | LocalVariable | SimpleName / ReturnStatement | BLOCK |
Package Explorer / JavaElement | |||
JavaProject, PackageFragmentRoot, PackageFragment, CompilationUnit, SourceType, SourceField, SourceMethod | |||
Outline / JavaElement | |||
PackageDeclaration, ImportContainer, ImportDeclaration, SourceType, SourceField, SourceMethod |
IJavaElementSelection
/** * Contains all required information about the user's selection of a java * element in the perspective (e.g. Editor, Package Explorer, Outline, ...). */ public interface IJavaElementSelection { /** * @return The selected java element. */ IJavaElement getJavaElement(); /** * @return The location type inside the compilation unit (e.g. * "method declaration" or "block") if the selection occurs in the * editor. */ ElementLocation getElementLocation(); /** * @return The invocation as if the selection in the editor was followed by * a content assist invocation. */ JavaContentAssistInvocationContext getInvocationContext(); /** * @return The selected java element's AST node. */ ASTNode getAstNode(); }