import java.lang.reflect.InvocationHandler;\r
import java.lang.reflect.Method;\r
import java.lang.reflect.Proxy;\r
-import java.util.Collection;\r
-import java.util.Collections;\r
+import java.util.*;\r
\r
/**\r
* Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
\r
@NotNull\r
public Collection<? extends NuGetTool> getAvailableTools(@NotNull ToolsPolicy policy) throws FetchException {\r
+ final Set<String> installed = new HashSet<String>();\r
+ for (NuGetInstalledTool tool : getInstalledTools()) {\r
+ installed.add(tool.getVersion());\r
+ }\r
//This must be cached to make if work faster!\r
- return myAvailables.getAvailable(policy);\r
+ final Collection<NuGetTool> available = new ArrayList<NuGetTool>(myAvailables.getAvailable(policy));\r
+ final Iterator<NuGetTool> it = available.iterator();\r
+ while (it.hasNext()) {\r
+ NuGetTool next = it.next();\r
+ if (installed.contains(next.getVersion())) {\r
+ it.remove();\r
+ }\r
+ }\r
+ return available;\r
}\r
\r
public void installTool(@NotNull String toolId) {\r