Added logic to remove existing dashboard instance.

This commit is contained in:
U-BASIS\dgrove 2018-03-13 17:56:59 -04:00
parent 7ae70957be
commit 42e264ea68

View File

@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2011-2017 Basis Technology Corp.
* Copyright 2011-2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@ -55,16 +55,22 @@ public final class AutoIngestDashboardTopComponent extends TopComponent {
topComponentInitialized = true;
WindowManager.getDefault().isTopComponentFloating(tc);
Mode mode = WindowManager.getDefault().findMode("dashboard"); // NON-NLS
try {
if (tc.isOpened() == false) {
if (mode != null) {
mode.dockInto(tc);
}
/*
* Make sure we have a clean-slate before attaching a new
* dashboard instance so we don't accumulate them.
*/
tc.removeAll();
AutoIngestDashboard dashboard;
try {
dashboard = AutoIngestDashboard.createDashboard();
AutoIngestDashboard dashboard = AutoIngestDashboard.createDashboard();
tc.add(dashboard);
dashboard.setSize(dashboard.getPreferredSize());
if (tc.isOpened() == false) {
tc.open();
}
tc.toFront();