Search in sources :

Example 1 with FindSettings

use of com.intellij.find.FindSettings in project intellij-community by JetBrains.

the class SearchDialog method doOKAction.

// Performs ok action
@Override
protected void doOKAction() {
    SearchScope selectedScope = getSelectedScope();
    if (selectedScope == null)
        return;
    myDoingOkAction = true;
    boolean result = isValid();
    myDoingOkAction = false;
    if (!result)
        return;
    myAlarm.cancelAllRequests();
    super.doOKAction();
    if (!myRunFindActionOnClose)
        return;
    final FindSettings findSettings = FindSettings.getInstance();
    findSettings.setDefaultScopeName(selectedScope.getDisplayName());
    findSettings.setShowResultsInSeparateView(openInNewTab.isSelected());
    try {
        final Configuration configuration = model.getConfig();
        if (model.getShadowConfig() != null) {
            if (model.getShadowConfig().isPredefined()) {
                configuration.setName(model.getShadowConfig().getName());
            }
        //else {
        //  // user template, save it
        //  setValuesToConfig(model.getShadowConfig());
        //}
        }
        filterOutUnusedVariableConstraints(configuration);
        existingTemplatesComponent.addConfigurationToHistory(configuration);
        startSearching();
    } catch (MalformedPatternException ex) {
        reportMessage("this.pattern.is.malformed.message", searchCriteriaEdit, ex.getMessage());
    }
}
Also used : GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) SearchScope(com.intellij.psi.search.SearchScope) FindSettings(com.intellij.find.FindSettings)

Example 2 with FindSettings

use of com.intellij.find.FindSettings in project intellij-community by JetBrains.

the class FindUIHelper method updateFindSettings.

void updateFindSettings() {
    FindSettings findSettings = FindSettings.getInstance();
    findSettings.setCaseSensitive(myModel.isCaseSensitive());
    if (myModel.isReplaceState()) {
        findSettings.setPreserveCase(myModel.isPreserveCase());
    }
    findSettings.setWholeWordsOnly(myModel.isWholeWordsOnly());
    boolean saveContextBetweenRestarts = false;
    findSettings.setInStringLiteralsOnly(saveContextBetweenRestarts && myModel.isInStringLiteralsOnly());
    findSettings.setInCommentsOnly(saveContextBetweenRestarts && myModel.isInCommentsOnly());
    findSettings.setExceptComments(saveContextBetweenRestarts && myModel.isExceptComments());
    findSettings.setExceptStringLiterals(saveContextBetweenRestarts && myModel.isExceptStringLiterals());
    findSettings.setExceptCommentsAndLiterals(saveContextBetweenRestarts && myModel.isExceptCommentsAndStringLiterals());
    findSettings.setRegularExpressions(myModel.isRegularExpressions());
    if (!myModel.isMultipleFiles()) {
        findSettings.setForward(myModel.isForward());
        findSettings.setFromCursor(myModel.isFromCursor());
        findSettings.setGlobal(myModel.isGlobal());
    } else {
        String directoryName = myModel.getDirectoryName();
        if (directoryName != null && !directoryName.isEmpty()) {
            findSettings.setWithSubdirectories(myModel.isWithSubdirectories());
        } else if (!StringUtil.isEmpty(myModel.getModuleName())) {
        //do nothing here
        } else if (myModel.getCustomScopeName() != null) {
            findSettings.setCustomScope(myModel.getCustomScopeName());
        }
    }
    findSettings.setFileMask(myModel.getFileFilter());
}
Also used : FindSettings(com.intellij.find.FindSettings)

Example 3 with FindSettings

use of com.intellij.find.FindSettings in project intellij-community by JetBrains.

the class AbstractFindUsagesDialog method doOKAction.

@Override
protected void doOKAction() {
    if (!shouldDoOkAction())
        return;
    FindSettings settings = FindSettings.getInstance();
    if (myScopeCombo != null) {
        settings.setDefaultScopeName(myScopeCombo.getSelectedScopeName());
    }
    if (mySearchForTextOccurrencesAvailable && myCbToSearchForTextOccurrences != null && myCbToSearchForTextOccurrences.isEnabled()) {
        myFindUsagesOptions.isSearchForTextOccurrences = myCbToSearchForTextOccurrences.isSelected();
    }
    if (myCbToSkipResultsWhenOneUsage != null) {
        settings.setSkipResultsWithOneUsage(isSkipResultsWhenOneUsage());
    }
    super.doOKAction();
}
Also used : FindSettings(com.intellij.find.FindSettings)

Aggregations

FindSettings (com.intellij.find.FindSettings)3 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)1 SearchScope (com.intellij.psi.search.SearchScope)1