use of org.freeplane.main.addons.AddOnProperties in project freeplane by freeplane.
the class ManageAddOnsPanel method createActivateAction.
private AbstractAction createActivateAction(final AddOnTableModel tableModel) {
return new AbstractAction() {
public void actionPerformed(ActionEvent e) {
final int row = Integer.parseInt(e.getActionCommand());
final AddOnProperties addOn = tableModel.getAddOnAt(row);
if (!addOn.supportsOperation(AddOnProperties.OP_ACTIVATE)) {
JOptionPane.showMessageDialog(ManageAddOnsPanel.this, getText("cannot.activate", addOn.getTranslatedName()), "Freeplane", JOptionPane.ERROR_MESSAGE);
} else {
addOn.setActive(true);
saveAddOn(addOn);
JOptionPane.showMessageDialog(ManageAddOnsPanel.this, getText("activation.success", addOn.getTranslatedName()), "Freeplane", JOptionPane.INFORMATION_MESSAGE);
}
}
};
}
use of org.freeplane.main.addons.AddOnProperties in project freeplane by freeplane.
the class ManageAddOnsPanel method createDeactivateAction.
private AbstractAction createDeactivateAction(final AddOnTableModel tableModel) {
return new AbstractAction() {
public void actionPerformed(ActionEvent e) {
final int row = Integer.parseInt(e.getActionCommand());
final AddOnProperties addOn = tableModel.getAddOnAt(row);
if (!addOn.supportsOperation(AddOnProperties.OP_DEACTIVATE)) {
JOptionPane.showMessageDialog(ManageAddOnsPanel.this, getText("cannot.deactivate", addOn.getTranslatedName()), "Freeplane", JOptionPane.ERROR_MESSAGE);
} else {
addOn.setActive(false);
saveAddOn(addOn);
JOptionPane.showMessageDialog(ManageAddOnsPanel.this, getText("deactivation.success", addOn.getTranslatedName()), "Freeplane", JOptionPane.INFORMATION_MESSAGE);
}
}
};
}
use of org.freeplane.main.addons.AddOnProperties in project freeplane by freeplane.
the class ManageAddOnsPanel method createConfigureAction.
private AbstractAction createConfigureAction(final AddOnTableModel tableModel) {
return new AbstractAction() {
public void actionPerformed(ActionEvent e) {
final int row = Integer.parseInt(e.getActionCommand());
final AddOnProperties addOn = tableModel.getAddOnAt(row);
if (!addOn.supportsOperation(AddOnProperties.OP_CONFIGURE)) {
JOptionPane.showMessageDialog(ManageAddOnsPanel.this, getText("cannot.configure", addOn.getTranslatedName()), "Freeplane", JOptionPane.ERROR_MESSAGE);
} else {
OptionPanelBuilder optionPanelBuilder = new OptionPanelBuilder();
optionPanelBuilder.load(new StringReader(addOn.getPreferencesXml()));
MModeController.createShowPreferencesAction(optionPanelBuilder).actionPerformed(e);
}
}
};
}
use of org.freeplane.main.addons.AddOnProperties in project freeplane by freeplane.
the class ManageAddOnsPanel method createDeinstallAction.
private AbstractAction createDeinstallAction(final AddOnTableModel tableModel) {
return new AbstractAction() {
public void actionPerformed(ActionEvent e) {
final int row = Integer.parseInt(e.getActionCommand());
final AddOnProperties addOn = tableModel.getAddOnAt(row);
if (!addOn.supportsOperation(AddOnProperties.OP_DEINSTALL)) {
UITools.errorMessage(getText("cannot.deinstall", addOn.getTranslatedName()));
} else {
int result = JOptionPane.showConfirmDialog(ManageAddOnsPanel.this, getText("really.deinstall", TextUtils.getText(addOn.getNameKey())), getText("deinstall"), JOptionPane.OK_CANCEL_OPTION);
if (result == JOptionPane.OK_OPTION) {
deinstall(tableModel, addOn);
repaint();
UITools.informationMessage(getText("deinstallation.success", addOn.getTranslatedName()));
}
}
}
private void deinstall(final AddOnTableModel tableModel, final AddOnProperties addOn) {
try {
AddOnsController.getController().deinstall(addOn);
tableModel.removeAddOn(addOn);
} finally {
Controller.getCurrentController().getViewController().setWaitingCursor(false);
}
}
};
}
Aggregations