本文整理汇总了Java中com.intellij.codeInsight.completion.PlainPrefixMatcher类的典型用法代码示例。如果您正苦于以下问题:Java PlainPrefixMatcher类的具体用法?Java PlainPrefixMatcher怎么用?Java PlainPrefixMatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlainPrefixMatcher类属于com.intellij.codeInsight.completion包,在下文中一共展示了PlainPrefixMatcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addCompletions
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters,
ProcessingContext context,
@NotNull CompletionResultSet result) {
PsiElement position = parameters.getPosition().getOriginalElement();
if (position == null) {
return;
}
String prefix = result.getPrefixMatcher().getPrefix();
DiIndex index = DiIndex.getInstance(position.getProject());
Collection<String> elements = index.getAllVirtualTypeElementNames(new PlainPrefixMatcher(prefix), position.getResolveScope());
for (String elementName:elements) {
result.addElement(
LookupElementBuilder
.create(elementName)
.withIcon(PhpIcons.CLASS_ICON)
);
}
}
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:23,代码来源:VirtualTypeCompletionProvider.java
示例2: getSmartyPluginNamesOfType
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
/**
* Get a list of all the Smarty plugins of a given type in the current project. Strips off the "smarty_*_" part.
*
* @param project The project to look in.
* @param prefix Optionally filter the list by a prefix.
* @param type The type of Smarty plugin we're looking for.
*
* @return List of all Smarty plugins of a given type.
*/
protected static Collection<String> getSmartyPluginNamesOfType (Project project, String prefix, String type)
{
String smarty_prefix = "smarty_" + type + "_";
Collection<String> plugins = PhpIndex.getInstance(project).getAllFunctionNames(
new PlainPrefixMatcher(smarty_prefix + prefix)
{
public boolean prefixMatches (@NotNull String name)
{
return StringUtil.startsWithIgnoreCase(name, getPrefix());
}
}
);
// Strip off "smarty_*_" before we return the list.
Collection<String> stripped_plugins = new ArrayList<String>();
for (String plugin : plugins)
{
stripped_plugins.add(plugin.substring(smarty_prefix.length()));
}
return stripped_plugins;
}
开发者ID:mollie,项目名称:PhpStorm,代码行数:34,代码来源:SmartyIndex.java
示例3: getPHPClasses
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
/**
* Get a list of all the PHP classes in the current project.
*
* @param project The project to look in.
* @param prefix Optionally filter the list by a prefix.
*
* @return List of all available PHP classes.
*/
public static Collection<PhpClass> getPHPClasses (Project project, String prefix)
{
Collection<String> class_names = PhpIndex.getInstance(project).getAllClassNames(new PlainPrefixMatcher(prefix));
Collection<PhpClass> php_classes = new ArrayList<PhpClass>();
for (String class_name : class_names)
{
PhpClass php_class = getPHPClassByName(project, class_name);
if (php_class != null)
{
php_classes.add(php_class);
}
}
return php_classes;
}
开发者ID:mollie,项目名称:PhpStorm,代码行数:27,代码来源:SmartyIndex.java
示例4: getPHPConstants
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
/**
* Get a list of all the PHP constants in the current project.
*
* @param project The project to look in.
* @param prefix Optionally filter the list by a prefix.
*
* @return List of all available PHP constants.
*/
public static Collection<Constant> getPHPConstants (Project project, String prefix)
{
Collection<String> constant_names = PhpIndex.getInstance(project).getAllConstantNames(new PlainPrefixMatcher(prefix));
Collection<Constant> php_constants = new ArrayList<Constant>();
for (String constant_name : constant_names)
{
Constant php_constant = getPHPConstantByName(project, constant_name);
if (php_constant != null)
{
php_constants.add(php_constant);
}
}
return php_constants;
}
开发者ID:mollie,项目名称:PhpStorm,代码行数:27,代码来源:SmartyIndex.java
示例5: addCompletions
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
@Override
protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) {
String prefix = getPrefix(parameters);
resultSet = resultSet.withPrefixMatcher(new PlainPrefixMatcher(prefix));
PsiFile specFile = parameters.getOriginalFile();
SpecDetail specDetail = PsiTreeUtil.getChildOfType(specFile, SpecDetail.class);
List<SpecStep> stepsInFile = new ArrayList<>();
addContextSteps(specDetail, stepsInFile);
addStepsInScenarios(specFile, stepsInFile);
Set<String> staticArgs = getArgsFromSteps(stepsInFile);
for (String arg : staticArgs) {
if (arg != null) {
LookupElementBuilder item = LookupElementBuilder.create(arg);
resultSet.addElement(item);
}
}
}
开发者ID:getgauge,项目名称:Intellij-Plugin,代码行数:19,代码来源:StaticArgCompletionProvider.java
示例6: buildResultSet
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
private void buildResultSet(CompletionResultSet resultSet, VirtualFile virtualFile, String keyStr, String value) {
if (!isIgnored(keyStr)) {
LookupElementBuilder builder = LookupElementBuilder.create(keyStr + "}}")
.appendTailText(value, true)
.withTypeText("[" + virtualFile.getPresentableName() + "]", true)
.withPresentableText(keyStr + " = ");
resultSet.withPrefixMatcher(new PlainPrefixMatcher("")).addElement(builder);
}
}
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:10,代码来源:YamlPropertyPlaceholdersSmartCompletion.java
示例7: buildResultSet
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
@Override
public void buildResultSet(CompletionResultSet resultSet, VirtualFile virtualFile) {
getProperties(virtualFile).forEach((key, value) -> {
String keyStr = (String) key;
if (!isIgnored(keyStr)) {
LookupElementBuilder builder = LookupElementBuilder.create(keyStr + "}}")
.appendTailText(String.valueOf(value), true)
.withTypeText("[" + virtualFile.getPresentableName() + "]", true)
.withPresentableText(keyStr + " = ");
resultSet.withPrefixMatcher(new PlainPrefixMatcher("")).addElement(builder);
}
});
}
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:14,代码来源:PropertiesPropertyPlaceholdersSmartCompletion.java
示例8: showTemplatesLookup
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
public static void showTemplatesLookup(final Project project, final Editor editor, Map<TemplateImpl, String> template2Argument) {
final LookupImpl lookup = (LookupImpl)LookupManager.getInstance(project).createLookup(editor, LookupElement.EMPTY_ARRAY, "",
new LookupArranger.DefaultArranger());
for (TemplateImpl template : template2Argument.keySet()) {
String prefix = computePrefix(template, template2Argument.get(template));
lookup.addItem(createTemplateElement(template), new PlainPrefixMatcher(prefix));
}
showLookup(lookup, template2Argument);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ListTemplatesHandler.java
示例9: getPHPFunctions
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
/**
* Get a list of all the regular PHP functions (excluding Smarty functions) in the current project.
*
* @param project The project to look in.
* @param prefix Optionally filter the list by a prefix.
*
* @return List of all available PHP functions.
*/
public static Collection<Function> getPHPFunctions (Project project, String prefix)
{
// Collect all PHP functions, except for smarty_* functions.
Collection<String> function_names = PhpIndex.getInstance(project).getAllFunctionNames(
new PlainPrefixMatcher(prefix)
{
public boolean prefixMatches (@NotNull String name)
{
return (
!StringUtil.startsWithIgnoreCase(name, "smarty_") // Ignore smarty_* functions.
&& StringUtil.containsIgnoreCase(name, getPrefix())
);
}
}
);
Collection<Function> php_functions = new ArrayList<Function>();
for (String function_name : function_names)
{
Function php_function = getCustomPHPFunctionByName(project, function_name);
if (php_function != null)
{
php_functions.add(php_function);
}
}
return php_functions;
}
开发者ID:mollie,项目名称:PhpStorm,代码行数:39,代码来源:SmartyIndex.java
示例10: addCompletions
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) {
String prefix = getPrefix(parameters);
resultSet = resultSet.withPrefixMatcher(new PlainPrefixMatcher(prefix));
SpecDetail specDetail = PsiTreeUtil.getChildOfType(parameters.getOriginalFile(), SpecDetail.class);
if (specDetail == null)
return;
SpecTable table = specDetail.getDataTable();
if (table != null) {
List<String> headers = table.getTableHeader().getHeaders();
for (String header : headers) {
LookupElementBuilder item = LookupElementBuilder.create(header);
resultSet.addElement(item);
}
}
}
开发者ID:getgauge,项目名称:Intellij-Plugin,代码行数:16,代码来源:DynamicArgCompletionProvider.java
示例11: addCompletions
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
@Override
protected void addCompletions(CompletionParameters parameters, ProcessingContext processingContext, CompletionResultSet resultSet) {
String prefix = getPrefix(parameters);
resultSet = resultSet.withPrefixMatcher(new PlainPrefixMatcher(prefix));
Collection<ConceptStaticArg> staticArgs = PsiTreeUtil.collectElementsOfType(parameters.getOriginalFile(), ConceptStaticArg.class);
for (ConceptStaticArg arg : staticArgs) {
if (arg != null) {
String text = arg.getText().replaceFirst("\"", "");
String textWithoutQuotes = text.substring(0, text.length() - 1);
if (!textWithoutQuotes.equals(""))
resultSet.addElement(LookupElementBuilder.create(textWithoutQuotes));
}
}
}
开发者ID:getgauge,项目名称:Intellij-Plugin,代码行数:15,代码来源:ConceptStaticArgCompletionProvider.java
示例12: addCompletions
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) {
String prefix = getPrefix(parameters);
resultSet = resultSet.withPrefixMatcher(new PlainPrefixMatcher(prefix));
Collection<ConceptDynamicArg> args = PsiTreeUtil.collectElementsOfType(parameters.getOriginalFile(), ConceptDynamicArg.class);
for (ConceptDynamicArg arg : args) {
LookupElementBuilder item = LookupElementBuilder.create(arg.getText().replaceAll("<|>", ""));
resultSet.addElement(item);
}
}
开发者ID:getgauge,项目名称:Intellij-Plugin,代码行数:10,代码来源:ConceptDynamicArgCompletionProvider.java
示例13: showTemplatesLookup
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
public static void showTemplatesLookup(final Project project, final Editor editor,
@NotNull String prefix, List<TemplateImpl> matchingTemplates) {
final LookupImpl lookup = (LookupImpl)LookupManager.getInstance(project).createLookup(editor, LookupElement.EMPTY_ARRAY, prefix,
new TemplatesArranger());
for (TemplateImpl template : matchingTemplates) {
lookup.addItem(createTemplateElement(template), new PlainPrefixMatcher(prefix));
}
showLookup(lookup, null);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:ListTemplatesHandler.java
示例14: createPrefixMatcher
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
@Nullable
public PrefixMatcher createPrefixMatcher(@NotNull final String prefix) {
return new PlainPrefixMatcher(prefix);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:TextFieldWithAutoCompletionListProvider.java
示例15: createPrefixMatcher
import com.intellij.codeInsight.completion.PlainPrefixMatcher; //导入依赖的package包/类
@Nullable
public PrefixMatcher createPrefixMatcher(@Nonnull final String prefix) {
return new PlainPrefixMatcher(prefix);
}
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:TextFieldWithAutoCompletionListProvider.java
注:本文中的com.intellij.codeInsight.completion.PlainPrefixMatcher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论