use of com.intellij.packageDependencies.DependenciesBuilder in project intellij-community by JetBrains.
the class AnalyzeDependenciesOnSpecifiedTargetHandler method shouldShowDependenciesPanel.
@Override
protected boolean shouldShowDependenciesPanel(List<DependenciesBuilder> builders) {
for (DependenciesBuilder builder : builders) {
for (Set<PsiFile> files : builder.getDependencies().values()) {
if (!files.isEmpty()) {
return true;
}
}
}
final String source = StringUtil.decapitalize(getForwardScope(builders).getDisplayName());
final String target = StringUtil.decapitalize(myTargetScope.getDisplayName());
String message = AnalysisScopeBundle.message("no.dependencies.found.message", source, target);
if (DependencyVisitorFactory.VisitorOptions.fromSettings(myProject).skipImports()) {
message += " ";
message += AnalysisScopeBundle.message("dependencies.in.imports.message");
}
NOTIFICATION_GROUP.createNotification(message, MessageType.INFO).notify(myProject);
return false;
}
use of com.intellij.packageDependencies.DependenciesBuilder in project intellij-community by JetBrains.
the class DependenciesHandlerBase method perform.
private void perform(List<DependenciesBuilder> builders) {
try {
PerformanceWatcher.Snapshot snapshot = PerformanceWatcher.takeSnapshot();
for (AnalysisScope scope : myScopes) {
builders.add(createDependenciesBuilder(scope));
}
for (DependenciesBuilder builder : builders) {
builder.analyze();
}
snapshot.logResponsivenessSinceCreation("Dependency analysis");
} catch (IndexNotReadyException e) {
DumbService.getInstance(myProject).showDumbModeNotification("Analyze dependencies is not available until indices are ready");
throw new ProcessCanceledException();
}
}
use of com.intellij.packageDependencies.DependenciesBuilder in project intellij-community by JetBrains.
the class UsagesInAnalyzingDependenciesTest method testForwardSimple.
@SuppressWarnings("ConstantConditions")
public void testForwardSimple() {
DependenciesBuilder builder = new ForwardDependenciesBuilder(myProject, new AnalysisScope(myProject));
builder.analyze();
Set<PsiFile> searchIn = new HashSet<>();
PsiClass aClass = myJavaFacade.findClass("A", GlobalSearchScope.allScope(myProject));
searchIn.add(aClass.getContainingFile());
Set<PsiFile> searchFor = new HashSet<>();
PsiClass bClass = myJavaFacade.findClass("B", GlobalSearchScope.allScope(myProject));
searchFor.add(bClass.getContainingFile());
UsageInfo[] usagesInfos = FindDependencyUtil.findDependencies(builder, searchIn, searchFor);
UsageInfo2UsageAdapter[] usages = UsageInfo2UsageAdapter.convert(usagesInfos);
String[] psiUsages = new String[usagesInfos.length];
for (int i = 0; i < usagesInfos.length; i++) {
psiUsages[i] = toString(usages[i]);
}
checkResult(new String[] { "2 B myB = new B();", "2 B myB = new B();", "4 myB.bb();" }, psiUsages);
}
Aggregations