Пример #1
0
  /** Creates a new instance of Me. */
  public Me() {
    super();

    CommandManager.registerCommand(this);
  }
Пример #2
0
 /** Loads the relevant commands into the parser. */
 @Override
 protected void loadCommands() {
   CommandManager.loadCommands(this, CommandType.TYPE_GLOBAL);
 }
Пример #3
0
  /**
   * Initialises the client.
   *
   * @param args The command line arguments
   */
  private static void init(final String[] args) {
    Thread.setDefaultUncaughtExceptionHandler(new DMDircExceptionHandler());

    for (Handler handler : java.util.logging.Logger.getLogger("").getHandlers()) {
      handler.setLevel(Level.OFF); // Needs to be changed to enable debugging
    }

    // Enable finer debugging for specific components like so:
    // java.util.logging.Logger.getLogger("com.dmdirc.plugins").setLevel(Level.ALL);

    IdentityManager.loadVersion();

    final CommandLineParser clp = new CommandLineParser(args);

    IdentityManager.load();

    final PluginManager pm = PluginManager.getPluginManager();

    ThemeManager.loadThemes();

    clp.applySettings();

    CommandManager.initCommands();

    for (String service : new String[] {"ui", "tabcompletion"}) {
      ensureExists(pm, service);
    }

    loadUI(pm, IdentityManager.getGlobalConfig());

    doFirstRun();

    ActionManager.init();

    pm.doAutoLoad();

    ActionManager.loadActions();

    getUI().getMainWindow();

    ActionManager.processEvent(CoreActionType.CLIENT_OPENED, null);

    UpdateChecker.init();

    clp.processArguments();

    GlobalWindow.init();

    Runtime.getRuntime()
        .addShutdownHook(
            new Thread(
                new Runnable() {
                  /** {@inheritDoc} */
                  @Override
                  public void run() {
                    ActionManager.processEvent(CoreActionType.CLIENT_CLOSED, null);
                    ServerManager.getServerManager().disconnectAll("Unexpected shutdown");
                    IdentityManager.save();
                  }
                },
                "Shutdown thread"));
  }