Package net.sf.jabref.net

Examples of net.sf.jabref.net.URLDownload


        File temp = null;
        try {
            temp = File.createTempFile("jabref-link", "."+fileType.getExtension());
            temp.deleteOnExit();
            System.out.println("Downloading to '"+temp.getPath()+"'");
            URLDownload ud = new URLDownload(null, new URL(link), temp);
            ud.download();
            System.out.println("Done");
        } catch (MalformedURLException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
View Full Code Here


    tmpfile.deleteOnExit();

    // System.out.println("Import url: " + dropLink.toString());
    // System.out.println("Temp file: "+tmpfile.getAbsolutePath());

    new URLDownload(entryTable, dropLink, tmpfile).download();

    // Import into new if entryTable==null, otherwise into current database:
    ImportMenuItem importer = new ImportMenuItem(frame, (entryTable == null));
    importer.automatedImport(new String[] { tmpfile.getAbsolutePath() });
View Full Code Here

     *                 is complete.
     */
    public void download(URL url, final DownloadCallback callback) throws IOException {

        String res = url.toString();
        URLDownload udl = null;

        // First of all, start the download itself in the background to a temporary file:
        final File tmp = File.createTempFile("jabref_download", "tmp");
        tmp.deleteOnExit();
        //long time = System.currentTimeMillis();
        try {
            udl = new URLDownload(frame, url, tmp);
            // TODO: what if this takes long time?
            // TODO: stop editor dialog if this results in an error:
            udl.openConnectionOnly(); // Read MIME type
        } catch (IOException ex) {
            JOptionPane.showMessageDialog(frame, Globals.lang("Invalid URL")+": "
                    + ex.getMessage(), Globals.lang("Download file"),
                    JOptionPane.ERROR_MESSAGE);
            Globals.logger("Error while downloading " + "'" + res + "'");
            return;
        }
        final URL urlF = url;
        final URLDownload udlF = udl;
        //System.out.println("Time: "+(System.currentTimeMillis()-time));
        (new Thread() {
            public void run() {

                try {
                    udlF.download();
                } catch (IOException e2) {
                    dontShowDialog = true;
                    if ((editor != null) && (editor.isVisible()))
                        editor.setVisible(false, false);
                    JOptionPane.showMessageDialog(frame, Globals.lang("Invalid URL")+": "
View Full Code Here

TOP

Related Classes of net.sf.jabref.net.URLDownload

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.