String type = document.get(repOffset, length);
IType[] types = PhpModelAccess.getDefault().findTypes(null, type, MatchRule.EXACT, 0, 0, scope, new NullProgressMonitor());
if (types.length == 1) {
this.type = types[0];
UseStatementInjector injector = new UseStatementInjector(this);
injector.inject(document, viewer, offset);
} else if (types.length > 1) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new TypeLabelProvider());
dialog.setElements(types);
if (dialog.open() == Window.OK) {
Object[] result = dialog.getResult();
if (result != null && result.length == 1) {
this.type = (IType) result[0];
UseStatementInjector injector = new UseStatementInjector(this);
injector.inject(document, viewer, offset);
}
}
}
} catch (BadLocationException e) {