essential-actions

Clone or download

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

Modified Files

.idea/
.idea/
target/
target/
WebsiteAction.iml
*.iml
.classpath
.classpath
.factorypath
.factorypath
.project
.project
.settings/
.settings/
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>runcommandaction</artifactId>
<artifactId>runcommandaction</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
<build>
<build>
<plugins>
<plugins>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<version>3.1.0</version>
<executions>
<executions>
<execution>
<execution>
<id>test-jar</id>
<id>test-jar</id>
<phase>package</phase>
<phase>package</phase>
<goals>
<goals>
<goal>test-jar</goal>
<goal>test-jar</goal>
</goals>
</goals>
</execution>
</execution>
</executions>
</executions>
</plugin>
</plugin>
<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.8.1</version>
<configuration>
<configuration>
<release>11</release>
<release>11</release>
</configuration>
</configuration>
</plugin>
</plugin>
</plugins>
</plugins>
</build>
</build>
<properties>
<properties>
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
<UtilVersion>1.0.0-SNAPSHOT</UtilVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.target>11</maven.compiler.target>
<IkonliVersion>11.5.0</IkonliVersion>
<IkonliFA5PackVersion>11.5.0</IkonliFA5PackVersion>
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>util</artifactId>
<artifactId>util</artifactId>
<version>${UtilVersion}</version>
<version>${UtilVersion}</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>com.stream-pi</groupId>
<groupId>com.stream-pi</groupId>
<artifactId>action-api</artifactId>
<artifactId>action-api</artifactId>
<version>${ActionAPIVersion}</version>
<version>${ActionAPIVersion}</version>
</dependency>
</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>
</dependencies>
</project>
</project>
package com.stream_pi.runcommandaction;
package com.stream_pi.runcommandaction;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.action_api.externalplugin.NormalAction;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import com.stream_pi.util.version.Version;
import java.io.IOException;
public class RunCommandAction extends NormalAction {
public class RunCommandAction extends NormalAction
{
public RunCommandAction()
public RunCommandAction()
{
{
setName("Run Command");
setName("Run Command");
setCategory("Essentials");
setCategory("Essentials");
setAuthor("rnayabed");
setAuthor("rnayabed");
setServerButtonGraphic("fas-terminal");
setServerButtonGraphic("fas-terminal");
setHelpLink("https://github.com/stream-pi/essentialactions/blob/master/runcommandaction/README.md");
setHelpLink("https://github.com/stream-pi/essentialactions/blob/master/runcommandaction/README.md");
setVersion(new Version(1,1,1));
setVersion(new Version(1,1,1));
}
}
@Override
@Override
public void initProperties() throws Exception {
public void initProperties()
{
Property commandProperty = new Property("command", Type.STRING);
Property commandProperty = new Property("command", Type.STRING);
commandProperty.setDisplayName("Command");
commandProperty.setDisplayName("Command");
addClientProperties(commandProperty);
addClientProperties(commandProperty);
}
}
@Override
@Override
public void initAction() throws Exception {
public void onActionClicked() throws MinorException
}
@Override
public void onActionClicked() throws Exception
{
{
runCommand(getClientProperties().getSingleProperty("command").getStringValue());
String command = getClientProperties().getSingleProperty("command").getStringValue();
}
try
@Override
{
public void onShutDown() throws Exception {
runCommand(command);
// TODO Auto-generated method stub
}
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();
Runtime rt = Runtime.getRuntime();
rt.exec(command);
rt.exec(command);
}
}
}
}
module com.stream_pi.runcommandaction
module com.stream_pi.runcommandaction
{
{
requires com.stream_pi.action_api;
requires com.stream_pi.action_api;
requires com.stream_pi.util;
requires com.stream_pi.util;
requires org.kordamp.ikonli.javafx;
requires org.kordamp.ikonli.javafx;
requires org.kordamp.ikonli.fontawesome5;
requires org.kordamp.ikonli.fontawesome5;
provides com.stream_pi.action_api.externalplugin.ExternalPlugin with com.stream_pi.runcommandaction.RunCommandAction;
provides com.stream_pi.action_api.externalplugin.ExternalPlugin with com.stream_pi.runcommandaction.RunCommandAction;
}
}