protected void onSave() {
    try {
      int channelInt = Integer.parseInt(channelName.getText());
      if (channelInt < 0 || channelInt > 256) {
        throw new Exception();
      }
      String key = getKey(String.valueOf(channelInt));
      raptorPreferenceStore.setValue(key, colorSelector.getColorValue());

      boolean channelsHasSelection = false;
      for (int i = 0; i < channels.getItemCount(); i++) {
        if (channels.getItem(i).equals(String.valueOf(channelInt))) {
          channelsHasSelection = true;
          break;
        }
      }

      if (!channelsHasSelection) {
        channels.add(String.valueOf(channelInt));
      }
    } catch (Throwable t) {
      MessageDialog.openInformation(
          Raptor.getInstance().getWindow().getShell(),
          local.getString("alert"),
          local.getString("chatConColP3"));
    }
  }
  public void appendToFile(String fileName, String message) {
    FileWriter writer = null;
    try {
      File file = new File(fileName);
      writer = new FileWriter(file, true);
      writer.append(message);
      writer.flush();

    } catch (Throwable t) {
      Raptor.getInstance().onError("Error writing to file: " + fileName, t);
    } finally {
      if (writer != null) {
        try {
          writer.close();
        } catch (Throwable t) {
        }
      }
    }
  }
 public ChessBoardBehaviorPage() {
   // Use the "flat" layout
   super(GRID);
   setTitle(local.getString("behavior"));
   setPreferenceStore(Raptor.getInstance().getPreferences());
 }
Пример #4
0
 public ScriptsPage() {
   super(FLAT);
   setTitle(L10n.getInstance().getString("scripts"));
   setPreferenceStore(Raptor.getInstance().getPreferences());
 }
 public String getUserFollowing() {
   Raptor.getInstance().alert("getUserFollowing is not yet implemented.");
   return "";
 }
 public void alert(String message) {
   Raptor.getInstance().alert(message);
 }
 public String prompt(String message) {
   return Raptor.getInstance().promptForText(message);
 }
 public ChatConsoleChannelColorsPage() {
   // Use the "flat" layout
   super();
   setPreferenceStore(raptorPreferenceStore = Raptor.getInstance().getPreferences());
   setTitle(local.getString("chanCol"));
 }