Skip to content

Commit

Permalink
Refactoring: use Computable in JS std library search
Browse files Browse the repository at this point in the history
  • Loading branch information
goodwinnk committed Apr 2, 2013
1 parent 957e97a commit d24b390
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.ProjectRootModificationTracker;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.Ref;
Expand Down Expand Up @@ -123,11 +124,11 @@ public boolean process(Library library) {

@Nullable
private static Library getJSStandardLibrary(final Module module) {
final Ref<Library> jsLibrary = Ref.create();

ApplicationManager.getApplication().runReadAction(new Runnable() {
return ApplicationManager.getApplication().runReadAction(new Computable<Library>() {
@Override
public void run() {
public Library compute() {
final Ref<Library> jsLibrary = Ref.create();

ModuleRootManager.getInstance(module).orderEntries().librariesOnly().forEachLibrary(new Processor<Library>() {
@Override
public boolean process(Library library) {
Expand All @@ -139,9 +140,9 @@ public boolean process(Library library) {
return true;
}
});

return jsLibrary.get();
}
});

return jsLibrary.get();
}
}

0 comments on commit d24b390

Please sign in to comment.