mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
file reference: code simplification
This commit is contained in:
+9
-13
@@ -457,20 +457,16 @@ public class FileReference implements PsiFileReference, FileReferenceOwner, PsiP
|
||||
final FileReferenceHelper helper = FileReferenceHelperRegistrar.getNotNullHelper(file);
|
||||
|
||||
final Collection<PsiFileSystemItem> contexts = getContextsForBindToElement(curVFile, project, helper);
|
||||
switch (contexts.size()) {
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
for (PsiFileSystemItem context : contexts) {
|
||||
final VirtualFile contextFile = context.getVirtualFile();
|
||||
assert contextFile != null;
|
||||
if (VfsUtilCore.isAncestor(contextFile, dstVFile, true)) {
|
||||
final String path = VfsUtilCore.getRelativePath(dstVFile, contextFile, '/');
|
||||
if (path != null) {
|
||||
return rename(path);
|
||||
}
|
||||
}
|
||||
|
||||
for (PsiFileSystemItem context : contexts) {
|
||||
final VirtualFile contextFile = context.getVirtualFile();
|
||||
assert contextFile != null;
|
||||
if (VfsUtilCore.isAncestor(contextFile, dstVFile, true)) {
|
||||
final String path = VfsUtilCore.getRelativePath(dstVFile, contextFile, '/');
|
||||
if (path != null) {
|
||||
return rename(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PsiFileSystemItem dstItem = helper.getPsiFileSystemItem(project, dstVFile);
|
||||
|
||||
Reference in New Issue
Block a user