use of org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities in project freeplane by freeplane.
the class RemoveExternalImageAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent arg0, final NodeModel node) {
final ProgressUtilities progUtil = new ProgressUtilities();
final ViewerController vc = ((ViewerController) Controller.getCurrentController().getModeController().getExtension(ViewerController.class));
if (progUtil.hasExternalResource(node) && !progUtil.hasExtendedProgressIcon(node)) {
vc.undoableDeactivateHook(node);
}
}
use of org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities in project freeplane by freeplane.
the class AddExternalImageAction method actionPerformed.
public void actionPerformed(final ActionEvent event) {
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 NodeModel selectedNode = mapController.getSelectedNode();
if (selectedNode == null)
return;
final ExternalResource extRes = (ExternalResource) vc.createExtension(selectedNode);
if (extRes == null)
return;
URI absoluteUri = extRes.getAbsoluteUri(selectedNode.getMap());
if (absoluteUri == null)
return;
for (final NodeModel node : nodes) {
if (!progUtil.hasExternalResource(node)) {
vc.paste(absoluteUri, node, node.isLeft());
}
}
}
use of org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities in project freeplane by freeplane.
the class ExternalImagePopupMenu method getRemove.
/**
* @return Returns the delete menu item.
*/
private JMenuItem getRemove() {
final ProgressUtilities progUtil = new ProgressUtilities();
if (remove == null) {
remove = new JMenuItem(TextUtils.getText("ExternalImage_popupMenu_Remove"));
remove.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
final ExternalResource extRes = node.getExtension(ExternalResource.class);
if (progUtil.hasExternalResource(node) && !progUtil.hasExtendedProgressIcon(node)) {
viewer.remove(node, extRes);
NodeView nv = null;
final Collection<INodeView> invs = Controller.getCurrentController().getModeController().getMapController().getSelectedNode().getViewers();
for (final INodeView inv : invs) {
if (inv instanceof NodeView) {
nv = (NodeView) inv;
break;
}
}
viewer.deleteViewer(extRes, nv);
viewer.undoableDeactivateHook(node);
Controller.getCurrentModeController().getMapController().nodeChanged(node, NodeModel.UNKNOWN_PROPERTY, null, null);
}
}
});
}
return remove;
}
use of org.freeplane.view.swing.features.progress.mindmapmode.ProgressUtilities in project freeplane by freeplane.
the class ExternalImagePopupMenu method make.
/**
* Builds the menu.
*/
private void make() {
final ProgressUtilities progUtil = new ProgressUtilities();
if (progUtil.hasExtendedProgressIcon(node)) {
removeAll();
add(getOpen());
add(getResetZoom());
} else {
removeAll();
add(getRemove());
add(getChange());
add(getOpen());
add(getResetZoom());
}
}
Aggregations