use of com.intellij.psi.PsiPackage in project intellij-community by JetBrains.
the class CyclicDependenciesTest method testT2.
public void testT2() {
//com.b<->com.a
//com.c<->com.d
final CyclicDependenciesBuilder builder = new CyclicDependenciesBuilder(myProject, new AnalysisScope(myProject));
builder.analyze();
final HashMap<PsiPackage, Set<List<PsiPackage>>> cyclicDependencies = builder.getCyclicDependencies();
HashMap<String, String[][]> expected = new HashMap<>();
expected.put("com.b", new String[][] { { "com.a", "com.b" } });
expected.put("com.d", new String[][] { { "com.c", "com.d" } });
expected.put("com.c", new String[][] { { "com.d", "com.c" } });
expected.put("com.a", new String[][] { { "com.b", "com.a" } });
checkResult(expected, cyclicDependencies);
}
use of com.intellij.psi.PsiPackage in project intellij-community by JetBrains.
the class JavaInheritorsSearchTest method doTest.
private void doTest(String className, @Nullable String packageScopeName, boolean deep, String... expected) {
SearchScope scope;
if (packageScopeName != null) {
PsiPackage aPackage = JavaPsiFacade.getInstance(myFixture.getProject()).findPackage(packageScopeName);
assertNotNull(aPackage);
scope = PackageScope.packageScope(aPackage, true).intersectWith(GlobalSearchScope.projectScope(myFixture.getProject()));
} else {
scope = GlobalSearchScope.projectScope(myFixture.getProject());
}
assertSameElements(getInheritorNames(className, deep, scope), expected);
}
use of com.intellij.psi.PsiPackage in project intellij-community by JetBrains.
the class CodeInsightTestCase method findPackage.
@NotNull
protected PsiPackage findPackage(@NotNull final String name) {
final PsiPackage aPackage = myJavaFacade.findPackage(name);
assertNotNull("Package " + name + " not found", aPackage);
return aPackage;
}
use of com.intellij.psi.PsiPackage in project intellij-community by JetBrains.
the class AllInPackageGradleConfigurationProducer method doIsConfigurationFromContext.
@Override
protected boolean doIsConfigurationFromContext(ExternalSystemRunConfiguration configuration, ConfigurationContext context) {
final PsiPackage psiPackage = JavaRuntimeConfigurationProducerBase.checkPackage(context.getPsiLocation());
if (psiPackage == null)
return false;
if (context.getModule() == null)
return false;
if (!StringUtil.equals(ExternalSystemApiUtil.getExternalProjectPath(context.getModule()), configuration.getSettings().getExternalProjectPath())) {
return false;
}
if (!configuration.getSettings().getTaskNames().containsAll(getTasksToRun(context.getModule())))
return false;
final String scriptParameters = configuration.getSettings().getScriptParameters() + ' ';
return psiPackage.getQualifiedName().isEmpty() ? scriptParameters.contains("--tests * ") : scriptParameters.contains(String.format("--tests %s.* ", psiPackage.getQualifiedName()));
}
use of com.intellij.psi.PsiPackage in project intellij-community by JetBrains.
the class GroovyUntypedAccessInspection method buildVisitor.
@Override
@NotNull
protected BaseInspectionVisitor buildVisitor() {
return new BaseInspectionVisitor() {
@Override
public void visitReferenceExpression(@NotNull GrReferenceExpression refExpr) {
super.visitReferenceExpression(refExpr);
if (PsiUtil.isThisOrSuperRef(refExpr))
return;
GroovyResolveResult resolveResult = refExpr.advancedResolve();
PsiElement resolved = resolveResult.getElement();
if (resolved != null) {
if (GrHighlightUtil.isDeclarationAssignment(refExpr) || resolved instanceof PsiPackage)
return;
} else {
GrExpression qualifier = refExpr.getQualifierExpression();
if (qualifier == null && GrHighlightUtil.isDeclarationAssignment(refExpr))
return;
}
final PsiType refExprType = refExpr.getType();
if (refExprType == null) {
if (resolved != null) {
registerError(refExpr);
}
} else if (refExprType instanceof PsiClassType && ((PsiClassType) refExprType).resolve() == null) {
registerError(refExpr);
}
}
};
}
Aggregations