Merge remote-tracking branch 'upstream' into develop

This commit is contained in:
Mark McKinnon 2025-01-17 10:10:13 -05:00
commit 2c9285541e
6 changed files with 71 additions and 33 deletions

View File

@ -26,6 +26,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.awt.Cursor;
import org.sleuthkit.autopsy.casemodule.multiusercases.CaseNodeData;
import java.awt.Frame;
import java.awt.GraphicsEnvironment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeListener;
@ -207,10 +208,12 @@ public class Case {
* changing the main window title.
*/
static {
if (!GraphicsEnvironment.isHeadless()) {
WindowManager.getDefault().invokeWhenUIReady(() -> {
mainFrame = WindowManager.getDefault().getMainWindow();
});
}
}
/**
* An enumeration of case types.

View File

@ -406,7 +406,11 @@ public class Installer extends ModuleInstall {
ensurePythonModulesFolderExists();
ensureClassifierFolderExists();
ensureOcrLanguagePacksFolderExists();
if (!GraphicsEnvironment.isHeadless()) {
initJavaFx();
}
initializeSevenZip();
for (ModuleInstall mi : packageInstallers) {
try {
@ -544,7 +548,10 @@ public class Installer extends ModuleInstall {
@Override
public boolean closing() {
if (IngestRunningCheck.checkAndConfirmProceed(Bundle.Installer_closing_confirmationDialog_title(), Bundle.Installer_closing_confirmationDialog_message())) {
if (!GraphicsEnvironment.isHeadless() && RuntimeProperties.runningWithGUI()) {
WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
}
FutureTask<Void> future = new FutureTask<>(new Callable<Void>() {
@Override
public Void call() throws Exception {
@ -562,8 +569,10 @@ public class Installer extends ModuleInstall {
logger.log(Level.SEVERE, "Error closing the current case", ex);
MessageNotifyUtil.Message.error(Bundle.Installer_closing_messageBox_caseCloseExceptionMessage(ex.getMessage()));
} finally {
if (!GraphicsEnvironment.isHeadless() && RuntimeProperties.runningWithGUI()) {
WindowManager.getDefault().getMainWindow().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
}
return true;
} else {
return false;

View File

@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.corecomponents;
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.awt.Insets;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@ -39,10 +40,10 @@ import javax.swing.plaf.FontUIResource;
import org.netbeans.spi.sendopts.OptionProcessor;
import org.netbeans.swing.tabcontrol.plaf.DefaultTabbedContainerUI;
import org.openide.modules.ModuleInstall;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.StartupWindowProvider;
import org.sleuthkit.autopsy.commandlineingest.CommandLineIngestManager;
import org.sleuthkit.autopsy.commandlineingest.CommandLineOptionProcessor;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
@ -80,12 +81,15 @@ public class Installer extends ModuleInstall {
}
if (!GraphicsEnvironment.isHeadless()) {
SwingUtilities.invokeLater(() -> {
setLookAndFeel();
});
UIManager.put("ViewTabDisplayerUI", "org.sleuthkit.autopsy.corecomponents.NoTabsTabDisplayerUI");
UIManager.put(DefaultTabbedContainerUI.KEY_VIEW_CONTENT_BORDER, BorderFactory.createEmptyBorder());
UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0));
}
final CommandLineOptionProcessor finalprocessor = processor;
@ -100,6 +104,20 @@ public class Installer extends ModuleInstall {
// Why not just listen to the command processor instead of using the invokeWhen?
// If there were no command line options supplied then the process method will never
// be called.
if (GraphicsEnvironment.isHeadless()) {
if (finalprocessor.getState() == CommandLineOptionProcessor.ProcessState.COMPLETED) {
new CommandLineIngestManager().start();
} else {
finalprocessor.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals(CommandLineOptionProcessor.PROCESSING_COMPLETED)) {
new CommandLineIngestManager().start();
}
}
});
}
} else {
WindowManager.getDefault().invokeWhenUIReady(() -> {
if(WindowManager.getDefault().getMainWindow().isVisible() || finalprocessor == null || finalprocessor.getState() == CommandLineOptionProcessor.ProcessState.COMPLETED) {
StartupWindowProvider.getInstance().open();
@ -115,6 +133,7 @@ public class Installer extends ModuleInstall {
}
});
}
}
@Override
public void uninstalled() {

View File

@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.ingest;
import com.google.common.eventbus.Subscribe;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.awt.EventQueue;
import java.awt.GraphicsEnvironment;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
@ -574,6 +575,7 @@ public class IngestManager implements IngestProgressSnapshotProvider {
// initialize IngestMessageInbox, if it hasn't been initialized yet. This can't be done in
// the constructor because that ends up freezing the UI on startup (JIRA-7345).
if (!GraphicsEnvironment.isHeadless()) {
if (SwingUtilities.isEventDispatchThread()) {
initIngestMessageInbox();
} else {
@ -585,6 +587,7 @@ public class IngestManager implements IngestProgressSnapshotProvider {
logger.log(Level.WARNING, "There was an error starting ingest message inbox", ex);
}
}
}
List<IngestModuleError> errors = null;
Case openCase;

View File

@ -18,6 +18,7 @@
*/
package org.sleuthkit.autopsy.ingest;
import java.awt.GraphicsEnvironment;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@ -68,7 +69,9 @@ public class Installer extends ModuleInstall {
@Override
public boolean closing() {
//force ingest inbox closed on exit and save state as such
if (!GraphicsEnvironment.isHeadless()) {
IngestMessageTopComponent.findInstance().close();
}
return true;
}

View File

@ -39,7 +39,8 @@
</target>
<target name="autoAIPath" description="Attempt to find the AI path based on standard installation location">
<property name="AI.path" value="C:\Program Files (x86)\Caphyon\Advanced Installer 10.3\bin\x86\AdvancedInstaller.com" />
<!-- latest taken from https://www.advancedinstaller.com/download.html -->
<property name="AI.path" value="C:\Program Files (x86)\Caphyon\Advanced Installer 22.3\bin\x86\AdvancedInstaller.com" />
<available file="${AI.path}"
property="ai-exe-path"
value="${AI.path}"/>