Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/kotlin/com/vk/modulite/actions/NewModuliteAction.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.vk.modulite.actions

import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
Expand All @@ -16,4 +17,6 @@ class NewModuliteAction : AnAction(
val folder = e.getData(CommonDataKeys.VIRTUAL_FILE) ?: return
ModuliteBuilder(project).startBuild(folder, fromSource = false)
}

override fun getActionUpdateThread() = ActionUpdateThread.BGT
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.vk.modulite.actions

import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
Expand Down Expand Up @@ -35,4 +36,6 @@ class NewModuliteFromFolderAction : AnAction(
return
}
}

override fun getActionUpdateThread() = ActionUpdateThread.BGT
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.vk.modulite.actions

import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
Expand All @@ -17,7 +18,8 @@ class RegenerateModuleRequiresAction : AnAction() {
val file = e.getData(CommonDataKeys.VIRTUAL_FILE)
if (file == null || file.name != ".modulite.yaml") {
e.presentation.isEnabledAndVisible = false
return
}
}

override fun getActionUpdateThread() = ActionUpdateThread.BGT
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.vk.modulite.actions

import com.intellij.codeInsight.hint.HintManager
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
Expand Down Expand Up @@ -105,6 +106,8 @@ abstract class SelectionBasedPsiElementAction<T : PsiElement>(
return PsiTreeUtil.findElementOfClassAtRange(file, selectionStart, selectionEnd, myClass)
}

override fun getActionUpdateThread() = ActionUpdateThread.BGT

companion object {
private fun getEditor(e: AnActionEvent) = e.getData(CommonDataKeys.EDITOR)
private fun getPsiFile(e: AnActionEvent) = e.getData(CommonDataKeys.PSI_FILE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ abstract class UsagesBaseFinder {
it is DefaultSearchScopeProviders.CustomNamed
} ?: return

// TODO: remove `allowSlowOperations`
val scopes = SlowOperations.allowSlowOperations<List<SearchScope>, RuntimeException> {
provider.getSearchScopes(
element.project,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package com.vk.modulite.actions.usages.php

import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.util.SlowOperations
import com.jetbrains.php.lang.psi.elements.PhpPsiElement
import com.jetbrains.php.lang.psi.elements.Variable
import com.vk.modulite.actions.PhpPsiElementAction
import com.vk.modulite.modulite.Modulite
import com.vk.modulite.psi.extensions.files.containingModulite

class FindSymbolUsagesInCurrentModuleAction : PhpPsiElementAction<PhpPsiElement>(PhpPsiElement::class.java) {
Expand All @@ -20,9 +18,7 @@ class FindSymbolUsagesInCurrentModuleAction : PhpPsiElementAction<PhpPsiElement>
return
}

val modulite = SlowOperations.allowSlowOperations<Modulite?, RuntimeException> {
e.getData(CommonDataKeys.VIRTUAL_FILE)?.containingModulite(e.project!!)
}
val modulite = e.getData(CommonDataKeys.VIRTUAL_FILE)?.containingModulite(e.project!!)

if (modulite == null) {
e.presentation.isEnabledAndVisible = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.vk.modulite.actions.usages.yaml

import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.util.SlowOperations
Expand All @@ -19,9 +20,7 @@ class FindAllowedSymbolUsagesInModuleAction : YamlPsiElementAction<YAMLQuotedTex
}

override fun update(e: AnActionEvent, element: YAMLQuotedText?) {
val modulite = SlowOperations.allowSlowOperations<Modulite?, RuntimeException> {
e.getData(CommonDataKeys.VIRTUAL_FILE)?.containingModulite(e.project!!)
}
val modulite = e.getData(CommonDataKeys.VIRTUAL_FILE)?.containingModulite(e.project!!)

if (element == null || modulite == null) {
e.presentation.isEnabledAndVisible = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.vk.modulite.actions.usages.yaml

import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.psi.PsiElement
Expand Down Expand Up @@ -40,10 +41,7 @@ class FindModuleUsagesInCurrentModuleAction : YamlPsiElementAction<YAMLQuotedTex
}

override fun update(e: AnActionEvent, element: YAMLQuotedText?) {
val module =
SlowOperations.allowSlowOperations<Modulite?, RuntimeException> {
e.getData(CommonDataKeys.VIRTUAL_FILE)?.containingModulite(e.project!!)
}
val module = e.getData(CommonDataKeys.VIRTUAL_FILE)?.containingModulite(e.project!!)

if (element == null || module == null) {
e.presentation.isEnabledAndVisible = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.vk.modulite.actions.usages.yaml

import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.util.SlowOperations
Expand All @@ -15,10 +16,7 @@ class FindSymbolUsagesInCurrentModuleAction : YamlPsiElementAction<YAMLQuotedTex
}

override fun update(e: AnActionEvent, element: YAMLQuotedText?) {
val modulite =
SlowOperations.allowSlowOperations<Modulite?, RuntimeException> {
e.getData(CommonDataKeys.VIRTUAL_FILE)?.containingModulite(e.project!!)
}
val modulite = e.getData(CommonDataKeys.VIRTUAL_FILE)?.containingModulite(e.project!!)

if (element == null || modulite == null) {
e.presentation.isEnabledAndVisible = false
Expand Down