Skip to content

Commit

Permalink
plugin information change
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadsebak committed Dec 22, 2015
1 parent 4c5cd29 commit 6d511bd
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
3 changes: 0 additions & 3 deletions META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
<li>
Fixed SSH commands not properly executing on embedded device.
</li>
<li>
Fixed exit state of running and debugging sessions.
</li>
</ul>
<b>Version 1.01</b>
<ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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<RunContentDescriptor> descriptors = executionManager.getContentManager().getAllDescriptors();
for (RunContentDescriptor descriptor : descriptors) {
if (descriptor.getProcessHandler() != null) {
descriptor.getProcessHandler().destroyProcess();
final RunManagerImpl runManager = (RunManagerImpl) RunManager.getInstance(project);
final Collection<RunnerAndConfigurationSettings> allConfigurations = runManager.getSortedConfigurations();
List<RunContentDescriptor> 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) {

}
}
}

}

}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 6d511bd

Please sign in to comment.