use of com.intellij.psi.PsiReference in project intellij-community by JetBrains.
the class MavenFilteredPropertiesCompletionAndResolutionTest method testCustomDelimiters.
public void testCustomDelimiters() throws Exception {
createProjectSubDir("res");
importProject("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<build>" + " <resources>" + " <resource>" + " <directory>res</directory>" + " <filtering>true</filtering>" + " </resource>" + " </resources>" + " <plugins>" + " <plugin>" + " <groupId>org.apache.maven.plugins</groupId>" + " <artifactId>maven-resources-plugin</artifactId>" + " <version>2.5</version>" + " <configuration>" + " <delimiters>" + " <delimiter>|</delimiter>" + " <delimiter>(*]</delimiter>" + " </delimiters>" + " </configuration>" + " </plugin>" + " </plugins>" + "</build>");
VirtualFile f = createProjectSubFile("res/foo1.properties", "foo1=${basedir}\n" + "foo2=|pom.baseUri|\n" + "foo3=a(ve|rsion]");
assertNotNull(resolveReference(f, "basedir"));
assertNotNull(resolveReference(f, "pom.baseUri"));
PsiReference ref = getReference(f, "ve|rsion");
assertNotNull(ref);
assertTrue(ref.isSoft());
}
use of com.intellij.psi.PsiReference in project intellij-community by JetBrains.
the class MavenPluginCompletionAndResolutionTest method testResolvingAbsentPlugins.
public void testResolvingAbsentPlugins() throws Exception {
removeFromLocalRepository("org/apache/maven/plugins/maven-compiler-plugin");
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<build>" + " <plugins>" + " <plugin>" + " <artifactId><caret>maven-compiler-plugin</artifactId>" + " </plugin>" + " </plugins>" + "</build>");
PsiReference ref = getReferenceAtCaret(myProjectPom);
assertNotNull(ref);
// shouldn't throw;
ref.resolve();
}
use of com.intellij.psi.PsiReference in project intellij-community by JetBrains.
the class MavenPluginCompletionAndResolutionTest method testGoalsResolution.
public void testGoalsResolution() throws Throwable {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<build>" + " <plugins>" + " <plugin>" + " <artifactId>maven-compiler-plugin</artifactId>" + " <executions>" + " <execution>" + " <goals>" + " <goal><caret>compile</goal>" + " </goals>" + " </execution>" + " </executions>" + " </plugin>" + " </plugins>" + "</build>");
PsiReference ref = getReferenceAtCaret(myProjectPom);
assertNotNull(ref);
PsiElement resolved = ref.resolve();
assertNotNull(resolved);
assertTrue(resolved instanceof XmlTag);
assertEquals("mojo", ((XmlTag) resolved).getName());
assertEquals("compile", ((XmlTag) resolved).findFirstSubTag("goal").getValue().getText());
}
use of com.intellij.psi.PsiReference in project intellij-community by JetBrains.
the class MavenPluginCompletionAndResolutionTest method testResolvingParamaters.
public void testResolvingParamaters() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<build>" + " <plugins>" + " <plugin>" + " <artifactId>maven-compiler-plugin</artifactId>" + " <configuration>" + " <<caret>includes></includes>" + " </configuration>" + " </plugin>" + " </plugins>" + "</build>");
PsiReference ref = getReferenceAtCaret(myProjectPom);
assertNotNull(ref);
PsiElement resolved = ref.resolve();
assertNotNull(resolved);
assertTrue(resolved instanceof XmlTag);
assertEquals("parameter", ((XmlTag) resolved).getName());
assertEquals("includes", ((XmlTag) resolved).findFirstSubTag("name").getValue().getText());
}
use of com.intellij.psi.PsiReference in project intellij-community by JetBrains.
the class PyModuleFindUsagesHandler method findReferencesToHighlight.
@NotNull
@Override
public Collection<PsiReference> findReferencesToHighlight(@NotNull PsiElement target, @NotNull SearchScope searchScope) {
if (target instanceof PyImportedModule) {
target = ((PyImportedModule) target).resolve();
}
if (target instanceof PyFile && PyNames.INIT_DOT_PY.equals(((PyFile) target).getName())) {
List<PsiReference> result = new ArrayList<>();
result.addAll(super.findReferencesToHighlight(target, searchScope));
PsiElement targetDir = PyUtil.turnInitIntoDir(target);
if (targetDir != null) {
result.addAll(ReferencesSearch.search(targetDir, searchScope, false).findAll());
}
return result;
}
return super.findReferencesToHighlight(target, searchScope);
}
Aggregations