diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml
index ab0844d..12d50ac 100644
--- a/META-INF/plugin.xml
+++ b/META-INF/plugin.xml
@@ -20,9 +20,6 @@
Fixed SSH commands not properly executing on embedded device.
-
- Fixed exit state of running and debugging sessions.
-
Version 1.01
diff --git a/src/com/atsebak/embeddedlinuxjvm/commandline/JavaStatusChecker.java b/src/com/atsebak/embeddedlinuxjvm/commandline/JavaStatusChecker.java
index f9c98b1..41e3fd6 100644
--- a/src/com/atsebak/embeddedlinuxjvm/commandline/JavaStatusChecker.java
+++ b/src/com/atsebak/embeddedlinuxjvm/commandline/JavaStatusChecker.java
@@ -1,13 +1,18 @@
package com.atsebak.embeddedlinuxjvm.commandline;
+import com.atsebak.embeddedlinuxjvm.runner.conf.EmbeddedLinuxJVMConfigurationType;
import com.atsebak.embeddedlinuxjvm.runner.data.EmbeddedLinuxJVMRunConfigurationRunnerParameters;
import com.intellij.execution.ExecutionManager;
+import com.intellij.execution.RunManager;
+import com.intellij.execution.RunnerAndConfigurationSettings;
+import com.intellij.execution.impl.RunManagerImpl;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.openapi.project.Project;
import com.jcraft.jsch.ChannelExec;
import lombok.SneakyThrows;
+import java.util.Collection;
import java.util.List;
public class JavaStatusChecker extends Thread {
@@ -28,19 +33,30 @@ public void run() {
while (!channelExec.isClosed()) { //runs until java app closes from target device
Thread.sleep(1000);
}
- // todo programmatically end session based on weather debugging or running.
- stopApplication();
channelExec.disconnect();
channelExec.getSession().disconnect();
+ //stopApplication(); //todo fix this stops debugger and runner states
}
private void stopApplication() {
- ExecutionManager executionManager = ExecutionManager.getInstance(project);
- List descriptors = executionManager.getContentManager().getAllDescriptors();
- for (RunContentDescriptor descriptor : descriptors) {
- if (descriptor.getProcessHandler() != null) {
- descriptor.getProcessHandler().destroyProcess();
+ final RunManagerImpl runManager = (RunManagerImpl) RunManager.getInstance(project);
+ final Collection allConfigurations = runManager.getSortedConfigurations();
+ List allDescriptors = ExecutionManager.getInstance(project).getContentManager().getAllDescriptors();
+
+ for (RunnerAndConfigurationSettings runConfiguration : allConfigurations) {
+ if (runConfiguration.getConfiguration().getFactory().getType() instanceof EmbeddedLinuxJVMConfigurationType) {
+ for (RunContentDescriptor descriptor : allDescriptors) {
+ if (runConfiguration.getName().equals(descriptor.getDisplayName())) {
+ try {
+ descriptor.getProcessHandler().destroyProcess();
+ } catch (Exception e) {
+
+ }
+ }
+ }
+
}
+
}
}
diff --git a/src/com/atsebak/embeddedlinuxjvm/localization/EmbeddedLinuxJVMBundle.properties b/src/com/atsebak/embeddedlinuxjvm/localization/EmbeddedLinuxJVMBundle.properties
index c29ec4e..6cc84ee 100644
--- a/src/com/atsebak/embeddedlinuxjvm/localization/EmbeddedLinuxJVMBundle.properties
+++ b/src/com/atsebak/embeddedlinuxjvm/localization/EmbeddedLinuxJVMBundle.properties
@@ -1,7 +1,7 @@
pi.invalid.hostname=Invalid Hostname Entered
pi.invalid.port=Invalid Port number entered.
pi.invalid.username=Invalid username
-pi.app.description=Run as a raspberry pi Java application
+pi.app.description=Run as an Embedded Java application
pi.password=Password
pi.username=Username
pi.sudo=Run as sudo