aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2012-08-21 01:47:40 (EDT)
committerzzhongwei2012-08-21 01:47:40 (EDT)
commit0b89c63895af832952bbf497d60976afa37900e8 (patch)
treea5be9c57ad9cf1c38e944c3700f90e8faecf6661
parentb278412f6a021ab568ec9f402dd4683d44c5f1ec (diff)
downloadorg.eclipse.pdt-0b89c63895af832952bbf497d60976afa37900e8.zip
org.eclipse.pdt-0b89c63895af832952bbf497d60976afa37900e8.tar.gz
org.eclipse.pdt-0b89c63895af832952bbf497d60976afa37900e8.tar.bz2
387659: ctrl+click does not work for trait member in trait use statement
https://bugs.eclipse.org/bugs/show_bug.cgi?id=387659
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPSelectionEngine.java39
1 files changed, 38 insertions, 1 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPSelectionEngine.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPSelectionEngine.java
index 655c586..15a1f24 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPSelectionEngine.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/PHPSelectionEngine.java
@@ -547,7 +547,44 @@ public class PHPSelectionEngine extends ScriptSelectionEngine {
if (element != null) {
return new IModelElement[] { element };
}
- }/*
+ } else if (node instanceof SimpleReference) {
+
+ SimpleReference reference = (SimpleReference) node;
+
+ node = ASTUtils.findMinimalNode(parsedUnit, offset,
+ node.end() + 1);
+ if (node instanceof TraitAliasStatement) {
+ node = ASTUtils.findMinimalNode(parsedUnit, offset,
+ node.end() + 1);
+ if (node instanceof TraitUseStatement) {
+ TraitUseStatement statement = (TraitUseStatement) node;
+ List<IModelElement> methods = new LinkedList<IModelElement>();
+ for (TypeReference typeReference : statement
+ .getTraitList()) {
+ IType[] types = PHPModelUtils.getTypes(
+ typeReference.getName(), sourceModule,
+ offset, null, null, false);
+ for (IType t : types) {
+ IModelElement[] children = t.getChildren();
+ for (IModelElement modelElement : children) {
+ String name = modelElement
+ .getElementName();
+ if (name.startsWith("$")) {
+ name = name.substring(1);
+ }
+ if (name.equals(reference.getName())) {
+ methods.add(modelElement);
+ }
+ }
+ }
+ }
+
+ return methods.toArray(new IMethod[methods.size()]);
+ }
+
+ }
+ }
+ /*
* else if (node instanceof Scalar) { Scalar scalar = (Scalar)
* node; if (PHPModelUtils.isQuotesString(scalar.getValue())) {
*