19 package org.sleuthkit.autopsy.casemodule;
21 import java.util.Collection;
22 import java.util.Iterator;
23 import java.util.logging.Level;
24 import org.netbeans.spi.sendopts.OptionProcessor;
25 import org.openide.util.Lookup;
47 if (instance == null) {
49 if (instance == null) {
60 if (startupWindowToUse == null) {
64 logger.log(Level.INFO,
"Running from command line");
72 Collection<? extends StartupWindowInterface> startupWindows
75 int windowsCount = startupWindows.size();
76 if (windowsCount == 1) {
77 startupWindowToUse = startupWindows.iterator().next();
78 logger.log(Level.INFO,
"Will use the default startup window: " + startupWindowToUse.toString());
79 }
else if (windowsCount == 2) {
81 Iterator<? extends StartupWindowInterface> it = startupWindows.iterator();
82 while (it.hasNext()) {
85 startupWindowToUse = window;
86 logger.log(Level.INFO,
"Will use the custom startup window: " + startupWindowToUse.toString());
92 Iterator<? extends StartupWindowInterface> it = startupWindows.iterator();
93 while (it.hasNext()) {
95 if (!window.getClass().getCanonicalName().startsWith(
"org.sleuthkit.autopsy")) {
96 startupWindowToUse = window;
97 logger.log(Level.INFO,
"Will use the custom startup window: " + startupWindowToUse.toString());
103 if (startupWindowToUse == null) {
104 logger.log(Level.SEVERE,
"Unexpected error, no startup window chosen, using the default");
121 Collection<? extends OptionProcessor> optionProcessors = Lookup.getDefault().lookupAll(OptionProcessor.class);
122 Iterator<? extends OptionProcessor> optionsIterator = optionProcessors.iterator();
123 while (optionsIterator.hasNext()) {
125 OptionProcessor processor = optionsIterator.next();
128 return ((CommandLineOptionProcessor) processor).isRunFromCommandLine();
136 if (startupWindowToUse != null) {
137 startupWindowToUse.
open();
143 if (startupWindowToUse != null) {
144 startupWindowToUse.
close();
StartupWindowInterface getStartupWindow()
static volatile StartupWindowProvider instance
boolean isRunningFromCommandLine()
volatile StartupWindowInterface startupWindowToUse
synchronized static Logger getLogger(String name)
static StartupWindowProvider getInstance()
static final Logger logger