Package org.intellij.sonar.persistence

Examples of org.intellij.sonar.persistence.LocalAnalysisScript


    myAddLocalAnalysisScriptButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        final LocalAnalysisScriptConfigurable dlg = showLocalAnalysisScriptConfigurableDialog();
        if (dlg.isOK()) {
          final LocalAnalysisScript newLocalAnalysisScript = dlg.toLocalAnalysisScript();
          try {
            LocalAnalysisScripts.add(newLocalAnalysisScript);
            myLocalAnalysisScriptComboBox.addItem(makeObj(newLocalAnalysisScript.getName()));
            UIUtil.selectComboBoxItem(myLocalAnalysisScriptComboBox, newLocalAnalysisScript.getName());
          } catch (IllegalArgumentException ex) {
            Messages.showErrorDialog(newLocalAnalysisScript.getName() + " already exists", "Local Analysis Script Name Error");
            showLocalAnalysisScriptConfigurableDialog(newLocalAnalysisScript);
          }
        }
      }
    });

    myEditLocalAnalysisScriptButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent actionEvent) {
        final Object selected = myLocalAnalysisScriptComboBox.getSelectedItem();
        final Optional<LocalAnalysisScript> previous = LocalAnalysisScripts.get(selected.toString());
        if (!previous.isPresent()) {
          Messages.showErrorDialog(selected.toString() + " is not more preset", "Cannot Perform Edit");
        } else {
          final LocalAnalysisScriptConfigurable dlg = showLocalAnalysisScriptConfigurableDialog(previous.get());
          if (dlg.isOK()) {
            LocalAnalysisScript next = dlg.toLocalAnalysisScript();
            try {
              LocalAnalysisScripts.remove(previous.get().getName());
              LocalAnalysisScripts.add(next);
              myLocalAnalysisScriptComboBox.removeItem(selected);
              myLocalAnalysisScriptComboBox.addItem(makeObj(next.getName()));
              UIUtil.selectComboBoxItem(myLocalAnalysisScriptComboBox, next.getName());
            } catch (IllegalArgumentException e) {
              Messages.showErrorDialog(selected.toString() + " cannot be saved\n\n" + Throwables.getStackTraceAsString(e), "Cannot Perform Edit");
            }
          }
        }
View Full Code Here

TOP

Related Classes of org.intellij.sonar.persistence.LocalAnalysisScript

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.