Exemple #1
0
  private void updateResults(final boolean allowedToChangedEditorSelection) {
    final String text = myFindModel.getStringToFind();
    if (text.length() == 0) {
      nothingToSearchFor();
    } else {

      if (myFindModel.isRegularExpressions()) {
        try {
          Pattern.compile(text);
        } catch (Exception e) {
          setNotFoundBackground();
          myClickToHighlightLabel.setVisible(false);
          mySearchResults.clear();
          myMatchInfoLabel.setText("Incorrect regular expression");
          return;
        }
      }

      final FindManager findManager = FindManager.getInstance(myProject);
      if (allowedToChangedEditorSelection) {
        findManager.setFindWasPerformed();
        FindModel copy = new FindModel();
        copy.copyFrom(myFindModel);
        copy.setReplaceState(false);
        findManager.setFindNextModel(copy);
      }
      if (myLivePreviewController != null) {
        myLivePreviewController.updateInBackground(myFindModel, allowedToChangedEditorSelection);
      }
    }
  }
Exemple #2
0
 private static void syncFindModels(FindModel to, FindModel from) {
   to.setCaseSensitive(from.isCaseSensitive());
   to.setWholeWordsOnly(from.isWholeWordsOnly());
   to.setRegularExpressions(from.isRegularExpressions());
   to.setSearchContext(from.getSearchContext());
   if (from.isReplaceState()) {
     to.setPreserveCase(from.isPreserveCase());
   }
 }