当前位置: 首页>>代码示例>>Java>>正文


Java RegistryFactory类代码示例

本文整理汇总了Java中org.eclipse.core.runtime.RegistryFactory的典型用法代码示例。如果您正苦于以下问题:Java RegistryFactory类的具体用法?Java RegistryFactory怎么用?Java RegistryFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RegistryFactory类属于org.eclipse.core.runtime包,在下文中一共展示了RegistryFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
/**
 * Reads information from extensions defined in plugin.xml files.
 */
private void initialize() {
	if (isInitialized)
		throw new IllegalStateException("may invoke method initialize() only once");
	isInitialized = true;

	final IExtensionRegistry registry = RegistryFactory.getRegistry();
	if (registry != null) {
		final IConfigurationElement[] configElems = registry
				.getConfigurationElementsFor(TESTERS_EXTENSION_POINT_ID);

		for (IConfigurationElement elem : configElems) {
			try {
				final EclipseTesterDescriptor descriptor = new EclipseTesterDescriptor(elem);
				injector.injectMembers(descriptor);
				register(descriptor);
			} catch (Exception ex) {
				log.error("Error while reading extensions for extension point " + TESTERS_EXTENSION_POINT_ID, ex);
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:25,代码来源:TesterRegistry.java

示例2: initialize

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
/**
 * Reads information from extensions defined in plugin.xml files.
 */
private void initialize() {
	if (isInitialized)
		throw new IllegalStateException("may invoke method initialize() only once");
	isInitialized = true;

	final IExtensionRegistry registry = RegistryFactory.getRegistry();
	if (registry != null) {
		final IConfigurationElement[] configElems = registry
				.getConfigurationElementsFor(RUNNERS_EXTENSION_POINT_ID);

		for (IConfigurationElement elem : configElems) {
			try {
				final EclipseRunnerDescriptor descriptor = new EclipseRunnerDescriptor(elem);
				injector.injectMembers(descriptor);
				register(descriptor);
			} catch (Exception ex) {
				log.error("Error while reading extensions for extension point " + RUNNERS_EXTENSION_POINT_ID, ex);
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:25,代码来源:RunnerRegistry.java

示例3: testValidExtensionPoints

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
@Test
public final void testValidExtensionPoints() {
  NodeList extensions = getDocument().getElementsByTagName("extension");
  Assert.assertTrue(
      "plugin.xml must contain at least one extension point", extensions.getLength() > 0);
      
  IExtensionRegistry registry = RegistryFactory.getRegistry();
  Assert.assertNotNull("Make sure you're running this as a plugin test", registry);
  for (int i = 0; i < extensions.getLength(); i++) {
    Element extension = (Element) extensions.item(i);
    String point = extension.getAttribute("point");
    Assert.assertNotNull("Could not load " + extension.getAttribute("id"), point);
    IExtensionPoint extensionPoint = registry.getExtensionPoint(point);
    Assert.assertNotNull("Could not load " + extension.getAttribute("id"), extensionPoint);
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:17,代码来源:BasePluginXmlTest.java

示例4: mockRegistry

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
/**
 * Mocks the extension registry.
 *
 * @throws CoreException
 */
@SuppressWarnings("restriction") // for accessing RegistryProviderFactory
public static synchronized void mockRegistry() {
  if (registrySpy == null) {
    registry = RegistryFactory.getRegistry();
    registrySpy = spy(registry);
    org.eclipse.core.internal.registry.RegistryProviderFactory.releaseDefault();
    try {
      RegistryFactory.setDefaultRegistryProvider(() -> {
        return registrySpy;
      });
    } catch (CoreException e) {
      // This shouldn't happen as the default was released.
      throw new WrappedException(e);
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:22,代码来源:ExtensionRegistryMock.java

示例5: unMockRegistry

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
/**
 * Unmocks the extension registry.
 */
@SuppressWarnings("restriction") // for accessing RegistryProviderFactory
public static void unMockRegistry() {
  configurationElements.clear();
  configurationAnswers.clear();
  registrySpy = null;
  org.eclipse.core.internal.registry.RegistryProviderFactory.releaseDefault(); // restricted
  try {
    RegistryFactory.setDefaultRegistryProvider(() -> {
      return registry;
    });
  } catch (CoreException e) {
    // This shouldn't happen as the default was released.
    throw new WrappedException(e);
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:19,代码来源:ExtensionRegistryMock.java

示例6: WidgetFactory

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
private WidgetFactory()
{
    final IExtensionRegistry registry = RegistryFactory.getRegistry();
    if (registry == null)
        registerKnownWidgets();
    else
    {   // Load available widgets from registry, which allows
        // other plugins to contribute widgets
        for (IConfigurationElement config : registry.getConfigurationElementsFor(EXTENSION_POINT_ID))
        {
            final WidgetDescriptor descriptor = WidgetDescriptor.fromRegistryEntry(config);
            logger.log(Level.CONFIG, "{0} contributes {1}", new Object[] { config.getContributor().getName(), descriptor});
            addWidgetType(descriptor);
        }
    }
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:17,代码来源:WidgetFactory.java

示例7: contributesToExtensionPoint

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
/**
 * Returns <code>true</code> if this bundle implements the extension point
 * with the given <code>extensionPointId</code>.
 * 
 * @param bundle the bundle to test
 * @param extensionSimpleId the simple id of the extension point
 * @param extensionPointId extension id to search for
 * 
 * @return <code>true</code> if this bundle implements the extension point
 *         with the given <code>extensionPointId</code>
 */
public static boolean contributesToExtensionPoint(Bundle bundle,
    String extensionSimpleId, String extensionPointId) {
  IExtensionRegistry registry = RegistryFactory.getRegistry();
  IContributor contributor = ContributorFactoryOSGi.createContributor(bundle);
  for (IExtension extension : registry.getExtensions(contributor.getName())) {
    if (extension.getExtensionPointUniqueIdentifier().equals(extensionPointId)) {
      if (extensionSimpleId != null
          && !extensionSimpleId.equals(extension.getSimpleIdentifier())) {
        continue;
      }

      return true;
    }
  }

  return false;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:29,代码来源:BundleUtilities.java

示例8: CodeTextHover

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
CodeTextHover(ISourceViewer sourceViewer) {
	this.sourceViewer = sourceViewer;
	IExtensionRegistry registry = RegistryFactory.getRegistry();
	
	for (IConfigurationElement extension : registry.getConfigurationElementsFor(BUNDLE_SYMBOLIC_NAME, ANNOTATION_HOVER_ID)) {
		if (extension.isValid()) {
			String annotationType = extension.getAttribute(ANNOTATION_TYPE_ATTRIBUTE);
			try {
				AnnotationHover hover = (AnnotationHover) extension.createExecutableExtension(CLASS_ATTRIBUTE);
				if (annotationType != null && hover != null) {
					this.hoverContributions.put(annotationType, hover);
				}
			} 
			catch (CoreException | ClassCastException ex) {
				BfActivator.getDefault().logError("AnnotationHover coud not be created", ex);
			}
		}
	}
}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:20,代码来源:BfSourceViewerConfiguration.java

示例9: getProviders

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
/**
* Provides a standard mean of getting an instances of interface. It uses
* Eclipse/OSGI extension registry.
  */
 private static Collection<IPredefinedSourceWrapProvider> getProviders() {
   List<IPredefinedSourceWrapProvider> result = new ArrayList<IPredefinedSourceWrapProvider>();
   IExtensionPoint extensionPoint = RegistryFactory.getRegistry().getExtensionPoint(
       EXTENSION_POINT_ID);
   IExtension[] extensions = extensionPoint.getExtensions();

   for (IExtension extension : extensions) {
     for (IConfigurationElement element : extension.getConfigurationElements()) {
       if (!ELEMENT_NAME.equals(element.getName())) {
         continue;
       }
       Object obj;
       try {
         obj = element.createExecutableExtension(CLASS_PROPERTY);
       } catch (CoreException e) {
         throw new RuntimeException(e);
       }
       IPredefinedSourceWrapProvider provider = (IPredefinedSourceWrapProvider) obj;
       result.add(provider);
     }
   }
   return result;
 }
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:28,代码来源:IPredefinedSourceWrapProvider.java

示例10: getInstance

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
/**
 * @return an instance of (any random) implementation of {@link JavaScriptFormatter} or null
 */
public static JavaScriptFormatter getInstance() {
  IExtensionPoint extensionPoint = RegistryFactory.getRegistry().getExtensionPoint(
      EXTENSION_POINT_ID);
  IExtension[] extensions = extensionPoint.getExtensions();

  for (IExtension extension : extensions) {
    for (IConfigurationElement element : extension.getConfigurationElements()) {
      if (!ELEMENT_NAME.equals(element.getName())) {
        continue;
      }
      Object obj;
      try {
        obj = element.createExecutableExtension(CLASS_PROPERTY);
      } catch (CoreException e) {
        throw new RuntimeException(e);
      }
      return (JavaScriptFormatter) obj;
    }
  }
  return null;
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:25,代码来源:JavaScriptFormatter.java

示例11: getBackends

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
public List<? extends WipBackend> getBackends() {
  IExtensionPoint extensionPoint = RegistryFactory.getRegistry().getExtensionPoint(
      WipBackExtensionPoint.ID);
  IExtension[] extensions = extensionPoint.getExtensions();

  List<WipBackend> result = new ArrayList<WipBackend>(extensions.length);

  for (IExtension extension : extensions) {
    for (IConfigurationElement element : extension.getConfigurationElements()) {
      if (!WipBackExtensionPoint.ELEMENT_NAME.equals(element.getName())) {
        continue;
      }
      Object obj;
      try {
        obj = element.createExecutableExtension(WipBackExtensionPoint.CLASS_PROPERTY);
      } catch (CoreException e) {
        throw new RuntimeException(e);
      }
      WipBackend backend = (WipBackend) obj;
      result.add(backend);
    }
  }
  return result;
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:25,代码来源:BackendRegistry.java

示例12: registerOverlays

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
public static void registerOverlays(final Map map) {

		final IExtensionRegistry registry = RegistryFactory.getRegistry();
		final IExtensionPoint point = registry.getExtensionPoint("net.tourbook.mapOverlay"); //$NON-NLS-1$
		final IExtension[] extensions = point.getExtensions();

		for (final IExtension extension : extensions) {
			final IConfigurationElement[] elements = extension.getConfigurationElements();

			final IConfigurationElement element = elements[elements.length - 1];

			Object o = null;
			try {
				o = element.createExecutableExtension("class"); //$NON-NLS-1$
			} catch (final CoreException e) {
				e.printStackTrace();
			}

			if (o != null && o instanceof MapPainter) {
				map.addOverlayPainter((MapPainter) o);
			}
		}
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:24,代码来源:GeoclipseExtensions.java

示例13: registerOverlays

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
public static void registerOverlays(final Map map) {

		final IExtensionRegistry registry = RegistryFactory.getRegistry();
		final IExtensionPoint point = registry.getExtensionPoint("de.byteholder.geoclipse.mapOverlay"); //$NON-NLS-1$
		final IExtension[] extensions = point.getExtensions();

		for (final IExtension extension : extensions) {
			final IConfigurationElement[] elements = extension.getConfigurationElements();

			final IConfigurationElement element = elements[elements.length - 1];

			Object o = null;
			try {
				o = element.createExecutableExtension("class"); //$NON-NLS-1$
			} catch (final CoreException e) {
				e.printStackTrace();
			}

			if (o != null && o instanceof MapPainter) {
				map.addOverlayPainter((MapPainter) o);
			}
		}
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:24,代码来源:GeoclipseExtensions.java

示例14: createFeatureProviders

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
protected Collection<FeatureProvider> createFeatureProviders() throws ResourceException {
    IExtensionPoint point = RegistryFactory.getRegistry().getExtensionPoint(PLUGIN_ID, "features");
    Collection<FeatureProvider> providers = new HashSet<FeatureProvider>();
    providers.add(resourceProvider);
    Set<Class<?>> knownFeatures = new HashSet<Class<?>>();
    IConfigurationElement[] configurationElements = point.getConfigurationElements();
    for (int i = 0; i < configurationElements.length; i++) {
        try {
            FeatureProvider currentFeatureProvider = (FeatureProvider) configurationElements[i]
                    .createExecutableExtension("provider");
            if (!currentFeatureProvider.isEnabled())
            	continue;
            Set<Class<?>> provided = new HashSet<Class<?>>(Arrays.asList(currentFeatureProvider
                    .getProvidedFeatureTypes()));
            provided.retainAll(knownFeatures);
            if (!provided.isEmpty())
                throw new ResourceException("Provider " + currentFeatureProvider.getClass().getSimpleName()
                        + " provides redundant features: " + provided);
            knownFeatures.addAll(Arrays.asList(currentFeatureProvider.getProvidedFeatureTypes()));
            providers.add(currentFeatureProvider);
        } catch (CoreException e) {
            throw new ResourceException(e);
        }
    }
    return providers;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:27,代码来源:BasicResourceManager.java

示例15: initialize

import org.eclipse.core.runtime.RegistryFactory; //导入依赖的package包/类
public static void initialize(Scheduler scheduler){
	try {
		IExtensionPoint refDataExtensionPoint =
			RegistryFactory.getRegistry().getExtensionPoint(SCHEDULED_JOB_EXTENSION_POINT);
		IConfigurationElement[] extensionPoints =
			refDataExtensionPoint.getConfigurationElements();
		
		for (IConfigurationElement ePoint : extensionPoints) {
			Object o = ePoint.createExecutableExtension(CLASS_PROPERTY);
			
			if (o instanceof AbstractElexisSchedulerJob) {
				AbstractElexisSchedulerJob aesj = (AbstractElexisSchedulerJob) o;
				log.debug("Found AbstractElexisSchedulerJob for " + aesj.getJob());
				addJob(aesj, scheduler);
			}
		}
	} catch (CoreException e) {
		log.error("Exception occured trying to load AstractElexisScheduler extension points", e);
	}
	
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:22,代码来源:ElexisSchedulerExtensionPoint.java


注:本文中的org.eclipse.core.runtime.RegistryFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。