Permalink
Browse files

show installed packages on all list

  • Loading branch information...
1 parent ad9d24c commit 0f15ca7f2c3903a2658bf888c08171602446b273 @JPMoresmau committed Dec 27, 2012
@@ -0,0 +1,27 @@
+EclipseFP Haskell 2.4.3
+
+Release Notes
+
+
+Necessary Haskell packages:
+
+ - EclipseFP relies on BuildWrapper, a Haskell IDE library, for a lot of its functionality. See https://github.com/JPMoresmau/BuildWrapper for more information. Version 0.6.4 of buildwrapper has been validated with this version of EclipseFP
+ - EclipseFP also uses scion-browser. Version 0.2.13 has been validated with this version of EclipseFP
+
+
+Fixes:
+
+Features:
+ - Cabal Packages view shows a green tick on installed packages and versions when you display the list of all hackage packages.
+
+Internal:
+
+
+Upgrade notes:
+ - Upgrade via the Eclipse install site http://eclipsefp.sf.net/updates.
+
+
+Known issues:
+
+Thanks to all bug reporters and users for their feedback.
+Thanks to all the people that expressed interest in EclipseFP and want to see it stay alive and improve!
@@ -2,7 +2,7 @@
<feature
id="net.sf.eclipsefp.haskell"
label="%bundleName"
- version="2.4.2"
+ version="2.4.3"
provider-name="%bundleVendor">
<description>
@@ -81,7 +81,7 @@ available at http://www.eclipse.org/legal/epl-v10.html.
id="net.sf.eclipsefp.haskell.core"
download-size="0"
install-size="0"
- version="2.4.0"
+ version="2.4.3"
unpack="false"/>
<plugin
@@ -95,7 +95,7 @@ available at http://www.eclipse.org/legal/epl-v10.html.
id="net.sf.eclipsefp.haskell.ui"
download-size="0"
install-size="0"
- version="2.4.1"
+ version="2.4.3"
unpack="false"/>
<plugin
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-Name: %bundleName
Bundle-SymbolicName: net.sf.eclipsefp.haskell.core;singleton:=true
-Bundle-Version: 2.4.0
+Bundle-Version: 2.4.3
Bundle-Activator: net.sf.eclipsefp.haskell.core.HaskellCorePlugin
Bundle-Vendor: %bundleVendor
Bundle-Localization: plugin
@@ -10,8 +10,10 @@
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
+import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import net.sf.eclipsefp.haskell.core.HaskellCorePlugin;
import net.sf.eclipsefp.haskell.util.PlatformUtil;
import net.sf.eclipsefp.haskell.util.ProcessRunner;
@@ -71,13 +73,28 @@ public String getLastInstalledVersion(final String name)throws IOException{
public List<CabalPackageRef> getInstalled()throws IOException {
if (installed==null){
installed=list("","--installed"); //$NON-NLS-1$ //$NON-NLS-2$
+ for (CabalPackageRef r:installed){
+ r.getInstalled().addAll( r.getVersions() ); // all versions are installed
+ }
}
return installed;
}
public List<CabalPackageRef> getAll()throws IOException {
if (all==null){
all=list("",""); //$NON-NLS-1$ //$NON-NLS-2$
+ // check which versions are installed
+ List<CabalPackageRef> installed=getInstalled();
+ Map<String,CabalPackageRef> pkgByName=new HashMap<String, CabalPackageRef>();
+ for (CabalPackageRef r:installed){
+ pkgByName.put( r.getName(),r );
+ }
+ for (CabalPackageRef r:all){
+ CabalPackageRef inst=pkgByName.get( r.getName() );
+ if (inst!=null){
+ r.getInstalled().addAll( inst.getInstalled() );
+ }
+ }
}
return all;
}
@@ -1,42 +1,60 @@
-package net.sf.eclipsefp.haskell.core.cabal;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * a reference to a Cabal Package (different than CabalPackage)
- * @author JP Moresmau
- *
- */
-public class CabalPackageRef {
- private String name;
- private final ArrayList<String> versions=new ArrayList<String>();
-
- public String getName() {
- return name;
- }
-
- public void setName( final String name ) {
- this.name = name;
- }
-
- public ArrayList<String> getVersions() {
- return versions;
- }
-
- public List<CabalPackageVersion> getCabalPackageVersions(){
- List<CabalPackageVersion> ret=new ArrayList<CabalPackageVersion>();
- for (int a=0;a<versions.size();a++){
- ret.add(new CabalPackageVersion( this, a));
- }
- return ret;
- }
-
- @Override
- public String toString() {
- return name;
- }
-
-
-}
+package net.sf.eclipsefp.haskell.core.cabal;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+
+/**
+ * a reference to a Cabal Package (different than CabalPackage)
+ * @author JP Moresmau
+ *
+ */
+public class CabalPackageRef {
+ private String name;
+ /**
+ * all versions
+ */
+ private final ArrayList<String> versions=new ArrayList<String>();
+ /**
+ * versions installed
+ */
+ private final Set<String> installed=new HashSet<String>();
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName( final String name ) {
+ this.name = name;
+ }
+
+ public ArrayList<String> getVersions() {
+ return versions;
+ }
+
+ public List<CabalPackageVersion> getCabalPackageVersions(){
+ List<CabalPackageVersion> ret=new ArrayList<CabalPackageVersion>();
+ for (int a=0;a<versions.size();a++){
+ ret.add(new CabalPackageVersion( this, a,installed.contains( versions.get(a) )));
+ }
+ return ret;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+
+ public Set<String> getInstalled() {
+ return installed;
+ }
+
+ public boolean isInstalled(){
+ return installed.size()>0; // we're installed if at least one version is installed
+ }
+
+
+}
@@ -1,65 +1,75 @@
-/**
- * Copyright (c) 2012 by JP Moresmau
- * This code is made available under the terms of the Eclipse Public License,
- * version 1.0 (EPL). See http://www.eclipse.org/legal/epl-v10.html
- */
-package net.sf.eclipsefp.haskell.core.cabal;
-
-/**
- * A precise version of a cabal package
- * @author JP Moresmau
- *
- */
-public class CabalPackageVersion implements Comparable<CabalPackageVersion> {
- private final CabalPackageRef ref;
- private final int index;
-
- public CabalPackageVersion( final CabalPackageRef ref, final int index ) {
- super();
- this.ref = ref;
- this.index = index;
- }
-
-
- public CabalPackageRef getRef() {
- return ref;
- }
-
- @Override
- public String toString(){
- return ref.getVersions().get(index);
- }
-
- public boolean isLast(){
- return index==ref.getVersions().size()-1;
- }
-
- @Override
- public int compareTo( final CabalPackageVersion o ) {
- String s1=toString();
- String s2=o.toString();
- return compare(s1,s2);
- }
-
- public static int compare( final String s1,final String s2 ) {
- String[] ss1=s1.split( "\\." ); //$NON-NLS-1$
- String[] ss2=s2.split( "\\." ); //$NON-NLS-1$
- int a=0;
- for (;a<ss1.length;a++){
- if (a>=ss2.length){
- return 1;
- }
- int i1=Integer.parseInt( ss1[a] );
- int i2=Integer.parseInt( ss2[a] );
- if (i1<i2){
- return -1;
- } else if (i2<i1){
- return 1;
- }
- }
- if (a<ss2.length){
- return -1;
- }
- return 0;
- }
-}
+/**
+ * Copyright (c) 2012 by JP Moresmau
+ * This code is made available under the terms of the Eclipse Public License,
+ * version 1.0 (EPL). See http://www.eclipse.org/legal/epl-v10.html
+ */
+package net.sf.eclipsefp.haskell.core.cabal;
+
+/**
+ * A precise version of a cabal package
+ * @author JP Moresmau
+ *
+ */
+public class CabalPackageVersion implements Comparable<CabalPackageVersion> {
+ private final CabalPackageRef ref;
+ private final int index;
+ /**
+ * are we installed?
+ */
+ private final boolean installed;
+
+ public CabalPackageVersion( final CabalPackageRef ref, final int index , final boolean installed) {
+ super();
+ this.ref = ref;
+ this.index = index;
+ this.installed=installed;
+ }
+
+
+ public CabalPackageRef getRef() {
+ return ref;
+ }
+
+ @Override
+ public String toString(){
+ return ref.getVersions().get(index);
+ }
+
+ public boolean isLast(){
+ return index==ref.getVersions().size()-1;
+ }
+
+ @Override
+ public int compareTo( final CabalPackageVersion o ) {
+ String s1=toString();
+ String s2=o.toString();
+ return compare(s1,s2);
+ }
+
+ public static int compare( final String s1,final String s2 ) {
+ String[] ss1=s1.split( "\\." ); //$NON-NLS-1$
+ String[] ss2=s2.split( "\\." ); //$NON-NLS-1$
+ int a=0;
+ for (;a<ss1.length;a++){
+ if (a>=ss2.length){
+ return 1;
+ }
+ int i1=Integer.parseInt( ss1[a] );
+ int i2=Integer.parseInt( ss2[a] );
+ if (i1<i2){
+ return -1;
+ } else if (i2<i1){
+ return 1;
+ }
+ }
+ if (a<ss2.length){
+ return -1;
+ }
+ return 0;
+ }
+
+
+ public boolean isInstalled() {
+ return installed;
+ }
+}
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-Name: %bundleName
Bundle-SymbolicName: net.sf.eclipsefp.haskell.ui;singleton:=true
-Bundle-Version: 2.4.1
+Bundle-Version: 2.4.3
Bundle-Activator: net.sf.eclipsefp.haskell.ui.HaskellUIPlugin
Bundle-Vendor: %bundleVendor
Bundle-Localization: plugin
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit 0f15ca7

Please sign in to comment.