3287 Fixed wait cursors with use of getGlassPane()

This commit is contained in:
William Schaefer 2017-12-08 16:25:28 -05:00
parent 42817363aa
commit c0861d24d9
2 changed files with 16 additions and 5 deletions

View File

@ -29,6 +29,7 @@ import java.util.logging.Level;
import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.RootPaneContainer;
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@ -56,13 +57,15 @@ import org.sleuthkit.datamodel.Image;
*/
@ActionID(category = "Tools", id = "org.sleuthkit.autopsy.casemodule.AddImageAction")
@ActionRegistration(displayName = "#CTL_AddImage", lazy = false)
@ActionReferences(value = {@ActionReference(path = "Toolbars/Case", position = 100)})
@ActionReferences(value = {
@ActionReference(path = "Toolbars/Case", position = 100)})
@ServiceProvider(service = AddImageAction.class)
public final class AddImageAction extends CallableSystemAction implements Presenter.Toolbar {
private static final long serialVersionUID = 1L;
private static final Dimension SIZE = new Dimension(875, 550);
private final ChangeSupport cleanupSupport = new ChangeSupport(this);
// private final static MouseAdapter mouseDisabler = new MouseAdapter() {};
// Keys into the WizardDescriptor properties that pass information between stages of the wizard
// <TYPE>: <DESCRIPTION>
@ -116,6 +119,9 @@ public final class AddImageAction extends CallableSystemAction implements Presen
String optionsDlgTitle = NbBundle.getMessage(this.getClass(), "AddImageAction.ingestConfig.ongoingIngest.title");
String optionsDlgMessage = NbBundle.getMessage(this.getClass(), "AddImageAction.ingestConfig.ongoingIngest.msg");
if (IngestRunningCheck.checkAndConfirmProceed(optionsDlgTitle, optionsDlgMessage)) {
RootPaneContainer root = (RootPaneContainer) WindowManager.getDefault().getMainWindow();
root.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
root.getGlassPane().setVisible(true);
WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
iterator = new AddImageWizardIterator(this);
wizardDescriptor = new WizardDescriptor(iterator);
@ -129,7 +135,8 @@ public final class AddImageAction extends CallableSystemAction implements Presen
dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
Dimension d = dialog.getSize();
dialog.setSize(SIZE);
WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
root.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
root.getGlassPane().setVisible(false);
dialog.setVisible(true);
dialog.toFront();

View File

@ -26,6 +26,7 @@ import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JOptionPane;
import javax.swing.RootPaneContainer;
import org.openide.DialogDisplayer;
import org.openide.WizardDescriptor;
import org.openide.util.NbBundle.Messages;
@ -50,6 +51,7 @@ public final class RunIngestModulesAction extends AbstractAction {
* used instead of this wizard and is retained for backwards compatibility.
*/
private static final String EXECUTION_CONTEXT = "org.sleuthkit.autopsy.ingest.RunIngestModulesDialog";
/**
* Display any warnings that the ingestJobSettings have.
*
@ -104,12 +106,15 @@ public final class RunIngestModulesAction extends AbstractAction {
* argument in the title format string will be supplied by
* WizardDescriptor.Panel.getComponent().getName().
*/
WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
RootPaneContainer root = (RootPaneContainer) WindowManager.getDefault().getMainWindow();
root.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
root.getGlassPane().setVisible(true);
RunIngestModulesWizardIterator wizard = new RunIngestModulesWizardIterator(EXECUTION_CONTEXT, this.ingestType, this.dataSources);
WizardDescriptor wiz = new WizardDescriptor(wizard);
wiz.setTitleFormat(new MessageFormat("{0}"));
wiz.setTitle(Bundle.RunIngestModulesAction_name());
WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
root.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
root.getGlassPane().setVisible(false);
if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
IngestJobSettings ingestJobSettings = wizard.getIngestJobSettings();
showWarnings(ingestJobSettings);
@ -117,7 +122,6 @@ public final class RunIngestModulesAction extends AbstractAction {
}
}
@Override
public Object clone() throws CloneNotSupportedException {
throw new CloneNotSupportedException("Clone is not supported for the RunIngestModulesAction");