Move Class to Top Leve: Suggest file name based on new class name
#KT-17977 Fixed
This commit is contained in:
+3
-4
@@ -376,6 +376,8 @@ public class MoveKotlinNestedClassesToUpperLevelDialog extends MoveDialogBase {
|
|||||||
settings.MOVE_TO_UPPER_LEVEL_SEARCH_FOR_TEXT = searchForTextOccurrencesCheckBox.isSelected();
|
settings.MOVE_TO_UPPER_LEVEL_SEARCH_FOR_TEXT = searchForTextOccurrencesCheckBox.isSelected();
|
||||||
settings.MOVE_TO_UPPER_LEVEL_SEARCH_IN_COMMENTS = searchInCommentsCheckBox.isSelected();
|
settings.MOVE_TO_UPPER_LEVEL_SEARCH_IN_COMMENTS = searchInCommentsCheckBox.isSelected();
|
||||||
|
|
||||||
|
String newClassName = getClassName();
|
||||||
|
|
||||||
KotlinMoveTarget moveTarget;
|
KotlinMoveTarget moveTarget;
|
||||||
if (target instanceof PsiDirectory) {
|
if (target instanceof PsiDirectory) {
|
||||||
final PsiDirectory targetDir = (PsiDirectory) target;
|
final PsiDirectory targetDir = (PsiDirectory) target;
|
||||||
@@ -383,10 +385,8 @@ public class MoveKotlinNestedClassesToUpperLevelDialog extends MoveDialogBase {
|
|||||||
final FqName targetPackageFqName = getTargetPackageFqName(target);
|
final FqName targetPackageFqName = getTargetPackageFqName(target);
|
||||||
if (targetPackageFqName == null) return;
|
if (targetPackageFqName == null) return;
|
||||||
|
|
||||||
String innerClassName = innerClass.getName();
|
|
||||||
if (innerClassName == null) return;
|
|
||||||
final String targetFileName = KotlinNameSuggester.INSTANCE.suggestNameByName(
|
final String targetFileName = KotlinNameSuggester.INSTANCE.suggestNameByName(
|
||||||
innerClassName,
|
newClassName,
|
||||||
new Function1<String, Boolean>() {
|
new Function1<String, Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public Boolean invoke(String s) {
|
public Boolean invoke(String s) {
|
||||||
@@ -412,7 +412,6 @@ public class MoveKotlinNestedClassesToUpperLevelDialog extends MoveDialogBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String outerInstanceParameterName = passOuterClassCheckBox.isSelected() ? getParameterName() : null;
|
String outerInstanceParameterName = passOuterClassCheckBox.isSelected() ? getParameterName() : null;
|
||||||
String newClassName = getClassName();
|
|
||||||
MoveDeclarationsDelegate delegate = new MoveDeclarationsDelegate.NestedClass(newClassName, outerInstanceParameterName);
|
MoveDeclarationsDelegate delegate = new MoveDeclarationsDelegate.NestedClass(newClassName, outerInstanceParameterName);
|
||||||
MoveDeclarationsDescriptor moveDescriptor = new MoveDeclarationsDescriptor(
|
MoveDeclarationsDescriptor moveDescriptor = new MoveDeclarationsDescriptor(
|
||||||
project,
|
project,
|
||||||
|
|||||||
Reference in New Issue
Block a user