essential-actions

Clone or download

[Run Command Action] Updated to work with new Action API, Cleanup

Modified Files

--- 'a/runcommandaction/.gitignore'
+++ b/runcommandaction/.gitignore
@@ -1,6 +1,6 @@
.idea/
target/
-WebsiteAction.iml
+*.iml
.classpath
.factorypath
.project
--- 'a/runcommandaction/pom.xml'
+++ b/runcommandaction/pom.xml
@@ -6,7 +6,7 @@
<groupId>com.stream-pi</groupId>
<artifactId>runcommandaction</artifactId>
- <version>1.1.0</version>
+ <version>1.1.1</version>
<build>
<plugins>
@@ -43,9 +43,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
-
- <IkonliVersion>11.5.0</IkonliVersion>
- <IkonliFA5PackVersion>11.5.0</IkonliFA5PackVersion>
</properties>
<dependencies>
@@ -60,17 +57,5 @@
<artifactId>action-api</artifactId>
<version>${ActionAPIVersion}</version>
</dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-fontawesome5-pack</artifactId>
- <version>${IkonliFA5PackVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.kordamp.ikonli</groupId>
- <artifactId>ikonli-javafx</artifactId>
- <version>${IkonliVersion}</version>
- </dependency>
</dependencies>
</project>
\ No newline at end of file
--- 'a/runcommandaction/src/main/java/com/stream_pi/runcommandaction/RunCommandAction.java'
+++ b/runcommandaction/src/main/java/com/stream_pi/runcommandaction/RunCommandAction.java
@@ -3,10 +3,13 @@ package com.stream_pi.runcommandaction;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
+import java.io.IOException;
-public class RunCommandAction extends NormalAction {
+public class RunCommandAction extends NormalAction
+{
public RunCommandAction()
{
@@ -19,7 +22,8 @@ public class RunCommandAction extends No
}
@Override
- public void initProperties() throws Exception {
+ public void initProperties()
+ {
Property commandProperty = new Property("command", Type.STRING);
commandProperty.setDisplayName("Command");
@@ -27,24 +31,22 @@ public class RunCommandAction extends No
}
@Override
- public void initAction() throws Exception {
-
-
- }
-
- @Override
- public void onActionClicked() throws Exception
+ public void onActionClicked() throws MinorException
{
- runCommand(getClientProperties().getSingleProperty("command").getStringValue());
- }
-
- @Override
- public void onShutDown() throws Exception {
- // TODO Auto-generated method stub
+ String command = getClientProperties().getSingleProperty("command").getStringValue();
+ try
+ {
+ runCommand(command);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ throw new MinorException("Unable to run command \n\n"+command+"\n\n.Reason:\n"+e.getMessage());
+ }
}
- private void runCommand(String command) throws Exception
+ private void runCommand(String command) throws IOException
{
Runtime rt = Runtime.getRuntime();
rt.exec(command);
--- 'a/runcommandaction/src/main/java/module-info.java'
+++ b/runcommandaction/src/main/java/module-info.java
@@ -1,4 +1,3 @@
-
module com.stream_pi.runcommandaction
{
requires com.stream_pi.action_api;
@@ -8,5 +7,4 @@ module com.stream_pi.runcommandaction
requires org.kordamp.ikonli.fontawesome5;
provides com.stream_pi.action_api.externalplugin.ExternalPlugin with com.stream_pi.runcommandaction.RunCommandAction;
-
}
\ No newline at end of file