/** * Constructs a new source location that will retrieve source * elements from the zip file with the given name. * * @param archiveName zip file * @param sourceRoot a path to the root source folder in the * specified archive, or <code>null</code> if the root source folder * is the root of the archive */ public ArchiveSourceLocation(String archiveName, String sourceRoot) { super(); setName(archiveName); setRootPath(sourceRoot); }
/** * Constructs a new source location that will retrieve source * elements from the zip file with the given name. * * @param archiveName zip file * @param sourceRoot a path to the root source folder in the * specified archive, or <code>null</code> if the root source folder * is the root of the archive */ public ArchiveSourceLocation(String archiveName, String sourceRoot) { super(); setName(archiveName); setRootPath(sourceRoot); }
@Override public void initializeFrom(String memento) throws CoreException { Exception ex = null; try { Element root = null; DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); StringReader reader = new StringReader(memento); InputSource source = new InputSource(reader); root = parser.parse(source).getDocumentElement(); String path = root.getAttribute("archivePath"); //$NON-NLS-1$ if (isEmpty(path)) { abort(LaunchingMessages.ArchiveSourceLocation_Unable_to_initialize_source_location___missing_archive_path__3, null); } String rootPath = root.getAttribute("rootPath"); //$NON-NLS-1$ setName(path); setRootPath(rootPath); return; } catch (ParserConfigurationException e) { ex = e; } catch (SAXException e) { ex = e; } catch (IOException e) { ex = e; } abort(LaunchingMessages.ArchiveSourceLocation_Exception_occurred_initializing_source_location__5, ex); }
@Override public void initializeFrom(String memento) throws CoreException { Exception ex = null; try { Element root = null; DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); parser.setErrorHandler(new DefaultHandler()); StringReader reader = new StringReader(memento); InputSource source = new InputSource(reader); root = parser.parse(source).getDocumentElement(); String path = root.getAttribute("archivePath"); //$NON-NLS-1$ if (isEmpty(path)) { abort(LaunchingMessages.ArchiveSourceLocation_Unable_to_initialize_source_location___missing_archive_path__3, null); } String rootPath = root.getAttribute("rootPath"); //$NON-NLS-1$ setName(path); setRootPath(rootPath); return; } catch (ParserConfigurationException e) { ex = e; } catch (SAXException e) { ex = e; } catch (IOException e) { ex = e; } abort(LaunchingMessages.ArchiveSourceLocation_Exception_occurred_initializing_source_location__5, ex); }
if (rootLength > 0) { String root = entryName.substring(0, rootLength); setRootPath(root);
if (rootLength > 0) { String root = entryName.substring(0, rootLength); setRootPath(root);