|
|
|
@ -60,11 +60,14 @@ public class PluginInstalledPane extends PluginAbstractViewPane {
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
PluginView plugin = controlPane.getSelectedPlugin(); |
|
|
|
|
if (plugin != null) { |
|
|
|
|
boolean isActive = plugin.isActive(); |
|
|
|
|
PluginMarker pluginMarker = PluginMarker.create(plugin.getID(), plugin.getVersion()); |
|
|
|
|
final String modifyMessage = isActive ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Actived") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled"); |
|
|
|
|
if (isActive) { |
|
|
|
|
PluginManager.getController().forbid(pluginMarker, new PluginTaskCallback() { |
|
|
|
|
PluginContext pluginContext = getPluginContextByView(plugin); |
|
|
|
|
if (pluginContext == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
boolean running = pluginContext.isRunning(); |
|
|
|
|
final String modifyMessage = running ? com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Actived") : com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled"); |
|
|
|
|
if (running) { |
|
|
|
|
PluginManager.getController().forbidPersistently(pluginContext.getMarker(), new PluginTaskCallback() { |
|
|
|
|
@Override |
|
|
|
|
public void done(PluginTaskResult result) { |
|
|
|
|
if (result.isSuccess()) { |
|
|
|
@ -75,7 +78,7 @@ public class PluginInstalledPane extends PluginAbstractViewPane {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
PluginManager.getController().enable(pluginMarker, new PluginTaskCallback() { |
|
|
|
|
PluginManager.getController().enablePersistently(pluginContext.getMarker(), new PluginTaskCallback() { |
|
|
|
|
@Override |
|
|
|
|
public void done(PluginTaskResult result) { |
|
|
|
|
if (result.isSuccess()) { |
|
|
|
@ -145,13 +148,25 @@ public class PluginInstalledPane extends PluginAbstractViewPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void changeTextForButton(PluginView plugin) { |
|
|
|
|
if (plugin.isActive()) { |
|
|
|
|
PluginContext pluginContext = getPluginContextByView(plugin); |
|
|
|
|
if (pluginContext == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (pluginContext.isRunning()) { |
|
|
|
|
disableButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Disable")); |
|
|
|
|
} else { |
|
|
|
|
disableButton.setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Active")); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private PluginContext getPluginContextByView(PluginView pluginView) { |
|
|
|
|
if (pluginView != null) { |
|
|
|
|
PluginMarker pluginMarker = PluginMarker.create(pluginView.getID(), pluginView.getVersion()); |
|
|
|
|
return PluginManager.getContext(pluginMarker); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected String title4PopupWindow() { |
|
|
|
|
return "Installed"; |
|
|
|
|