Skip to content

v0.4.6 #705

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

Merged
merged 12 commits into from
Mar 30, 2022
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
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ kotlin.code.style=official

pluginGroup = spp.jetbrains
pluginName = Source++
projectVersion=0.4.5
projectVersion=0.4.6
pluginSinceBuild = 202.4357
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
# See https://jb.gg/intellij-platform-builds-list for available build versions
pluginVerifierIdeVersions = 2020.3.2, 2021.3.3
pluginVerifierIdeVersions = 2020.2.4, 2021.3.3

platformType = IC
ideVersion = 2021.3.3
Expand All @@ -22,7 +22,7 @@ platformPlugins = java, Groovy, Kotlin, PythonCore:213.5744.223, org.intellij.sc
kotlin.stdlib.default.dependency = true

apolloVersion=3.2.0
vertxVersion=4.2.4
vertxVersion=4.2.6
slf4jVersion=1.7.33
jacksonVersion=2.13.1
joorVersion=0.9.13
11 changes: 5 additions & 6 deletions plugin/src/main/java/spp/jetbrains/sourcemarker/PluginUI.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package spp.jetbrains.sourcemarker;

import com.intellij.DynamicBundle;
import com.intellij.ui.Gray;
import com.intellij.ui.JBColor;
import com.intellij.util.ui.UIUtil;
Expand Down Expand Up @@ -42,10 +41,10 @@ public class PluginUI {
}
}

public static final Font BIG_FONT = (DynamicBundle.getLocale().getLanguage().equals("zh")) ? MICROSOFT_YAHEI_PLAIN_16 : ROBOTO_LIGHT_PLAIN_17;
public static final Font SMALL_FONT = (DynamicBundle.getLocale().getLanguage().equals("zh")) ? MICROSOFT_YAHEI_PLAIN_15 : ROBOTO_LIGHT_PLAIN_16;
public static final Font SMALLER_FONT = (DynamicBundle.getLocale().getLanguage().equals("zh")) ? MICROSOFT_YAHEI_PLAIN_14 : ROBOTO_LIGHT_PLAIN_15;
public static final Font SMALLEST_FONT = (DynamicBundle.getLocale().getLanguage().equals("zh")) ? MICROSOFT_YAHEI_PLAIN_13 : ROBOTO_LIGHT_PLAIN_14;
public static final Font BIG_FONT = (PluginBundle.INSTANCE.getLOCALE().getLanguage().equals("zh")) ? MICROSOFT_YAHEI_PLAIN_16 : ROBOTO_LIGHT_PLAIN_17;
public static final Font SMALL_FONT = (PluginBundle.INSTANCE.getLOCALE().getLanguage().equals("zh")) ? MICROSOFT_YAHEI_PLAIN_15 : ROBOTO_LIGHT_PLAIN_16;
public static final Font SMALLER_FONT = (PluginBundle.INSTANCE.getLOCALE().getLanguage().equals("zh")) ? MICROSOFT_YAHEI_PLAIN_14 : ROBOTO_LIGHT_PLAIN_15;
public static final Font SMALLEST_FONT = (PluginBundle.INSTANCE.getLOCALE().getLanguage().equals("zh")) ? MICROSOFT_YAHEI_PLAIN_13 : ROBOTO_LIGHT_PLAIN_14;
public static final Color PANEL_BACKGROUND_COLOR = Gray._37;
public static final Color LABEL_FOREGROUND_COLOR = new Color(152, 118, 170);
public static final Color LABEL_FOREGROUND_COLOR1 = new Color(106, 135, 89);
Expand All @@ -69,6 +68,6 @@ public static String getCommandHighlightColor() {
}

public static Color getEditCompleteColor() {
return UIUtil.getWindowColor();//Color.decode("#2B2B2B");
return UIUtil.getWindowColor();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<properties/>
<border type="none"/>
<children>
<component id="b854b" class="javax.swing.JLabel">
<component id="b854b" class="javax.swing.JLabel" binding="rootSourcePackageLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
Expand All @@ -56,7 +56,7 @@
</component>
</children>
</grid>
<component id="77432" class="javax.swing.JCheckBox" binding="consoleCheckBox">
<component id="77432" class="javax.swing.JCheckBox" binding="debugConsoleCheckBox">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
Expand All @@ -74,7 +74,7 @@
<text resource-bundle="messages/PluginBundle" key="auto_resolve_endpoint_names"/>
</properties>
</component>
<component id="27dfe" class="javax.swing.JCheckBox" binding="autoDisplayEndpointQuickStatCheckBox">
<component id="27dfe" class="javax.swing.JCheckBox" binding="autoDisplayEndpointQuickStatsCheckBox">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
Expand All @@ -92,7 +92,7 @@
<properties/>
<border type="none"/>
<children>
<component id="57fd0" class="javax.swing.JLabel">
<component id="57fd0" class="javax.swing.JLabel" binding="hostLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
Expand All @@ -109,7 +109,7 @@
</constraints>
<properties/>
</component>
<component id="afa10" class="javax.swing.JLabel">
<component id="afa10" class="javax.swing.JLabel" binding="accessTokenLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
Expand All @@ -125,7 +125,7 @@
</constraints>
<properties/>
</component>
<component id="9bd2e" class="javax.swing.JLabel">
<component id="9bd2e" class="javax.swing.JLabel" binding="certificatePinsLabel">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
Expand All @@ -141,7 +141,7 @@
<border type="none"/>
<children/>
</grid>
<component id="99c47" class="javax.swing.JLabel">
<component id="99c47" class="javax.swing.JLabel" binding="serviceLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,20 @@ public class PluginConfigurationPanel {
private JPanel myGlobalSettingsPanel;
private JTextField rootSourcePackageTextField;
private JCheckBox autoResolveEndpointNamesCheckBox;
private JCheckBox consoleCheckBox;
private JCheckBox debugConsoleCheckBox;
private JPanel myServiceSettingsPanel;
private JTextField serviceHostTextField;
private JTextField accessTokenTextField;
private JPanel testPanel;
private JComboBox serviceComboBox;
private JCheckBox verifyHostCheckBox;
private JLabel verifyHostLabel;
private JCheckBox autoDisplayEndpointQuickStatCheckBox;
private JCheckBox autoDisplayEndpointQuickStatsCheckBox;
private JLabel hostLabel;
private JLabel accessTokenLabel;
private JLabel certificatePinsLabel;
private JLabel serviceLabel;
private JLabel rootSourcePackageLabel;
private SourceMarkerConfig config;
private CertificatePinPanel myCertificatePins;

Expand All @@ -59,6 +64,17 @@ public PluginConfigurationPanel(SourceMarkerConfig config) {
}
});
}

//todo: shouldn't need to manually update locale text
hostLabel.setText(message("service_host"));
accessTokenLabel.setText(message("access_token"));
verifyHostLabel.setText(message("verify_host"));
certificatePinsLabel.setText(message("certificate_pins"));
serviceLabel.setText(message("service"));
rootSourcePackageLabel.setText(message("root_source_package"));
debugConsoleCheckBox.setText(message("debug_console"));
autoResolveEndpointNamesCheckBox.setText(message("auto_resolve_endpoint_names"));
autoDisplayEndpointQuickStatsCheckBox.setText(message("auto_display_endpoint_quick_stats"));
}

public JComponent getContentPane() {
Expand All @@ -72,7 +88,7 @@ boolean isModified() {
if (!Objects.equals(autoResolveEndpointNamesCheckBox.isSelected(), config.getAutoResolveEndpointNames())) {
return true;
}
if (!Objects.equals(consoleCheckBox.isSelected(), config.getPluginConsoleEnabled())) {
if (!Objects.equals(debugConsoleCheckBox.isSelected(), config.getPluginConsoleEnabled())) {
return true;
}
if (!Objects.equals(serviceHostTextField.getText(), config.getServiceHost())) {
Expand All @@ -90,7 +106,7 @@ boolean isModified() {
if (!Objects.equals(serviceComboBox.getSelectedItem(), config.getServiceName())) {
return config.getServiceName() != null || serviceComboBox.getSelectedItem() != "All Services";
}
if (!Objects.equals(autoDisplayEndpointQuickStatCheckBox.isSelected(), config.getAutoDisplayEndpointQuickStats())) {
if (!Objects.equals(autoDisplayEndpointQuickStatsCheckBox.isSelected(), config.getAutoDisplayEndpointQuickStats())) {
return true;
}
return false;
Expand All @@ -106,26 +122,26 @@ public SourceMarkerConfig getPluginConfig() {
Arrays.stream(rootSourcePackageTextField.getText().split(","))
.map(String::trim).collect(Collectors.toList()),
autoResolveEndpointNamesCheckBox.isSelected(),
true, consoleCheckBox.isSelected(),
true, debugConsoleCheckBox.isSelected(),
serviceHostTextField.getText(),
accessTokenTextField.getText(),
new ArrayList<>(Collections.list(myCertificatePins.listModel.elements())),
null,
verifyHostCheckBox.isSelected(),
currentService,
autoDisplayEndpointQuickStatCheckBox.isSelected()
autoDisplayEndpointQuickStatsCheckBox.isSelected()
);
}

public void applySourceMarkerConfig(SourceMarkerConfig config) {
this.config = config;
rootSourcePackageTextField.setText(String.join(",", config.getRootSourcePackages()));
autoResolveEndpointNamesCheckBox.setSelected(config.getAutoResolveEndpointNames());
consoleCheckBox.setSelected(config.getPluginConsoleEnabled());
debugConsoleCheckBox.setSelected(config.getPluginConsoleEnabled());
serviceHostTextField.setText(config.getServiceHost());
accessTokenTextField.setText(config.getAccessToken());
verifyHostCheckBox.setSelected(config.getVerifyHost());
autoDisplayEndpointQuickStatCheckBox.setSelected(config.getAutoDisplayEndpointQuickStats());
autoDisplayEndpointQuickStatsCheckBox.setSelected(config.getAutoDisplayEndpointQuickStats());

myCertificatePins = new CertificatePinPanel();
myCertificatePins.listModel.addAll(config.getCertificatePins());
Expand Down
14 changes: 12 additions & 2 deletions plugin/src/main/kotlin/spp/jetbrains/sourcemarker/PluginBundle.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
package spp.jetbrains.sourcemarker

import com.intellij.AbstractBundle
import com.intellij.DynamicBundle
import com.intellij.ide.plugins.PluginManager
import com.intellij.openapi.extensions.PluginId
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import java.util.*
Expand All @@ -34,9 +35,18 @@ private const val BUNDLE = "messages.PluginBundle"
*/
object PluginBundle : AbstractBundle(BUNDLE) {

val LOCALE: Locale by lazy {
val chineseLanguagePlugin = "com.intellij.zh"
if (PluginManager.isPluginInstalled(PluginId.getId(chineseLanguagePlugin))) {
Locale.CHINA
} else {
Locale.ROOT
}
}

//todo: shouldn't need to manually load bundle.
val LOCALE_BUNDLE: ResourceBundle by lazy {
ResourceBundle.getBundle(BUNDLE, DynamicBundle.getLocale(), PluginBundle::class.java.classLoader)
ResourceBundle.getBundle(BUNDLE, LOCALE, PluginBundle::class.java.classLoader)
}

@Suppress("SpreadOperator")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
package spp.jetbrains.sourcemarker.view

import com.intellij.DynamicBundle
import com.intellij.openapi.application.ApplicationManager
import com.intellij.ui.JBColor
import io.vertx.core.json.Json
Expand All @@ -42,6 +41,7 @@ import spp.jetbrains.monitor.skywalking.bridge.EndpointMetricsBridge
import spp.jetbrains.monitor.skywalking.model.GetEndpointMetrics
import spp.jetbrains.monitor.skywalking.model.ZonedDuration
import spp.jetbrains.monitor.skywalking.toProtocol
import spp.jetbrains.sourcemarker.PluginBundle
import spp.jetbrains.sourcemarker.PluginBundle.message
import spp.jetbrains.sourcemarker.PluginUI
import spp.jetbrains.sourcemarker.SourceMarkerPlugin.vertx
Expand Down Expand Up @@ -123,7 +123,7 @@ class ActivityQuickStatsIndicator(val config: SourceMarkerConfig) : SourceMarkEv
inlay.putUserData(SHOWING_QUICK_STATS, true)
inlay.configuration.virtualText = InlayMarkVirtualText(inlay, formatMetricResult(metricResult))
inlay.configuration.virtualText!!.textAttributes.foregroundColor = inlayForegroundColor
if (DynamicBundle.getLocale().language == "zh") {
if (PluginBundle.LOCALE.language == "zh") {
inlay.configuration.virtualText!!.font = PluginUI.MICROSOFT_YAHEI_PLAIN_14
inlay.configuration.virtualText!!.xOffset = 15
}
Expand Down
5 changes: 4 additions & 1 deletion plugin/src/main/resources/messages/PluginBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,7 @@ type=Type
count=Count
operation_name=Operation Name
sec_letter=s
day=Day
day=Day
verify_host=Verify Host
certificate_pins=Certificate Pins
service=Service
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,7 @@ type=类
count=数
operation_name=操作名称
sec_letter=秒
day=日
day=日
verify_host=验证主机
certificate_pins=证书别针
service=营运