The current way of handling actions works great for small plugins, however, for larger ones, it gets a bit messy.
Add the possibility for Actions and Connectors to be classes that extend something from the SDK.
Basically an abstract class such as:
abstract class TPInvokable<T extends TouchPortalPlugin> {
protected final T touchPortalPlugin;
public TPInvokable(T touchPortalPlugin) {
this.touchPortalPlugin = touchPortalPlugin;
}
public abstract void onInvoke();
public abstract void onListChanged(TPListChangeMessage tpListChangeMessage);
}
TPAction would extend it as is
TPConnector would extend it and also add the necessary implementation to handle the ConnectorValue
Developers would then have to register those to the TouchPortalPlugin before connecting
// Plugin class
public class MyTPPlugin extends TouchPortalPlugin {}
// TPAction class
@Action(name = "Action One", categoryId = "BaseCategory")
public class ActionOne extends TPAction<MyTPPlugin> {
@Data
private String param1;
public ActionOne(MyTPPlugin myTPPlugin) {
super(myTPPlugin);
}
@Override
public void onListChanged(TPListChangeMessage tpListChangeMessage) {
// Update Specific Choices
}
@Override
public void onInvoke() {
// Do stuff
}
}
// Later when the plugin starts
MyTPPlugin myTPPlugin = new MyTPPlugin();
myTPPlugin.register(ActionOne.class);
myTPPlugin.connectThenPairAndListen(myTPPlugin);
The current way of handling actions works great for small plugins, however, for larger ones, it gets a bit messy.
Add the possibility for Actions and Connectors to be classes that extend something from the SDK.
Basically an abstract class such as:
TPAction
would extend it as isTPConnector
would extend it and also add the necessary implementation to handle the ConnectorValueDevelopers would then have to register those to the
TouchPortalPlugin
before connecting