X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Fjsite%2Fgui%2FProjectInsertPage.java;h=86305aa0604339ca59b8b9f7fed9e22c5f186b5a;hb=b4dc22f0312554d7724d1b7ebb2599afe8e798ac;hp=e43510d3f9db95797419057307409c7d6765e4f0;hpb=ed54585ba9537da09379df378e51216e9ae528c1;p=jSite.git 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);