public void actionPerformed(ActionEvent event) { NodeModel selected = Controller.getCurrentController().getSelection().getSelected(); if (selected == null) { return; } else { URI uri = URIUtils.getAbsoluteURI(selected); try { ReadOnlyExceptionWarningHandler warningHandler = new ReadOnlyExceptionWarningHandler(); warningHandler.prepare(); while (warningHandler.retry()) { try { PdfAnnotationImporter importer = new PdfAnnotationImporter(); List<AnnotationModel> annotations = importer.importAnnotations(uri); MonitoringUtils.insertChildNodesFrom(annotations, selected.isLeft(), selected); warningHandler.consume(); } catch (DocumentReadOnlyException e) { if (warningHandler.skip()) { break; } warningHandler.showDialog(URIUtils.getFile(uri)); } } } catch (IOException e) { LogUtils.severe( "ImportAllAnnotationsAction IOException at URI(" + uri + "): ", e); //$NON-NLS-1$ //$NON-NLS-2$ } catch (COSRuntimeException e) { LogUtils.severe( "ImportAllAnnotationsAction COSRuntimeException at URI(" + uri + "): ", e); //$NON-NLS-1$ //$NON-NLS-2$ } } }
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 = ((ViewerController) Controller.getCurrentController() .getModeController() .getExtension(ViewerController.class)); final NodeModel selectedNode = mapController.getSelectedNode(); final ExternalResource extRes = (ExternalResource) vc.createExtension(selectedNode); if (extRes != null) { final File file = new File(extRes.getAbsoluteUri(selectedNode.getMap())); for (final NodeModel node : nodes) { if (!progUtil.hasExternalResource(node)) { vc.paste(file, node, node.isLeft()); } } } }