@Override
  public void apply() throws ConfigurationException {
    List<X509Certificate> existing = myTrustManager.getCertificates();

    Set<X509Certificate> added = new HashSet<X509Certificate>(myCertificates);
    added.removeAll(existing);

    Set<X509Certificate> removed = new HashSet<X509Certificate>(existing);
    removed.removeAll(myCertificates);

    for (X509Certificate certificate : added) {
      if (!myTrustManager.addCertificate(certificate)) {
        throw new ConfigurationException(
            "Cannot add certificate for " + getCommonName(certificate), "Cannot Add Certificate");
      }
    }

    for (X509Certificate certificate : removed) {
      if (!myTrustManager.removeCertificate(certificate)) {
        throw new ConfigurationException(
            "Cannot remove certificate for " + getCommonName(certificate),
            "Cannot Remove Certificate");
      }
    }
    CertificateManager.Config state = CertificateManager.getInstance().getState();

    state.ACCEPT_AUTOMATICALLY = myAcceptAutomatically.isSelected();
    state.CHECK_HOSTNAME = myCheckHostname.isSelected();
    state.CHECK_VALIDITY = myCheckValidityPeriod.isSelected();
  }
  @Override
  public void reset() {
    List<X509Certificate> original = myTrustManager.getCertificates();
    myTreeBuilder.reset(original);

    myCertificates.clear();
    myCertificates.addAll(original);

    myDetailsPanel.removeAll();
    myDetailsPanel.add(myEmptyPanel, EMPTY_PANEL);

    // fill lower panel with cards
    for (X509Certificate certificate : original) {
      addCertificatePanel(certificate);
    }

    if (!myCertificates.isEmpty()) {
      myTreeBuilder.selectFirstCertificate();
    }

    CertificateManager.Config state = CertificateManager.getInstance().getState();
    myAcceptAutomatically.setSelected(state.ACCEPT_AUTOMATICALLY);
    myCheckHostname.setSelected(state.CHECK_HOSTNAME);
    myCheckValidityPeriod.setSelected(state.CHECK_VALIDITY);
  }
 @Override
 public boolean isModified() {
   CertificateManager.Config state = CertificateManager.getInstance().getState();
   return myAcceptAutomatically.isSelected() != state.ACCEPT_AUTOMATICALLY
       || myCheckHostname.isSelected() != state.CHECK_HOSTNAME
       || myCheckValidityPeriod.isSelected() != state.CHECK_VALIDITY
       || !myCertificates.equals(new HashSet<X509Certificate>(myTrustManager.getCertificates()));
 }
  private void initControls(final LauncherParameters launcherParameters) {
    final LauncherParameters.LauncherType launcherType = launcherParameters.getLauncherType();
    myDefaultOSApplicationRadioButton.setSelected(
        launcherType == LauncherParameters.LauncherType.OSDefault);
    myBrowserRadioButton.setSelected(launcherType == LauncherParameters.LauncherType.Browser);
    myPlayerRadioButton.setSelected(launcherType == LauncherParameters.LauncherType.Player);

    myBrowserSelector.setSelected(launcherParameters.getBrowser());

    myPlayerTextWithBrowse.setText(
        FileUtil.toSystemDependentName(launcherParameters.getPlayerPath()));
    myPlayerTextWithBrowse.addBrowseFolderListener(
        null,
        null,
        myProject,
        new FileChooserDescriptor(true, true, false, false, false, false) {
          @Override
          public boolean isFileSelectable(final VirtualFile file) {
            return SystemInfo.isMac
                    && file.isDirectory()
                    && "app".equalsIgnoreCase(file.getExtension())
                || !file.isDirectory();
          }
        });
    myNewPlayerInstanceCheckBox.setVisible(SystemInfo.isMac);
  }
 public UserDefinedLibraryPanel() {
   pathListModel = new DefaultListModel();
   pathList = preparePathList(pathListModel);
   toolbarDecorator = prepareToolbarDecorator(pathList);
   pathsPanel.add(toolbarDecorator.createPanel());
   userDefinedLibraryEnabled.addActionListener(getUserDefinedLibraryEnabledListener());
 }
  @Override
  public void updateOptionsList() {
    myIsInSchemeChange = true;

    myLineSpacingField.setText(Float.toString(getLineSpacing()));
    FontPreferences fontPreferences = getFontPreferences();
    List<String> fontFamilies = fontPreferences.getEffectiveFontFamilies();
    myPrimaryCombo.setFontName(fontPreferences.getFontFamily());
    boolean isThereSecondaryFont = fontFamilies.size() > 1;
    myUseSecondaryFontCheckbox.setSelected(isThereSecondaryFont);
    mySecondaryCombo.setFontName(isThereSecondaryFont ? fontFamilies.get(1) : null);
    myEditorFontSizeField.setText(
        String.valueOf(fontPreferences.getSize(fontPreferences.getFontFamily())));

    boolean readOnly = ColorAndFontOptions.isReadOnly(myOptions.getSelectedScheme());
    myPrimaryCombo.setEnabled(!readOnly);
    mySecondaryCombo.setEnabled(isThereSecondaryFont && !readOnly);
    myOnlyMonospacedCheckBox.setEnabled(!readOnly);
    myLineSpacingField.setEnabled(!readOnly);
    myEditorFontSizeField.setEnabled(!readOnly);
    myUseSecondaryFontCheckbox.setEnabled(!readOnly);

    myEnableLigaturesCheckbox.setEnabled(!readOnly);
    myLigaturesInfoLinkLabel.setEnabled(!readOnly);
    myEnableLigaturesCheckbox.setSelected(fontPreferences.useLigatures());

    myIsInSchemeChange = false;
  }
 @Override
 public void apply(CodeStyleSettings settings) {
   boolean newValue = myEnabled.isSelected();
   settings.getCustomSettings(EditorConfigSettings.class).ENABLED = newValue;
   MessageBus bus = ApplicationManager.getApplication().getMessageBus();
   bus.syncPublisher(EditorConfigSettings.EDITOR_CONFIG_ENABLED_TOPIC).valueChanged(newValue);
 }
  public void setUpChangeListeners(
      final DataSourceConfigurationAggregatingPanel aggregatingPanel,
      final ConfigurationChangeListener listener) {
    userDefinedLibraryEnabled.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            listener.changeApplied(aggregatingPanel.getCurrentConfigurationState());
          }
        });
    pathListModel.addListDataListener(
        new ListDataListener() {
          @Override
          public void intervalAdded(ListDataEvent e) {
            listener.changeApplied(aggregatingPanel.getCurrentConfigurationState());
          }

          @Override
          public void intervalRemoved(ListDataEvent e) {
            listener.changeApplied(aggregatingPanel.getCurrentConfigurationState());
          }

          @Override
          public void contentsChanged(ListDataEvent e) {
            // do nothing (can't happen - we only support adding and removing)
          }
        });
  }
 private void initQuickDocProcessing() {
   myCbShowQuickDocOnMouseMove.addItemListener(
       new ItemListener() {
         @Override
         public void itemStateChanged(ItemEvent e) {
           myQuickDocDelayTextField.setEnabled(myCbShowQuickDocOnMouseMove.isSelected());
           myQuickDocDelayLabel.setEnabled(myCbShowQuickDocOnMouseMove.isSelected());
         }
       });
 }
Exemplo n.º 10
0
  @Override
  public void apply() {
    if (myJavaModuleFacet.getModule() instanceof Solution) {
      SolutionDescriptor descriptor =
          (SolutionDescriptor) myJavaModuleFacet.getModule().getModuleDescriptor();
      descriptor.setCompileInMPS(myCheckBox.isSelected());
      descriptor.setKind((SolutionKind) myComboBox.getSelectedItem());
    }

    myPathsTableModel.apply();
    myLibraryTableModel.apply();
  }
Exemplo n.º 11
0
  @Override
  public boolean isModified() {
    boolean solutionCheck = false;
    if (myJavaModuleFacet.getModule() instanceof Solution) {
      SolutionDescriptor descriptor =
          (SolutionDescriptor) myJavaModuleFacet.getModule().getModuleDescriptor();
      solutionCheck =
          descriptor.getCompileInMPS() != myCheckBox.isSelected()
              || descriptor.getKind() != myComboBox.getSelectedItem();
    }

    return myPathsTableModel.isModified() || myLibraryTableModel.isModified() || solutionCheck;
  }
 @Override
 protected void doOKAction() {
   if (getOKAction().isEnabled()) {
     UsageTrackerProvider.getInstance()
         .trackEvent(GctTracking.CATEGORY, GctTracking.CLOUD_DEBUGGER, "start.session", null);
     // TODO : add source context tracking info
     if (mySyncStashCheckbox.isSelected()) {
       syncOrStash();
     } else {
       buildResult();
       close(OK_EXIT_CODE); // We close before kicking off the update so it doesn't interfere with
       // the output window coming to focus.
     }
   }
 }
 public LauncherParameters getLauncherParameters() {
   final LauncherParameters.LauncherType launcherType =
       myPlayerRadioButton.isSelected()
           ? LauncherParameters.LauncherType.Player
           : myBrowserRadioButton.isSelected()
               ? LauncherParameters.LauncherType.Browser
               : LauncherParameters.LauncherType.OSDefault;
   final WebBrowser browser = myBrowserSelector.getSelected();
   final WebBrowser notNullBrowser =
       browser == null
           ? WebBrowserManager.getInstance().getFirstBrowser(BrowserFamily.FIREFOX)
           : browser;
   final String playerPath =
       FileUtil.toSystemIndependentName(myPlayerTextWithBrowse.getText().trim());
   final boolean isNewPlayerInstance = myNewPlayerInstanceCheckBox.isSelected();
   return new LauncherParameters(launcherType, notNullBrowser, playerPath, isNewPlayerInstance);
 }
 public boolean isMoveToAnotherClass() {
   return myMoveToAnotherClassJBCheckBox.isSelected();
 }
  /** Checks whether a stash or sync is needed based on the chosen target and local state. */
  private void checkSyncStashState() {
    if (myProcessResultState == null) {
      LOG.error("unexpected result state during a check sync stash state");
      return;
    }
    mySyncResult = new ProjectRepositoryValidator(myProcessResultState).checkSyncStashState();

    if (mySyncResult.needsStash() && mySyncResult.needsSync()) {
      setOKButtonText(
          isContinued()
              ? GctBundle.getString("clouddebug.continuesession")
              : GctBundle.getString("clouddebug.attach"));
      mySyncStashCheckbox.setVisible(true);
      assert mySyncResult.getTargetSyncSHA() != null;
      mySyncStashCheckbox.setText(
          GctBundle.getString(
              "clouddebug.stash.local.changes.and.sync",
              mySyncResult.getTargetSyncSHA().substring(0, 7)));
      mySyncStashCheckbox.setSelected(true);
      myWarningLabel.setVisible(false);
      myWarningLabel2.setVisible(false);
      myInfoPanel.setVisible(true);
    } else if (mySyncResult.needsStash()) {
      setOKButtonText(
          isContinued()
              ? GctBundle.getString("clouddebug.continuesession")
              : GctBundle.getString("clouddebug.attach"));
      mySyncStashCheckbox.setVisible(true);
      mySyncStashCheckbox.setText(GctBundle.getString("clouddebug.stashbuttontext"));
      mySyncStashCheckbox.setSelected(true);
      myWarningLabel.setVisible(false);
      myWarningLabel2.setVisible(false);
      myInfoPanel.setVisible(true);
    } else if (mySyncResult.needsSync()) {
      setOKButtonText(
          isContinued()
              ? GctBundle.getString("clouddebug.continuesession")
              : GctBundle.getString("clouddebug.attach"));
      mySyncStashCheckbox.setVisible(true);
      assert mySyncResult.getTargetSyncSHA() != null;
      mySyncStashCheckbox.setText("Sync to " + mySyncResult.getTargetSyncSHA().substring(0, 7));
      mySyncStashCheckbox.setSelected(true);
      myWarningLabel.setVisible(false);
      myWarningLabel2.setVisible(false);
      myInfoPanel.setVisible(true);
    } else if (mySyncResult.needsSync() && mySyncResult.getTargetSyncSHA() == null) {
      setOKButtonText(
          isContinued()
              ? GctBundle.getString("clouddebug.continueanyway")
              : GctBundle.getString("clouddebug.attach.anyway"));
      myWarningLabel.setVisible(true);
      myWarningLabel2.setVisible(true);
      myInfoPanel.setVisible(true);
      myWarningLabel2.setText(GctBundle.getString("clouddebug.no.matching.sha"));
    } else if (!mySyncResult.hasRemoteRepository()) {
      setOKButtonText(
          isContinued()
              ? GctBundle.getString("clouddebug.continueanyway")
              : GctBundle.getString("clouddebug.attach.anyway"));
      myWarningLabel.setVisible(true);
      myWarningLabel2.setVisible(true);
      myInfoPanel.setVisible(true);
      if (mySyncResult.getRepositoryType() != null) {
        myWarningLabel2.setText(
            GctBundle.getString(
                "clouddebug.repositories.are.not.supported", mySyncResult.getRepositoryType()));
      } else {
        myWarningLabel2.setText(GctBundle.getString("clouddebug.no.remote.repository"));
      }
    } else {
      setOKButtonText(
          isContinued()
              ? GctBundle.getString("clouddebug.continuesession")
              : GctBundle.getString("clouddebug.attach"));
      mySyncStashCheckbox.setVisible(false);
      myWarningLabel.setVisible(false);
      myWarningLabel2.setVisible(false);
      myInfoPanel.setVisible(true);
    }
  }
  public void apply() throws ConfigurationException {
    EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
    CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
    UISettings uiSettings = UISettings.getInstance();
    VcsApplicationSettings vcsSettings = VcsApplicationSettings.getInstance();

    // Display

    editorSettings.setSmoothScrolling(myCbSmoothScrolling.isSelected());

    // Brace Highlighting

    codeInsightSettings.HIGHLIGHT_BRACES = myCbHighlightBraces.isSelected();
    codeInsightSettings.HIGHLIGHT_SCOPE = myCbHighlightScope.isSelected();
    codeInsightSettings.HIGHLIGHT_IDENTIFIER_UNDER_CARET =
        myCbHighlightIdentifierUnderCaret.isSelected();
    clearAllIdentifierHighlighters();

    // Virtual space

    editorSettings.setUseSoftWraps(
        myCbUseSoftWrapsAtEditor.isSelected(), SoftWrapAppliancePlaces.MAIN_EDITOR);
    editorSettings.setUseCustomSoftWrapIndent(myCbUseCustomSoftWrapIndent.isSelected());
    editorSettings.setCustomSoftWrapIndent(getCustomSoftWrapIndent());
    editorSettings.setAllSoftwrapsShown(!myCbShowSoftWrapsOnlyOnCaretLine.isSelected());
    editorSettings.setVirtualSpace(myCbVirtualSpace.isSelected());
    editorSettings.setCaretInsideTabs(myCbCaretInsideTabs.isSelected());
    editorSettings.setAdditionalPageAtBottom(myCbVirtualPageAtBottom.isSelected());

    // Limits

    boolean uiSettingsChanged = false;
    int maxClipboardContents = getMaxClipboardContents();
    if (uiSettings.MAX_CLIPBOARD_CONTENTS != maxClipboardContents) {
      uiSettings.MAX_CLIPBOARD_CONTENTS = maxClipboardContents;
      uiSettingsChanged = true;
    }

    if (uiSettingsChanged) {
      uiSettings.fireUISettingsChanged();
    }

    // Strip trailing spaces on save

    if (STRIP_NONE.equals(myStripTrailingSpacesCombo.getSelectedItem())) {
      editorSettings.setStripTrailingSpaces(
          EditorSettingsExternalizable.STRIP_TRAILING_SPACES_NONE);
    } else if (STRIP_CHANGED.equals(myStripTrailingSpacesCombo.getSelectedItem())) {
      editorSettings.setStripTrailingSpaces(
          EditorSettingsExternalizable.STRIP_TRAILING_SPACES_CHANGED);
    } else {
      editorSettings.setStripTrailingSpaces(
          EditorSettingsExternalizable.STRIP_TRAILING_SPACES_WHOLE);
    }

    editorSettings.setEnsureNewLineAtEOF(myCbEnsureBlankLineBeforeCheckBox.isSelected());

    if (myCbShowQuickDocOnMouseMove.isSelected()
        ^ editorSettings.isShowQuickDocOnMouseOverElement()) {
      boolean enabled = myCbShowQuickDocOnMouseMove.isSelected();
      editorSettings.setShowQuickDocOnMouseOverElement(enabled);
      ServiceManager.getService(QuickDocOnMouseOverManager.class).setEnabled(enabled);
    }

    Long quickDocDelay = getQuickDocDelayFromGui();
    if (quickDocDelay != null) {
      editorSettings.setQuickDocOnMouseOverElementDelayMillis(quickDocDelay);
    }

    editorSettings.setDndEnabled(myCbEnableDnD.isSelected());

    editorSettings.setWheelFontChangeEnabled(myCbEnableWheelFontChange.isSelected());
    editorSettings.setMouseClickSelectionHonorsCamelWords(
        myCbHonorCamelHumpsWhenSelectingByClicking.isSelected());
    editorSettings.setRefrainFromScrolling(myRbPreferMovingCaret.isSelected());

    editorSettings.setVariableInplaceRenameEnabled(myCbRenameLocalVariablesInplace.isSelected());
    editorSettings.setPreselectRename(myPreselectCheckBox.isSelected());
    editorSettings.setShowInlineLocalDialog(myShowInlineDialogForCheckBox.isSelected());

    editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_REFORMAT_CODE_ACTION =
        myShowNotificationAfterReformatCodeCheckBox.isSelected();
    editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_OPTIMIZE_IMPORTS_ACTION =
        myShowNotificationAfterOptimizeImportsCheckBox.isSelected();

    boolean updateVcsSettings = false;
    if (vcsSettings.SHOW_WHITESPACES_IN_LST
        != myShowWhitespacesModificationsInLSTGutterCheckBox.isSelected()) {
      vcsSettings.SHOW_WHITESPACES_IN_LST =
          myShowWhitespacesModificationsInLSTGutterCheckBox.isSelected();
      updateVcsSettings = true;
    }
    if (vcsSettings.SHOW_LST_GUTTER_MARKERS != myShowLSTInGutterCheckBox.isSelected()) {
      vcsSettings.SHOW_LST_GUTTER_MARKERS = myShowLSTInGutterCheckBox.isSelected();
      updateVcsSettings = true;
    }
    if (updateVcsSettings) {
      ApplicationManager.getApplication()
          .getMessageBus()
          .syncPublisher(LineStatusTrackerSettingListener.TOPIC)
          .settingsUpdated();
    }

    reinitAllEditors();

    String temp = myRecentFilesLimitField.getText();
    if (temp.trim().length() > 0) {
      try {
        int newRecentFilesLimit = Integer.parseInt(temp);
        if (newRecentFilesLimit > 0 && uiSettings.RECENT_FILES_LIMIT != newRecentFilesLimit) {
          uiSettings.RECENT_FILES_LIMIT = newRecentFilesLimit;
          uiSettingsChanged = true;
        }
      } catch (NumberFormatException ignored) {
      }
    }
    if (uiSettingsChanged) {
      uiSettings.fireUISettingsChanged();
    }

    myErrorHighlightingPanel.apply();

    RichCopySettings settings = RichCopySettings.getInstance();
    settings.setEnabled(myCbEnableRichCopyByDefault.isSelected());
    Object item = myRichCopyColorSchemeComboBox.getSelectedItem();
    if (item instanceof String) {
      settings.setSchemeName(item.toString());
    }

    restartDaemons();
  }
Exemplo n.º 17
0
  public void apply() throws ConfigurationException {
    EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
    CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
    UISettings uiSettings = UISettings.getInstance();

    // Display

    editorSettings.setSmoothScrolling(myCbSmoothScrolling.isSelected());

    // Brace Highlighting

    codeInsightSettings.HIGHLIGHT_BRACES = myCbHighlightBraces.isSelected();
    codeInsightSettings.HIGHLIGHT_SCOPE = myCbHighlightScope.isSelected();
    codeInsightSettings.HIGHLIGHT_IDENTIFIER_UNDER_CARET =
        myCbHighlightIdentifierUnderCaret.isSelected();
    clearAllIdentifierHighlighters();

    // Virtual space

    editorSettings.setUseSoftWraps(
        myCbUseSoftWrapsAtEditor.isSelected(), SoftWrapAppliancePlaces.MAIN_EDITOR);
    editorSettings.setUseSoftWraps(
        myCbUseSoftWrapsAtConsole.isSelected(), SoftWrapAppliancePlaces.CONSOLE);
    editorSettings.setUseCustomSoftWrapIndent(myCbUseCustomSoftWrapIndent.isSelected());
    editorSettings.setCustomSoftWrapIndent(getCustomSoftWrapIndent());
    editorSettings.setAllSoftwrapsShown(myCbShowAllSoftWraps.isSelected());
    editorSettings.setVirtualSpace(myCbVirtualSpace.isSelected());
    editorSettings.setCaretInsideTabs(myCbCaretInsideTabs.isSelected());
    editorSettings.setAdditionalPageAtBottom(myCbVirtualPageAtBottom.isSelected());

    // Limits

    boolean uiSettingsChanged = false;
    int maxClipboardContents = getMaxClipboardContents();
    if (uiSettings.MAX_CLIPBOARD_CONTENTS != maxClipboardContents) {
      uiSettings.MAX_CLIPBOARD_CONTENTS = maxClipboardContents;
      uiSettingsChanged = true;
    }

    if (uiSettingsChanged) {
      uiSettings.fireUISettingsChanged();
    }

    // Strip trailing spaces on save

    if (STRIP_NONE.equals(myStripTrailingSpacesCombo.getSelectedItem())) {
      editorSettings.setStripTrailingSpaces(
          EditorSettingsExternalizable.STRIP_TRAILING_SPACES_NONE);
    } else if (STRIP_CHANGED.equals(myStripTrailingSpacesCombo.getSelectedItem())) {
      editorSettings.setStripTrailingSpaces(
          EditorSettingsExternalizable.STRIP_TRAILING_SPACES_CHANGED);
    } else {
      editorSettings.setStripTrailingSpaces(
          EditorSettingsExternalizable.STRIP_TRAILING_SPACES_WHOLE);
    }

    editorSettings.setEnsureNewLineAtEOF(myCbEnsureBlankLineBeforeCheckBox.isSelected());

    if (myCbShowQuickDocOnMouseMove.isSelected()
        ^ editorSettings.isShowQuickDocOnMouseOverElement()) {
      boolean enabled = myCbShowQuickDocOnMouseMove.isSelected();
      editorSettings.setShowQuickDocOnMouseOverElement(enabled);
      ServiceManager.getService(QuickDocOnMouseOverManager.class).setEnabled(enabled);
    }

    Long quickDocDelay = getQuickDocDelayFromGui();
    if (quickDocDelay != null) {
      editorSettings.setQuickDocOnMouseOverElementDelayMillis(quickDocDelay);
    }

    editorSettings.setDndEnabled(myCbEnableDnD.isSelected());

    editorSettings.setWheelFontChangeEnabled(myCbEnableWheelFontChange.isSelected());
    editorSettings.setMouseClickSelectionHonorsCamelWords(
        myCbHonorCamelHumpsWhenSelectingByClicking.isSelected());
    editorSettings.setRefrainFromScrolling(myRbPreferMovingCaret.isSelected());

    editorSettings.setVariableInplaceRenameEnabled(myCbRenameLocalVariablesInplace.isSelected());
    editorSettings.setPreselectRename(myPreselectCheckBox.isSelected());

    editorSettings.getOptions().SHOW_REFORMAT_DIALOG =
        myShowReformatCodeDialogCheckBox.isSelected();
    editorSettings.getOptions().SHOW_OPIMIZE_IMPORTS_DIALOG =
        myShowOptimizeImportsDialogCheckBox.isSelected();

    reinitAllEditors();

    String temp = myRecentFilesLimitField.getText();
    if (temp.trim().length() > 0) {
      try {
        int newRecentFilesLimit = Integer.parseInt(temp);
        if (newRecentFilesLimit > 0 && uiSettings.RECENT_FILES_LIMIT != newRecentFilesLimit) {
          uiSettings.RECENT_FILES_LIMIT = newRecentFilesLimit;
          uiSettingsChanged = true;
        }
      } catch (NumberFormatException ignored) {
      }
    }
    if (uiSettingsChanged) {
      uiSettings.fireUISettingsChanged();
    }
    uiSettings.CONSOLE_COMMAND_HISTORY_LIMIT =
        StringUtil.parseInt(
            myCommandsHistoryLimitField.getText(), uiSettings.CONSOLE_COMMAND_HISTORY_LIMIT);

    myErrorHighlightingPanel.apply();

    RichCopySettings settings = RichCopySettings.getInstance();
    Object item = myRichCopyColorSchemeComboBox.getSelectedItem();
    if (item instanceof String) {
      settings.setSchemeName(item.toString());
    }
    settings.setStripIndents(myRichCopyStripWhitespaceCheckBox.isSelected());

    restartDaemons();
  }
 public boolean isUserDefinedLibraryEnabled() {
   return userDefinedLibraryEnabled.isSelected();
 }
 @Override
 public void apply() throws ConfigurationException {
   mySettings.myAttachToSingleProcessWithoutDialog =
       myAttachToSingleProcessWithoutDialogBox.isSelected();
 }
 @Override
 public boolean isModified() {
   return myAttachToSingleProcessWithoutDialogBox.isSelected()
       != mySettings.myAttachToSingleProcessWithoutDialog;
 }
  private void initializeUI() {
    myTree = new Tree();
    myTreeBuilder = new CertificateTreeBuilder(myTree);

    // are not fully functional by now
    myCheckHostname.setVisible(false);
    myCheckValidityPeriod.setVisible(false);

    myTrustManager = CertificateManager.getInstance().getCustomTrustManager();
    // show newly added certificates
    myTrustManager.addListener(this);

    myTree.getEmptyText().setText("No certificates");
    myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    myTree.setRootVisible(false);
    // myTree.setShowsRootHandles(false);

    ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTree).disableUpDownActions();
    decorator
        .setAddAction(
            new AnActionButtonRunnable() {
              @Override
              public void run(AnActionButton button) {
                // show choose file dialog, add certificate
                FileChooser.chooseFile(
                    CERTIFICATE_DESCRIPTOR,
                    null,
                    null,
                    file -> {
                      String path = file.getPath();
                      X509Certificate certificate = CertificateUtil.loadX509Certificate(path);
                      if (certificate == null) {
                        Messages.showErrorDialog(
                            myRootPanel, "Malformed X509 server certificate", "Not Imported");
                      } else if (myCertificates.contains(certificate)) {
                        Messages.showWarningDialog(
                            myRootPanel, "Certificate already exists", "Not Imported");
                      } else {
                        myCertificates.add(certificate);
                        myTreeBuilder.addCertificate(certificate);
                        addCertificatePanel(certificate);
                        myTreeBuilder.selectCertificate(certificate);
                      }
                    });
              }
            })
        .setRemoveAction(
            new AnActionButtonRunnable() {
              @Override
              public void run(AnActionButton button) {
                // allow to delete several certificates at once
                for (X509Certificate certificate : myTreeBuilder.getSelectedCertificates(true)) {
                  myCertificates.remove(certificate);
                  myTreeBuilder.removeCertificate(certificate);
                }
                if (myCertificates.isEmpty()) {
                  showCard(EMPTY_PANEL);
                } else {
                  myTreeBuilder.selectFirstCertificate();
                }
              }
            });

    myTree.addTreeSelectionListener(
        new TreeSelectionListener() {
          @Override
          public void valueChanged(TreeSelectionEvent e) {
            X509Certificate certificate = myTreeBuilder.getFirstSelectedCertificate(true);
            if (certificate != null) {
              showCard(getCardName(certificate));
            }
          }
        });
    myCertificatesListPanel.add(decorator.createPanel(), BorderLayout.CENTER);
  }
 private void userDefinedLibraryEnabledChanged() {
   pathList.setEnabled(userDefinedLibraryEnabled.isSelected());
 }
  public void reset() {
    EditorSettingsExternalizable editorSettings = EditorSettingsExternalizable.getInstance();
    CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
    UISettings uiSettings = UISettings.getInstance();
    VcsApplicationSettings vcsSettings = VcsApplicationSettings.getInstance();

    // Display

    myCbSmoothScrolling.setSelected(editorSettings.isSmoothScrolling());

    // Brace highlighting

    myCbHighlightBraces.setSelected(codeInsightSettings.HIGHLIGHT_BRACES);
    myCbHighlightScope.setSelected(codeInsightSettings.HIGHLIGHT_SCOPE);
    myCbHighlightIdentifierUnderCaret.setSelected(
        codeInsightSettings.HIGHLIGHT_IDENTIFIER_UNDER_CARET);

    // Virtual space

    myCbUseSoftWrapsAtEditor.setSelected(
        editorSettings.isUseSoftWraps(SoftWrapAppliancePlaces.MAIN_EDITOR));
    myCbUseCustomSoftWrapIndent.setSelected(editorSettings.isUseCustomSoftWrapIndent());
    myCustomSoftWrapIndent.setText(Integer.toString(editorSettings.getCustomSoftWrapIndent()));
    myCbShowSoftWrapsOnlyOnCaretLine.setSelected(!editorSettings.isAllSoftWrapsShown());
    updateSoftWrapSettingsRepresentation();

    myCbVirtualSpace.setSelected(editorSettings.isVirtualSpace());
    myCbCaretInsideTabs.setSelected(editorSettings.isCaretInsideTabs());
    myCbVirtualPageAtBottom.setSelected(editorSettings.isAdditionalPageAtBottom());

    // Limits
    myClipboardContentLimitTextField.setText(Integer.toString(uiSettings.MAX_CLIPBOARD_CONTENTS));

    // Strip trailing spaces on save

    String stripTrailingSpaces = editorSettings.getStripTrailingSpaces();
    if (EditorSettingsExternalizable.STRIP_TRAILING_SPACES_NONE.equals(stripTrailingSpaces)) {
      myStripTrailingSpacesCombo.setSelectedItem(STRIP_NONE);
    } else if (EditorSettingsExternalizable.STRIP_TRAILING_SPACES_CHANGED.equals(
        stripTrailingSpaces)) {
      myStripTrailingSpacesCombo.setSelectedItem(STRIP_CHANGED);
    } else if (EditorSettingsExternalizable.STRIP_TRAILING_SPACES_WHOLE.equals(
        stripTrailingSpaces)) {
      myStripTrailingSpacesCombo.setSelectedItem(STRIP_ALL);
    }
    explainTrailingSpaces(stripTrailingSpaces);

    myCbEnsureBlankLineBeforeCheckBox.setSelected(editorSettings.isEnsureNewLineAtEOF());
    myCbShowQuickDocOnMouseMove.setSelected(editorSettings.isShowQuickDocOnMouseOverElement());
    myQuickDocDelayTextField.setText(
        Long.toString(editorSettings.getQuickDocOnMouseOverElementDelayMillis()));
    myQuickDocDelayTextField.setEnabled(editorSettings.isShowQuickDocOnMouseOverElement());
    myQuickDocDelayLabel.setEnabled(editorSettings.isShowQuickDocOnMouseOverElement());

    // Advanced mouse
    myCbEnableDnD.setSelected(editorSettings.isDndEnabled());
    myCbEnableWheelFontChange.setSelected(editorSettings.isWheelFontChangeEnabled());
    myCbHonorCamelHumpsWhenSelectingByClicking.setSelected(
        editorSettings.isMouseClickSelectionHonorsCamelWords());

    myRbPreferMovingCaret.setSelected(editorSettings.isRefrainFromScrolling());
    myRbPreferScrolling.setSelected(!editorSettings.isRefrainFromScrolling());

    myRecentFilesLimitField.setText(Integer.toString(uiSettings.RECENT_FILES_LIMIT));

    myCbRenameLocalVariablesInplace.setSelected(editorSettings.isVariableInplaceRenameEnabled());
    myPreselectCheckBox.setSelected(editorSettings.isPreselectRename());
    myShowInlineDialogForCheckBox.setSelected(editorSettings.isShowInlineLocalDialog());

    myShowNotificationAfterReformatCodeCheckBox.setSelected(
        editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_REFORMAT_CODE_ACTION);
    myShowNotificationAfterOptimizeImportsCheckBox.setSelected(
        editorSettings.getOptions().SHOW_NOTIFICATION_AFTER_OPTIMIZE_IMPORTS_ACTION);

    myShowLSTInGutterCheckBox.setSelected(vcsSettings.SHOW_LST_GUTTER_MARKERS);
    myShowWhitespacesModificationsInLSTGutterCheckBox.setSelected(
        vcsSettings.SHOW_WHITESPACES_IN_LST);
    myShowWhitespacesModificationsInLSTGutterCheckBox.setEnabled(
        myShowLSTInGutterCheckBox.isSelected());

    myErrorHighlightingPanel.reset();

    RichCopySettings settings = RichCopySettings.getInstance();
    myCbEnableRichCopyByDefault.setSelected(settings.isEnabled());
    myRichCopyColorSchemeComboBox.removeAllItems();
    EditorColorsScheme[] schemes = EditorColorsManager.getInstance().getAllSchemes();
    myRichCopyColorSchemeComboBox.addItem(RichCopySettings.ACTIVE_GLOBAL_SCHEME_MARKER);
    for (EditorColorsScheme scheme : schemes) {
      myRichCopyColorSchemeComboBox.addItem(scheme.getName());
    }
    String toSelect = settings.getSchemeName();
    if (!StringUtil.isEmpty(toSelect)) {
      myRichCopyColorSchemeComboBox.setSelectedItem(toSelect);
    }
  }
 @Override
 public void reset() {
   myAttachToSingleProcessWithoutDialogBox.setSelected(
       mySettings.myAttachToSingleProcessWithoutDialog);
 }
  public CloudAttachDialog(@NotNull Project project) {
    super(project, true);

    myProject = project;
    init();
    initValidation();
    setTitle(GctBundle.getString("clouddebug.attachtitle"));
    setOKButtonText(GctBundle.getString("clouddebug.attach"));
    mySyncStashCheckbox.setVisible(false);
    mySyncStashCheckbox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            if (mySyncStashCheckbox.isVisible()) {
              myWarningLabel.setVisible(!mySyncStashCheckbox.isSelected());
              myWarningLabel2.setVisible(!mySyncStashCheckbox.isSelected());
              myInfoPanel.setVisible(mySyncStashCheckbox.isSelected());
              if (mySyncStashCheckbox.isSelected()) {
                setOKButtonText(
                    isContinued()
                        ? GctBundle.getString("clouddebug.continuesession")
                        : GctBundle.getString("clouddebug.attach"));
              } else {
                setOKButtonText(
                    isContinued()
                        ? GctBundle.getString("clouddebug.continueanyway")
                        : GctBundle.getString("clouddebug.attach.anyway"));
              }
            }
          }
        });

    myWarningLabel.setVisible(false);
    myWarningLabel.setFont(
        new Font(
            myWarningLabel.getFont().getName(), Font.BOLD, myWarningLabel.getFont().getSize() - 1));
    myWarningLabel.setForeground(JBColor.RED);
    myWarningLabel2.setVisible(false);
    myWarningLabel2.setFont(
        new Font(
            myWarningLabel2.getFont().getName(),
            Font.PLAIN,
            myWarningLabel.getFont().getSize() - 1));
    myWarningLabel2.setText(GctBundle.getString("clouddebug.sourcedoesnotmatch"));

    myInfoPanel.setFont(
        new Font(
            myWarningLabel2.getFont().getName(),
            Font.PLAIN,
            myWarningLabel.getFont().getSize() - 1));
    Border paddingBorder = BorderFactory.createEmptyBorder(2, 0, 2, 0);
    myInfoPanel.setBorder(paddingBorder);

    Window myWindow = getWindow();
    if (myWindow != null) {
      myWindow.setPreferredSize(new Dimension(355, 175));
    }
    BasicAction.saveAll();

    myWireup = new ProjectDebuggeeBinding(myElysiumProjectId, myDebuggeeTarget);
    myDebuggeeTarget.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            buildResult();
            checkSyncStashState();
            setOKActionEnabled(doValidate() == null);
          }
        });

    setOKActionEnabled(isContinued() || doValidate() == null);
  }
 @Override
 public boolean isModified(CodeStyleSettings settings) {
   return myEnabled.isSelected() != settings.getCustomSettings(EditorConfigSettings.class).ENABLED;
 }
Exemplo n.º 27
0
  protected FontOptions(@NotNull ColorAndFontOptions options, final String title) {
    setLayout(new MigLayout("ins 0, gap 5, flowx"));
    Insets borderInsets =
        new Insets(
            IdeBorderFactory.TITLED_BORDER_TOP_INSET,
            IdeBorderFactory.TITLED_BORDER_LEFT_INSET,
            0,
            IdeBorderFactory.TITLED_BORDER_RIGHT_INSET);
    setBorder(IdeBorderFactory.createTitledBorder(title, false, borderInsets));
    myOptions = options;
    add(myOnlyMonospacedCheckBox, "sgx b, sx 2");

    add(new JLabel(ApplicationBundle.message("primary.font")), "newline, ax right");
    add(myPrimaryCombo, "sgx b");
    add(new JLabel(ApplicationBundle.message("editbox.font.size")), "gapleft 20");
    add(myEditorFontSizeField);
    add(new JLabel(ApplicationBundle.message("editbox.line.spacing")), "gapleft 20");
    add(myLineSpacingField);

    add(
        new JLabel(
            ApplicationBundle.message("label.fallback.fonts.list.description"),
            MessageType.INFO.getDefaultIcon(),
            SwingConstants.LEFT),
        "newline, sx 5");
    add(myUseSecondaryFontCheckbox, "newline, ax right");
    add(mySecondaryCombo, "sgx b");
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0));
    myEnableLigaturesCheckbox.setBorder(null);
    panel.add(myEnableLigaturesCheckbox);
    myLigaturesInfoLinkLabel =
        new LinkLabel<Void>(
            ApplicationBundle.message("ligatures.more.info"),
            null,
            new LinkListener<Void>() {
              @Override
              public void linkSelected(LinkLabel aSource, Void aLinkData) {
                BrowserUtil.browse(
                    "https://confluence.jetbrains.com/display/IDEADEV/Support+for+Ligatures+in+Editor");
              }
            });
    myLigaturesInfoLinkLabel.setBorder(new EmptyBorder(0, 5, 0, 0));
    panel.add(myLigaturesInfoLinkLabel);
    add(panel, "newline, sx 2");

    myOnlyMonospacedCheckBox.setBorder(null);
    myUseSecondaryFontCheckbox.setBorder(null);
    mySecondaryCombo.setEnabled(false);

    myOnlyMonospacedCheckBox.setSelected(
        EditorColorsManager.getInstance().isUseOnlyMonospacedFonts());
    myOnlyMonospacedCheckBox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            EditorColorsManager.getInstance()
                .setUseOnlyMonospacedFonts(myOnlyMonospacedCheckBox.isSelected());
            myPrimaryCombo.setMonospacedOnly(myOnlyMonospacedCheckBox.isSelected());
            mySecondaryCombo.setMonospacedOnly(myOnlyMonospacedCheckBox.isSelected());
          }
        });
    myPrimaryCombo.setMonospacedOnly(myOnlyMonospacedCheckBox.isSelected());
    myPrimaryCombo.setRenderer(RENDERER);

    mySecondaryCombo.setMonospacedOnly(myOnlyMonospacedCheckBox.isSelected());
    mySecondaryCombo.setRenderer(RENDERER);

    myUseSecondaryFontCheckbox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            mySecondaryCombo.setEnabled(myUseSecondaryFontCheckbox.isSelected());
            syncFontFamilies();
          }
        });
    ItemListener itemListener =
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              syncFontFamilies();
            }
          }
        };
    myPrimaryCombo.addItemListener(itemListener);
    mySecondaryCombo.addItemListener(itemListener);

    ActionListener actionListener =
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            syncFontFamilies();
          }
        };
    myPrimaryCombo.addActionListener(actionListener);
    mySecondaryCombo.addActionListener(actionListener);

    myEditorFontSizeField
        .getDocument()
        .addDocumentListener(
            new DocumentAdapter() {
              @Override
              public void textChanged(DocumentEvent event) {
                if (myIsInSchemeChange || !SwingUtilities.isEventDispatchThread()) return;
                String selectedFont = myPrimaryCombo.getFontName();
                if (selectedFont != null) {
                  FontPreferences fontPreferences = getFontPreferences();
                  fontPreferences.register(selectedFont, getFontSizeFromField());
                }
                updateDescription(true);
              }
            });
    myEditorFontSizeField.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() != KeyEvent.VK_UP && e.getKeyCode() != KeyEvent.VK_DOWN) return;
            boolean up = e.getKeyCode() == KeyEvent.VK_UP;
            try {
              int value = Integer.parseInt(myEditorFontSizeField.getText());
              value += (up ? 1 : -1);
              value =
                  Math.min(
                      OptionsConstants.MAX_EDITOR_FONT_SIZE,
                      Math.max(OptionsConstants.MIN_EDITOR_FONT_SIZE, value));
              myEditorFontSizeField.setText(String.valueOf(value));
            } catch (NumberFormatException ignored) {
            }
          }
        });

    myLineSpacingField
        .getDocument()
        .addDocumentListener(
            new DocumentAdapter() {
              @Override
              public void textChanged(DocumentEvent event) {
                if (myIsInSchemeChange) return;
                float lineSpacing = getLineSpacingFromField();
                if (getLineSpacing() != lineSpacing) {
                  setCurrentLineSpacing(lineSpacing);
                }
                updateDescription(true);
              }
            });
    myLineSpacingField.addKeyListener(
        new KeyAdapter() {
          @Override
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() != KeyEvent.VK_UP && e.getKeyCode() != KeyEvent.VK_DOWN) return;
            boolean up = e.getKeyCode() == KeyEvent.VK_UP;
            try {
              float value = Float.parseFloat(myLineSpacingField.getText());
              value += (up ? 1 : -1) * .1F;
              value =
                  Math.min(
                      OptionsConstants.MAX_EDITOR_LINE_SPACING,
                      Math.max(OptionsConstants.MIN_EDITOR_LINE_SPACING, value));
              myLineSpacingField.setText(String.format(Locale.ENGLISH, "%.1f", value));
            } catch (NumberFormatException ignored) {
            }
          }
        });
    myEnableLigaturesCheckbox.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            getFontPreferences().setUseLigatures(myEnableLigaturesCheckbox.isSelected());
          }
        });
  }
 @Override
 public void reset(CodeStyleSettings settings) {
   myEnabled.setSelected(settings.getCustomSettings(EditorConfigSettings.class).ENABLED);
 }
  private void updateControls() {
    myBrowserSelector.getMainComponent().setEnabled(myBrowserRadioButton.isSelected());

    myPlayerTextWithBrowse.setEnabled(myPlayerRadioButton.isSelected());
    myNewPlayerInstanceCheckBox.setEnabled(myPlayerRadioButton.isSelected());
  }