public void run() throws Exception { IConfigurationElement[] extensions= Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT_ID); for (int i= 0; i < extensions.length; i++) { IConfigurationElement curr= extensions[i]; if (PROVIDER_NODE_NAME.equals(curr.getName()) && id.equals(curr.getAttribute(ATTRIB_ID))) { res[0]= (TextSearchQueryProvider) curr.createExecutableExtension(ATTRIB_CLASS); return; } } } public void handleException(Throwable e) {
/** * This method returns the id of the tab that this tab should be placed immediately after. * @return the id of the relative tab or <code>null</code> if one has not been specified * */ public String getRelativeTabId() { IConfigurationElement[] elems = fElement.getChildren(IConfigurationElementConstants.PLACEMENT); if(elems.length == 1) { return elems[0].getAttribute(IConfigurationElementConstants.AFTER); } return null; }
IConfigurationElement[] config = Platform.getExtensionRegistry() .getConfigurationElementsFor( Activator.EXTENSION_POINT_ID_MAPPER); try { for (IConfigurationElement e : config) { final Object o = e.createExecutableExtension("class"); if (o instanceof ThemePreferenceMapper) { String pluginId = e.getAttribute("pluginId"); ThemePreferenceMapper mapper = (ThemePreferenceMapper) o; mapper.setPluginId(pluginId); if (o instanceof GenericMapper) { String xml = e.getAttribute("xml"); String contributorPluginId = e.getContributor() .getName(); Bundle bundle = Platform.getBundle(contributorPluginId); InputStream input = (InputStream) bundle.getResource( xml).getContent();
private String getDescriptionFromConfig(IConfigurationElement config) { IConfigurationElement [] children = config.getChildren(TAG_DESCRIPTION); if (children.length>=1) { return children[0].getValue(); } return ""; //$NON-NLS-1$ }
/** * Loads runtime classpath extensions */ private void initializeRuntimeClasspathExtensions() { IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(LaunchingPlugin.ID_PLUGIN, ID_EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRIES); IConfigurationElement[] configs= extensionPoint.getConfigurationElements(); fClasspathEntryExtensions = new HashMap<String, IConfigurationElement>(configs.length); for (int i= 0; i < configs.length; i++) { fClasspathEntryExtensions.put(configs[i].getAttribute("id"), configs[i]); //$NON-NLS-1$ } }
private void readExtentions() { IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint point = registry.getExtensionPoint(PDECore.PLUGIN_ID, TARGET_LOC_EXTPT); if (point == null) return; IExtension[] extensions = point.getExtensions(); for (int i = 0; i < extensions.length; i++) { IConfigurationElement[] elements = extensions[i].getConfigurationElements(); for (int j = 0; j < elements.length; j++) { String type = elements[j].getAttribute(ATTR_TYPE); if (type != null) { fExtentionMap.put(type, elements[j]); } } } }
private Bundle getBundle() { String namespace= fElement.getDeclaringExtension().getContributor().getName(); Bundle bundle= Platform.getBundle(namespace); return bundle; }
public static void initExtensions() { IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint templatesExtensionPoint = registry.getExtensionPoint(EXTENSION_CUSTOM_CATEGORY); IExtension[] templateExtensions = templatesExtensionPoint.getExtensions(); for (IExtension templateExtension : templateExtensions) { IConfigurationElement[] elements = templateExtension.getConfigurationElements(); for (IConfigurationElement element : elements) { if (element.getName().equals(EXTENSION_TMPL_REPOSITORY_CATEGORY)) { readRepositoryCategory(element); } } } }
private void loadElements() { fFrameworks = new HashMap(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IConfigurationElement[] elements = registry.getConfigurationElementsFor(POINT_ID); for (int i = 0; i < elements.length; i++) { String id = elements[i].getAttribute(ATT_ID); if (id == null || elements[i].getAttribute(ATT_NAME) == null || elements[i].getAttribute(ATT_DELEGATE) == null) continue; fFrameworks.put(id, elements[i]); } }
/** * Reads the MetaDataEnabledFeatures extensions into a registry */ protected void readRegistry() { try { IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(JSFCorePlugin.PLUGIN_ID, EXTPTID); IExtension[] extensions = point.getExtensions(); for (int i=0;i < extensions.length;i++){ IExtension ext = extensions[i]; for (int j=0;j < ext.getConfigurationElements().length;j++){ final String bundleId = ext.getConfigurationElements()[j].getContributor().getName(); final String id = ext.getConfigurationElements()[j].getAttribute("typeid"); final String klass = ext.getConfigurationElements()[j].getAttribute("class"); registerFeature(bundleId, id, klass); } } } catch (InvalidRegistryObjectException e) { JSFCorePlugin.log(e, "Unable to read " + JSFCorePlugin.PLUGIN_ID + EXTPTID + " registry"); } }
public boolean supportsConfigs() { if (!supportsConfigurationsCalculated) { IExtension extension = Platform.getExtensionRegistry().getExtension(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PT_BUILDERS, name); if (extension != null) { IConfigurationElement[] configs = extension.getConfigurationElements(); if (configs.length != 0) { String value = configs[0].getAttribute("supportsConfigurations"); //$NON-NLS-1$ supportsConfigurations = (value != null && value.equalsIgnoreCase(Boolean.TRUE.toString())); } } supportsConfigurationsCalculated = true; } return supportsConfigurations; }
public static List<ITestNGLaunchConfigurationProvider> getLaunchConfigurationProviders() throws CoreException { List<ITestNGLaunchConfigurationProvider> result = new ArrayList<>(); IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint extensionPoint = registry .getExtensionPoint("org.testng.eclipse.launchConfigurationProvider"); IExtension extensions[] = extensionPoint.getExtensions(); for (IExtension ext : extensions) { IConfigurationElement elements[] = ext.getConfigurationElements(); for (IConfigurationElement element : elements) { ITestNGLaunchConfigurationProvider provider = (ITestNGLaunchConfigurationProvider) element .createExecutableExtension("class"); result.add(provider); } } return result; }
private Map<String, String> createThemeAssociations() { Map<String, String> result = new HashMap<>(); IExtensionRegistry registry = RegistryFactory.getRegistry(); IExtensionPoint extPoint = registry.getExtensionPoint(E4_THEME_EXTENSION_POINT); for (IExtension e : extPoint.getExtensions()) { for (IConfigurationElement ce : e.getConfigurationElements()) { if (ce.getName().equals(ATT_THEME_ASSOCIATION)) { String themeId = ce.getAttribute(ATT_THEME_ID); String osVersion = ce.getAttribute(ATT_OS_VERSION); result.put(osVersion != null ? themeId + osVersion : themeId, ce.getAttribute(ATT_COLOR_AND_FONT_ID)); } } } return result; }
@Override public void run() throws Exception { String pluginId = fElement.getContributor().getName(); boolean isPlugInActivated= Platform.getBundle(pluginId).getState() == Bundle.ACTIVE; if (isPlugInActivated || canActivatePlugIn()) result[0]= (IHyperlinkDetector)fElement.createExecutableExtension(CLASS_ATTRIBUTE); } @Override
private void setupWizardPluginIDMap() { wizardPluginIDMap = new HashMap(); // get editor plugin and save it to a hash map // Note: editors extension id is different from editor id IExtensionPoint[] point = new IExtensionPoint[]{Platform.getExtensionRegistry().getExtensionPoint(ORG_ECLIPSE_UI, "exportWizards"), //$NON-NLS-1$ Platform.getExtensionRegistry().getExtensionPoint(ORG_ECLIPSE_UI, "importWizards"), //$NON-NLS-1$ Platform.getExtensionRegistry().getExtensionPoint(ORG_ECLIPSE_UI, "newWizards"), //$NON-NLS-1$ Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.wst.common.frameworks.ui", "extendableWizard")}; //$NON-NLS-1$ //$NON-NLS-2$ for (int x = 0; x < point.length; x++) { IConfigurationElement[] elements = point[x].getConfigurationElements(); for (int i = 0; i < elements.length; i++) { String wizardID = elements[i].getAttribute("id"); //$NON-NLS-1$ String pluginID = elements[i].getDeclaringExtension().getNamespace(); wizardPluginIDMap.put(wizardID, pluginID); } } }
/** * Load extensions */ private void initialize() { fConfigurations = new HashMap<>(); IExtensionPoint point= Platform.getExtensionRegistry().getExtensionPoint(DebugUIPlugin.getUniqueIdentifier(), EXTENSION_POINT_STRING_VARIABLE_PRESENTATIONS); IConfigurationElement elements[]= point.getConfigurationElements(); for (int i = 0; i < elements.length; i++) { IConfigurationElement element = elements[i]; String name= element.getAttribute(ATTR_NAME); if (name == null) { DebugUIPlugin.logErrorMessage(MessageFormat.format("String variable presentation extension missing required 'variableName' attribute: {0}", new Object[] { element.getDeclaringExtension().getLabel() })); //$NON-NLS-1$ continue; } fConfigurations.put(name, element); } }
/** * @param configElement */ public StatusHandlerProductBindingDescriptor( IConfigurationElement configElement) { super(); id = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID); pluginId = configElement.getContributor().getName(); productId = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_PRODUCTID); handlerId = configElement.getAttribute(ATT_HANDLER_ID); }
private synchronized void ensureCleanUpInitializersRegistered() { if (fCleanUpInitializerDescriptors != null) return; ArrayList<CleanUpInitializerDescriptor> result= new ArrayList<>(); IExtensionPoint point= Platform.getExtensionRegistry().getExtensionPoint(JavaPlugin.getPluginId(), EXTENSION_POINT_NAME); IConfigurationElement[] elements= point.getConfigurationElements(); for (int i= 0; i < elements.length; i++) { IConfigurationElement element= elements[i]; if (CLEAN_UP_INITIALIZER_CONFIGURATION_ELEMENT_NAME.equals(element.getName())) { result.add(new CleanUpInitializerDescriptor(element)); } } fCleanUpInitializerDescriptors= result.toArray(new CleanUpInitializerDescriptor[result.size()]); }
private Configuration readProvider(IConfigurationElement element) { if (!ELEM_PROVIDER.equals(element.getName())) { reportError(SecAuthMessages.unexpectedConfigElement, element.getName(), element, null); return null; } try { return (Configuration) element.createExecutableExtension(ATTR_PROVIDER_CLASS); } catch (CoreException e) { reportError(SecAuthMessages.instantiationFailed, element.getAttribute(ATTR_PROVIDER_CLASS), element, e); return null; } }
/** * Returns the sorter's image * @return the sorter's image */ public ImageDescriptor getImage() { String imageName= fElement.getAttribute(ICON_ATTRIBUTE); if (imageName == null) return null; Bundle bundle = Platform.getBundle(fElement.getContributor().getName()); return SearchPluginImages.createImageDescriptor(bundle, new Path(imageName), true); }