-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update listener and notification translation (#24)
- Loading branch information
1 parent
316abf6
commit 70f4f86
Showing
26 changed files
with
469 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
<idea-plugin> | ||
<id>org.bitlap.sbtDependencyAnalyzer</id> | ||
<name>Sbt Dependency Analyzer</name> | ||
<version>0.1.4-231.9392.1</version> | ||
<version>0.2.0-RC1-231.9392.1</version> | ||
<vendor url="https://github.com/bitlap/intellij-sbt-dependency-analyzer" email="[email protected]">Bitlap | ||
</vendor> | ||
<idea-version since-build="231.0"/> | ||
|
@@ -17,32 +17,46 @@ | |
<extensions defaultExtensionNs="com.intellij"> | ||
<externalSystemDependencyAnalyzer implementation="bitlap.sbt.analyzer.SbtDependencyAnalyzerExtension"/> | ||
<notificationGroup id="Sbt.DependencyAnalyzer.Notification" displayType="BALLOON"/> | ||
<notificationGroup id="Sbt.DependencyAnalyzer.UpdateNotification" displayType="BALLOON"/> | ||
|
||
<registryKey key="bitlap.sbt.analyzer.SbtDependencyAnalyzerBundle" | ||
defaultValue="true" restartRequired="false" | ||
description="Force translation for notification"/> | ||
|
||
<postStartupActivity implementation="bitlap.sbt.analyzer.activity.PluginUpdateActivity"/> | ||
|
||
</extensions> | ||
|
||
<actions> | ||
<action id="Sbt.ViewDependencyAnalyzer" class="bitlap.sbt.analyzer.ViewDependencyAnalyzerAction"/> | ||
<action id="Sbt.ToolbarDependencyAnalyzer" class="bitlap.sbt.analyzer.ToolbarDependencyAnalyzerAction"/> | ||
<action id="Sbt.ViewDependencyAnalyzer" class="bitlap.sbt.analyzer.action.ViewDependencyAnalyzerAction"/> | ||
<action id="Sbt.ToolbarDependencyAnalyzer" class="bitlap.sbt.analyzer.action.ToolbarDependencyAnalyzerAction"/> | ||
<action id="Sbt.ProjectViewDependencyAnalyzer" | ||
class="bitlap.sbt.analyzer.ProjectViewDependencyAnalyzerAction"> | ||
class="bitlap.sbt.analyzer.action.ProjectViewDependencyAnalyzerAction"> | ||
<add-to-group group-id="ProjectViewPopupMenu" anchor="before" relative-to-action="UML.Group"/> | ||
</action> | ||
<action id="Sbt.DependencyAnalyzer.OpenConfig" | ||
class="bitlap.sbt.analyzer.SbtDependencyAnalyzerOpenConfigAction"> | ||
class="bitlap.sbt.analyzer.action.SbtDependencyAnalyzerOpenConfigAction"> | ||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.DependencyListGroup"/> | ||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.DependencyTreeGroup"/> | ||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.UsagesTreeGroup"/> | ||
</action> | ||
<action id="Sbt.DependencyAnalyzer.GoTo" class="bitlap.sbt.analyzer.SbtDependencyAnalyzerGoToAction"> | ||
<action id="Sbt.DependencyAnalyzer.GoTo" class="bitlap.sbt.analyzer.action.SbtDependencyAnalyzerGoToAction"> | ||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.DependencyListGroup"/> | ||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.DependencyTreeGroup"/> | ||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.UsagesTreeGroup"/> | ||
</action> | ||
<action id="Sbt.DependencyAnalyzer.RefreshDependencies" class="bitlap.sbt.analyzer.SbtRefreshDependenciesAction"> | ||
<action id="Sbt.DependencyAnalyzer.RefreshDependencies" | ||
class="bitlap.sbt.analyzer.action.SbtRefreshDependenciesAction"> | ||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.DependencyListGroup"/> | ||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.DependencyTreeGroup"/> | ||
<add-to-group group-id="ExternalSystem.DependencyAnalyzer.UsagesTreeGroup"/> | ||
</action> | ||
|
||
<action id="Sbt.WhatsNewInSbtDependencyAnalyzer" | ||
class="bitlap.sbt.analyzer.activity.WhatsNewAction"> | ||
<add-to-group group-id="HelpMenu" anchor="after" relative-to-action="WhatsNewAction"/> | ||
</action> | ||
|
||
<group id="Sbt.View.ProjectMenu"> | ||
<separator/> | ||
<reference id="Sbt.ViewDependencyAnalyzer"/> | ||
|
@@ -93,6 +107,13 @@ | |
</description> | ||
<change-notes> | ||
<![CDATA[ | ||
<h1>0.2.0-RC1-231.9392.1</h1> | ||
<ul> | ||
<li>🎉Add locale zn_CN translation for notification.</li> | ||
<li>🎉Add plugin update notification.</li> | ||
<li>🎉Add What's New action in Help menu.</li> | ||
</ul> | ||
<h1>0.1.3-231.9392.1</h1> | ||
<ul> | ||
<li>Fix module recognition failure when analyzing cross-build projects for Scala2 and Scala3.</li> | ||
|
24 changes: 16 additions & 8 deletions
24
src/main/resources/messages/SbtDependencyAnalyzerBundle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
sbt.dependency.analyzer.error=Please ensure to include the 'addDependencyTreePlugin' statement in 'plugins.sbt'. | ||
sbt.dependency.analyzer.error.unknown=Unknown problem occurs: {0} / {1} / {2}, please report the problem to the developer. | ||
sbt.dependency.analyzer.error.parse=Failed to parse the file: {0}, please report the problem to the developer. | ||
sbt.dependency.analyzer.error.title=Failed to use Sbt Dependency Analyzer plugin. | ||
sbt.dependency.analyzer.action.name=Analyze SBT Dependencies... | ||
sbt.dependency.analyzer.notification.goto.plugins.sbt=Add and Goto plugins.sbt | ||
sbt.dependency.analyzer.refresh.dependencies.text=Refresh SBT Dependencies | ||
sbt.dependency.analyzer.refresh.dependencies.description=Refresh SBT dependencies | ||
analyzer.task.error.unknown.title=Please ensure to include the "addDependencyTreePlugin" statement in "plugins.sbt" | ||
analyzer.task.error.unknown.text=Unknown problem occurs: {0} / {1} / {2}, please report the problem to the developer | ||
analyzer.task.error.text=Failed to parse the file: {0}, please report the problem to the developer | ||
analyzer.task.error.title=Failed to use Sbt Dependency Analyzer plugin | ||
analyzer.action.name=Analyze SBT Dependencies... | ||
analyzer.notification.gotoPluginsFile=Add and Goto "plugins.sbt" | ||
analyzer.refresh.dependencies.text=Refresh SBT Dependencies | ||
analyzer.refresh.dependencies.description=Refresh SBT dependencies | ||
analyzer.updated.notification.title={0} plugin updated to v{1} | ||
analyzer.updated.notification.text=Thank you for downloading \ | ||
<b><a href="https://github.com/bitlap/intellij-sbt-dependency-analyzer">Sbt Dependency Analyzer</a></b>! \ | ||
<div style="{0}">Change notes (<a href="https://github.com/bitlap/intellij-sbt-dependency-analyzer/releases/tag/v{2}">releases notes</a>)\:</div>\ | ||
<div style="margin: 2px 0">{1}</div> | ||
analyzer.updated.notification.gotoBrowser=Go to see | ||
analyzer.action.WhatsNew.text=What''s New in {0} | ||
|
15 changes: 15 additions & 0 deletions
15
src/main/resources/messages/SbtDependencyAnalyzerBundle_zh.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
analyzer.task.error.unknown.title=请确保在 “plugins.sbt” 中包含 “addDependencyTreePlugin” 语句 | ||
analyzer.task.error.unknown.text=出现未知问题: {0} / {1} / {2}, 请向开发人员报告问题 | ||
analyzer.task.error.title=无法使用 Sbt Dependency Analyzer 插件 | ||
analyzer.task.error.text=无法分析文件: {0}, 请向开发人员报告问题 | ||
analyzer.action.name=分析 SBT 依赖... | ||
analyzer.notification.gotoPluginsFile=添加并打开 ”plugins.sbt“ | ||
analyzer.refresh.dependencies.text=刷新 SBT 依赖 | ||
analyzer.refresh.dependencies.description=刷新 SBT 依赖 | ||
analyzer.updated.notification.title={0} 插件已更新为 v{1} | ||
analyzer.updated.notification.text=感谢下载 \ | ||
<b><a href="https://github.com/bitlap/intellij-sbt-dependency-analyzer">Sbt Dependency Analyzer</a></b>! \ | ||
<div style="{0}">更新说明 (<a href="https://github.com/bitlap/intellij-sbt-dependency-analyzer/releases/tag/v{2}">releases notes</a>)\:</div>\ | ||
<div style="margin: 2px 0">{1}</div> | ||
analyzer.updated.notification.gotoBrowser=去看看 | ||
analyzer.action.WhatsNew.text={0} 最新功能 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 63 additions & 5 deletions
68
src/main/scala/bitlap/sbt/analyzer/SbtDependencyAnalyzerBundle.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,79 @@ | ||
package bitlap.sbt.analyzer | ||
|
||
import java.util.* | ||
|
||
import org.jetbrains.annotations.Nls | ||
import org.jetbrains.annotations.NotNull | ||
import org.jetbrains.annotations.PropertyKey | ||
|
||
import com.intellij.DynamicBundle | ||
import com.intellij.* | ||
import com.intellij.openapi.diagnostic.Logger | ||
import com.intellij.openapi.util.registry.Registry | ||
|
||
import SbtDependencyAnalyzerBundle.* | ||
|
||
final class SbtDependencyAnalyzerBundle extends DynamicBundle(BUNDLE) | ||
final class SbtDependencyAnalyzerBundle(private val pathToBundle: String) extends AbstractBundle(pathToBundle): | ||
private val adaptedControl = ResourceBundle.Control.getNoFallbackControl(ResourceBundle.Control.FORMAT_PROPERTIES) | ||
|
||
private lazy val adaptedBundle: AbstractBundle = { | ||
val dynamicLocale = getDynamicLocale | ||
if dynamicLocale != null then | ||
if (dynamicLocale.toLanguageTag == Locale.ENGLISH.toLanguageTag) { | ||
new AbstractBundle(pathToBundle) { | ||
override def findBundle( | ||
pathToBundle: String, | ||
loader: ClassLoader, | ||
control: ResourceBundle.Control | ||
): ResourceBundle = { | ||
val dynamicBundle = ResourceBundle.getBundle(pathToBundle, dynamicLocale, loader, adaptedControl) | ||
if dynamicBundle == null then super.findBundle(pathToBundle, loader, control) else dynamicBundle | ||
} | ||
} | ||
} else null | ||
else null | ||
} | ||
|
||
def getAdaptedMessage(@PropertyKey(resourceBundle = BUNDLE) key: String, params: Any*): String = { | ||
if (adaptedBundle != null) adaptedBundle.getMessage(key, params: _*) else getMessage(key, params: _*) | ||
} | ||
|
||
override def findBundle( | ||
pathToBundle: String, | ||
loader: ClassLoader, | ||
control: ResourceBundle.Control | ||
): ResourceBundle = | ||
val dynamicLocale = getDynamicLocale | ||
if dynamicLocale != null then | ||
if forceFollowLanguagePack then ResourceBundle.getBundle(pathToBundle, dynamicLocale, loader, adaptedControl) | ||
else ResourceBundle.getBundle(pathToBundle, dynamicLocale, loader, control) | ||
else super.findBundle(pathToBundle, loader, control) | ||
|
||
end findBundle | ||
|
||
end SbtDependencyAnalyzerBundle | ||
|
||
object SbtDependencyAnalyzerBundle: | ||
private val LOG = Logger.getInstance(classOf[SbtDependencyAnalyzerBundle]) | ||
|
||
private lazy val forceFollowLanguagePack: Boolean = { | ||
Registry.get("bitlap.sbt.analyzer.SbtDependencyAnalyzerBundle").asBoolean() | ||
} | ||
|
||
private lazy val getDynamicLocale: Locale = { | ||
try { | ||
DynamicBundle.getLocale | ||
} catch { | ||
case e: NoSuchMethodError => | ||
LOG.debug("NoSuchMethodError: DynamicBundle.getLocale()") | ||
null | ||
} | ||
} | ||
|
||
final val BUNDLE = "messages.SbtDependencyAnalyzerBundle" | ||
|
||
final val BUNDLE = "messages.SbtDependencyAnalyzerBundle" | ||
final val INSTANCE = new SbtDependencyAnalyzerBundle | ||
final val INSTANCE = new SbtDependencyAnalyzerBundle(BUNDLE) | ||
|
||
@Nls def message(@NotNull @PropertyKey(resourceBundle = BUNDLE) key: String, @NotNull params: AnyRef*): String = | ||
INSTANCE.getMessage(key, params: _*) | ||
INSTANCE.getAdaptedMessage(key, params: _*) | ||
|
||
end SbtDependencyAnalyzerBundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/scala/bitlap/sbt/analyzer/SbtDependencyAnalyzerPlugin.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package bitlap.sbt.analyzer | ||
|
||
import com.intellij.ide.plugins.IdeaPluginDescriptor | ||
import com.intellij.ide.plugins.PluginManagerCore | ||
import com.intellij.openapi.extensions.PluginId | ||
|
||
/** @author | ||
* 梦境迷离 | ||
* @version 1.0,2023/9/1 | ||
*/ | ||
object SbtDependencyAnalyzerPlugin { | ||
|
||
val PLUGIN_ID = "org.bitlap.sbtDependencyAnalyzer" | ||
|
||
val descriptor: IdeaPluginDescriptor = PluginManagerCore.getPlugin(PluginId.getId(PLUGIN_ID)) | ||
|
||
lazy val version: String = descriptor.getVersion | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 7 additions & 1 deletion
8
...zer/SbtDependencyAnalyzerGoToAction.scala → ...ion/SbtDependencyAnalyzerGoToAction.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 9 additions & 4 deletions
13
...tDependencyAnalyzerOpenConfigAction.scala → ...tDependencyAnalyzerOpenConfigAction.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.