<commit_before>/*
 * Copyright (c) 2000-2006 JetBrains s.r.o. All Rights Reserved.
 */
package com.intellij.find.findUsages;

import com.intellij.find.FindBundle;
import com.intellij.find.FindSettings;
import com.intellij.ide.util.scopeChooser.ScopeChooserCombo;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.IconLoader;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.SearchScope;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.StateRestoringCheckBox;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * @author peter
 */
public abstract class AbstractFindUsagesDialog extends DialogWrapper {
  protected final Project myProject;
  protected final FindUsagesOptions myFindUsagesOptions;

  private final boolean myToShowInNewTab;
  private final boolean myIsShowInNewTabEnabled;
  protected final boolean myIsShowInNewTabVisible;

  private final boolean mySearchForTextOccurencesAvailable;

  private final boolean mySearchInLibrariesAvailable;

  private JCheckBox myCbToOpenInNewTab;

  protected StateRestoringCheckBox myCbToSearchForTextOccurences;
  protected JCheckBox myCbToSkipResultsWhenOneUsage;

  private ActionListener myUpdateAction;

  private ScopeChooserCombo myScopeCombo;

  protected AbstractFindUsagesDialog(Project project,
                                     FindUsagesOptions findUsagesOptions,
                                     boolean toShowInNewTab,
                                     boolean mustOpenInNewTab,
                                     boolean isSingleFile,
                                     boolean searchForTextOccurencesAvailable,
                                     boolean searchInLibrariesAvailable) {
    super(project, true);
    myProject = project;
    myFindUsagesOptions = findUsagesOptions;
    myToShowInNewTab = toShowInNewTab;
    myIsShowInNewTabEnabled = mustOpenInNewTab;
    myIsShowInNewTabVisible = !isSingleFile;
    mySearchForTextOccurencesAvailable = searchForTextOccurencesAvailable;
    mySearchInLibrariesAvailable = searchInLibrariesAvailable;

    myUpdateAction = new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        update();
      }
    };

    setButtonsMargin(null);

    setOKButtonText(FindBundle.message("find.dialog.find.button"));
    setOKButtonIcon(IconLoader.getIcon("/actions/find.png"));
    setTitle(isSingleFile ? FindBundle.message("find.usages.in.file.dialog.title") : FindBundle.message("find.usages.dialog.title"));

  }

  protected Action[] createActions() {
    return new Action[]{getOKAction(), getCancelAction(), getHelpAction()};
  }

  protected boolean isInFileOnly() {
    return !myIsShowInNewTabVisible;
  }<commit_msg>enable "show in new tab"<commit_after>/*
 * Copyright (c) 2000-2006 JetBrains s.r.o. All Rights Reserved.
 */
package com.intellij.find.findUsages;

import com.intellij.find.FindBundle;
import com.intellij.find.FindSettings;
import com.intellij.ide.util.scopeChooser.ScopeChooserCombo;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.IconLoader;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.SearchScope;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.StateRestoringCheckBox;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * @author peter
 */
public abstract class AbstractFindUsagesDialog extends DialogWrapper {
  protected final Project myProject;
  protected final FindUsagesOptions myFindUsagesOptions;

  private final boolean myToShowInNewTab;
  private final boolean myIsShowInNewTabEnabled;
  protected final boolean myIsShowInNewTabVisible;

  private final boolean mySearchForTextOccurencesAvailable;

  private final boolean mySearchInLibrariesAvailable;

  private JCheckBox myCbToOpenInNewTab;

  protected StateRestoringCheckBox myCbToSearchForTextOccurences;
  protected JCheckBox myCbToSkipResultsWhenOneUsage;

  private ActionListener myUpdateAction;

  private ScopeChooserCombo myScopeCombo;

  protected AbstractFindUsagesDialog(Project project,
                                     FindUsagesOptions findUsagesOptions,
                                     boolean toShowInNewTab,
                                     boolean mustOpenInNewTab,
                                     boolean isSingleFile,
                                     boolean searchForTextOccurencesAvailable,
                                     boolean searchInLibrariesAvailable) {
    super(project, true);
    myProject = project;
    myFindUsagesOptions = findUsagesOptions;
    myToShowInNewTab = toShowInNewTab;
    myIsShowInNewTabEnabled = !mustOpenInNewTab;
    myIsShowInNewTabVisible = !isSingleFile;
    mySearchForTextOccurencesAvailable = searchForTextOccurencesAvailable;
    mySearchInLibrariesAvailable = searchInLibrariesAvailable;

    myUpdateAction = new ActionListener() {
      public void actionPerformed(ActionEvent event) {
        update();
      }
    };

    setButtonsMargin(null);

    setOKButtonText(FindBundle.message("find.dialog.find.button"));
    setOKButtonIcon(IconLoader.getIcon("/actions/find.png"));
    setTitle(isSingleFile ? FindBundle.message("find.usages.in.file.dialog.title") : FindBundle.message("find.usages.dialog.title"));

  }

  protected Action[] createActions() {
    return new Action[]{getOKAction(), getCancelAction(), getHelpAction()};
  }

  protected boolean isInFileOnly() {
    return !myIsShowInNewTabVisible;
  }
{'fraction_non_alphanumeric': 0.07632933104631218, 'fraction_numerical': 0.0027444253859348197, 'mean_word_length': 3.6986301369863015, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3402530', 'n_tokens_mistral': 1662, 'n_tokens_neox': 1606, 'n_words': 304}