Skip to content

Latest commit

 

History

History
80 lines (45 loc) · 3.88 KB

jar_guide.md

File metadata and controls

80 lines (45 loc) · 3.88 KB

Jar Plugin Guide

In this tutorial, you'll learn how to write a jar plugin on JVM, we'll use both Java and Kotlin to program this demo plugin. And we'll discuss more advanced features, so you can choose some you needed parts to read, other parts can be read at any time later.

We strongly recommend programing in kotlin.

Creating Project

First step, we need to use intellij idea to create a java project named java-demo-plugin using gradle as the build tool, and choosing kotlin as the gradle dsl.

settings.gradle.kts content as follows:

settings.gradle.kts

build.gradle.kts content as follows:

build.gradle.kts

Refer our kotlin gradle template.

Creating Plugin Specification File

Create plugin-spec.yml in project directory, writing content as follows:

id: runflow.java
name: Java Plugin
entry: ./java-demo-plugin.jar
customize-loader: default
version: 1.0.0
compatible-version:
  since-build: 961
  until-build: 961

Adding MainTest Class For Developing And Testing

Create a MainTest.java file locate in src/test/java, the codes like following:

MainTest.java

Run MainTest, you'll see the action window, here is no any plugins, even no builtin plugin, it's simple and base implemented only, just for plugin developing and testing.

This sample full codes.

Writing Functions

  • Cycle Listener interprets how to listen plugin loading state.

  • Action interprets how to write a general action, and an action of customized ui.

  • Placeholder interprets how to update our placeholder.

  • Theme interprets how to update our theme.

  • Action Callback Extension interprets how to extend action callbacks.

  • Storing Data interprets how to store data by using our builtin database, and some requirements.

  • Data Encryptor interprets how to provide data encryptors for data sync service.

  • Data Sync Service interprets how to provide data sync methods for user.

  • Translator interprets how to provide language translator for user to translate bundled language resources.

  • Action Focused Mode interprets how to write an action that supports focused mode.

  • Toolbar interprets how to write a toolbar.

  • Func Page interprets how to write a func page with gui.

  • Action Window interprets how to replace our action window.

  • Http Service interprets how to use our builtin http service to expose endpoint.

  • Bundle Language interprets how to bundle language resource to java bean.

  • Localization Matcher interprets how to help us get more user-friendly results when looking for keywords.

  • Utilities interprets all the useful classes, methods and fields.