Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #439 #451

Merged
merged 1 commit into from
Jan 31, 2024
Merged
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
35 changes: 23 additions & 12 deletions src/main/kotlin/org/arend/ArendStartupActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.runReadAction
import com.intellij.openapi.components.service
import com.intellij.openapi.editor.colors.EditorColorsManager
import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.openapi.module.Module
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.project.DumbModeTask
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.ModuleListener
import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.ProjectActivity
import com.intellij.ui.JBColor
import org.arend.module.ArendModuleType
import org.arend.module.config.ArendModuleConfigService
import org.arend.typechecking.TypeCheckingService
Expand Down Expand Up @@ -66,20 +69,28 @@ class ArendStartupActivity : ProjectActivity {
}
})
disableActions()
changeColors()
}

companion object {
fun disableActions() {
val actionManager = ApplicationManager.getApplication().getServiceIfCreated(ActionManager::class.java)
actionManager?.getAction(ArendBundle.message("arend.disableActionExclude"))?.let {
actionManager.unregisterAction(ArendBundle.message("arend.disableActionExclude"))
}
actionManager?.getAction(ArendBundle.message("arend.disableGroupSource"))?.let {
actionManager.unregisterAction(ArendBundle.message("arend.disableGroupSource"))
}
actionManager?.getAction(ArendBundle.message("arend.disableActionUnmark"))?.let {
actionManager.unregisterAction(ArendBundle.message("arend.disableActionUnmark"))
}
private fun disableActions() {
val actionManager = ApplicationManager.getApplication().getServiceIfCreated(ActionManager::class.java)
actionManager?.getAction(ArendBundle.message("arend.disableActionExclude"))?.let {
actionManager.unregisterAction(ArendBundle.message("arend.disableActionExclude"))
}
actionManager?.getAction(ArendBundle.message("arend.disableGroupSource"))?.let {
actionManager.unregisterAction(ArendBundle.message("arend.disableGroupSource"))
}
actionManager?.getAction(ArendBundle.message("arend.disableActionUnmark"))?.let {
actionManager.unregisterAction(ArendBundle.message("arend.disableActionUnmark"))
}
}

private fun changeColors() {
val colorManager = EditorColorsManager.getInstance()
val highContrastColorScheme = colorManager.getScheme("_@user_High contrast")
val inlayDefaultTextColor = TextAttributesKey.createTextAttributesKey("INLAY_DEFAULT")
val attributes = highContrastColorScheme.getAttributes(inlayDefaultTextColor)
attributes.foregroundColor = JBColor.YELLOW
highContrastColorScheme.setAttributes(inlayDefaultTextColor, attributes)
}
}
Loading