本文整理汇总了Java中org.eclipse.core.runtime.RegistryFactory.getRegistry方法的典型用法代码示例。如果您正苦于以下问题:Java RegistryFactory.getRegistry方法的具体用法?Java RegistryFactory.getRegistry怎么用?Java RegistryFactory.getRegistry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.RegistryFactory
的用法示例。
在下文中一共展示了RegistryFactory.getRegistry方法的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);
}
}
}
}
示例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);
}
}
}
}
示例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);
}
}
示例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);
}
}
}
示例5: 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);
}
}
}
示例6: 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;
}
示例7: 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);
}
}
}
}
示例8: 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);
}
}
}
示例9: 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);
}
}
}
示例10: initialize
import org.eclipse.core.runtime.RegistryFactory; //导入方法依赖的package包/类
/**
* Read 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 IExtension[] extensions = registry.getExtensionPoint(FILE_EXTENSIONS_POINT_ID).getExtensions();
for (IExtension extension : extensions) {
final IConfigurationElement[] configElems = extension.getConfigurationElements();
for (IConfigurationElement elem : configElems) {
try {
List<String> fileExtensions = Splitter.on(',').trimResults().omitEmptyStrings()
.splitToList(elem.getAttribute(ATT_FILE_EXTENSION));
String elementName = elem.getName();
if (ATT_TRANSPILABLE_FILE_EXTENSIONS.equals(elementName)) {
transpilableFileExtensions.addAll(fileExtensions);
} else if (ATT_TEST_FILE_EXTENSIONS.equals(elementName)) {
testFileExtensions.addAll(fileExtensions);
} else if (ATT_RUNNABLE_FILE_EXTENSIONS.equals(elementName)) {
runnableFileExtensions.addAll(fileExtensions);
} else if (ATT_TYPABLE_FILE_EXTENSIONS.equals(elementName)) {
typableFileExtensions.addAll(fileExtensions);
} else if (ATT_RAW_FILE_EXTENSIONS.equals(elementName)) {
rawFileExtensions.addAll(fileExtensions);
} else {
LOGGER.error(new UnsupportedOperationException(
"This file extension type " + elementName + " is not supported yet"));
}
} catch (Exception ex) {
LOGGER.error("Error while reading extensions for extension point " + FILE_EXTENSIONS_POINT_ID,
ex);
}
}
}
}
}
示例11: initialize
import org.eclipse.core.runtime.RegistryFactory; //导入方法依赖的package包/类
/**
* Read 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 IExtension[] extensions = registry.getExtensionPoint(SUBGENERATORS_EXTENSIONS_POINT_ID)
.getExtensions();
for (IExtension extension : extensions) {
final IConfigurationElement[] configElems = extension.getConfigurationElements();
for (IConfigurationElement elem : configElems) {
try {
String fileExtensions = elem.getAttribute(ATT_FILE_EXTENSIONS);
List<String> fileExtensionList = Splitter.on(',').trimResults().omitEmptyStrings()
.splitToList(fileExtensions);
ISubGenerator generator = (ISubGenerator) elem
.createExecutableExtension(ATT_SUB_GENERATOR_CLASS);
for (String fileExtension : fileExtensionList) {
register(generator, fileExtension);
}
} catch (Exception ex) {
LOGGER.error(
"Error while reading extensions for extension point "
+ SUBGENERATORS_EXTENSIONS_POINT_ID,
ex);
}
}
}
}
}
示例12: setUp
import org.eclipse.core.runtime.RegistryFactory; //导入方法依赖的package包/类
@Before
public void setUp() {
IExtensionRegistry registry = RegistryFactory.getRegistry();
IExtension extension =
registry.getExtension("org.eclipse.ui.console.consolePatternMatchListeners",
"com.google.cloud.tools.eclipse.appengine.localserver.urlLinker");
assertNotNull("URL linking extension not found", extension);
assertEquals("Should only have a single URL linker", 1,
extension.getConfigurationElements().length);
IConfigurationElement definition = extension.getConfigurationElements()[0];
assertEquals("consolePatternMatchListener", definition.getName());
assertNotNull(definition.getAttribute("regex"));
regexp = Pattern.compile(".*(" + definition.getAttribute("regex") + ").*");
}
示例13: WidgetRuntimeFactory
import org.eclipse.core.runtime.RegistryFactory; //导入方法依赖的package包/类
/** Initialize available runtimes */
private WidgetRuntimeFactory()
{
final IExtensionRegistry registry = RegistryFactory.getRegistry();
if (registry == null)
{ // Fall back to hardcoded runtimes
runtimes.put(DisplayModel.WIDGET_TYPE, () -> new DisplayRuntime());
runtimes.put(ArrayWidget.WIDGET_DESCRIPTOR.getType(), () -> new ArrayWidgetRuntime());
runtimes.put(EmbeddedDisplayWidget.WIDGET_DESCRIPTOR.getType(), () -> new EmbeddedDisplayRuntime());
runtimes.put(GroupWidget.WIDGET_DESCRIPTOR.getType(), () -> new GroupWidgetRuntime());
runtimes.put(KnobWidget.WIDGET_DESCRIPTOR.getType(), () -> new KnobWidgetRuntime());
runtimes.put(ImageWidget.WIDGET_DESCRIPTOR.getType(), () -> new ImageWidgetRuntime());
runtimes.put(NavigationTabsWidget.WIDGET_DESCRIPTOR.getType(), () -> new NavigationTabsRuntime());
runtimes.put(ScaledSliderWidget.WIDGET_DESCRIPTOR.getType(), () -> new SliderWidgetRuntime());
runtimes.put(ScrollBarWidget.WIDGET_DESCRIPTOR.getType(), () -> new SliderWidgetRuntime());
runtimes.put(TableWidget.WIDGET_DESCRIPTOR.getType(), () -> new TableWidgetRuntime());
runtimes.put(TabsWidget.WIDGET_DESCRIPTOR.getType(), () -> new TabsWidgetRuntime());
runtimes.put(XYPlotWidget.WIDGET_DESCRIPTOR.getType(), () -> new XYPlotWidgetRuntime());
}
else
{ // Locate runtimes in registry
for (IConfigurationElement config : registry.getConfigurationElementsFor(WidgetRuntime.EXTENSION_POINT))
{
final String type = config.getAttribute("type");
runtimes.put(type, createSupplier(config));
}
}
}
示例14: initialize
import org.eclipse.core.runtime.RegistryFactory; //导入方法依赖的package包/类
@Override
protected void initialize()
{
final Map<String, WidgetRepresentationFactory<Parent, Node>> factories = new HashMap<>();
registerKnownRepresentations(factories);
final IExtensionRegistry registry = RegistryFactory.getRegistry();
if (registry != null)
{ // Load available representations from registry,
// which allows other plugins to contribute new widgets.
for (IConfigurationElement config : registry.getConfigurationElementsFor(WidgetRepresentation.EXTENSION_POINT))
{
final String type = config.getAttribute("type");
final String clazz = config.getAttribute("class");
logger.log(Level.CONFIG, "{0} contributes {1}", new Object[] { config.getContributor().getName(), clazz });
factories.put(type, createFactory(config));
}
}
for (Map.Entry<String, WidgetRepresentationFactory<Parent, Node>> entry : factories.entrySet())
register(entry.getKey(), entry.getValue());
if (! initialized_colormaps)
{
for (PredefinedColorMaps.Predefined map : PredefinedColorMaps.PREDEFINED)
NamedColorMappings.add(new NamedColorMapping(map.getName(), intensity -> ColorMappingFunction.getRGB(map.getColor(intensity))));
initialized_colormaps = true;
}
}
示例15: readFactories
import org.eclipse.core.runtime.RegistryFactory; //导入方法依赖的package包/类
/**
* @return Returns a list with all available map/tile factories
*/
public List<MPPlugin> readFactories() {
if (_tileFactories != null) {
return _tileFactories;
}
final IExtensionRegistry registry = RegistryFactory.getRegistry();
final IExtensionPoint point = registry.getExtensionPoint("net.tourbook.tilefactory"); //$NON-NLS-1$
final IExtension[] extensions = point.getExtensions();
_tileFactories = new ArrayList<MPPlugin>();
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 MPPlugin) {
_tileFactories.add((MPPlugin) o);
}
}
return _tileFactories;
}