Пример #1
0
  /**
   * @param friends the Client the Plugin belongs to
   * @param starter is true if the Clients started the plugin (start() will be called instead of
   *     follow()
   * @return a new instance of the Plugin.
   */
  public Plugin newInstance(ConnectInfo[] friends, boolean starter) {
    QuickLaunch self = new QuickLaunch();

    try {
      self.trayIcon =
          new TrayIcon(
              this.getImageIcon16(),
              Client.getInstance().getMyInfos().getName() + " - Lucane Groupware");
    } catch (Throwable t) {
      self.trayIcon = null;
    }

    return self;
  }
Пример #2
0
  /** Show a dialog asking for the friend name */
  public void start() {
    if (this.trayIcon == null) {
      // no user message if we aren't on windows
      if (System.getProperty("os.name").startsWith("Win")) DialogBox.error(tr("err.noTray"));
      else Logging.getLogger().info("Not on windows, running MainInterface instead of QuickLaunch");

      PluginManager.getInstance().run(MAIN_INTERFACE, new ConnectInfo[0]);
      Client.getInstance().setStartupPlugin(MAIN_INTERFACE);
      return;
    }

    addMenuToTray();

    this.trayIcon.addMouseListener(this);
    this.trayIcon.setVisible(true);
    this.trayIcon.showInfo(tr("lucane.is.ready"), "Lucane Groupware");
  }
Пример #3
0
  private void runPlugin(String pluginName) {
    ConnectInfo[] friends = null;
    Plugin plugin = PluginManager.getInstance().getPlugin(pluginName);

    // get users
    if (plugin.isStandalone()) friends = new ConnectInfo[0];
    else {
      ListBox userList =
          new ListBox(
              null, plugin.getTitle(), tr("msg.selectUsers"), Client.getInstance().getUserList());
      Object[] users = userList.selectItems();
      if (users != null) {
        friends = new ConnectInfo[users.length];
        for (int i = 0; i < friends.length; i++)
          friends[i] = Communicator.getInstance().getConnectInfo((String) users[i]);
      }
    }

    // run the plugin if the user didn't click on cancel
    if (friends != null) PluginManager.getInstance().run(pluginName, friends);
  }