[java] navigation around decompiled code

Fixes IDEA-157772; reduces the number of cases where PsiCompiledFile check is necessary.
This commit is contained in:
Roman Shevchenko
2016-07-01 15:43:42 +03:00
parent 210243eadd
commit 7c2cb465cd
14 changed files with 51 additions and 111 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,9 +49,6 @@ public abstract class CopyPasteReferenceProcessor<TRef extends PsiElement> exten
return Collections.emptyList();
}
if (file instanceof PsiCompiledFile) {
file = ((PsiCompiledFile) file).getDecompiledPsiFile();
}
if (!(file instanceof PsiClassOwner)) {
return Collections.emptyList();
}
@@ -183,14 +180,7 @@ public abstract class CopyPasteReferenceProcessor<TRef extends PsiElement> exten
if (array.isEmpty()) return;
Object[] selectedObjects = ArrayUtil.toObjectArray(array);
Arrays.sort(
selectedObjects,
(o1, o2) -> {
String fqName1 = getFQName(o1);
String fqName2 = getFQName(o2);
return fqName1.compareToIgnoreCase(fqName2);
}
);
Arrays.sort(selectedObjects, (o1, o2) -> getFQName(o1).compareToIgnoreCase(getFQName(o2)));
RestoreReferencesDialog dialog = new RestoreReferencesDialog(project, selectedObjects);
dialog.show();
@@ -218,4 +208,4 @@ public abstract class CopyPasteReferenceProcessor<TRef extends PsiElement> exten
private static String getFQName(Object element) {
return element instanceof PsiClass ? ((PsiClass)element).getQualifiedName() : (String)element;
}
}
}