forked from fanruan/design
Browse Source
* commit '18840749a43c5bca2a9e3c2ffc01f0e09affeef5': REPORT-2354 将平台的插件管理和设计器的插件管理统一起来master
17 changed files with 310 additions and 24 deletions
@ -0,0 +1,38 @@
|
||||
package com.fr.design.extra.exe.callback; |
||||
|
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.context.PluginMarker; |
||||
import com.fr.plugin.manage.control.PluginTaskResult; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/6/21. |
||||
*/ |
||||
public class InstallDependenceCallback extends AbstractPluginTaskCallback { |
||||
protected JSCallback jsCallback; |
||||
private static int HUNDRED_PERCENT = 100; |
||||
|
||||
public InstallDependenceCallback(PluginMarker pluginMarker, JSCallback jsCallback){ |
||||
this.pluginMarker = pluginMarker; |
||||
this.jsCallback = jsCallback; |
||||
} |
||||
|
||||
@Override |
||||
public void updateProgress(String description, double aProgress) { |
||||
jsCallback.execute(String.valueOf(aProgress * HUNDRED_PERCENT + "%")); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void done(PluginTaskResult result) { |
||||
if (result.isSuccess()) { |
||||
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin-Install_Dependence_Success")); |
||||
}else { |
||||
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin-Install_Dependence_Failed")); |
||||
JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); |
||||
} |
||||
} |
||||
} |
||||
|
@ -0,0 +1,39 @@
|
||||
package com.fr.design.extra.exe.callback; |
||||
|
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
import com.fr.plugin.context.PluginMarker; |
||||
import com.fr.plugin.manage.control.PluginTaskResult; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/6/21. |
||||
*/ |
||||
public class UpdateDependenceCallback extends AbstractPluginTaskCallback { |
||||
public PluginMarker toPluginMarker; |
||||
protected JSCallback jsCallback; |
||||
private static int HUNDRED_PERCENT = 100; |
||||
|
||||
public UpdateDependenceCallback(PluginMarker pluginMarker, PluginMarker toPluginMarker, JSCallback jsCallback){ |
||||
this.pluginMarker = pluginMarker; |
||||
this.toPluginMarker = toPluginMarker; |
||||
this.jsCallback = jsCallback; |
||||
} |
||||
|
||||
@Override |
||||
public void updateProgress(String description, double aProgress) { |
||||
jsCallback.execute(String.valueOf(aProgress * HUNDRED_PERCENT + "%")); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void done(PluginTaskResult result) { |
||||
if (result.isSuccess()) { |
||||
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin-Update_Dependence_Success")); |
||||
}else { |
||||
FRLogger.getLogger().info(Inter.getLocText("FR-Designer-Plugin-Update_Dependence_Failed")); |
||||
JOptionPane.showMessageDialog(null, result.getMessage(), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fr.design.extra.exe.extratask; |
||||
|
||||
import com.fr.design.extra.exe.callback.InstallDependenceCallback; |
||||
import com.fr.design.extra.exe.callback.JSCallback; |
||||
import com.fr.plugin.context.PluginMarker; |
||||
import com.fr.plugin.manage.PluginManager; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/6/21. |
||||
*/ |
||||
public class InstallDependenceTask extends AbstractExtraPluginTask { |
||||
protected JSCallback jsCallback; |
||||
|
||||
|
||||
public InstallDependenceTask(PluginMarker pluginMarker, JSCallback jsCallback) { |
||||
this.pluginMarker = pluginMarker; |
||||
this.jsCallback = jsCallback; |
||||
} |
||||
|
||||
@Override |
||||
public void doExtraPluginTask() { |
||||
PluginManager.getController().install(pluginMarker, new InstallDependenceCallback(pluginMarker, jsCallback)); |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.fr.design.extra.exe.extratask; |
||||
|
||||
import com.fr.design.extra.exe.callback.JSCallback; |
||||
import com.fr.design.extra.exe.callback.UpdateDependenceCallback; |
||||
import com.fr.plugin.context.PluginMarker; |
||||
import com.fr.plugin.manage.PluginManager; |
||||
|
||||
/** |
||||
* Created by ibm on 2017/6/21. |
||||
*/ |
||||
public class UpdateDependenceTask extends AbstractExtraPluginTask { |
||||
|
||||
public PluginMarker toPluginMarker; |
||||
protected JSCallback jsCallback; |
||||
|
||||
public UpdateDependenceTask(PluginMarker pluginMarker, PluginMarker toPluginMarker, JSCallback jsCallback) { |
||||
this.pluginMarker = pluginMarker; |
||||
this.toPluginMarker = toPluginMarker; |
||||
this.jsCallback = jsCallback; |
||||
} |
||||
|
||||
@Override |
||||
public void doExtraPluginTask() { |
||||
PluginManager.getController().update(pluginMarker, toPluginMarker, new UpdateDependenceCallback(pluginMarker, toPluginMarker, jsCallback)); |
||||
} |
||||
} |
Loading…
Reference in new issue