New J2K: add copy-paste tests for new j2k
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
class A {
|
||||
<selection>private static String formatElement(PsiElement element) {
|
||||
element = JetPsiUtil.ascendIfPropertyAccessor(element);
|
||||
if (element instanceof JetNamedFunction || element instanceof JetProperty) {
|
||||
BindingContext bindingContext =
|
||||
AnalyzerFacadeWithCache.analyzeFileWithCache(element.getContainingJetFile()).getBindingContext();
|
||||
|
||||
DeclarationDescriptor declarationDescriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element);
|
||||
if (declarationDescriptor instanceof CallableMemberDescriptor) {
|
||||
DeclarationDescriptor containingDescriptor = declarationDescriptor.getContainingDeclaration();
|
||||
if (containingDescriptor instanceof ClassDescriptor) {
|
||||
return JetBundle.message(
|
||||
"x.in.y",
|
||||
DescriptorRenderer.COMPACT.render(declarationDescriptor),
|
||||
IdeDescriptorRenderers.SOURCE_CODE_SHORT_NAMES_NO_ANNOTATIONS.render(containingDescriptor)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
assert element instanceof PsiMethod
|
||||
: "Method accepts only kotlin functions/properties and java methods, but '" + element.getText() + "' was found";
|
||||
return JetRefactoringUtil.formatPsiMethod((PsiMethod) element, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDimensionServiceKey() {
|
||||
return "#org.jetbrains.kotlin.idea.refactoring.safeDelete.KotlinOverridingDialog";
|
||||
}
|
||||
|
||||
public ArrayList<UsageInfo> getSelected() {
|
||||
ArrayList<UsageInfo> result = new ArrayList<UsageInfo>();
|
||||
for (int i = 0; i < myChecked.length; i++) {
|
||||
if (myChecked[i]) {
|
||||
result.add(myOverridingMethods.get(i));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}</selection>
|
||||
}
|
||||
Reference in New Issue
Block a user