aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2013-03-13 02:10:05 (EDT)
committerzzhongwei2013-03-13 02:10:05 (EDT)
commit70ddddd01d8115bd3665e5edf86251ed67dc4e0e (patch)
tree80632f0ef191cd6553fd83525df9193ba1c06fc5
parentca8a755f0625614d4da0529d06718cb7459ec37e (diff)
downloadorg.eclipse.pdt-70ddddd01d8115bd3665e5edf86251ed67dc4e0e.zip
org.eclipse.pdt-70ddddd01d8115bd3665e5edf86251ed67dc4e0e.tar.gz
org.eclipse.pdt-70ddddd01d8115bd3665e5edf86251ed67dc4e0e.tar.bz2
403139: [CA] show namespace classes in string
https://bugs.eclipse.org/bugs/show_bug.cgi?id=403139
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/CompletionStrategyFactory.java3
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/GlobalTypesStrategy.java24
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/NamespacesStrategy.java5
3 files changed, 31 insertions, 1 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/CompletionStrategyFactory.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/CompletionStrategyFactory.java
index bd32922..0b0d910 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/CompletionStrategyFactory.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/CompletionStrategyFactory.java
@@ -251,7 +251,8 @@ public class CompletionStrategyFactory implements ICompletionStrategyFactory {
return new ICompletionStrategy[] { new NamespacesStrategy(context) };
}
if (contextClass == QuotesContext.class) {
- return new ICompletionStrategy[] { new NamespacesStrategy(context) };
+ return new ICompletionStrategy[] { new NamespacesStrategy(context,
+ true) };
}
if (contextClass == GotoStatementContext.class) {
return new ICompletionStrategy[] { new GotoStatementStrategy(
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/GlobalTypesStrategy.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/GlobalTypesStrategy.java
index 48f8703..8947a9e 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/GlobalTypesStrategy.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/GlobalTypesStrategy.java
@@ -48,6 +48,7 @@ public class GlobalTypesStrategy extends GlobalElementStrategy {
protected final int falseFlag;
protected static final IType[] EMPTY = {};
private boolean aliasAdded = false;
+ private boolean addClassInNamespace = false;
public GlobalTypesStrategy(ICompletionContext context, int trueFlag,
int falseFlag) {
@@ -56,6 +57,14 @@ public class GlobalTypesStrategy extends GlobalElementStrategy {
this.falseFlag = falseFlag;
}
+ public GlobalTypesStrategy(ICompletionContext context, int trueFlag,
+ int falseFlag, boolean addClassInNamespace) {
+ super(context, null);
+ this.trueFlag = trueFlag;
+ this.falseFlag = falseFlag;
+ this.addClassInNamespace = addClassInNamespace;
+ }
+
public GlobalTypesStrategy(ICompletionContext context) {
this(context, 0, 0);
}
@@ -106,6 +115,17 @@ public class GlobalTypesStrategy extends GlobalElementStrategy {
reporter.reportType(type,
PHPFlags.isNamespace(flags) ? nsSuffix : suffix,
replacementRange, extraInfo);
+ if (addClassInNamespace) {
+ if (PHPFlags.isNamespace(flags)) {
+ IType[] subTypes = type.getTypes();
+ for (IType subType : subTypes) {
+ int subFlags = type.getFlags();
+ reporter.reportType(subType, PHPFlags
+ .isNamespace(subFlags) ? nsSuffix : suffix,
+ replacementRange, extraInfo);
+ }
+ }
+ }
} catch (ModelException e) {
PHPCorePlugin.log(e);
}
@@ -413,4 +433,8 @@ public class GlobalTypesStrategy extends GlobalElementStrategy {
protected int getExtraInfo() {
return ProposalExtraInfo.DEFAULT;
}
+
+ public void setAddClassInNamespace(boolean addClassInNamespace) {
+ this.addClassInNamespace = addClassInNamespace;
+ }
}
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/NamespacesStrategy.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/NamespacesStrategy.java
index 5aed171..3a8916c 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/NamespacesStrategy.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/strategies/NamespacesStrategy.java
@@ -31,6 +31,11 @@ public class NamespacesStrategy extends GlobalTypesStrategy {
super(context, Modifiers.AccNameSpace, 0);
}
+ public NamespacesStrategy(ICompletionContext context,
+ boolean addClassInNamespace) {
+ super(context, Modifiers.AccNameSpace, 0, addClassInNamespace);
+ }
+
public String getNSSuffix(AbstractCompletionContext abstractContext) {
return ""; //$NON-NLS-1$
}