@Override
 public boolean select(Viewer viewer, Object parentElement, Object element) {
   IPluginModelBase plugin = (IPluginModelBase) element;
   Version hVersion = versions.get(plugin.getBundleDescription().getSymbolicName());
   if (hVersion == null) return true;
   return hVersion.equals(plugin.getBundleDescription().getVersion());
 }
Beispiel #2
0
 private static Resource getResource(Set<Resource> resources, String bsn, String versionString) {
   for (Resource resource : resources) {
     List<Capability> identities = resource.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE);
     if (identities != null && identities.size() == 1) {
       Capability idCap = identities.get(0);
       Object id = idCap.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE);
       Object version = idCap.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);
       if (bsn.equals(id)) {
         if (versionString == null) {
           return resource;
         }
         Version requested = Version.parseVersion(versionString);
         Version current;
         if (version instanceof Version) {
           current = (Version) version;
         } else {
           current = Version.parseVersion((String) version);
         }
         if (requested.equals(current)) {
           return resource;
         }
       }
     }
   }
   return null;
 }
  private static void rebuildGoogleProjectIfPluginVersionChanged(IProject project) {
    try {
      // We're only worried about Google projects
      if (NatureUtils.hasNature(project, GWTNature.NATURE_ID)
          || NatureUtils.hasNature(project, GaeNature.NATURE_ID)) {
        // Find the last plugin version that know the project was built with
        Version lastForcedRebuildAt = GdtPreferences.getVersionForLastForcedRebuild(project);
        Version currentPluginVersion = GdtPlugin.getVersion();

        if (!lastForcedRebuildAt.equals(currentPluginVersion)) {
          GdtPreferences.setVersionForLastForcedRebuild(project, currentPluginVersion);

          BuilderUtilities.scheduleRebuild(project);
          CorePluginLog.logInfo(
              "Scheduled rebuild of project "
                  + project.getName()
                  + " because of plugin update (current version: "
                  + currentPluginVersion.toString()
                  + ")");
        }
      }
    } catch (CoreException e) {
      CorePluginLog.logError(e);
    }
  }
 @Override
 @Generated("eclipse")
 public boolean equals(final Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (getClass() != obj.getClass()) {
     return false;
   }
   WebResourceImpl other = (WebResourceImpl) obj;
   if (bundle == null) {
     if (other.bundle != null) {
       return false;
     }
   } else if (!bundle.equals(other.bundle)) {
     return false;
   }
   if (fileName == null) {
     if (other.fileName != null) {
       return false;
     }
   } else if (!fileName.equals(other.fileName)) {
     return false;
   }
   if (library == null) {
     if (other.library != null) {
       return false;
     }
   } else if (!library.equals(other.library)) {
     return false;
   }
   if (version == null) {
     if (other.version != null) {
       return false;
     }
   } else if (!version.equals(other.version)) {
     return false;
   }
   return true;
 }
 @SuppressWarnings("unchecked")
 public static Long getBundleId(String symbolicName, Version version) throws IOException {
   Long result = null;
   cli.sendLine("/subsystem=osgi:read-resource(include-runtime=true,recursive=true)");
   CLIOpResult cliresult = cli.readAllAsOpResult(WAIT_TIMEOUT, WAIT_LINETIMEOUT);
   assertTrue(cliresult.isIsOutcomeSuccess());
   Map<String, Object> bundlemap = cliresult.getNamedResultAsMap("bundle");
   for (Entry<String, Object> entry : bundlemap.entrySet()) {
     String auxid = entry.getKey();
     Map<String, Object> bundle = (Map<String, Object>) entry.getValue();
     if (bundle.get("symbolic-name").equals(symbolicName)) {
       Version auxver = Version.parseVersion((String) bundle.get("version"));
       if (version == null || version.equals(auxver)) {
         result = Long.valueOf(auxid);
         break;
       }
     }
   }
   return result;
 }