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");
65 System.out.println(
"Running from command line");
73 Collection<? extends StartupWindowInterface> startupWindows
76 int windowsCount = startupWindows.size();
77 if (windowsCount == 1) {
78 startupWindowToUse = startupWindows.iterator().next();
79 logger.log(Level.INFO,
"Will use the default startup window: " + startupWindowToUse.toString());
80 }
else if (windowsCount == 2) {
82 Iterator<? extends StartupWindowInterface> it = startupWindows.iterator();
83 while (it.hasNext()) {
86 startupWindowToUse = window;
87 logger.log(Level.INFO,
"Will use the custom startup window: " + startupWindowToUse.toString());
93 Iterator<? extends StartupWindowInterface> it = startupWindows.iterator();
94 while (it.hasNext()) {
96 if (!window.getClass().getCanonicalName().startsWith(
"org.sleuthkit.autopsy")) {
97 startupWindowToUse = window;
98 logger.log(Level.INFO,
"Will use the custom startup window: " + startupWindowToUse.toString());
104 if (startupWindowToUse == null) {
105 logger.log(Level.SEVERE,
"Unexpected error, no startup window chosen, using the default");
122 Collection<? extends OptionProcessor> optionProcessors = Lookup.getDefault().lookupAll(OptionProcessor.class);
123 Iterator<? extends OptionProcessor> optionsIterator = optionProcessors.iterator();
124 while (optionsIterator.hasNext()) {
126 OptionProcessor processor = optionsIterator.next();
129 return ((CommandLineOptionProcessor) processor).isRunFromCommandLine();
137 if (startupWindowToUse != null) {
138 startupWindowToUse.
open();
144 if (startupWindowToUse != null) {
145 startupWindowToUse.
close();
static volatile StartupWindowProvider instance
boolean isRunningFromCommandLine()
volatile StartupWindowInterface startupWindowToUse
synchronized static Logger getLogger(String name)
static StartupWindowProvider getInstance()
static final Logger logger