|
|
@ -25,6 +25,7 @@ import com.fr.plugin.manage.control.PluginTask; |
|
|
|
import com.fr.plugin.manage.control.PluginTaskCallback; |
|
|
|
import com.fr.plugin.manage.control.PluginTaskCallback; |
|
|
|
import com.fr.plugin.manage.control.PluginTaskResult; |
|
|
|
import com.fr.plugin.manage.control.PluginTaskResult; |
|
|
|
import com.fr.plugin.view.PluginView; |
|
|
|
import com.fr.plugin.view.PluginView; |
|
|
|
|
|
|
|
import com.fr.plugin.xml.PluginElementName; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
import javax.swing.JOptionPane; |
|
|
@ -91,15 +92,31 @@ public class PluginOperateUtils { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void setPluginActive(String pluginInfo, JSCallback jsCallback) { |
|
|
|
public static void setPluginActive(String pluginInfo, JSCallback jsCallback) { |
|
|
|
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); |
|
|
|
SwingUtilities.invokeLater(new Runnable() { |
|
|
|
PluginContext plugin = PluginManager.getContext(pluginMarker); |
|
|
|
|
|
|
|
boolean active = plugin.isActive(); |
|
|
|
@Override |
|
|
|
PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); |
|
|
|
public void run() { |
|
|
|
if (active) { |
|
|
|
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); |
|
|
|
PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); |
|
|
|
PluginContext plugin = PluginManager.getContext(pluginMarker); |
|
|
|
} else { |
|
|
|
boolean active = plugin.isActive(); |
|
|
|
PluginManager.getController().enable(pluginMarker, modifyStatusCallback); |
|
|
|
PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); |
|
|
|
} |
|
|
|
if (active) { |
|
|
|
|
|
|
|
// 禁用前提示
|
|
|
|
|
|
|
|
int rv = FineJOptionPane.showConfirmDialog( |
|
|
|
|
|
|
|
null, |
|
|
|
|
|
|
|
plugin.getXml().getElement(PluginElementName.ForbidReminder).getContent(), |
|
|
|
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), |
|
|
|
|
|
|
|
JOptionPane.OK_CANCEL_OPTION, |
|
|
|
|
|
|
|
JOptionPane.WARNING_MESSAGE |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (rv == JOptionPane.OK_OPTION) { |
|
|
|
|
|
|
|
PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
PluginManager.getController().enable(pluginMarker, modifyStatusCallback); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) { |
|
|
|
public static void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSCallback jsCallback) { |
|
|
|