Skip to content

Commit

Permalink
Improve inline resillience
Browse files Browse the repository at this point in the history
Should work better outside of IJ
  • Loading branch information
jojo2357 committed Sep 11, 2023
1 parent 7d94297 commit 3ed42b2
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package nl.hannahsten.texifyidea.refactoring.inlinecommand

import com.intellij.java.refactoring.JavaRefactoringBundle
import com.intellij.psi.PsiElement
import com.intellij.refactoring.RefactoringBundle
import com.intellij.usageView.UsageViewBundle
import com.intellij.usageView.UsageViewDescriptor
import nl.hannahsten.texifyidea.file.LatexFile
Expand All @@ -27,7 +27,7 @@ class LatexInlineCommandDescriptor(private val myElement: PsiElement) : UsageVie
}

override fun getCodeReferencesText(usagesCount: Int, filesCount: Int): String {
return JavaRefactoringBundle.message(
return RefactoringBundle.message(
"invocations.to.be.inlined",
UsageViewBundle.getReferencesString(usagesCount, filesCount)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class LatexInlineCommandDialog(
GlobalSearchScope.projectScope(myProject)
)
)
updateSettingsPreferences()
}

override fun getNumberOfOccurrences(): Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.intellij.openapi.project.Project
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiNameIdentifierOwner
import com.intellij.psi.search.searches.ReferencesSearch
import com.intellij.refactoring.JavaRefactoringSettings
import com.intellij.refactoring.RefactoringBundle
import com.intellij.refactoring.inline.InlineOptionsDialog

Expand All @@ -30,13 +29,7 @@ abstract class LatexInlineDialog(project: Project?, genericDefinition: PsiElemen
return RefactoringBundle.message("inline.method.border.title")
}

override fun isInlineThis(): Boolean {
return JavaRefactoringSettings.getInstance().INLINE_METHOD_THIS
}

override fun isKeepTheDeclarationByDefault(): Boolean {
return JavaRefactoringSettings.getInstance().INLINE_METHOD_KEEP
}
override fun isInlineThis(): Boolean = false

override fun hasHelpAction(): Boolean {
return false
Expand All @@ -45,14 +38,4 @@ abstract class LatexInlineDialog(project: Project?, genericDefinition: PsiElemen
override fun allowInlineAll(): Boolean {
return true
}

protected fun updateSettingsPreferences() {
val settings = JavaRefactoringSettings.getInstance()
if (myRbInlineThisOnly.isEnabled && myRbInlineAll.isEnabled) {
settings.INLINE_METHOD_THIS = isInlineThisOnly
}
if (myKeepTheDeclaration != null && myKeepTheDeclaration!!.isEnabled) {
settings.INLINE_METHOD_KEEP = isKeepTheDeclaration
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package nl.hannahsten.texifyidea.refactoring.inlinefile

import com.intellij.java.refactoring.JavaRefactoringBundle
import com.intellij.psi.PsiElement
import com.intellij.refactoring.RefactoringBundle
import com.intellij.usageView.UsageViewBundle
import com.intellij.usageView.UsageViewDescriptor
import nl.hannahsten.texifyidea.file.LatexFile
Expand All @@ -27,7 +27,7 @@ class LatexInlineFileDescriptor(private val myElement: PsiElement) : UsageViewDe
}

override fun getCodeReferencesText(usagesCount: Int, filesCount: Int): String {
return JavaRefactoringBundle.message(
return RefactoringBundle.message(
"invocations.to.be.inlined",
UsageViewBundle.getReferencesString(usagesCount, filesCount)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class LatexInlineFileDialog(
GlobalSearchScope.projectScope(myProject)
)
)
updateSettingsPreferences()
}

override fun getNumberOfOccurrences(): Int {
Expand Down

0 comments on commit 3ed42b2

Please sign in to comment.