Search in sources :

Example 1 with ProgressUtilities

use of org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities in project freeplane by freeplane.

the class ChangeExternalImageAction method setEnabled.

@Override
public void setEnabled() {
    boolean enable = false;
    final ProgressUtilities progUtil = new ProgressUtilities();
    final Collection<NodeModel> nodes = Controller.getCurrentModeController().getMapController().getSelectedNodes();
    for (final NodeModel node : nodes) {
        if (node != null && progUtil.hasExternalResource(node) && !progUtil.hasExtendedProgressIcon(node)) {
            enable = true;
            break;
        }
    }
    setEnabled(enable);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) ProgressUtilities(org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities)

Example 2 with ProgressUtilities

use of org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities in project freeplane by freeplane.

the class AddExternalImageAction method setEnabled.

@Override
public void setEnabled() {
    boolean enable = false;
    final ProgressUtilities progUtil = new ProgressUtilities();
    final Collection<NodeModel> nodes = Controller.getCurrentModeController().getMapController().getSelectedNodes();
    for (final NodeModel node : nodes) {
        if (node != null && !progUtil.hasExternalResource(node)) {
            enable = true;
            break;
        }
    }
    setEnabled(enable);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) ProgressUtilities(org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities)

Example 3 with ProgressUtilities

use of org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities in project freeplane by freeplane.

the class ExternalImagePopupMenu method getChange.

/**
 * @return Returns the change menu item.
 */
private JMenuItem getChange() {
    final ProgressUtilities progUtil = new ProgressUtilities();
    if (change == null) {
        change = new JMenuItem(TextUtils.getText("ExternalImage_popupMenu_Change"));
        change.addActionListener(new ActionListener() {

            public void actionPerformed(final ActionEvent e) {
                final ExternalResource extRes = (ExternalResource) viewer.createExtension(node);
                if (extRes != null) {
                    URI uri = extRes.getAbsoluteUri(node.getMap());
                    if (progUtil.hasExternalResource(node) && !progUtil.hasExtendedProgressIcon(node)) {
                        viewer.undoableDeactivateHook(node);
                        viewer.paste(uri, node, node.isLeft());
                    }
                }
            }
        });
    }
    return change;
}
Also used : ActionListener(java.awt.event.ActionListener) ProgressUtilities(org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities) ActionEvent(java.awt.event.ActionEvent) JMenuItem(javax.swing.JMenuItem) URI(java.net.URI)

Example 4 with ProgressUtilities

use of org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities in project freeplane by freeplane.

the class ChangeExternalImageAction method actionPerformed.

public void actionPerformed(final ActionEvent arg0) {
    final ProgressUtilities progUtil = new ProgressUtilities();
    final MapController mapController = Controller.getCurrentModeController().getMapController();
    final Collection<NodeModel> nodes = mapController.getSelectedNodes();
    final ViewerController vc = (Controller.getCurrentController().getModeController().getExtension(ViewerController.class));
    final ExternalResource extRes = (ExternalResource) vc.createExtension(mapController.getSelectedNode());
    if (extRes != null) {
        URI uri = extRes.getAbsoluteUri(mapController.getSelectedNode().getMap());
        for (final NodeModel node : nodes) {
            if (progUtil.hasExternalResource(node) && !progUtil.hasExtendedProgressIcon(node)) {
                vc.undoableDeactivateHook(node);
                vc.paste(uri, node, node.isLeft());
            }
        }
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) ProgressUtilities(org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities) URI(java.net.URI) MapController(org.freeplane.features.map.MapController)

Example 5 with ProgressUtilities

use of org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities in project freeplane by freeplane.

the class RemoveExternalImageAction method setEnabled.

@Override
public void setEnabled() {
    boolean enable = false;
    final ProgressUtilities progUtil = new ProgressUtilities();
    final Collection<NodeModel> nodes = Controller.getCurrentModeController().getMapController().getSelectedNodes();
    for (final NodeModel node : nodes) {
        if (node != null && progUtil.hasExternalResource(node) && !progUtil.hasExtendedProgressIcon(node)) {
            enable = true;
            break;
        }
    }
    setEnabled(enable);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) ProgressUtilities(org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities)

Aggregations

ProgressUtilities (org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities)9 NodeModel (org.freeplane.features.map.NodeModel)5 URI (java.net.URI)3 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 JMenuItem (javax.swing.JMenuItem)2 MapController (org.freeplane.features.map.MapController)2 Collection (java.util.Collection)1 INodeView (org.freeplane.features.map.INodeView)1 NodeView (org.freeplane.view.swing.map.NodeView)1