ICompletionDataList CreateCaseCompletionData (DomLocation location, ExpressionResult expressionResult)
{
NRefactoryResolver resolver = CreateResolver ();
resolver.SetupResolver (location);
SwitchFinder switchFinder = new SwitchFinder (location);
if (resolver.MemberCompilationUnit != null)
switchFinder.VisitCompilationUnit (resolver.MemberCompilationUnit, null);
CompletionDataList result = new ProjectDomCompletionDataList ();
if (switchFinder.SwitchStatement == null)
return result;
ResolveResult resolveResult = resolver.ResolveExpression (switchFinder.SwitchStatement.SwitchExpression, location);
IType type = dom.GetType (resolveResult.ResolvedType);
if (type != null && type.ClassType == ClassType.Enum) {
OutputFlags flags = OutputFlags.None;
var declaringType = resolver.CallingType;
if (declaringType != null && dom != null) {
foreach (IType t in new List<IType>(dom.GetInheritanceTree (declaringType))) {
if (t.SearchMember (type.Name, true).Any (m => m.MemberType != MonoDevelop.Projects.Dom.MemberType.Type)) {
flags |= OutputFlags.UseFullName;
break;
}
}
}
// if (!foundType && (NamePrefix.Length == 0 || !type.Namespace.StartsWith (NamePrefix)) && !type.Namespace.EndsWith ("." + NamePrefix) && type.DeclaringType == null && NamePrefix != null && !NamePrefix.Contains ("::"))
// flags |= OutputFlags.UseFullName;
CompletionDataCollector cdc = new CompletionDataCollector (dom, result, Document.CompilationUnit, resolver.CallingType, location);
cdc.Add (type, flags);
}
return result;
}