本文整理汇总了Java中com.intellij.find.FindModel.setRegularExpressions方法的典型用法代码示例。如果您正苦于以下问题:Java FindModel.setRegularExpressions方法的具体用法?Java FindModel.setRegularExpressions怎么用?Java FindModel.setRegularExpressions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.find.FindModel
的用法示例。
在下文中一共展示了FindModel.setRegularExpressions方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initModelBySetings
import com.intellij.find.FindModel; //导入方法依赖的package包/类
@Override
public void initModelBySetings(@NotNull FindModel model){
model.setCaseSensitive(isCaseSensitive());
model.setForward(isForward());
model.setFromCursor(isFromCursor());
model.setGlobal(isGlobal());
model.setRegularExpressions(isRegularExpressions());
model.setWholeWordsOnly(isWholeWordsOnly());
FindModel.SearchContext searchContext = isInCommentsOnly() ?
FindModel.SearchContext.IN_COMMENTS :
isInStringLiteralsOnly() ?
FindModel.SearchContext.IN_STRING_LITERALS :
isExceptComments() ?
FindModel.SearchContext.EXCEPT_COMMENTS :
isExceptStringLiterals() ?
FindModel.SearchContext.EXCEPT_STRING_LITERALS :
isExceptCommentsAndLiterals() ?
FindModel.SearchContext.EXCEPT_COMMENTS_AND_STRING_LITERALS :
FindModel.SearchContext.ANY;
model.setSearchContext(searchContext);
model.setWithSubdirectories(isWithSubdirectories());
model.setFileFilter(FILE_MASK);
model.setCustomScopeName(FIND_SCOPE);
}
示例2: initModelBySetings
import com.intellij.find.FindModel; //导入方法依赖的package包/类
@Override
public void initModelBySetings(@Nonnull FindModel model){
model.setCaseSensitive(isCaseSensitive());
model.setForward(isForward());
model.setFromCursor(isFromCursor());
model.setGlobal(isGlobal());
model.setRegularExpressions(isRegularExpressions());
model.setWholeWordsOnly(isWholeWordsOnly());
FindModel.SearchContext searchContext = isInCommentsOnly() ?
FindModel.SearchContext.IN_COMMENTS :
isInStringLiteralsOnly() ?
FindModel.SearchContext.IN_STRING_LITERALS :
isExceptComments() ?
FindModel.SearchContext.EXCEPT_COMMENTS :
isExceptStringLiterals() ?
FindModel.SearchContext.EXCEPT_STRING_LITERALS :
isExceptCommentsAndLiterals() ?
FindModel.SearchContext.EXCEPT_COMMENTS_AND_STRING_LITERALS :
FindModel.SearchContext.ANY;
model.setSearchContext(searchContext);
model.setWithSubdirectories(isWithSubdirectories());
model.setFileFilter(FILE_MASK);
model.setCustomScopeName(FIND_SCOPE);
}
示例3: findExpressionOccurrences
import com.intellij.find.FindModel; //导入方法依赖的package包/类
public PsiExpression[] findExpressionOccurrences() {
if (myMainOccurence instanceof PsiLiteralExpression && !myMainOccurence.isPhysical()) {
final FindManager findManager = FindManager.getInstance(getScope().getProject());
final FindModel findModel = (FindModel)findManager.getFindInFileModel().clone();
findModel.setCaseSensitive(true);
findModel.setRegularExpressions(false);
String value = StringUtil.stripQuotesAroundValue(myMainOccurence.getText());
if (value.length() > 0) {
findModel.setStringToFind(value);
final List<PsiExpression> results = new ArrayList<PsiExpression>();
final PsiFile file = getScope().getContainingFile();
final String text = getScope().getText();
final int offset = getScope().getTextRange().getStartOffset();
FindResult result = findManager.findString(text, 0, findModel);
final Set<PsiLiteralExpression> literals = new HashSet<PsiLiteralExpression>();
while (result.isStringFound()) {
final int startOffset = offset + result.getStartOffset();
final int endOffset = result.getEndOffset();
final PsiLiteralExpression literalExpression =
PsiTreeUtil.getParentOfType(file.findElementAt(startOffset), PsiLiteralExpression.class);
if (literalExpression != null && !literals.contains(literalExpression)) { //enum. occurrences inside string literals
final PsiExpression expression =
IntroduceVariableBase.getSelectedExpression(file.getProject(), file, startOffset, offset + endOffset);
if (expression != null && IntroduceVariableBase.getErrorMessage(expression) == null) {
results.add(expression);
literals.add(literalExpression);
}
}
result = findManager.findString(text, endOffset, findModel);
}
return results.toArray(new PsiExpression[results.size()]);
}
}
return CodeInsightUtil.findExpressionOccurrences(myScope, myMainOccurence);
}
示例4: setSelected
import com.intellij.find.FindModel; //导入方法依赖的package包/类
@Override
protected void setSelected(@NotNull SearchSession session, boolean selected) {
FindModel findModel = session.getFindModel();
findModel.setRegularExpressions(selected);
if (selected) {
findModel.setWholeWordsOnly(false);
}
FindSettings.getInstance().setLocalRegularExpressions(selected);
}
示例5: createFindModel
import com.intellij.find.FindModel; //导入方法依赖的package包/类
private static FindModel createFindModel(FindManager findManager, String selectedString, String replaceWith) {
FindModel findModel = (FindModel)findManager.getFindInProjectModel().clone();
findModel.setStringToFind(selectedString);
findModel.setStringToReplace(replaceWith);
findModel.setReplaceState(true);
findModel.setPromptOnReplace(true);
findModel.setCaseSensitive(true);
findModel.setRegularExpressions(false);
return findModel;
}
示例6: testFindInLiteralToSkipQuotes
import com.intellij.find.FindModel; //导入方法依赖的package包/类
public void testFindInLiteralToSkipQuotes() {
FindModel findModel = FindManagerTestUtils.configureFindModel("^done$");
findModel.setRegularExpressions(true);
findModel.setInStringLiteralsOnly(true);
findModel.setInCommentsOnly(false);
String text = "def n = \"\"\"done\"\"\"\n def n = /done/\n def n = \"done\"\n def n = \"done2\"";
FindManagerTestUtils.runFindForwardAndBackward(myFindManager, findModel, text, "groovy");
}
示例7: setSelected
import com.intellij.find.FindModel; //导入方法依赖的package包/类
@Override
public void setSelected(AnActionEvent e, boolean state) {
final FindModel findModel = getEditorSearchComponent().getFindModel();
findModel.setRegularExpressions(state);
if (state) {
findModel.setWholeWordsOnly(false);
}
FindSettings.getInstance().setLocalRegularExpressions(state);
}
示例8: initModelBySetings
import com.intellij.find.FindModel; //导入方法依赖的package包/类
@Override
public void initModelBySetings(FindModel model){
model.setCaseSensitive(isCaseSensitive());
model.setForward(isForward());
model.setFromCursor(isFromCursor());
model.setGlobal(isGlobal());
model.setRegularExpressions(isRegularExpressions());
model.setWholeWordsOnly(isWholeWordsOnly());
model.setInCommentsOnly(isInCommentsOnly());
model.setInStringLiteralsOnly(isInStringLiteralsOnly());
model.setWithSubdirectories(isWithSubdirectories());
model.setFileFilter(FILE_MASK);
model.setCustomScopeName(FIND_SCOPE);
}
示例9: setSelected
import com.intellij.find.FindModel; //导入方法依赖的package包/类
@Override
protected void setSelected(@Nonnull SearchSession session, boolean selected) {
FindModel findModel = session.getFindModel();
findModel.setRegularExpressions(selected);
if (selected) {
findModel.setWholeWordsOnly(false);
}
FindSettings.getInstance().setLocalRegularExpressions(selected);
}
示例10: createFindModel
import com.intellij.find.FindModel; //导入方法依赖的package包/类
FindModel createFindModel(FindManager findManager) {
FindModel clone = (FindModel) findManager.getFindInFileModel().clone();
clone.setFindAll(true);
clone.setFromCursor(true);
clone.setForward(true);
clone.setWholeWordsOnly(false);
clone.setCaseSensitive(true);
clone.setRegularExpressions(true);
clone.setWholeWordsOnly(true);
clone.setStringToFind(FIND_REGEXP);
return clone;
}
示例11: applyTo
import com.intellij.find.FindModel; //导入方法依赖的package包/类
private void applyTo(@NotNull FindModel model, boolean findAll) {
model.setCaseSensitive(myCbCaseSensitive.isSelected());
if (model.isReplaceState()) {
model.setPreserveCase(myCbPreserveCase.isSelected());
}
model.setWholeWordsOnly(myCbWholeWordsOnly.isSelected());
String selectedSearchContextInUi = (String)mySearchContext.getSelectedItem();
FindModel.SearchContext searchContext = FindModel.SearchContext.ANY;
if (FindBundle.message("find.context.in.literals.scope.label").equals(selectedSearchContextInUi)) {
searchContext = FindModel.SearchContext.IN_STRING_LITERALS;
}
else if (FindBundle.message("find.context.in.comments.scope.label").equals(selectedSearchContextInUi)) {
searchContext = FindModel.SearchContext.IN_COMMENTS;
}
else if (FindBundle.message("find.context.except.comments.scope.label").equals(selectedSearchContextInUi)) {
searchContext = FindModel.SearchContext.EXCEPT_COMMENTS;
}
else if (FindBundle.message("find.context.except.literals.scope.label").equals(selectedSearchContextInUi)) {
searchContext = FindModel.SearchContext.EXCEPT_STRING_LITERALS;
} else if (FindBundle.message("find.context.except.comments.and.literals.scope.label").equals(selectedSearchContextInUi)) {
searchContext = FindModel.SearchContext.EXCEPT_COMMENTS_AND_STRING_LITERALS;
}
model.setSearchContext(searchContext);
model.setRegularExpressions(myCbRegularExpressions.isSelected());
String stringToFind = getStringToFind();
model.setStringToFind(stringToFind);
if (model.isReplaceState()){
model.setPromptOnReplace(true);
model.setReplaceAll(false);
String stringToReplace = getStringToReplace();
model.setStringToReplace(StringUtil.convertLineSeparators(stringToReplace));
}
if (!model.isMultipleFiles()){
model.setForward(myRbForward.isSelected());
model.setFromCursor(myRbFromCursor.isSelected());
model.setGlobal(myRbGlobal.isSelected());
}
else{
if (myCbToOpenInNewTab != null){
model.setOpenInNewTab(myCbToOpenInNewTab.isSelected());
}
model.setProjectScope(myRbProject.isSelected());
model.setDirectoryName(null);
model.setModuleName(null);
model.setCustomScopeName(null);
model.setCustomScope(null);
model.setCustomScope(false);
if (myRbDirectory.isSelected()) {
String directory = getDirectory();
model.setDirectoryName(directory == null ? "" : directory);
model.setWithSubdirectories(myCbWithSubdirectories.isSelected());
}
else if (myRbModule.isSelected()) {
model.setModuleName((String)myModuleComboBox.getSelectedItem());
}
else if (myRbCustomScope.isSelected()) {
SearchScope selectedScope = myScopeCombo.getSelectedScope();
String customScopeName = selectedScope == null ? null : selectedScope.getDisplayName();
model.setCustomScopeName(customScopeName);
model.setCustomScope(selectedScope == null ? null : selectedScope);
model.setCustomScope(true);
}
}
model.setFindAll(findAll);
String mask = getFileTypeMask();
model.setFileFilter(mask);
}
示例12: applyTo
import com.intellij.find.FindModel; //导入方法依赖的package包/类
private void applyTo(@NotNull FindModel model, boolean findAll) {
model.setCaseSensitive(myCbCaseSensitive.isSelected());
if (model.isReplaceState()) {
model.setPreserveCase(myCbPreserveCase.isSelected());
}
model.setWholeWordsOnly(myCbWholeWordsOnly.isSelected());
model.setInStringLiteralsOnly(myCbInStringLiteralsOnly.isSelected());
model.setInCommentsOnly(myCbInCommentsOnly.isSelected());
model.setRegularExpressions(myCbRegularExpressions.isSelected());
String stringToFind = getStringToFind();
model.setStringToFind(stringToFind);
if (model.isReplaceState()){
model.setPromptOnReplace(true);
model.setReplaceAll(false);
String stringToReplace = getStringToReplace();
model.setStringToReplace(StringUtil.convertLineSeparators(stringToReplace));
}
if (!model.isMultipleFiles()){
model.setForward(myRbForward.isSelected());
model.setFromCursor(myRbFromCursor.isSelected());
model.setGlobal(myRbGlobal.isSelected());
}
else{
if (myCbToOpenInNewTab != null){
model.setOpenInNewTab(myCbToOpenInNewTab.isSelected());
}
model.setProjectScope(myRbProject.isSelected());
model.setDirectoryName(null);
model.setModuleName(null);
model.setCustomScopeName(null);
model.setCustomScope(null);
model.setCustomScope(false);
if (myRbDirectory.isSelected()) {
String directory = getDirectory();
model.setDirectoryName(directory == null ? "" : directory);
model.setWithSubdirectories(myCbWithSubdirectories.isSelected());
}
else if (myRbModule.isSelected()) {
model.setModuleName((String)myModuleComboBox.getSelectedItem());
}
else if (myRbCustomScope.isSelected()) {
SearchScope selectedScope = myScopeCombo.getSelectedScope();
String customScopeName = selectedScope == null ? null : selectedScope.getDisplayName();
model.setCustomScopeName(customScopeName);
model.setCustomScope(selectedScope == null ? null : selectedScope);
model.setCustomScope(true);
}
}
model.setFindAll(findAll);
String mask = getFileTypeMask();
model.setFileFilter(mask);
}
示例13: getNextSymbolOffset
import com.intellij.find.FindModel; //导入方法依赖的package包/类
private int getNextSymbolOffset(boolean searchForward, Project project) {
_editor.getSelectionModel().selectWordAtCaret(false);
int symbolStart = _editor.getSelectionModel().getSelectionStart();
int symbolEnd = _editor.getSelectionModel().getSelectionEnd();
if (symbolStart >= 0 && symbolEnd > symbolStart) {
String symbol = _editor.getDocument().getText(new TextRange(symbolStart, symbolEnd));
FindManager findManager = FindManager.getInstance(project);
FindModel findModel = (FindModel) findManager.getFindInFileModel().clone();
findModel.setFindAll(false);
findModel.setFromCursor(true);
findModel.setForward(searchForward);
findModel.setRegularExpressions(false);
findModel.setWholeWordsOnly(true);
findModel.setCaseSensitive(true);
findModel.setSearchHighlighters(false);
findModel.setPreserveCase(false);
findModel.setStringToFind(symbol);
int startOffset = _editor.getCaretModel().getOffset();
if (searchForward) {
startOffset++;
}
FindResult findResult = findManager.findString(_editor.getDocument().getText(), startOffset, findModel);
//fix errors in Appcode, which is the findManager.findString return 0, when string not found.
if (findResult.getStartOffset() == 0) {
String potentialSymbol = _editor.getDocument().getText(new TextRange(0, symbol.length()));
if (!potentialSymbol.equals(symbol)) {
return -1;
}
}
return findResult.getStartOffset();
}
return -1;
}