Move Nested Class to Upper Level: Preserve state of "Search in comments"/"Search for text occurrences" checkboxes
#KT-13904 Fixed
This commit is contained in:
@@ -136,6 +136,7 @@ These artifacts include extensions for the types available in the latter JDKs, s
|
|||||||
- [`KT-13916`](https://youtrack.jetbrains.com/issue/KT-13916) Move: Report visibility conflicts in import directives
|
- [`KT-13916`](https://youtrack.jetbrains.com/issue/KT-13916) Move: Report visibility conflicts in import directives
|
||||||
- [`KT-13906`](https://youtrack.jetbrains.com/issue/KT-13906) Move Nested Class to Upper Level: Do not show directory selection dialog twice
|
- [`KT-13906`](https://youtrack.jetbrains.com/issue/KT-13906) Move Nested Class to Upper Level: Do not show directory selection dialog twice
|
||||||
- [`KT-13901`](https://youtrack.jetbrains.com/issue/KT-13901) Move: Do not ignore target directory selected in the dialog (DnD mode)
|
- [`KT-13901`](https://youtrack.jetbrains.com/issue/KT-13901) Move: Do not ignore target directory selected in the dialog (DnD mode)
|
||||||
|
- [`KT-13904`](https://youtrack.jetbrains.com/issue/KT-13904) Move Nested Class to Upper Level: Preserve state of "Search in comments"/"Search for text occurrences" checkboxes
|
||||||
|
|
||||||
##### New features
|
##### New features
|
||||||
|
|
||||||
|
|||||||
@@ -679,6 +679,9 @@
|
|||||||
serviceImplementation="org.jetbrains.kotlin.idea.editor.KotlinEditorOptions"/>
|
serviceImplementation="org.jetbrains.kotlin.idea.editor.KotlinEditorOptions"/>
|
||||||
<editorSmartKeysConfigurable instance="org.jetbrains.kotlin.idea.editor.KotlinEditorOptionsConfigurable"/>
|
<editorSmartKeysConfigurable instance="org.jetbrains.kotlin.idea.editor.KotlinEditorOptionsConfigurable"/>
|
||||||
|
|
||||||
|
<applicationService serviceInterface="org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringSettings"
|
||||||
|
serviceImplementation="org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringSettings"/>
|
||||||
|
|
||||||
<statementUpDownMover id="jetExpression"
|
<statementUpDownMover id="jetExpression"
|
||||||
implementation="org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinExpressionMover"
|
implementation="org.jetbrains.kotlin.idea.codeInsight.upDownMover.KotlinExpressionMover"
|
||||||
order="before declaration" />
|
order="before declaration" />
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-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.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.idea.refactoring
|
||||||
|
|
||||||
|
import com.intellij.openapi.components.PersistentStateComponent
|
||||||
|
import com.intellij.openapi.components.ServiceManager
|
||||||
|
import com.intellij.openapi.components.State
|
||||||
|
import com.intellij.openapi.components.Storage
|
||||||
|
import com.intellij.util.xmlb.XmlSerializerUtil
|
||||||
|
|
||||||
|
@State(name = "KotlinRefactoringSettings", storages = arrayOf(Storage("kotlinRefactoring.xml")))
|
||||||
|
class KotlinRefactoringSettings : PersistentStateComponent<KotlinRefactoringSettings> {
|
||||||
|
@JvmField var MOVE_TO_UPPER_LEVEL_SEARCH_IN_COMMENTS = false
|
||||||
|
@JvmField var MOVE_TO_UPPER_LEVEL_SEARCH_FOR_TEXT = false
|
||||||
|
|
||||||
|
override fun getState() = this
|
||||||
|
|
||||||
|
override fun loadState(state: KotlinRefactoringSettings) = XmlSerializerUtil.copyBean(state, this)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
val instance: KotlinRefactoringSettings
|
||||||
|
get() = ServiceManager.getService(KotlinRefactoringSettings::class.java)
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -51,6 +51,7 @@ import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
|
|||||||
import org.jetbrains.kotlin.idea.core.CollectingNameValidator;
|
import org.jetbrains.kotlin.idea.core.CollectingNameValidator;
|
||||||
import org.jetbrains.kotlin.idea.core.KotlinNameSuggester;
|
import org.jetbrains.kotlin.idea.core.KotlinNameSuggester;
|
||||||
import org.jetbrains.kotlin.idea.core.NewDeclarationNameValidator;
|
import org.jetbrains.kotlin.idea.core.NewDeclarationNameValidator;
|
||||||
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringSettings;
|
||||||
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtilKt;
|
import org.jetbrains.kotlin.idea.refactoring.KotlinRefactoringUtilKt;
|
||||||
import org.jetbrains.kotlin.idea.refactoring.move.MoveUtilsKt;
|
import org.jetbrains.kotlin.idea.refactoring.move.MoveUtilsKt;
|
||||||
import org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.*;
|
import org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.*;
|
||||||
@@ -219,6 +220,10 @@ public class MoveKotlinNestedClassesToUpperLevelDialog extends MoveDialogBase {
|
|||||||
packageNameField.prependItem(packageFqName.asString());
|
packageNameField.prependItem(packageFqName.asString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KotlinRefactoringSettings settings = KotlinRefactoringSettings.getInstance();
|
||||||
|
searchForTextOccurrencesCheckBox.setSelected(settings.MOVE_TO_UPPER_LEVEL_SEARCH_FOR_TEXT);
|
||||||
|
searchInCommentsCheckBox.setSelected(settings.MOVE_TO_UPPER_LEVEL_SEARCH_IN_COMMENTS);
|
||||||
|
|
||||||
super.init();
|
super.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,6 +362,10 @@ public class MoveKotlinNestedClassesToUpperLevelDialog extends MoveDialogBase {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KotlinRefactoringSettings settings = KotlinRefactoringSettings.getInstance();
|
||||||
|
settings.MOVE_TO_UPPER_LEVEL_SEARCH_FOR_TEXT = searchForTextOccurrencesCheckBox.isSelected();
|
||||||
|
settings.MOVE_TO_UPPER_LEVEL_SEARCH_IN_COMMENTS = searchInCommentsCheckBox.isSelected();
|
||||||
|
|
||||||
KotlinMoveTarget moveTarget;
|
KotlinMoveTarget moveTarget;
|
||||||
if (target instanceof PsiDirectory) {
|
if (target instanceof PsiDirectory) {
|
||||||
final PsiDirectory targetDir = (PsiDirectory) target;
|
final PsiDirectory targetDir = (PsiDirectory) target;
|
||||||
|
|||||||
Reference in New Issue
Block a user