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

项目: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    文件:AboutFeaturesPage.java   
/**
 * The Plugins button was pressed. Open an about dialog on the plugins for
 * the selected feature.
 */
private void handlePluginInfoPressed() {
    final TableItem[] items = table.getSelection();
    if (items.length <= 0) {
        return;
    }

    final AboutBundleGroupData info = (AboutBundleGroupData) items[0]
            .getData();
    final IBundleGroup bundleGroup = info.getBundleGroup();
    final Bundle[] bundles = bundleGroup == null ? new Bundle[0]
            : bundleGroup.getBundles();

    final AboutPluginsDialog d = new AboutPluginsDialog(getShell(),
            getProductName(), bundles,
            WorkbenchMessages.AboutFeaturesDialog_pluginInfoTitle,
            NLS.bind(
                    WorkbenchMessages.AboutFeaturesDialog_pluginInfoMessage,
                    bundleGroup.getIdentifier()),
            IWorkbenchHelpContextIds.ABOUT_FEATURES_PLUGINS_DIALOG);
    d.open();
}
项目: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   
private void loadFeatures(Version version, IBundleGroup[] bundleGroups) {
    for (IBundleGroup bundlegroup : bundleGroups) {
        Feature feature = ModelFactory.eINSTANCE.createFeature();
        feature.setId(bundlegroup.getIdentifier());
        feature.setName(bundlegroup.getName());
        feature.setVendor(bundlegroup.getProviderName());
        Description description = ModelFactory.eINSTANCE.createDescription();
        description.setDescription(bundlegroup.getDescription());
        feature.setFeatureDescription(description);
        version.getFeatures().add(feature);
        loadBundles(bundlegroup, feature, version, bundlegroup.getBundles());
    }

}
项目:FDE    文件:RunningEclipseImport.java   
private void loadBundles(IBundleGroup bundlegroup, Feature feature, Version version,
        Bundle[] bundles) {

    for (Bundle bundle : bundles) {
        com.remainsoftware.fde.model.Bundle fbundle = ModelFactory.eINSTANCE.createBundle();
        fbundle.setId(bundle.getSymbolicName());
        fbundle.setName(bundle.getHeaders().get("Bundle-Name"));
        fbundle.setVersion(bundle.getHeaders().get("Bundle-Version"));
        fbundle.setVendor(bundle.getHeaders().get("Bundle-Vendor"));
        version.getBundles().add(fbundle);
    }
}
项目: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);
}