|
|
@ -25,6 +25,8 @@ 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.plugin.xml.PluginXmlElement; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.JOptionPane; |
|
|
|
import javax.swing.JOptionPane; |
|
|
@ -91,16 +93,38 @@ public class PluginOperateUtils { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void setPluginActive(String pluginInfo, JSCallback jsCallback) { |
|
|
|
public static void setPluginActive(String pluginInfo, JSCallback jsCallback) { |
|
|
|
|
|
|
|
SwingUtilities.invokeLater(new Runnable() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void run() { |
|
|
|
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); |
|
|
|
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); |
|
|
|
PluginContext plugin = PluginManager.getContext(pluginMarker); |
|
|
|
PluginContext plugin = PluginManager.getContext(pluginMarker); |
|
|
|
boolean active = plugin.isActive(); |
|
|
|
boolean active = plugin.isActive(); |
|
|
|
PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); |
|
|
|
PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(active, jsCallback); |
|
|
|
if (active) { |
|
|
|
if (active) { |
|
|
|
|
|
|
|
PluginXmlElement forbidReminder = plugin.getXml().getElement(PluginElementName.ForbidReminder); |
|
|
|
|
|
|
|
if (forbidReminder != null && forbidReminder.getContent() != null) { |
|
|
|
|
|
|
|
// 禁用前提示
|
|
|
|
|
|
|
|
int rv = FineJOptionPane.showConfirmDialog( |
|
|
|
|
|
|
|
null, |
|
|
|
|
|
|
|
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().forbid(pluginMarker, modifyStatusCallback); |
|
|
|
PluginManager.getController().forbid(pluginMarker, modifyStatusCallback); |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
PluginManager.getController().enable(pluginMarker, modifyStatusCallback); |
|
|
|
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) { |
|
|
|
|
|
|
|
|
|
|
|