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