use of com.facebook.buck.intellij.ideabuck.build.BuckCommandHandler in project buck by facebook.
the class BuckQueryAction method execute.
public static synchronized List<String> execute(final Project project, final String target, final Function<List<String>, Void> fillTextResults) {
if (ongoingQuery.contains(target)) {
return Collections.emptyList();
}
List<String> targetsInBuckFile = buckTargetCache.getIfPresent(target);
if (targetsInBuckFile != null) {
return targetsInBuckFile;
}
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
public void run() {
ongoingQuery.add(target);
BuckBuildManager buildManager = BuckBuildManager.getInstance(project);
BuckCommandHandler handler = new BuckQueryCommandHandler(project, project.getBaseDir(), BuckCommand.QUERY, new Function<List<String>, Void>() {
@Nullable
@Override
public Void apply(@Nullable List<String> strings) {
ongoingQuery.remove(target);
buckTargetCache.put(target, strings);
fillTextResults.apply(strings);
return null;
}
});
handler.command().addParameter(target);
buildManager.runBuckCommand(handler, ACTION_TITLE);
}
});
return Collections.emptyList();
}
Aggregations