From: David ‘Bombe’ Roden Date: Thu, 17 Jun 2010 17:53:37 +0000 (+0200) Subject: Expose whether the insert is currently running. X-Git-Tag: 0.9.2~4 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=b4dc22f0312554d7724d1b7ebb2599afe8e798ac;p=jSite.git Expose whether the insert is currently running. --- diff --git a/src/de/todesbaum/jsite/gui/ProjectInsertPage.java b/src/de/todesbaum/jsite/gui/ProjectInsertPage.java index e43510d..86305aa 100644 --- a/src/de/todesbaum/jsite/gui/ProjectInsertPage.java +++ b/src/de/todesbaum/jsite/gui/ProjectInsertPage.java @@ -91,6 +91,9 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener, Cl /** Whether the “copy URI to clipboard” button was used. */ private boolean uriCopied; + /** Whether the insert is currently running. */ + private volatile boolean running = false; + /** * Creates a new progress insert wizard page. * @@ -211,6 +214,7 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener, Cl * Starts the insert. */ public void startInsert() { + running = true; wizard.setNextEnabled(false); copyURIAction.setEnabled(false); progressBar.setValue(0); @@ -220,6 +224,26 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener, Cl } /** + * Stops the currently running insert. + */ + public void stopInsert() { + if (running) { + wizard.setNextEnabled(false); + projectInserter.stop(); + } + } + + /** + * Returns whether the insert is currently running. + * + * @return {@code true} if the insert is currently running, {@code false} + * otherwise + */ + public boolean isRunning() { + return running; + } + + /** * Sets the project to insert. * * @param project @@ -356,6 +380,7 @@ public class ProjectInsertPage extends TWizardPage implements InsertListener, Cl * {@inheritDoc} */ public void projectInsertFinished(Project project, boolean success, Throwable cause) { + running = false; if (success) { String copyURILabel = I18n.getMessage("jsite.insert.okay-copy-uri"); int selectedValue = JOptionPane.showOptionDialog(this, I18n.getMessage("jsite.insert.inserted"), I18n.getMessage("jsite.insert.done.title"), 0, JOptionPane.INFORMATION_MESSAGE, null, new Object[] { I18n.getMessage("jsite.general.ok"), copyURILabel }, copyURILabel);