private void selectFirstConfig() {
   if (isConfigListEmpty()) {
     disableDeleteButton();
   } else {
     enableDeleteButton();
     configList.setSelectedIndex(0);
   }
 }
예제 #2
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);
  }
 private boolean isConfigListEmpty() {
   return configList.getItemCount() == 0;
 }
 private void selectLastConfig() {
   int lastIndex = configList.getItemCount() - 1;
   configList.setSelectedIndex(lastIndex);
 }
 private int getSelectedConfigIndex() {
   return configList.getSelectedIndex();
 }
 private String getSelectedConfig() {
   return configList.getItemText(getSelectedConfigIndex());
 }
 private void removeSelectedConfig() {
   configurations.remove(getSelectedConfig());
   configList.removeItem(getSelectedConfigIndex());
 }
 private void addConfig(Configuration configuration) {
   configList.addItem(configuration.getName());
   configurations.put(configuration.getName(), configuration);
 }