public ComponentRegistry() {
MutablePicoContainer container = new DefaultPicoContainer();
this.container = container;
ComponentParameter anyComponentParameter = new ComponentParameter();
// non-GUI
Config globalConfig = Config.getConfig();
container.registerComponentInstance(globalConfig);
container.registerComponentInstance(globalConfig.getPreferences());
container.registerComponentInstance(globalConfig.forScanner());
container.registerComponentInstance(globalConfig.forGUI());
container.registerComponentInstance(globalConfig.forOpeners());
container.registerComponentInstance(globalConfig.forFavorites());
container.registerComponentInstance(Labels.getInstance());
container.registerComponentImplementation(CommentsConfig.class);
container.registerComponentImplementation(ConfigDetector.class);
container.registerComponentImplementation(ExporterRegistry.class);
container.registerComponentImplementation(TXTExporter.class);
container.registerComponentImplementation(CSVExporter.class);
container.registerComponentImplementation(XMLExporter.class);
container.registerComponentImplementation(IPListExporter.class);
container.registerComponentImplementation(FetcherRegistry.class, FetcherRegistry.class);
container.registerComponentImplementation(IPFetcher.class);
container.registerComponentImplementation(PingFetcher.class);
container.registerComponentImplementation(PingTTLFetcher.class);
container.registerComponentImplementation(HostnameFetcher.class);
container.registerComponentImplementation(PortsFetcher.class);
container.registerComponentImplementation(FilteredPortsFetcher.class);
container.registerComponentImplementation(WebDetectFetcher.class);
container.registerComponentImplementation(HTTPSenderFetcher.class);
container.registerComponentImplementation(CommentFetcher.class);
container.registerComponentImplementation(NetBIOSInfoFetcher.class);
if (Platform.WINDOWS) container.registerComponentImplementation(WinMACFetcher.class);
else container.registerComponentImplementation(UnixMACFetcher.class);
container.registerComponentImplementation(MACVendorFetcher.class);
container.registerComponentImplementation(PingerRegistry.class, PingerRegistry.class);
container.registerComponentImplementation(ScanningResultList.class);
container.registerComponentImplementation(Scanner.class);
container.registerComponentImplementation(SWTAwareStateMachine.class);
container.registerComponentImplementation(ScannerDispatcherThreadFactory.class);
container.registerComponentImplementation(CommandLineProcessor.class);
// GUI follows (TODO: move GUI to a separate place)
// Some "shared" GUI components
container.registerComponentInstance(Display.getDefault());
container.registerComponentImplementation("mainShell", Shell.class);
container.registerComponentImplementation("mainMenu", Menu.class, new Parameter[] {
new ComponentParameter("mainShell"), new ConstantParameter(SWT.BAR) });
container.registerComponentImplementation("commandsMenu", CommandsMenu.class);
container.registerComponentImplementation("feederArea", Composite.class, new Parameter[] {
new ComponentParameter("mainShell"), new ConstantParameter(SWT.NONE) });
container.registerComponentImplementation("controlsArea", Composite.class, new Parameter[] {
new ComponentParameter("mainShell"), new ConstantParameter(SWT.NONE) });
container.registerComponentImplementation("startStopButton", Button.class, new Parameter[] {
new ComponentParameter("controlsArea"), new ConstantParameter(SWT.NONE) });
container.registerComponentImplementation("feederSelectionCombo", Combo.class,
new Parameter[] { new ComponentParameter("controlsArea"), new ConstantParameter(SWT.READ_ONLY) });
// GUI Feeders
container.registerComponentImplementation(FeederGUIRegistry.class);
Parameter[] feederGUIParameters = new Parameter[] { new ComponentParameter("feederArea") };
container.registerComponentImplementation(RangeFeederGUI.class, RangeFeederGUI.class, feederGUIParameters);
container.registerComponentImplementation(RandomFeederGUI.class, RandomFeederGUI.class, feederGUIParameters);
container.registerComponentImplementation(FileFeederGUI.class, FileFeederGUI.class, feederGUIParameters);
container.registerComponentImplementation(OpenerLauncher.class);
container.registerComponentImplementation(MainWindow.class, MainWindow.class, new Parameter[] {
new ComponentParameter("mainShell"), anyComponentParameter, new ComponentParameter("feederArea"),
new ComponentParameter("controlsArea"), new ComponentParameter("feederSelectionCombo"),
new ComponentParameter("startStopButton"), anyComponentParameter, anyComponentParameter,
anyComponentParameter, anyComponentParameter, anyComponentParameter, anyComponentParameter,
anyComponentParameter, anyComponentParameter });
container.registerComponentImplementation(ResultTable.class, ResultTable.class, new Parameter[] {
new ComponentParameter("mainShell"), anyComponentParameter, anyComponentParameter,
anyComponentParameter, anyComponentParameter, anyComponentParameter, anyComponentParameter });
container.registerComponentImplementation(StatusBar.class, StatusBar.class, new Parameter[] {
new ComponentParameter("mainShell"), anyComponentParameter, anyComponentParameter, anyComponentParameter, anyComponentParameter });
container.registerComponentImplementation(MainMenu.class, MainMenu.class, new Parameter[] {
new ComponentParameter("mainShell"), new ComponentParameter("mainMenu"),
new ComponentParameter("commandsMenu"), anyComponentParameter, new ConstantParameter(container) });
container.registerComponentImplementation(MainMenu.ColumnsMenu.class, MainMenu.ColumnsMenu.class,
new Parameter[] { new ComponentParameter("mainShell"), anyComponentParameter, anyComponentParameter, anyComponentParameter });
if (Platform.MAC_OS)
container.registerComponentImplementation(MacApplicationMenu.class);
container.registerComponentImplementation(AboutDialog.class);
container.registerComponentImplementation(PreferencesDialog.class);