|
|
|
@ -180,24 +180,24 @@ namespace ICSharpCode.SharpDevelop.Refactoring
@@ -180,24 +180,24 @@ namespace ICSharpCode.SharpDevelop.Refactoring
|
|
|
|
|
bool isLocal, |
|
|
|
|
string fileName, string fileContent) |
|
|
|
|
{ |
|
|
|
|
string lowerFileContent = fileContent.ToLower(); |
|
|
|
|
string lowerFileContent = fileContent.ToLowerInvariant(); |
|
|
|
|
string searchedText; // the text that is searched for
|
|
|
|
|
bool searchingIndexer = false; |
|
|
|
|
|
|
|
|
|
if (member == null) { |
|
|
|
|
searchedText = parentClass.Name.ToLower(); |
|
|
|
|
searchedText = parentClass.Name.ToLowerInvariant(); |
|
|
|
|
} else { |
|
|
|
|
// When looking for a member, the name of the parent class does not always exist
|
|
|
|
|
// in the file where the member is accessed.
|
|
|
|
|
// (examples: derived classes, partial classes)
|
|
|
|
|
if (member is IMethod && ((IMethod)member).IsConstructor) |
|
|
|
|
searchedText = parentClass.Name.ToLower(); |
|
|
|
|
searchedText = parentClass.Name.ToLowerInvariant(); |
|
|
|
|
else { |
|
|
|
|
if (member is IProperty && ((IProperty)member).IsIndexer) { |
|
|
|
|
searchingIndexer = true; |
|
|
|
|
searchedText = GetIndexerExpressionStartToken(fileName); |
|
|
|
|
} else { |
|
|
|
|
searchedText = member.Name.ToLower(); |
|
|
|
|
searchedText = member.Name.ToLowerInvariant(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -335,28 +335,32 @@ namespace ICSharpCode.SharpDevelop.Refactoring
@@ -335,28 +335,32 @@ namespace ICSharpCode.SharpDevelop.Refactoring
|
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the list of files that could have a reference to the specified class.
|
|
|
|
|
/// </summary>
|
|
|
|
|
static List<ProjectItem> GetPossibleFiles(IClass c) |
|
|
|
|
{ |
|
|
|
|
if (c.DeclaringType != null) { |
|
|
|
|
return GetPossibleFiles(c.DeclaringType, c); |
|
|
|
|
} |
|
|
|
|
List<ProjectItem> resultList = new List<ProjectItem>(); |
|
|
|
|
GetPossibleFilesInternal(resultList, c.ProjectContent, c.IsInternal); |
|
|
|
|
return resultList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the files of files that could have a reference to the <paramref name="member"/>
|
|
|
|
|
/// int the <paramref name="ownerClass"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
static List<ProjectItem> GetPossibleFiles(IClass ownerClass, IDecoration member) |
|
|
|
|
{ |
|
|
|
|
if (member == null) |
|
|
|
|
return GetPossibleFiles(ownerClass); |
|
|
|
|
List<ProjectItem> resultList = new List<ProjectItem>(); |
|
|
|
|
if (ProjectService.OpenSolution == null) { |
|
|
|
|
FileProjectItem tempItem = new FileProjectItem(null, ItemType.Compile); |
|
|
|
|
tempItem.Include = ownerClass.CompilationUnit.FileName; |
|
|
|
|
resultList.Add(tempItem); |
|
|
|
|
return resultList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (member == null) { |
|
|
|
|
// get files possibly referencing ownerClass
|
|
|
|
|
while (ownerClass.DeclaringType != null) { |
|
|
|
|
// for nested classes, treat class as member
|
|
|
|
|
member = ownerClass; |
|
|
|
|
ownerClass = ownerClass.DeclaringType; |
|
|
|
|
} |
|
|
|
|
if (member == null) { |
|
|
|
|
GetPossibleFilesInternal(resultList, ownerClass.ProjectContent, ownerClass.IsInternal); |
|
|
|
|
return resultList; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (member.IsPrivate) { |
|
|
|
|
List<string> fileNames = GetFileNames(ownerClass); |
|
|
|
|
foreach (string fileName in fileNames) { |
|
|
|
@ -376,16 +380,18 @@ namespace ICSharpCode.SharpDevelop.Refactoring
@@ -376,16 +380,18 @@ namespace ICSharpCode.SharpDevelop.Refactoring
|
|
|
|
|
|
|
|
|
|
static ProjectItem FindItem(string fileName) |
|
|
|
|
{ |
|
|
|
|
if (ProjectService.OpenSolution == null) |
|
|
|
|
return null; |
|
|
|
|
foreach (IProject p in ProjectService.OpenSolution.Projects) { |
|
|
|
|
foreach (ProjectItem item in p.Items) { |
|
|
|
|
if (FileUtility.IsEqualFileName(fileName, item.FileName)) { |
|
|
|
|
return item; |
|
|
|
|
if (ProjectService.OpenSolution != null) { |
|
|
|
|
foreach (IProject p in ProjectService.OpenSolution.Projects) { |
|
|
|
|
foreach (ProjectItem item in p.Items) { |
|
|
|
|
if (FileUtility.IsEqualFileName(fileName, item.FileName)) { |
|
|
|
|
return item; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
FileProjectItem tempItem = new FileProjectItem(null, ItemType.Compile); |
|
|
|
|
tempItem.Include = fileName; |
|
|
|
|
return tempItem; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void GetPossibleFilesInternal(List<ProjectItem> resultList, IProjectContent ownerProjectContent, bool internalOnly) |
|
|
|
|