Skip to content

Commit

Permalink
Merge pull request #50 from anboralabs/download
Browse files Browse the repository at this point in the history
add download feature
  • Loading branch information
dalgarins authored Jan 17, 2025
2 parents 2ea78f4 + bb181a1 commit 9cd6e6e
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 261 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fun environment(key: String) = providers.environmentVariable(key)

plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "1.9.24"
id("org.jetbrains.kotlin.jvm") version "2.0.0"
id("org.jetbrains.intellij.platform") version "2.2.1"
}

Expand Down
199 changes: 0 additions & 199 deletions core/src/main/kotlin/org/apache/jmeter/treebuilder/TreeBuilder.kt

This file was deleted.

This file was deleted.

9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ kotlin.stdlib.default.dependency=false
pluginGroup = co.anbora.labs
pluginName = JMeter Viewer
# SemVer format -> https://semver.org
pluginVersion = 1.6.5
pluginVersion = 1.7.0

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 243
pluginUntilBuild = 243.*
pluginSinceBuild = 251
pluginUntilBuild = 251.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IC
platformVersion = 243.12818.47
platformVersion = 251.14649.49
#platformVersion = LATEST-EAP-SNAPSHOT

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
Expand Down
4 changes: 2 additions & 2 deletions src/main/html/change-notes.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Versions:
<ul>
<li>All Intellij products support: 1.6.5</li>
<li>All Intellij products support: 1.7.0</li>
</ul>
<br>
Plugin updates:
<ul>
<li><b>1.6.5</b> <em>(2024-12-18)</em> - add feature
<li><b>1.7.0</b> <em>(2025-01-17)</em> - add feature
<ul>
<li>Download JMeter</li>
</ul>
Expand Down
41 changes: 20 additions & 21 deletions src/main/java/co/anbora/labs/jmeter/ide/license/CheckLicense.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package co.anbora.labs.jmeter.ide.license;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ex.ActionUtil;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.ui.LicensingFacade;
Expand Down Expand Up @@ -143,7 +141,7 @@ public static Boolean isLicensed() {
return false;
}

/*public static void requestLicense(final String message) {
public static void requestLicense(final String message) {
// ensure the dialog is appeared from UI thread and in a non-modal context
ApplicationManager.getApplication().invokeLater(
()
Expand All @@ -162,10 +160,15 @@ private static void showRegisterDialog(final String productCode,
registerAction = actionManager.getAction("Register");
}
if (registerAction != null) {
registerAction.actionPerformed(AnActionEvent.createFromDataContext(
"", new Presentation(), asDataContext(productCode, message)));
ActionUtil.performActionDumbAwareWithCallbacks(registerAction, AnActionEvent.createEvent(
asDataContext(productCode, message),
new Presentation(),
"",
ActionUiKind.NONE,
null
));
}
}*/
}

// This creates a DataContext providing additional information for the license
// UI The "Register*" actions show the registration dialog and expect to find
Expand All @@ -174,24 +177,20 @@ private static void showRegisterDialog(final String productCode,
// pre-selected in the opened dialog
// - message: optional message explaining the reason why the dialog has been
// shown
/*@NotNull
@NotNull
private static DataContext asDataContext(final String productCode,
@Nullable String message) {
return dataId -> {
switch (dataId) {
// the same code as registered in plugin.xml, 'product-descriptor' tag
case "register.product-descriptor.code":
return productCode;
// optional message to be shown in the registration dialog that appears
case "register.message":
return message;
return switch (dataId) {
// the same code as registered in plugin.xml, 'product-descriptor' tag
case "register.product-descriptor.code" -> productCode;

default:
return null;
}
// optional message to be shown in the registration dialog that appears
case "register.message" -> message;
default -> null;
};
};
}*/
}

private static boolean isEvaluationValid(String expirationTime) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package co.anbora.labs.jmeter.ide.listeners

import co.anbora.labs.jmeter.ide.checker.CheckerFlavor
import co.anbora.labs.jmeter.ide.editor.gui.JMeterFileEditor
import co.anbora.labs.jmeter.ide.license.CheckLicense
import co.anbora.labs.jmeter.ide.notifications.JMeterNotifications
import co.anbora.labs.jmeter.ide.utils.toPath
import com.intellij.openapi.fileEditor.FileEditorManagerEvent
Expand All @@ -13,6 +14,7 @@ class JMeterSelectionListener: FileEditorManagerListener {
val editor = event.newEditor
if (editor is JMeterFileEditor) {
if (!CheckerFlavor.isSupported()) {
CheckLicense.requestLicense("Support plugin")
JMeterNotifications.supportNotification(editor.getProject())
}
val fileName = event.newFile?.path?.toPath()?.toFile()?.name.orEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class JMeterDownloadToolchainDialog(
.withTitle("Select Directory")
.withPathToTextConvertor(::getPresentablePath)
.withTextToPathConvertor(::getCanonicalPath)
textFieldWithBrowseButton("JMeter Directory", project, fileChooserDescriptor)
textFieldWithBrowseButton(fileChooserDescriptor, project)
.align(AlignX.FILL)
.bindText(model::location)
.trimmedTextValidation(CHECK_NON_EMPTY, CHECK_DIRECTORY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ class JMeterNewToolchainDialog(private val toolchainFilter: Condition<Path>, pro

val version = JMeterConfigurationUtil.guessToolchainVersion(model.toolchainLocation)
if (version == JMeterConfigurationUtil.UNDEFINED_VERSION) {
if (model.toolchainLocation.contains("homebrew")) {
return error("JMeter location is invalid, for homebrew installation please select libexec folder")
}
return error("JMeter location is invalid, can't get version. Please check that bin folder contains ${JMeterConfigurationUtil.STANDARD_JMETER_CONFIG}")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package co.anbora.labs.jmeter.ide.startup

import co.anbora.labs.jmeter.ide.actions.SetupFilesAction
import co.anbora.labs.jmeter.ide.checker.CheckerFlavor
import co.anbora.labs.jmeter.ide.license.CheckLicense
import co.anbora.labs.jmeter.ide.notifications.JMeterNotifications
import co.anbora.labs.jmeter.ide.toolchain.JMeterToolchainService.Companion.toolchainSettings
import co.anbora.labs.jmeter.loader.JMeterLoader
Expand Down
Loading

0 comments on commit 9cd6e6e

Please sign in to comment.