Java 类org.eclipse.core.runtime.IBundleGroupProvider 实例源码

项目:pgcodekeeper    文件:EclipseEnvironment.java   
private String getComponentIds() {
    String featureId = "ru.taximaxim.codekeeper.feature";
    String pluginId = "ru.taximaxim.codekeeper.ui";
    String pluginName = "codekeeperUI";

    if (Platform.getBundle(pluginId) != null) {
        return pluginName;
    } else {
        for (IBundleGroupProvider bundleGroupProvider : Platform.getBundleGroupProviders()) {
            for (IBundleGroup group : bundleGroupProvider.getBundleGroups()) {
                if (group.getIdentifier().equals(featureId)) {
                    return pluginName;
                }
            }
        }
    }

    return "";
}
项目:limpet    文件:ApplicationWorkbenchAdvisor.java   
/**
 * Returns the map of versioned feature ids -> info object for all installed features. The format
 * of the versioned feature id (the key of the map) is featureId + ":" + versionId.
 * 
 * @return map of versioned feature ids -> info object (key type: <code>String</code>, value type:
 *         <code>AboutInfo</code>)
 * @since 3.0
 */
private Map<String, AboutInfo> computeBundleGroupMap()
{
  // use tree map to get predicable order
  Map<String, AboutInfo> ids = new TreeMap<String, AboutInfo>();

  IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
  for (int i = 0; i < providers.length; ++i)
  {
    IBundleGroup[] groups = providers[i].getBundleGroups();
    for (int j = 0; j < groups.length; ++j)
    {
      IBundleGroup group = groups[j];
      AboutInfo info = new AboutInfo(group);

      String version = info.getVersionId();
      version = version == null ? "0.0.0" //$NON-NLS-1$
          : new Version(version).toString();
      String versionedFeature = group.getIdentifier() + ":" + version; //$NON-NLS-1$

      ids.put(versionedFeature, info);
    }
  }

  return ids;
}
项目:mytourbook    文件:LocalizeDialog.java   
public LocalizeDialog(Shell shell, ITranslatableText tabTitle, ITranslatableSet targetLanguageSet, ITranslatableSet menuTextSet) {
    super(shell);
    this.tabTitle = tabTitle;
    this.targetLanguageSet = targetLanguageSet;
    this.menuTextSet = menuTextSet;

    // create a descriptive object for each BundleGroup
    IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
    LinkedList groups = new LinkedList();
    if (providers != null) {
        for (int i = 0; i < providers.length; ++i) {
            IBundleGroup[] bundleGroups = providers[i].getBundleGroups();
            for (int j = 0; j < bundleGroups.length; ++j) {
                groups.add(new AboutBundleGroupData(bundleGroups[j]));
            }
        }
    }
    bundleGroupInfos = (AboutBundleGroupData[]) groups
    .toArray(new AboutBundleGroupData[0]);
}
项目:relations    文件:AboutDialog.java   
/**
 * @param shell
 */
public AboutDialog(Shell shell) {
    super(shell);

    product = Platform.getProduct();
    if (product != null) {
        productName = product.getName();
    }
    if (productName == null) {
        productName = WorkbenchMessages.AboutDialog_defaultProductName;
    }

    // create a descriptive object for each BundleGroup
    final IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
    final LinkedList<AboutBundleGroupData> groups = new LinkedList<AboutBundleGroupData>();
    if (providers != null) {
        for (final IBundleGroupProvider provider : providers) {
            final IBundleGroup[] bundleGroups = provider.getBundleGroups();
            for (final IBundleGroup bundleGroup : bundleGroups) {
                groups.add(new AboutBundleGroupData(bundleGroup));
            }
        }
    }
    bundleGroupInfos = groups.toArray(new AboutBundleGroupData[0]);
}
项目:pgcodekeeper    文件:UsageReportDispatcher.java   
private String getVersion() {
    IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
    if (providers != null) {
        for (IBundleGroupProvider provider : providers) {
            IBundleGroup[] bundleGroups = provider.getBundleGroups();
            for (IBundleGroup group : bundleGroups) {
                if (group.getIdentifier().equals("ru.taximaxim.codekeeper.feature")) {
                    return group.getVersion();
                }
            }
        }
    }
    return "version_unavalable";
}
项目:team-explorer-everywhere    文件:DefaultHTTPClientFactory.java   
/**
 * It returns two strings, the first is the eclipse provider and the second
 * is the eclipse version.
 */
private final String getProductInformation(final String shortName) {

    final String[] productInfo = new String[2];
    String productVendorVersion = ""; //$NON-NLS-1$

    // collect this information only in case of running as eclipse plugin
    if (shortName.equals(ProductName.PLUGIN)) {
        productInfo[0] = Platform.getProduct().getName().replace(' ', '_');

        final IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();

        if (providers != null) {
            for (final IBundleGroupProvider provider : providers) {
                final IBundleGroup[] groups = provider.getBundleGroups();
                for (final IBundleGroup group : groups) {
                    final String groupName = group.getName();
                    final String groupVersion = group.getVersion();

                    if (groupName.equalsIgnoreCase(ECLIPSE_GROUP_NAME)) {
                        final int index = groupVersion.indexOf(".v"); //$NON-NLS-1$
                        if (index > 0) {
                            productInfo[1] = groupVersion.substring(0, index);
                        } else {
                            productInfo[1] = groupVersion;
                        }
                        break;
                    }
                }
            }
        }
    }

    if (productInfo[0] != null && productInfo[1] != null) {
        productVendorVersion = MessageFormat.format("{0} {1} ", productInfo[0], productInfo[1]); //$NON-NLS-1$
    }
    return productVendorVersion;
}
项目:google-cloud-eclipse    文件:CloudToolsInfo.java   
@VisibleForTesting
static String getToolsVersion(IBundleGroupProvider[] bundleGroupProviders) {
  for (IBundleGroupProvider provider : bundleGroupProviders) {
    for (IBundleGroup feature : provider.getBundleGroups()) {
      if (CLOUD_TOOLS_FOR_ECLIPSE_FEATURE_ID.equals(feature.getIdentifier())) {
        return feature.getVersion();
      }
    }
  }
  // May not have been installed with via a feature. Although we could report the bundle version,
  // that may result in a confusing versions.
  logger.fine("Feature not found: " + CLOUD_TOOLS_FOR_ECLIPSE_FEATURE_ID);
  return "0.0.0";
}
项目:google-cloud-eclipse    文件:CloudToolsInfoTest.java   
@Test
public void testGetToolsVersion_hasFeature() {
  Mockito.when(bundleGroupProvider.getBundleGroups())
      .thenReturn(new IBundleGroup[] {bundleGroup});
  Mockito.when(bundleGroup.getIdentifier())
      .thenReturn(CloudToolsInfo.CLOUD_TOOLS_FOR_ECLIPSE_FEATURE_ID);
  Mockito.when(bundleGroup.getVersion()).thenReturn("123.456.789");
  Assert.assertEquals("123.456.789",
      CloudToolsInfo.getToolsVersion(new IBundleGroupProvider[] {bundleGroupProvider}));
}
项目:FDE    文件:RunningEclipseImport.java   
@Override
public void doImport(Version version) {

    version.getFeatures().clear();
    version.getBundles().clear();
    IBundleGroupProvider[] features = Platform.getBundleGroupProviders();
    for (IBundleGroupProvider bgProvider : features) {
        loadFeatures(version, bgProvider.getBundleGroups());
    }
}
项目:relations    文件:AboutFeaturesPage.java   
private void initializeBundleGroupInfos() {
    if (bundleGroupInfos == null) {
        final IBundleGroupProvider[] providers = Platform
                .getBundleGroupProviders();

        // create a descriptive object for each BundleGroup
        final LinkedList groups = new LinkedList();
        if (providers != null) {
            for (int i = 0; i < providers.length; ++i) {
                final IBundleGroup[] bundleGroups = providers[i]
                        .getBundleGroups();
                for (int j = 0; j < bundleGroups.length; ++j) {
                    groups.add(new AboutBundleGroupData(bundleGroups[j]));
                }
            }
        }
        bundleGroupInfos = (AboutBundleGroupData[]) groups
                .toArray(new AboutBundleGroupData[0]);
    } else {
        // the order of the array may be changed due to sorting, so create a
        // copy, since the client set this value.
        final AboutBundleGroupData[] clientArray = bundleGroupInfos;
        bundleGroupInfos = new AboutBundleGroupData[clientArray.length];
        System.arraycopy(clientArray, 0, bundleGroupInfos, 0,
                clientArray.length);
    }
    AboutData.sortByProvider(reverseSort, bundleGroupInfos);
}
项目:google-cloud-eclipse    文件:CloudToolsInfoTest.java   
@Test
public void testGetToolsVersion_noFeature() {
  Assert.assertEquals("0.0.0", CloudToolsInfo.getToolsVersion(new IBundleGroupProvider[0]));
}