// Path: src/com/github/kennedyoliveira/ultimatepastebin/settings/PasteBinConfigurableSettings.java
// public class PasteBinConfigurableSettings implements SearchableConfigurable {
// 
//   private PasteBinConfigurationForm pasteBinConfigurationForm;
//   private PasteBinConfigurationService pasteBinConfigurationService;
// 
//   public PasteBinConfigurableSettings() {
//     UIUtil.invokeLaterIfNeeded(() -> this.pasteBinConfigurationForm = new PasteBinConfigurationForm(true));
// 
//     this.pasteBinConfigurationService = ServiceManager.getService(PasteBinConfigurationService.class);
//   }
// 
//   @NotNull
//   @Override
//   public String getId() {
//     return "ultimatepastebin.settings";
//   }
// 
//   @Nullable
//   @Override
//   public Runnable enableSearch(String option) {
//     return null;
//   }
// 
//   @Nls
//   @Override
//   public String getDisplayName() {
//     return "Ultimate PasteBin";
//   }
// 
//   @Nullable
//   @Override
//   public String getHelpTopic() {
//     return null;
//   }
// 
//   @Nullable
//   @Override
//   public JComponent createComponent() {
//     return pasteBinConfigurationForm.createCenterPanel();
//   }
// 
//   @Override
//   public boolean isModified() {
//     return changedAccountCredentials() ||
//         pasteBinConfigurationService.getTotalPastesToFetch() != ((int) pasteBinConfigurationForm.getPasteToFetch().getValue()) ||
//         !pasteBinConfigurationForm.getLanguage().getSelectedItem().equals(pasteBinConfigurationService.getCurrentLanguage());
//   }
// 
//   public boolean changedAccountCredentials() {
//     return !(
//         Objects.equals(pasteBinConfigurationForm.getDevkey().getText(), pasteBinConfigurationService.getDevkey())
//             && Objects.equals(pasteBinConfigurationForm.getUserName().getText(), pasteBinConfigurationService.getUsername())
//             && Objects.equals(new String(pasteBinConfigurationForm.getPassword().getPassword()), pasteBinConfigurationService.getPassword())
//     );
//   }
// 
//   @Override
//   public void apply() throws ConfigurationException {
//     boolean changedAccountCredentials = changedAccountCredentials();
// 
//     pasteBinConfigurationService.setUsername(pasteBinConfigurationForm.getUserName().getText());
//     pasteBinConfigurationService.setDevkey(pasteBinConfigurationForm.getDevkey().getText());
//     pasteBinConfigurationService.setTotalPastesToFetch((Integer) pasteBinConfigurationForm.getPasteToFetch().getValue());
//     pasteBinConfigurationService.setCurrentLanguage((String) pasteBinConfigurationForm.getLanguage().getSelectedItem());
//     pasteBinConfigurationService.setPassword(new String(pasteBinConfigurationForm.getPassword().getPassword()));
// 
//     // Updates the default locale so forms will get the language too
//     Locale.setDefault(MessageBundle.getLanguageLocale());
// 
//     ToolWindowService service = ServiceManager.getService(ToolWindowService.class);
// 
//     UIUtil.invokeLaterIfNeeded(() -> {
//       // when the settings changed, i try to login on pastebin with the new credentials
//       if (changedAccountCredentials || !pasteBinConfigurationService.isValidCredentials()) {
//         PasteBinService pasteBinService = ServiceManager.getService(PasteBinService.class);
//         pasteBinService.invalidateCredentials();
// 
//         try {
//           pasteBinService.checkCredentials();
//           service.fetchPastes();
//         } catch (Exception e) {
//           // if there is any error, show to user
//           logger.error("Logging into pastebin", e);
//           showErrorMessageBox(null, e.getMessage(), "Error While Logging with the Credentials Provided.");
//         }
//       } else {
//         service.fetchPastes();
//       }
//     });
//   }
// 
//   @Override
//   public void reset() {
//     if (StringUtil.isEmpty(pasteBinConfigurationService.getDevkey()) || StringUtil.isEmpty(pasteBinConfigurationService.getUsername())) {
//       pasteBinConfigurationForm.getUserName().setText(null);
//       pasteBinConfigurationForm.getDevkey().setText(null);
//       pasteBinConfigurationForm.getPasteToFetch().setValue(UltimatePasteBinConstants.DEFAULT_TOTAL_PASTES_TO_FETCH);
//       pasteBinConfigurationForm.getLanguage().setSelectedItem("English");
//       pasteBinConfigurationForm.getPassword().setText(null);
//     } else {
//       pasteBinConfigurationForm.getUserName().setText(pasteBinConfigurationService.getUsername());
//       pasteBinConfigurationForm.getDevkey().setText(pasteBinConfigurationService.getDevkey());
//       pasteBinConfigurationForm.getPasteToFetch().setValue(pasteBinConfigurationService.getTotalPastesToFetch());
//       pasteBinConfigurationForm.getPassword().setText(pasteBinConfigurationService.getPassword());
// 
//       if (pasteBinConfigurationService.getCurrentLanguage() != null) {
//         pasteBinConfigurationForm.getLanguage().setSelectedItem(pasteBinConfigurationService.getCurrentLanguage());
//       } else {
//         pasteBinConfigurationForm.getLanguage().setSelectedItem("English");
//       }
//     }
//   }
// 
//   @Override
//   public void disposeUIResources() {
//     logger.debug("Disposing Configuration Settings UI");
//   }
// }
// 
// Path: src/com/github/kennedyoliveira/ultimatepastebin/i18n/MessageBundle.java
// @Nullable
// public static String getMessage(String key, Object... params) {
//   return CommonBundle.message(getBundle(), key, params);
// }


import com.github.kennedyoliveira.ultimatepastebin.settings.PasteBinConfigurableSettings;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.options.ShowSettingsUtil;
import static com.github.kennedyoliveira.ultimatepastebin.i18n.MessageBundle.getMessage;
package com.github.kennedyoliveira.ultimatepastebin.action;



/**
 * Action that show the setting window of the plugin.
 */
public class ShowSettingsAction extends AnAction {

  @Override
  public void actionPerformed(AnActionEvent e) {
    ShowSettingsUtil.getInstance().showSettingsDialog(e.getProject(), PasteBinConfigurableSettings.class);
  }

  @Override
// Path: src/com/github/kennedyoliveira/ultimatepastebin/settings/PasteBinConfigurableSettings.java
// public class PasteBinConfigurableSettings implements SearchableConfigurable {
// 
//   private PasteBinConfigurationForm pasteBinConfigurationForm;
//   private PasteBinConfigurationService pasteBinConfigurationService;
// 
//   public PasteBinConfigurableSettings() {
//     UIUtil.invokeLaterIfNeeded(() -> this.pasteBinConfigurationForm = new PasteBinConfigurationForm(true));
// 
//     this.pasteBinConfigurationService = ServiceManager.getService(PasteBinConfigurationService.class);
//   }
// 
//   @NotNull
//   @Override
//   public String getId() {
//     return "ultimatepastebin.settings";
//   }
// 
//   @Nullable
//   @Override
//   public Runnable enableSearch(String option) {
//     return null;
//   }
// 
//   @Nls
//   @Override
//   public String getDisplayName() {
//     return "Ultimate PasteBin";
//   }
// 
//   @Nullable
//   @Override
//   public String getHelpTopic() {
//     return null;
//   }
// 
//   @Nullable
//   @Override
//   public JComponent createComponent() {
//     return pasteBinConfigurationForm.createCenterPanel();
//   }
// 
//   @Override
//   public boolean isModified() {
//     return changedAccountCredentials() ||
//         pasteBinConfigurationService.getTotalPastesToFetch() != ((int) pasteBinConfigurationForm.getPasteToFetch().getValue()) ||
//         !pasteBinConfigurationForm.getLanguage().getSelectedItem().equals(pasteBinConfigurationService.getCurrentLanguage());
//   }
// 
//   public boolean changedAccountCredentials() {
//     return !(
//         Objects.equals(pasteBinConfigurationForm.getDevkey().getText(), pasteBinConfigurationService.getDevkey())
//             && Objects.equals(pasteBinConfigurationForm.getUserName().getText(), pasteBinConfigurationService.getUsername())
//             && Objects.equals(new String(pasteBinConfigurationForm.getPassword().getPassword()), pasteBinConfigurationService.getPassword())
//     );
//   }
// 
//   @Override
//   public void apply() throws ConfigurationException {
//     boolean changedAccountCredentials = changedAccountCredentials();
// 
//     pasteBinConfigurationService.setUsername(pasteBinConfigurationForm.getUserName().getText());
//     pasteBinConfigurationService.setDevkey(pasteBinConfigurationForm.getDevkey().getText());
//     pasteBinConfigurationService.setTotalPastesToFetch((Integer) pasteBinConfigurationForm.getPasteToFetch().getValue());
//     pasteBinConfigurationService.setCurrentLanguage((String) pasteBinConfigurationForm.getLanguage().getSelectedItem());
//     pasteBinConfigurationService.setPassword(new String(pasteBinConfigurationForm.getPassword().getPassword()));
// 
//     // Updates the default locale so forms will get the language too
//     Locale.setDefault(MessageBundle.getLanguageLocale());
// 
//     ToolWindowService service = ServiceManager.getService(ToolWindowService.class);
// 
//     UIUtil.invokeLaterIfNeeded(() -> {
//       // when the settings changed, i try to login on pastebin with the new credentials
//       if (changedAccountCredentials || !pasteBinConfigurationService.isValidCredentials()) {
//         PasteBinService pasteBinService = ServiceManager.getService(PasteBinService.class);
//         pasteBinService.invalidateCredentials();
// 
//         try {
//           pasteBinService.checkCredentials();
//           service.fetchPastes();
//         } catch (Exception e) {
//           // if there is any error, show to user
//           logger.error("Logging into pastebin", e);
//           showErrorMessageBox(null, e.getMessage(), "Error While Logging with the Credentials Provided.");
//         }
//       } else {
//         service.fetchPastes();
//       }
//     });
//   }
// 
//   @Override
//   public void reset() {
//     if (StringUtil.isEmpty(pasteBinConfigurationService.getDevkey()) || StringUtil.isEmpty(pasteBinConfigurationService.getUsername())) {
//       pasteBinConfigurationForm.getUserName().setText(null);
//       pasteBinConfigurationForm.getDevkey().setText(null);
//       pasteBinConfigurationForm.getPasteToFetch().setValue(UltimatePasteBinConstants.DEFAULT_TOTAL_PASTES_TO_FETCH);
//       pasteBinConfigurationForm.getLanguage().setSelectedItem("English");
//       pasteBinConfigurationForm.getPassword().setText(null);
//     } else {
//       pasteBinConfigurationForm.getUserName().setText(pasteBinConfigurationService.getUsername());
//       pasteBinConfigurationForm.getDevkey().setText(pasteBinConfigurationService.getDevkey());
//       pasteBinConfigurationForm.getPasteToFetch().setValue(pasteBinConfigurationService.getTotalPastesToFetch());
//       pasteBinConfigurationForm.getPassword().setText(pasteBinConfigurationService.getPassword());
// 
//       if (pasteBinConfigurationService.getCurrentLanguage() != null) {
//         pasteBinConfigurationForm.getLanguage().setSelectedItem(pasteBinConfigurationService.getCurrentLanguage());
//       } else {
//         pasteBinConfigurationForm.getLanguage().setSelectedItem("English");
//       }
//     }
//   }
// 
//   @Override
//   public void disposeUIResources() {
//     logger.debug("Disposing Configuration Settings UI");
//   }
// }
// 
// Path: src/com/github/kennedyoliveira/ultimatepastebin/i18n/MessageBundle.java
// @Nullable
// public static String getMessage(String key, Object... params) {
//   return CommonBundle.message(getBundle(), key, params);
// }


// Path: src/com/github/kennedyoliveira/ultimatepastebin/action/ShowSettingsAction.java
import com.github.kennedyoliveira.ultimatepastebin.settings.PasteBinConfigurableSettings;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.options.ShowSettingsUtil;
import static com.github.kennedyoliveira.ultimatepastebin.i18n.MessageBundle.getMessage;

package com.github.kennedyoliveira.ultimatepastebin.action;



/**
 * Action that show the setting window of the plugin.
 */
public class ShowSettingsAction extends AnAction {

  @Override
  public void actionPerformed(AnActionEvent e) {
    ShowSettingsUtil.getInstance().showSettingsDialog(e.getProject(), PasteBinConfigurableSettings.class);
  }

  @Override
  public void update(AnActionEvent e) {