本文整理匯總了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, () -> {});
}