X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Ftodesbaum%2Fjsite%2Fgui%2FFileScanner.java;h=9135073858141e6b300cd15f44587bec927e8a0f;hb=9eafefbca8ddf6c20500a78789a474000cdfe457;hp=cfb0c238a286685fe9106caec9bbd22432dc2f0d;hpb=967018cd81182ec2fd4f941e271137aadbaa6d81;p=jSite.git diff --git a/src/main/java/de/todesbaum/jsite/gui/FileScanner.java b/src/main/java/de/todesbaum/jsite/gui/FileScanner.java index cfb0c23..9135073 100644 --- a/src/main/java/de/todesbaum/jsite/gui/FileScanner.java +++ b/src/main/java/de/todesbaum/jsite/gui/FileScanner.java @@ -1,5 +1,5 @@ /* - * jSite - FileScanner.java - Copyright © 2006–2012 David Roden + * jSite - FileScanner.java - Copyright © 2006–2014 David Roden * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,6 +63,9 @@ public class FileScanner implements Runnable { /** Wether there was an error. */ private boolean error = false; + /** The name of the last file scanned. */ + private String lastFilename; + /** * Creates a new file scanner for the given project. * @@ -103,6 +106,20 @@ public class FileScanner implements Runnable { } /** + * Returns the name of the last file scanned. + * + * @return The name of the last file scanned, or {@code null} if there was + * no file scanned yet + */ + public String getLastFilename() { + return lastFilename; + } + + public void startInBackground() { + new Thread(this).start(); + } + + /** * {@inheritDoc} *

* Scans all available files in the project’s local path and emits an event @@ -114,6 +131,7 @@ public class FileScanner implements Runnable { public void run() { files = new ArrayList(); error = false; + lastFilename = null; try { scanFiles(new File(project.getLocalPath()), files); Collections.sort(files); @@ -172,6 +190,7 @@ public class FileScanner implements Runnable { String filename = project.shortenFilename(file).replace('\\', '/'); String hash = hashFile(project.getLocalPath(), filename); fileList.add(new ScannedFile(filename, hash)); + lastFilename = filename; } }