// ------------------------------------------------------------------------ // Operation(s) // ------------------------------------------------------------------------ @Override public void run(IProgressMonitor monitor) { try { monitor.worked(1); String root = null; List<TracePackageElement> resultElementList = new ArrayList<>(); SubMonitor subMonitor = SubMonitor.convert(monitor, fProfile.getChildren().length * 2); List<RemoteImportConnectionNodeElement> connectionNodes = fProfile.getConnectionNodeElements(); for (RemoteImportConnectionNodeElement connectionNode : connectionNodes) { RemoteSystemProxy proxy = connectionNode.getRemoteSystemProxy(); // create new element to decouple from input element RemoteImportConnectionNodeElement outputConnectionNode = new RemoteImportConnectionNodeElement( null, connectionNode.getName(), connectionNode.getURI()); resultElementList.add(outputConnectionNode); for (TracePackageElement element : connectionNode.getChildren()) { if (element instanceof RemoteImportTraceGroupElement) { ModalContext.checkCanceled(monitor); RemoteImportTraceGroupElement traceGroup = (RemoteImportTraceGroupElement) element; root = traceGroup.getRootImportPath(); TracePackageElement[] traceElements = traceGroup.getChildren(); fTemplatePatternsToTraceElements = generatePatterns(traceElements); IRemoteFileService fs = proxy.getRemoteConnection().getService(IRemoteFileService.class); if (fs == null) { continue; } final IFileStore remoteFolder = fs.getResource(root); // make sure that remote directory is read and not cached int recursionLevel = 0; // create new element to decouple from input element RemoteImportTraceGroupElement outputTraceGroup = new RemoteImportTraceGroupElement( outputConnectionNode, traceGroup.getRootImportPath()); outputTraceGroup.setRecursive(traceGroup.isRecursive()); generateElementsFromArchive( outputTraceGroup, outputTraceGroup, remoteFolder, recursionLevel, subMonitor.newChild(1)); filterElements(outputTraceGroup); } } } setResultElements(resultElementList.toArray(new TracePackageElement[0])); setStatus(Status.OK_STATUS); } catch (InterruptedException e) { setStatus(Status.CANCEL_STATUS); } catch (Exception e) { setStatus( new Status( IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind( RemoteMessages.RemoteGenerateManifest_GenerateProfileManifestError, fProfile.getText()), e)); } }
/** * Constructs a new import operation for generating the manifest * * @param profile the input profile element */ public RemoteGenerateManifestOperation(RemoteImportProfileElement profile) { super(profile.getText()); fProfile = profile; }