org.osgi.framework.Bundle#equals ( )源码实例Demo

下面列出了org.osgi.framework.Bundle#equals ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: knopflerfish.org   文件: JBundleHistory.java
public boolean removeBundle(Bundle b) {
  Component[] cl = panel.getComponents();
  for(int i = 0; i < cl.length; i++) {
    JBundle jb = (JBundle)cl[i];
    if(b.equals(jb.b)) {
      panel.remove(cl[i]);
      cl = panel.getComponents();
      if(cl.length > 0) {
        lastBundle = ((JBundle)cl[cl.length-1]).b;
      } else {
        lastBundle = null;
      }
      resizeBundles();
      return true;
    }
  }
  return false;
}
 
源代码2 项目: knopflerfish.org   文件: GraphDisplayer.java
public void removeBundle(Bundle b) {
  if(b.equals(bundle)) {
    if(bundleHistory.removeBundle(b)) {
      final Bundle last = bundleHistory.getLastBundle();
      if(last != null) {
        setBundle(last);
      }
    }
  }
}
 
源代码3 项目: xtext-eclipse   文件: TargetPlatformUtil.java
/**
 * Sets the target platform for tests (to be used in tycho mainly)
 * @param context any class of the test bundle to be able to determine the test bundle
 * @since 2.14
 */
public static void setTargetPlatform(Class<?> context) throws Exception {
	if (isPdeLaunch()) {
		return;
	}
	Bundle currentBundle = FrameworkUtil.getBundle(context);
	ITargetPlatformService tpService = TargetPlatformService.getDefault();
	ITargetDefinition targetDef = tpService.newTarget();
	targetDef.setName("Tycho platform");
	Bundle[] bundles = Platform.getBundle("org.eclipse.core.runtime").getBundleContext().getBundles();
	List<ITargetLocation> bundleContainers = new ArrayList<ITargetLocation>();
	Set<File> dirs = new HashSet<File>();
	for (Bundle bundle : bundles) {
		if (bundle.equals(currentBundle)) {
			// we skip the current bundle, otherwise the folder for the target platform
			// will include the absolute directory of the maven parent project
			// since the projects are nested in the parent project the result
			// would be that Java packages of our project will be available twice
			// and Java won't be able to find our classes leading in compilation
			// errors during our tests.
			continue;
		}
		EquinoxBundle bundleImpl = (EquinoxBundle) bundle;
		Generation generation = (Generation) bundleImpl.getModule().getCurrentRevision().getRevisionInfo();
		File file = generation.getBundleFile().getBaseFile();
		File folder = file.getParentFile();
		if ((file.isFile() || Platform.inDevelopmentMode()) && !dirs.contains(folder)) {
			dirs.add(folder);
			bundleContainers.add(tpService.newDirectoryLocation(folder.getAbsolutePath()));
		}
	}
	targetDef.setTargetLocations(bundleContainers.toArray(new ITargetLocation[bundleContainers.size()]));
	targetDef.setArch(Platform.getOSArch());
	targetDef.setOS(Platform.getOS());
	targetDef.setWS(Platform.getWS());
	targetDef.setNL(Platform.getNL());
	// targetDef.setJREContainer()
	tpService.saveTargetDefinition(targetDef);

	Job job = new LoadTargetDefinitionJob(targetDef);
	job.schedule();
	job.join();
}
 
源代码4 项目: xtext-eclipse   文件: TargetPlatformUtil.java
/**
 * Sets the target platform for tests (to be used in tycho mainly)
 * @param context any class of the test bundle to be able to determine the test bundle
 * @since 2.14
 */
public static void setTargetPlatform(Class<?> context) throws Exception {
	if (isPdeLaunch()) {
		return;
	}
	Bundle currentBundle = FrameworkUtil.getBundle(context);
	ITargetPlatformService tpService = TargetPlatformService.getDefault();
	ITargetDefinition targetDef = tpService.newTarget();
	targetDef.setName("Tycho platform");
	Bundle[] bundles = Platform.getBundle("org.eclipse.core.runtime").getBundleContext().getBundles();
	List<ITargetLocation> bundleContainers = new ArrayList<ITargetLocation>();
	Set<File> dirs = new HashSet<File>();
	for (Bundle bundle : bundles) {
		if (bundle.equals(currentBundle)) {
			// we skip the current bundle, otherwise the folder for the target platform
			// will include the absolute directory of the maven parent project
			// since the projects are nested in the parent project the result
			// would be that Java packages of our project will be available twice
			// and Java won't be able to find our classes leading in compilation
			// errors during our tests.
			continue;
		}
		EquinoxBundle bundleImpl = (EquinoxBundle) bundle;
		Generation generation = (Generation) bundleImpl.getModule().getCurrentRevision().getRevisionInfo();
		File file = generation.getBundleFile().getBaseFile();
		File folder = file.getParentFile();
		if (!dirs.contains(folder)) {
			dirs.add(folder);
			bundleContainers.add(tpService.newDirectoryLocation(folder.getAbsolutePath()));
		}
	}
	targetDef.setTargetLocations(bundleContainers.toArray(new ITargetLocation[bundleContainers.size()]));
	targetDef.setArch(Platform.getOSArch());
	targetDef.setOS(Platform.getOS());
	targetDef.setWS(Platform.getWS());
	targetDef.setNL(Platform.getNL());
	// targetDef.setJREContainer()
	tpService.saveTargetDefinition(targetDef);

	Job job = new LoadTargetDefinitionJob(targetDef);
	job.schedule();
	job.join();
}
 
源代码5 项目: knopflerfish.org   文件: CMDisplayer.java
static boolean isCmBundle(final Bundle bundle) {
  final Bundle cmBundle = cmTracker.getServiceReference().getBundle();
  return cmBundle != null ? cmBundle.equals(bundle)  : false;
}