Skip to content

Commit

Permalink
#74: Adding download option to Ahk runner-setup notification
Browse files Browse the repository at this point in the history
  • Loading branch information
takanuva15 committed Apr 13, 2024
1 parent 111114e commit f2162ae
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
(compatibility: 2024.1 - 2024.3.*)
### Added
- Added download option to Ahk runner-setup notification

### Changed
- Dependencies updated to support IntelliJ 2024.*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package com.autohotkey.ide.notifications

import com.autohotkey.lang.core.isAhkFile
import com.autohotkey.project.configurable.AhkProjectConfigurable
import com.autohotkey.sdk.AhkSdkTypeInstance
import com.autohotkey.sdk.getAhkSdks
import com.autohotkey.util.AhkBundle
import com.intellij.ide.BrowserUtil
import com.intellij.openapi.fileEditor.FileEditor
import com.intellij.openapi.options.ShowSettingsUtil
import com.intellij.openapi.project.DumbAware
Expand All @@ -27,11 +29,14 @@ class MissingAhkSdkNotificationProvider : EditorNotificationProvider, DumbAware
): Function<in FileEditor, out JComponent?>? {
if (!file.isAhkFile() || getAhkSdks().isNotEmpty()) return null
return Function { fileEditor ->
EditorNotificationPanel(fileEditor).apply {
EditorNotificationPanel(fileEditor, EditorNotificationPanel.Status.Warning).apply {
text = AhkBundle.msg("ahksdktype.projectsetup.noahksdksfound.message")
createActionLabel(AhkBundle.msg("ahksdktype.projectsetup.noahksdksfound.actionlabel")) {
createActionLabel(AhkBundle.msg("ahksdktype.projectsetup.noahksdksfound.configurelabel")) {
ShowSettingsUtil.getInstance().showSettingsDialog(proj, AhkProjectConfigurable::class.java)
}
createActionLabel(AhkBundle.msg("ahksdktype.projectsetup.noahksdksfound.downloadlabel")) {
BrowserUtil.browse(AhkSdkTypeInstance.downloadSdkUrl)
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/com/autohotkey/sdk/AhkSdkType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class AhkSdkType : SdkType("AutoHotkeySDK") {

override fun suggestHomePath() = """C:\Program Files\AutoHotkey"""

override fun getDownloadSdkUrl(): String = "https://www.autohotkey.com/download/"

override fun getDefaultDocumentationUrl(sdk: Sdk): String =
when {
sdk.versionString?.startsWith("1") == true -> AHK_DOCUMENTATION_URL_V1
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/localization/AhkBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ ahksdktype.createsdk.error.noexeselected=You must specify an AutoHotkey executab
ahksdktype.createsdk.dialogselecthomepath.description=Please select the home directory containing the AutoHotkey installation
ahksdktype.createsdk.dialogexeselect.title=Select AutoHotkey Executable
ahksdktype.projectsetup.noahksdksfound.message=No AutoHotkey runners are configured to be able to run this file
ahksdktype.projectsetup.noahksdksfound.actionlabel=Configure AutoHotkey runner...
ahksdktype.projectsetup.noahksdksfound.configurelabel=Configure from disk...
ahksdktype.projectsetup.noahksdksfound.downloadlabel=Download...

settings.ahksdktable.general.sdkcolumn.label=AutoHotkey runners
settings.ahksdktable.general.defaultcolumn.label=Default
Expand Down

0 comments on commit f2162ae

Please sign in to comment.