org.eclipse.core.runtime.Platform.getBundleGroupProviders()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中org.eclipse.core.runtime.Platform.getBundleGroupProviders()方法的一些代码示例,展示了Platform.getBundleGroupProviders()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Platform.getBundleGroupProviders()方法的具体详情如下:
包路径:org.eclipse.core.runtime.Platform
类名称:Platform
方法名:getBundleGroupProviders

Platform.getBundleGroupProviders介绍

[英]Returns the currently registered bundle group providers.

Clients are also able to acquire the IBundleGroupProvider service and query it for the registered bundle group providers.
[中]返回当前注册的捆绑组提供程序。
客户端还可以获取IBundleGroupProvider服务,并在其中查询已注册的捆绑组提供商。

代码示例

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.equinox.p2.discovery

private Map<String, Version> computeFeatureToVersion() {
  Map<String, Version> map = new HashMap<String, Version>();
  for (IBundleGroupProvider provider : Platform.getBundleGroupProviders()) {
    for (IBundleGroup bundleGroup : provider.getBundleGroups()) {
      for (Bundle bundle : bundleGroup.getBundles()) {
        map.put(bundle.getSymbolicName(), bundle.getVersion());
      }
    }
  }
  return map;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * Returns the about information of all known features,
 * omitting any features which are missing this information.
 *
 * @return a possibly empty list of about infos
 */
public AboutInfo[] getFeatureInfos() {
  // cannot be cached since bundle groups come and go
  List infos = new ArrayList();
  // add an entry for each bundle group
  IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
  if (providers != null) {
    for (int i = 0; i < providers.length; ++i) {
      IBundleGroup[] bundleGroups = providers[i].getBundleGroups();
      for (int j = 0; j < bundleGroups.length; ++j) {
        infos.add(new AboutInfo(bundleGroups[j]));
      }
    }
  }
  return (AboutInfo[]) infos.toArray(new AboutInfo[infos.size()]);
}
/**

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

private void initializeBundleGroupInfos() {
  if (bundleGroupInfos == null) {
    IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
    // create a descriptive object for each BundleGroup
    LinkedList<AboutBundleGroupData> groups = new LinkedList<>();
    if (providers != null) {
      for (IBundleGroupProvider provider : providers) {
        IBundleGroup[] bundleGroups = provider.getBundleGroups();
        for (IBundleGroup bundleGroup : bundleGroups) {
          groups.add(new AboutBundleGroupData(bundleGroup));
        }
      }
    }
    bundleGroupInfos = 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.
    AboutBundleGroupData[] clientArray = bundleGroupInfos;
    bundleGroupInfos = new AboutBundleGroupData[clientArray.length];
    System.arraycopy(clientArray, 0, bundleGroupInfos, 0,
        clientArray.length);
  }
  AboutData.sortByProvider(reverseSort, bundleGroupInfos);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

private static IBundleGroup getBundleGroup(String id, String versionId) {
  if (id == null || versionId == null) {
    return null;
  }
  IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
  for (int p = 0; p < providers.length; ++p) {
    IBundleGroup[] groups = providers[p].getBundleGroups();
    for (int g = 0; g < groups.length; ++g) {
      if (id.equals(groups[g].getIdentifier())
          && versionId.equals(groups[g].getVersion())) {
        return groups[g];
      }
    }
  }
  return null;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

/**
 * Appends the installed and configured features.
 */
private void appendFeatures(PrintWriter writer) {
  writer.println();
  writer.println(WorkbenchMessages.SystemSummary_features);
  IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
  LinkedList<AboutBundleGroupData> groups = new LinkedList<>();
  if (providers != null) {
    for (IBundleGroupProvider provider : providers) {
      IBundleGroup[] bundleGroups = provider.getBundleGroups();
      for (IBundleGroup bundleGroup : bundleGroups) {
        groups.add(new AboutBundleGroupData(bundleGroup));
      }
    }
  }
  AboutBundleGroupData[] bundleGroupInfos = groups.toArray(new AboutBundleGroupData[0]);
  AboutData.sortById(false, bundleGroupInfos);
  for (AboutBundleGroupData info : bundleGroupInfos) {
    String[] args = new String[] { info.getId(), info.getVersion(), info.getName() };
    writer.println(NLS.bind(WorkbenchMessages.SystemSummary_featureVersion, args));
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

/**
 * Create an instance of the AboutDialog for the given window.
 * @param parentShell The parent of the dialog.
 */
public AboutDialog(Shell parentShell) {
  super(parentShell);
  product = Platform.getProduct();
  if (product != null) {
    productName = product.getName();
  }
  if (productName == null) {
    productName = WorkbenchMessages.AboutDialog_defaultProductName;
  }
  // create a descriptive object for each BundleGroup
  IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
  LinkedList<AboutBundleGroupData> groups = new LinkedList<>();
  if (providers != null) {
    for (IBundleGroupProvider provider : providers) {
      IBundleGroup[] bundleGroups = provider.getBundleGroups();
      for (IBundleGroup bundleGroup : bundleGroups) {
        groups.add(new AboutBundleGroupData(bundleGroup));
      }
    }
  }
  bundleGroupInfos = groups
      .toArray(new AboutBundleGroupData[0]);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.ide.application

/**
 * 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<>();
  IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
  for (IBundleGroupProvider provider : providers) {
    IBundleGroup[] groups = provider.getBundleGroups();
    for (IBundleGroup group : groups) {
      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;
}

相关文章