本文整理汇总了Java中com.jetbrains.php.completion.PhpCompletionUtil类的典型用法代码示例。如果您正苦于以下问题:Java PhpCompletionUtil类的具体用法?Java PhpCompletionUtil怎么用?Java PhpCompletionUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PhpCompletionUtil类属于com.jetbrains.php.completion包,在下文中一共展示了PhpCompletionUtil类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCompletions
import com.jetbrains.php.completion.PhpCompletionUtil; //导入依赖的package包/类
public void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull CompletionResultSet resultSet) {
if(!Symfony2ProjectComponent.isEnabled(parameters.getPosition())) {
return;
}
PhpIndex phpIndex = PhpIndex.getInstance(parameters.getOriginalFile().getProject());
Map<String, String> entityNamespaces = ServiceXmlParserFactory.getInstance(parameters.getOriginalFile().getProject(), EntityNamesServiceParser.class).getEntityNameMap();
// copied from PhpCompletionUtil::addClassesInNamespace looks the official way to find classes in namespaces
// its a really performance nightmare
Collection<String> names = phpIndex.getAllClassNames(new CamelHumpMatcher(resultSet.getPrefixMatcher().getPrefix()));
for (String name : names) {
Collection<PhpClass> classes = phpIndex.getClassesByName(name);
for(Map.Entry<String, String> entry: entityNamespaces.entrySet()) {
String namespaceFqn = PhpLangUtil.toFQN(entry.getValue());
Collection<PhpClass> filtered = PhpCompletionUtil.filterByNamespace(classes, namespaceFqn);
for (PhpClass phpClass : filtered) {
resultSet.addElement(new PhpClassLookupElement(phpClass, true, PhpClassReferenceInsertHandler.getInstance()));
}
}
}
}
示例2: init
import com.jetbrains.php.completion.PhpCompletionUtil; //导入依赖的package包/类
private void init() {
this.field = new EditorTextField("", project, com.jetbrains.php.lang.PhpFileType.INSTANCE);
PhpCompletionUtil.installClassCompletion(this.field, null, getDisposable());
this.field.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
String text = field.getText();
if (StringUtil.isEmpty(text) || StringUtil.endsWith(text, "\\")) {
return;
}
addUpdateRequest(250, () -> consumer.consume(field.getText()));
}
});
GridBagConstraints gbConstraints = new GridBagConstraints();
gbConstraints.fill = 1;
gbConstraints.weightx = 1.0D;
gbConstraints.gridx = 1;
gbConstraints.gridy = 1;
panel.add(field, gbConstraints);
}
示例3: getPropertyValueCompletions
import com.jetbrains.php.completion.PhpCompletionUtil; //导入依赖的package包/类
@Override
public void getPropertyValueCompletions(AnnotationPropertyParameter parameter, AnnotationCompletionProviderParameter completionParameter) {
if(!supports(parameter)) {
return;
}
String className = "";
PsiElement element = parameter.getElement();
if(element instanceof StringLiteralExpression) {
className = ((StringLiteralExpression) element).getContents();
}
PhpIndex phpIndex = PhpIndex.getInstance(parameter.getProject());
PhpCompletionUtil.addClasses(className, completionParameter.getResult(), phpIndex, null);
}
示例4: createUIComponents
import com.jetbrains.php.completion.PhpCompletionUtil; //导入依赖的package包/类
private void createUIComponents() {
namespaceField = new EditorTextField("", project, null);
PhpCompletionUtil.installNamespaceCompletion(namespaceField, null, () -> {});
}