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]); } } } }
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(); ((GenericMapper) mapper).parseMappings(input);
protected static boolean isWindows() { return Platform.OS_WIN32.equals(Platform.getOS()); }
/** * 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$ } }
@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
public EjbEmitter(IConfigurationElement emitterConfig) throws ClassNotFoundException, InstantiationException, IllegalAccessException, CoreException { this.emitterConfig = emitterConfig; String pluginDescriptor = emitterConfig.getDeclaringExtension().getContributor().getName(); org.osgi.framework.Bundle bundle = Platform.getBundle(pluginDescriptor); Class c = bundle.loadClass(emitterConfig.getAttribute(CLASSPATHPROVIDER)); classpathProvider = (IEmitterClasspathProvider) c.newInstance(); base = bundle.getEntry("/").toString(); IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(EJBEMITTERPROJECT); IProgressMonitor monitor = new NullProgressMonitor(); project.delete(true, true, monitor); }
private static String[] readGlobalLoadingPluginNames() { IExtensionRegistry reg = Platform.getExtensionRegistry(); IExtensionPoint exPoint = reg.getExtensionPoint(ID, "globalPluginResourceLoad"); //$NON-NLS-1$ IExtension[] extensions = exPoint.getExtensions(); String[] names = new String[extensions.length]; if (extensions.length > 0) { for (int i = 0; i < extensions.length; i++) names[i] = extensions[i].getContributor().getName(); } return names; }
@Override public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { String id = config.getContributor().getName(); bundle = Platform.getBundle(id); if (data instanceof String) { clazzName = (String) data; } else { throw new CoreException(new Status(IStatus.ERROR, bundle.getSymbolicName(), "Unsupported extension initialization data: " + data)); } }
public SearchPageRegistry() { fExtensionToInstance= new HashMap<>(); fResultClassNameToExtension= new HashMap<>(); fExtensions= Platform.getExtensionRegistry().getConfigurationElementsFor(ID_EXTENSION_POINT); for (IConfigurationElement fExtension : fExtensions) { fResultClassNameToExtension.put(fExtension.getAttribute(ATTRIB_SEARCH_RESULT_CLASS), fExtension); } }
private Authenticator getPluggedInAuthenticator() { IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(Activator.ID, Activator.PT_AUTHENTICATOR).getExtensions(); if (extensions.length == 0) return null; IExtension extension = extensions[0]; IConfigurationElement[] configs = extension.getConfigurationElements(); if (configs.length == 0) { Activator.log(IStatus.ERROR, NLS.bind("Authenticator {0} is missing required fields", (new Object[] {extension.getUniqueIdentifier()})), null);//$NON-NLS-1$ return null; } try { IConfigurationElement config = configs[0]; return (Authenticator) config.createExecutableExtension("class");//$NON-NLS-1$ } catch (CoreException ex) { Activator.log(IStatus.ERROR, NLS.bind("Unable to instantiate authenticator {0}", (new Object[] {extension.getUniqueIdentifier()})), ex);//$NON-NLS-1$ return null; } }
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); } } }
private void initializeResourceServiceProviderRegistry(BundleContext context) { IExtensionRegistry eReg = Platform.getExtensionRegistry(); String symbolicName = context.getBundle().getSymbolicName(); new ContentResourceServiceProviderRegistryReader(eReg, symbolicName).readRegistry(); new ExtensionResourceServiceProviderRegistryReader(eReg, symbolicName).readRegistry(); new ProtocolResourceServiceProviderRegistryReader(eReg, symbolicName).readRegistry(); }
private void processIconAttr() { String iconAttr = mElement.getAttribute(ATTR_ICON); if (iconAttr != null && iconAttr.trim().length() > 0) { URL url = Platform.getBundle( mElement.getContributor().getName()).getEntry( iconAttr); mIcon = ImageDescriptor.createFromURL(url); } else { mIcon = ImageDescriptor.getMissingImageDescriptor(); } }
@Override public boolean isDeclaringPluginActive() { Bundle fBundle= Platform.getBundle(fConfigElement.getContributor().getName()); return fBundle.getState() == Bundle.ACTIVE; }
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()]); }
/** * Computes whether this build command allows configuration of its * triggers, based on information in the builder extension declaration. */ private void computeIsConfigurable() { triggers |= MASK_CONFIG_COMPUTED; 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("isConfigurable"); //$NON-NLS-1$ setConfigurable(value != null && value.equalsIgnoreCase(Boolean.TRUE.toString())); } } }
protected IConfigurationElement[] getExtendedConfigurationElements() { IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint exampleWizardXP = registry.getExtensionPoint(EXAMPLE_WIZARD_XP_ID); if (exampleWizardXP == null) { return new IConfigurationElement[0]; } IExtension extension = exampleWizardXP.getExtension(getWizardExtensionId()); if (extension != null) { return extension.getConfigurationElements(); } IConfigurationElement[] exampleWizardCEs = exampleWizardXP.getConfigurationElements(); return exampleWizardCEs; }
/** * Returns whether creating executable extensions is acceptable * at this point in time. In particular, returns <code>false</code> * when the system bundle is shutting down, which only occurs * when the entire framework is exiting. */ private boolean canCreateExtensions() { return Platform.getBundle("org.eclipse.osgi").getState() != Bundle.STOPPING; //$NON-NLS-1$ }
private IConfigurationElement[] loadElements() { IExtensionPoint point = Platform.getExtensionRegistry() .getExtensionPoint("org.eclipse.ui", "installationPages"); //$NON-NLS-1$ //$NON-NLS-2$ return point.getConfigurationElements(); }
private Bundle getBundle() { String namespace= fElement.getDeclaringExtension().getContributor().getName(); Bundle bundle= Platform.getBundle(namespace); return bundle; }