Browse Source

动态获取插件分类api

master
vito 9 years ago
parent
commit
3d73fade2d
  1. 10
      designer_base/src/com/fr/design/extra/PluginWebBridge.java
  2. 35
      designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java

10
designer_base/src/com/fr/design/extra/PluginWebBridge.java

@ -243,6 +243,16 @@ public class PluginWebBridge {
new Thread(task).start(); new Thread(task).start();
} }
/**
* 在线获取插件分类
*
* @param callback 回调函数
*/
public void getPluginCategories(final JSObject callback) {
Task<Void> task = new PluginTask<>(webEngine, callback, new GetPluginCategoriesExecutor());
new Thread(task).start();
}
/** /**
* 展示一个重启的对话框(少用,莫名其妙会有bug) * 展示一个重启的对话框(少用,莫名其妙会有bug)
* *

35
designer_base/src/com/fr/design/extra/exe/GetPluginCategoriesExecutor.java

@ -0,0 +1,35 @@
package com.fr.design.extra.exe;
import com.fr.design.extra.Process;
import com.fr.general.SiteCenter;
import com.fr.general.http.HttpClient;
/**
* Created by vito on 16/5/16.
*/
public class GetPluginCategoriesExecutor implements Executor {
private String result = "[]";
@Override
public String getTaskFinishMessage() {
return result;
}
@Override
public Command[] getCommands() {
return new Command[]{
new Command() {
@Override
public String getExecuteMessage() {
return null;
}
@Override
public void run(Process<String> process) {
HttpClient httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind("plugin.category"));
result = httpClient.getResponseText();
}
}
};
}
}
Loading…
Cancel
Save