1 11 package org.eclipse.update.search; 12 13 import org.eclipse.core.runtime.*; 14 import org.eclipse.update.core.*; 15 import org.eclipse.update.internal.operations.*; 16 17 32 public class BackLevelFilter extends BaseFilter { 33 34 public boolean accept(IFeature match) { 35 36 PluginVersionIdentifier matchVid = match.getVersionedIdentifier().getVersion(); 37 IFeature [] installed = UpdateUtils.getInstalledFeatures(match.getVersionedIdentifier(), false); 38 if (installed.length==0) return true; 39 40 for (int i=0; i<installed.length; i++) { 41 PluginVersionIdentifier ivid = installed[i].getVersionedIdentifier().getVersion(); 42 if (matchVid.isGreaterThan(ivid)) 43 continue; 44 return false; 47 } 48 return true; 49 50 } 51 52 public boolean accept(IFeatureReference match) { 53 try { 54 PluginVersionIdentifier matchVid = match.getVersionedIdentifier().getVersion(); 55 IFeature [] installed = UpdateUtils.getInstalledFeatures(match.getVersionedIdentifier(), false); 56 if (installed.length==0) return true; 57 58 for (int i=0; i<installed.length; i++) { 59 PluginVersionIdentifier ivid = installed[i].getVersionedIdentifier().getVersion(); 60 if (matchVid.isGreaterThan(ivid)) 61 continue; 62 return false; 65 } 66 return true; 67 } catch (CoreException e) { 68 return false; 69 } 70 } 71 } 72 | Popular Tags |