import net.sourceforge.phpdt.internal.corext.template.ContextType;
import net.sourceforge.phpdt.internal.corext.template.php.CompilationUnitContextType;
import net.sourceforge.phpdt.internal.corext.template.php.PHPUnitContext;
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
import net.sourceforge.phpdt.internal.ui.text.java.IPHPCompletionProposal;
+import net.sourceforge.phpeclipse.PHPeclipsePlugin;
+import net.sourceforge.phpeclipse.builder.PHPIdentifierLocation;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
PHPUnitContext context = (PHPUnitContext) fContextType.createContext();
int start = context.getStart();
int end = context.getEnd();
- String prefix = context.getKey();
+ String prefix = context.getKey();
IRegion region = new Region(start, end - start);
String identifier = null;
-
- SortedMap subMap = map.subMap(prefix,prefix+'\255');
- Iterator iter = subMap.keySet().iterator();
+ SortedMap subMap = map.subMap(prefix, prefix + '\255');
+ Iterator iter = subMap.keySet().iterator();
+ PHPIdentifierLocation location;
+ ArrayList list;
+ int maxProposals = PHPeclipsePlugin.MAX_PROPOSALS;
while (iter.hasNext()) {
identifier = (String) iter.next();
if (context.canEvaluate(identifier)) {
- fProposals.add(
- new DeclarationProposal(
- identifier,
- context,
- region,
- viewer,
- PHPUiImages.get(PHPUiImages.IMG_FUN),
- PHPUiImages.get(PHPUiImages.IMG_VAR)));
+ list = (ArrayList) subMap.get(identifier);
+ for (int i = 0; i < list.size(); i++) {
+ if (maxProposals-- < 0) {
+ return;
+ }
+ fProposals.add(new DeclarationProposal(identifier, (PHPIdentifierLocation) list.get(i), context, region, viewer));
+ }
}
}