|
2 | 2 | * Copyright © Magento, Inc. All rights reserved.
|
3 | 3 | * See COPYING.txt for license details.
|
4 | 4 | */
|
| 5 | + |
5 | 6 | package com.magento.idea.magento2plugin.completion.provider;
|
6 | 7 |
|
7 | 8 | import com.intellij.codeInsight.completion.CompletionParameters;
|
8 | 9 | import com.intellij.codeInsight.completion.CompletionProvider;
|
9 | 10 | import com.intellij.codeInsight.completion.CompletionResultSet;
|
10 | 11 | import com.intellij.codeInsight.completion.PlainPrefixMatcher;
|
11 | 12 | import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
| 13 | +import com.intellij.icons.AllIcons; |
12 | 14 | import com.intellij.psi.PsiElement;
|
13 | 15 | import com.intellij.util.ProcessingContext;
|
14 |
| -import com.jetbrains.php.PhpIcons; |
15 | 16 | import com.magento.idea.magento2plugin.indexes.DiIndex;
|
| 17 | +import java.util.Collection; |
16 | 18 | import org.jetbrains.annotations.NotNull;
|
17 | 19 |
|
18 |
| -import java.util.Collection; |
19 | 20 |
|
20 | 21 | public class VirtualTypeCompletionProvider extends CompletionProvider<CompletionParameters> {
|
21 | 22 |
|
22 | 23 | @Override
|
23 |
| - protected void addCompletions(@NotNull CompletionParameters parameters, |
24 |
| - ProcessingContext context, |
25 |
| - @NotNull CompletionResultSet result) { |
26 |
| - PsiElement position = parameters.getPosition().getOriginalElement(); |
| 24 | + protected void addCompletions(final @NotNull CompletionParameters parameters, |
| 25 | + final ProcessingContext context, |
| 26 | + final @NotNull CompletionResultSet result) { |
| 27 | + final PsiElement position = parameters.getPosition().getOriginalElement(); |
27 | 28 | if (position == null) {
|
28 | 29 | return;
|
29 | 30 | }
|
30 | 31 |
|
31 |
| - String prefix = result.getPrefixMatcher().getPrefix(); |
| 32 | + final String prefix = result.getPrefixMatcher().getPrefix(); |
32 | 33 |
|
33 |
| - DiIndex index = DiIndex.getInstance(position.getProject()); |
34 |
| - Collection<String> elements = index.getAllVirtualTypeElementNames(new PlainPrefixMatcher(prefix), position.getResolveScope()); |
| 34 | + final DiIndex index = DiIndex.getInstance(position.getProject()); |
| 35 | + final Collection<String> elements = index.getAllVirtualTypeElementNames( |
| 36 | + new PlainPrefixMatcher(prefix), |
| 37 | + position.getResolveScope() |
| 38 | + ); |
35 | 39 |
|
36 |
| - for (String elementName:elements) { |
| 40 | + for (final String elementName:elements) { |
37 | 41 | result.addElement(
|
38 | 42 | LookupElementBuilder
|
39 | 43 | .create(elementName)
|
40 |
| - .withIcon(PhpIcons.CLASS_ICON) |
| 44 | + .withIcon(AllIcons.Nodes.Class) |
41 | 45 | );
|
42 | 46 | }
|
43 | 47 | }
|
|
0 commit comments