public AddExternalImageAction() {
super("ExternalImageAddAction");
}
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());
}
}
}