Search in sources :

Example 6 with AddOnProperties

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);
            }
        }
    };
}
Also used : ActionEvent(java.awt.event.ActionEvent) AbstractAction(javax.swing.AbstractAction) AddOnProperties(org.freeplane.main.addons.AddOnProperties)

Example 7 with AddOnProperties

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);
            }
        }
    };
}
Also used : ActionEvent(java.awt.event.ActionEvent) AbstractAction(javax.swing.AbstractAction) AddOnProperties(org.freeplane.main.addons.AddOnProperties)

Example 8 with AddOnProperties

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);
            }
        }
    };
}
Also used : OptionPanelBuilder(org.freeplane.core.resources.components.OptionPanelBuilder) ActionEvent(java.awt.event.ActionEvent) StringReader(java.io.StringReader) AbstractAction(javax.swing.AbstractAction) AddOnProperties(org.freeplane.main.addons.AddOnProperties)

Example 9 with AddOnProperties

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);
            }
        }
    };
}
Also used : ActionEvent(java.awt.event.ActionEvent) AbstractAction(javax.swing.AbstractAction) AddOnProperties(org.freeplane.main.addons.AddOnProperties)

Aggregations

AddOnProperties (org.freeplane.main.addons.AddOnProperties)9 ActionEvent (java.awt.event.ActionEvent)5 AbstractAction (javax.swing.AbstractAction)4 URL (java.net.URL)2 JButton (javax.swing.JButton)2 FreeplaneVersion (org.freeplane.core.util.FreeplaneVersion)2 Component (java.awt.Component)1 Font (java.awt.Font)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 ActionListener (java.awt.event.ActionListener)1 File (java.io.File)1 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1 MalformedURLException (java.net.MalformedURLException)1 URISyntaxException (java.net.URISyntaxException)1 Box (javax.swing.Box)1 JCheckBox (javax.swing.JCheckBox)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1