本文整理汇总了Java中com.intellij.psi.codeStyle.MinusculeMatcher类的典型用法代码示例。如果您正苦于以下问题:Java MinusculeMatcher类的具体用法?Java MinusculeMatcher怎么用?Java MinusculeMatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MinusculeMatcher类属于com.intellij.psi.codeStyle包,在下文中一共展示了MinusculeMatcher类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getQualifiedNameMatcher
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
private static Condition<PsiMember> getQualifiedNameMatcher(String completePattern) {
final Condition<PsiMember> qualifiedMatcher;
if (completePattern.contains(".")) {
final MinusculeMatcher matcher = new MinusculeMatcher("*" + StringUtil.replace(completePattern, ".", ".*"), NameUtil.MatchingCaseSensitivity.NONE);
qualifiedMatcher = new Condition<PsiMember>() {
@Override
public boolean value(PsiMember member) {
String qualifiedName = PsiUtil.getMemberQualifiedName(member);
return qualifiedName != null && matcher.matches(qualifiedName);
}
};
} else {
//noinspection unchecked
qualifiedMatcher = Condition.TRUE;
}
return qualifiedMatcher;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DefaultSymbolNavigationContributor.java
示例2: appendColoredFragmentForMatcher
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
public static void appendColoredFragmentForMatcher(@NotNull String text,
SimpleColoredComponent component,
@NotNull final SimpleTextAttributes attributes,
Matcher matcher,
Color selectedBg,
boolean selected) {
if (!(matcher instanceof MinusculeMatcher) || (Registry.is("ide.highlight.match.in.selected.only") && !selected)) {
component.append(text, attributes);
return;
}
final Iterable<TextRange> iterable = ((MinusculeMatcher)matcher).matchingFragments(text);
if (iterable != null) {
final Color fg = attributes.getFgColor();
final int style = attributes.getStyle();
final SimpleTextAttributes plain = new SimpleTextAttributes(style, fg);
final SimpleTextAttributes highlighted = new SimpleTextAttributes(selectedBg, fg, null, style | SimpleTextAttributes.STYLE_SEARCH_MATCH);
appendColoredFragments(component, text, iterable, plain, highlighted);
}
else {
component.append(text, attributes);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:SpeedSearchUtil.java
示例3: addMacroPaths
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
private void addMacroPaths(final CompletionResult result, final String typedText) {
result.myMacros = new ArrayList<LookupFile>();
MinusculeMatcher matcher = createMatcher(typedText);
for (String eachMacro : myMacroMap.keySet()) {
if (matcher.matches(eachMacro)) {
final String eachPath = myMacroMap.get(eachMacro);
if (eachPath != null) {
final LookupFile macroFile = myFinder.find(eachPath);
if (macroFile != null && macroFile.exists()) {
result.myMacros.add(macroFile);
result.myToComplete.add(macroFile);
macroFile.setMacro(eachMacro);
}
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FileTextFieldImpl.java
示例4: consumeTopHits
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
@Override
public final void consumeTopHits(@NonNls String pattern, Consumer<Object> collector, Project project) {
if (!pattern.startsWith("#")) return;
pattern = pattern.substring(1);
final List<String> parts = StringUtil.split(pattern, " ");
if (parts.size() == 0) {
return;
}
String id = parts.get(0);
if (getId().startsWith(id) || pattern.startsWith(" ")) {
if (pattern.startsWith(" ")) {
pattern = pattern.trim();
} else {
pattern = pattern.substring(id.length()).trim().toLowerCase();
}
final MinusculeMatcher matcher = NameUtil.buildMatcher("*" + pattern, NameUtil.MatchingCaseSensitivity.NONE);
for (BooleanOptionDescription option : getOptions(project)) {
if (matcher.matches(option.getOption())) {
collector.consume(option);
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:OptionsTopHitProvider.java
示例5: createMatcher
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
private MinusculeMatcher createMatcher(final boolean caseSensitive) {
String prefix = applyMiddleMatching(myPrefix);
if (!caseSensitive) {
return NameUtil.buildMatcher(prefix, NameUtil.MatchingCaseSensitivity.NONE);
}
switch (CodeInsightSettings.getInstance().COMPLETION_CASE_SENSITIVE) {
case CodeInsightSettings.NONE:
return NameUtil.buildMatcher(prefix, NameUtil.MatchingCaseSensitivity.NONE);
case CodeInsightSettings.FIRST_LETTER:
return NameUtil.buildMatcher(prefix, NameUtil.MatchingCaseSensitivity.FIRST_LETTER);
default:
return NameUtil.buildMatcher(prefix, NameUtil.MatchingCaseSensitivity.ALL);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CamelHumpMatcher.java
示例6: buildStructure
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
private synchronized void buildStructure(final String pattern) {
if (!Registry.is("search.everywhere.structure") || myStructureModel == null) return;
final List<StructureViewTreeElement> elements = new ArrayList<StructureViewTreeElement>();
final MinusculeMatcher matcher = new MinusculeMatcher("*" + pattern, NameUtil.MatchingCaseSensitivity.NONE);
fillStructure(myStructureModel.getRoot(), elements, matcher);
if (elements.size() > 0) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (isCanceled()) return;
myListModel.titleIndex.structure = myListModel.size();
for (Object element : elements) {
myListModel.addElement(element);
}
myListModel.moreIndex.files = -1;
}
});
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:SearchEverywhereAction.java
示例7: processNamesByPattern
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
private static void processNamesByPattern(@NotNull final ChooseByNameBase base,
@NotNull final String[] names,
@NotNull final String pattern,
final ProgressIndicator indicator,
@NotNull final Consumer<MatchResult> consumer) {
final MinusculeMatcher matcher = buildPatternMatcher(pattern, NameUtil.MatchingCaseSensitivity.NONE);
Processor<String> processor = new Processor<String>() {
@Override
public boolean process(String name) {
ProgressManager.checkCanceled();
MatchResult result = matches(base, pattern, matcher, name);
if (result != null) {
consumer.consume(result);
}
return true;
}
};
if (!JobLauncher.getInstance().invokeConcurrentlyUnderProgress(Arrays.asList(names), indicator, false, true, processor)) {
throw new ProcessCanceledException();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DefaultChooseByNameItemProvider.java
示例8: matches
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
@Nullable
private static MatchResult matches(@NotNull ChooseByNameBase base,
@NotNull String pattern,
@NotNull MinusculeMatcher matcher,
@Nullable String name) {
if (name == null) {
return null;
}
if (base.getModel() instanceof CustomMatcherModel) {
try {
return ((CustomMatcherModel)base.getModel()).matches(name, pattern) ? new MatchResult(name, 0, true) : null;
}
catch (Exception e) {
LOG.info(e);
return null; // no matches appears valid result for "bad" pattern
}
}
FList<TextRange> fragments = matcher.matchingFragments(name);
return fragments != null ? new MatchResult(name, matcher.matchingDegree(name, false, fragments), MinusculeMatcher.isStartMatch(fragments)) : null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:DefaultChooseByNameItemProvider.java
示例9: processElementsWithName
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
@Override
public void processElementsWithName(@NotNull String name,
@NotNull final Processor<NavigationItem> processor,
@NotNull FindSymbolParameters parameters) {
final MinusculeMatcher matcher = NameUtil.buildMatcher(parameters.getCompletePattern(), NameUtil.MatchingCaseSensitivity.FIRST_LETTER);
if (!matcher.isStartMatch(name.substring(0, name.lastIndexOf(':')))) return;
String[] names = name.split(":");
MavenId mavenId = new MavenId(names[0], names[1], names[2]);
projectsManager = MavenProjectsManager.getInstance(project);
MavenProject p = projectsManager.findProject(mavenId);
PsiFileSystemItem pomFile = null;
if (p != null) {
pomFile = PsiManager.getInstance(project).findFile(p.getFile());
} else if (parameters.isSearchInLibraries()) {
Map<MavenId, PsiFile> notImportPoms = getNotImportPoms(projectsManager.getRootProjects().get(0));
pomFile = notImportPoms.get(mavenId);
}
if (pomFile != null) {
PomWrapper pomWrapper = new PomWrapper(pomFile, mavenId, project.getBasePath(), showPomLocation);
processor.process(pomWrapper);
}
}
开发者ID:shlxue,项目名称:MvnRunner,代码行数:25,代码来源:PomNavigationContributor.java
示例10: appendColoredFragmentForMatcher
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
public static void appendColoredFragmentForMatcher(@NotNull final String text,
final SimpleColoredComponent component,
@NotNull final SimpleTextAttributes attributes,
final Matcher matcher,
final Color selectedBg,
final boolean selected) {
if (!(matcher instanceof MinusculeMatcher) || (Registry.is("ide.highlight.match.in.selected.only") && !selected)) {
component.append(text, attributes);
return;
}
final Iterable<TextRange> iterable = ((MinusculeMatcher)matcher).matchingFragments(text);
if (iterable != null) {
final Color fg = attributes.getFgColor();
final int style = attributes.getStyle();
final SimpleTextAttributes plain = new SimpleTextAttributes(style, fg);
final SimpleTextAttributes highlighted = new SimpleTextAttributes(selectedBg, fg, null, style | SimpleTextAttributes.STYLE_SEARCH_MATCH);
appendColoredFragments(component, text, iterable, plain, highlighted);
}
else {
component.append(text, attributes);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:SpeedSearchUtil.java
示例11: processNamesByPattern
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
private static void processNamesByPattern(@NotNull final ChooseByNameBase base,
@NotNull final String[] names,
@NotNull final String pattern,
final ProgressIndicator indicator,
@NotNull final Consumer<MatchResult> consumer) {
final MinusculeMatcher matcher = buildPatternMatcher(pattern, NameUtil.MatchingCaseSensitivity.NONE);
Processor<String> processor = new Processor<String>() {
@Override
public boolean process(String name) {
ProgressManager.checkCanceled();
MatchResult result = matches(base, pattern, matcher, name);
if (result != null) {
consumer.consume(result);
}
return true;
}
};
JobLauncher.getInstance().invokeConcurrentlyUnderProgress(Arrays.asList(names), indicator, false, false, processor);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:DefaultChooseByNameItemProvider.java
示例12: matches
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
@Nullable
private static MatchResult matches(@NotNull ChooseByNameBase base,
@NotNull String pattern,
@NotNull MinusculeMatcher matcher,
@Nullable String name) {
if (name == null) {
return null;
}
if (base.getModel() instanceof CustomMatcherModel) {
try {
return ((CustomMatcherModel)base.getModel()).matches(name, pattern) ? new MatchResult(name, 0, true) : null;
}
catch (Exception e) {
LOG.info(e);
return null; // no matches appears valid result for "bad" pattern
}
}
return matcher.matches(name) ? new MatchResult(name, matcher.matchingDegree(name), matcher.isStartMatch(name)) : null;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:DefaultChooseByNameItemProvider.java
示例13: appendColoredFragmentForMatcher
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
public static void appendColoredFragmentForMatcher(@Nonnull String text,
SimpleColoredComponent component,
@Nonnull final SimpleTextAttributes attributes,
Matcher matcher,
Color selectedBg,
boolean selected) {
if (!(matcher instanceof MinusculeMatcher) || (Registry.is("ide.highlight.match.in.selected.only") && !selected)) {
component.append(text, attributes);
return;
}
final Iterable<TextRange> iterable = ((MinusculeMatcher)matcher).matchingFragments(text);
if (iterable != null) {
final Color fg = attributes.getFgColor();
final int style = attributes.getStyle();
final SimpleTextAttributes plain = new SimpleTextAttributes(style, fg);
final SimpleTextAttributes highlighted = new SimpleTextAttributes(selectedBg, fg, null, style | SimpleTextAttributes.STYLE_SEARCH_MATCH);
appendColoredFragments(component, text, iterable, plain, highlighted);
}
else {
component.append(text, attributes);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:SpeedSearchUtil.java
示例14: consumeTopHits
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
@Override
public final void consumeTopHits(@NonNls String pattern, Consumer<Object> collector, Project project) {
if (!pattern.startsWith("#")) return;
pattern = pattern.substring(1);
final List<String> parts = StringUtil.split(pattern, " ");
if (parts.size() == 0) return;
String id = parts.get(0);
if (getId().startsWith(id)) {
pattern = pattern.substring(id.length()).trim().toLowerCase();
final MinusculeMatcher matcher = NameUtil.buildMatcher("*" + pattern, NameUtil.MatchingCaseSensitivity.NONE);
for (BooleanOptionDescription option : getOptions(project)) {
if (matcher.matches(option.getOption())) {
collector.consume(option);
}
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:OptionsTopHitProvider.java
示例15: buildStructure
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
private synchronized void buildStructure(final String pattern) {
if (!Registry.is("search.everywhere.structure") || myStructureModel == null) return;
final List<StructureViewTreeElement> elements = new ArrayList<>();
final MinusculeMatcher matcher = new MinusculeMatcher("*" + pattern, NameUtil.MatchingCaseSensitivity.NONE);
fillStructure(myStructureModel.getRoot(), elements, matcher);
if (elements.size() > 0) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (isCanceled()) return;
myListModel.titleIndex.structure = myListModel.size();
for (Object element : elements) {
myListModel.addElement(element);
}
myListModel.moreIndex.files = -1;
}
});
}
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:SearchEverywhereAction.java
示例16: getConfigurations
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
private SearchResult getConfigurations(String pattern, int max) {
SearchResult configurations = new SearchResult();
if (!Registry.is("search.everywhere.configurations")) {
return configurations;
}
MinusculeMatcher matcher = new MinusculeMatcher(pattern, NameUtil.MatchingCaseSensitivity.NONE);
final ChooseRunConfigurationPopup.ItemWrapper[] wrappers = ChooseRunConfigurationPopup.createSettingsList(project, new ExecutorProvider() {
@Override
public Executor getExecutor() {
return ExecutorRegistry.getInstance().getExecutorById(ToolWindowId.DEBUG);
}
}, false);
check();
for (ChooseRunConfigurationPopup.ItemWrapper wrapper : wrappers) {
if (matcher.matches(wrapper.getText()) && !myListModel.contains(wrapper)) {
if (configurations.size() == max) {
configurations.needMore = true;
break;
}
configurations.add(wrapper);
}
check();
}
return configurations;
}
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:SearchEverywhereAction.java
示例17: processNamesByPattern
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
private static void processNamesByPattern(@Nonnull final ChooseByNameBase base,
@Nonnull final String[] names,
@Nonnull final String pattern,
final ProgressIndicator indicator,
@Nonnull final Consumer<MatchResult> consumer) {
final MinusculeMatcher matcher = buildPatternMatcher(pattern, NameUtil.MatchingCaseSensitivity.NONE);
Processor<String> processor = new Processor<String>() {
@Override
public boolean process(String name) {
ProgressManager.checkCanceled();
MatchResult result = matches(base, pattern, matcher, name);
if (result != null) {
consumer.consume(result);
}
return true;
}
};
if (!JobLauncher.getInstance().invokeConcurrentlyUnderProgress(Arrays.asList(names), indicator, false, true, processor)) {
throw new ProcessCanceledException();
}
}
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:DefaultChooseByNameItemProvider.java
示例18: matches
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
@Nullable
private static MatchResult matches(@Nonnull ChooseByNameBase base,
@Nonnull String pattern,
@Nonnull MinusculeMatcher matcher,
@Nullable String name) {
if (name == null) {
return null;
}
if (base.getModel() instanceof CustomMatcherModel) {
try {
return ((CustomMatcherModel)base.getModel()).matches(name, pattern) ? new MatchResult(name, 0, true) : null;
}
catch (Exception e) {
LOG.info(e);
return null; // no matches appears valid result for "bad" pattern
}
}
return matcher.matches(name) ? new MatchResult(name, matcher.matchingDegree(name), matcher.isStartMatch(name)) : null;
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:DefaultChooseByNameItemProvider.java
示例19: ellipsizeText
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
String ellipsizeText(@NotNull String text, Matcher matcher) {
final int textLength = text.length();
if (textLength > MAX_LENGTH) {
if (matcher instanceof MinusculeMatcher) {
FList iterable = ((MinusculeMatcher) matcher).matchingFragments(text);
if (iterable != null) {
TextRange textRange = (TextRange) iterable.getHead();
int startOffset = textRange.getStartOffset();
int startIndex = 0;
int endIndex = textLength;
if (startOffset > ELLIPSIS_EXTRA_LENGTH) {
startIndex = startOffset - ELLIPSIS_EXTRA_LENGTH;
}
if (textLength > startIndex + MAX_LENGTH) {
endIndex = startIndex + MAX_LENGTH;
}
String ellipsizedText = text.substring(startIndex, endIndex);
if (startIndex > 0) {
ellipsizedText = DOTS + ellipsizedText;
}
if (endIndex < textLength) {
ellipsizedText = ellipsizedText + DOTS;
}
return ellipsizedText;
}
}
}
return text;
}
开发者ID:hoai265,项目名称:SearchResourcePlugin,代码行数:37,代码来源:StringEllipsisPolicy.java
示例20: processElementsWithName
import com.intellij.psi.codeStyle.MinusculeMatcher; //导入依赖的package包/类
@Override
public void processElementsWithName(@NotNull String name,
@NotNull final Processor<NavigationItem> processor,
@NotNull final FindSymbolParameters parameters) {
String namePattern = StringUtil.getShortName(parameters.getCompletePattern());
boolean hasDollar = namePattern.contains("$");
if (hasDollar) {
Matcher matcher = ChooseByNamePopup.patternToDetectAnonymousClasses.matcher(namePattern);
if (matcher.matches()) {
namePattern = matcher.group(1);
hasDollar = namePattern.contains("$");
}
}
final MinusculeMatcher innerMatcher = hasDollar ? new MinusculeMatcher("*" + namePattern, NameUtil.MatchingCaseSensitivity.NONE) : null;
PsiShortNamesCache.getInstance(parameters.getProject()).processClassesWithName(name, new Processor<PsiClass>() {
final boolean isAnnotation = parameters.getLocalPatternName().startsWith("@");
@Override
public boolean process(PsiClass aClass) {
if (aClass.getContainingFile().getVirtualFile() == null || !aClass.isPhysical()) return true;
if (isAnnotation && !aClass.isAnnotationType()) return true;
if (innerMatcher != null) {
if (aClass.getContainingClass() == null) return true;
String jvmQName = ClassUtil.getJVMClassName(aClass);
if (jvmQName == null || !innerMatcher.matches(StringUtil.getShortName(jvmQName))) return true;
}
return processor.process(aClass);
}
}, parameters.getSearchScope(), parameters.getIdFilter());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:DefaultClassNavigationContributor.java
注:本文中的com.intellij.psi.codeStyle.MinusculeMatcher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论