Refine search
/** * Logs the error in the desktop log using the provided * text and the information in the configuration element. */ protected void logError(IConfigurationElement element, String text) { IExtension extension = element.getDeclaringExtension(); System.err.println("Plugin " + extension.getContributor().getName() + ", extension " + extension.getExtensionPointUniqueIdentifier()); System.err.println(text); }
private void readStockThemes(Map<String, ColorTheme> themes) { IConfigurationElement[] config = Platform.getExtensionRegistry() .getConfigurationElementsFor( Activator.EXTENSION_POINT_ID_THEME); try { for (IConfigurationElement e : config) { String xml = e.getAttribute("file"); String contributorPluginId = e.getContributor().getName(); Bundle bundle = Platform.getBundle(contributorPluginId); InputStream input = (InputStream) bundle.getResource(xml) .getContent(); ParsedTheme theme = parseTheme(input, false); amendThemeEntries(theme.getTheme().getEntries()); themes.put(theme.getTheme().getName(), theme.getTheme()); } } catch (Exception e) { e.printStackTrace(); } }
private String getNamespace(IConfigurationElement configurationElement) { String namespace = null; if (configurationElement != null) { IExtension extension = configurationElement.getDeclaringExtension(); if (extension != null) { namespace = extension.getContributor().getName(); } } return namespace; }
/** * 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"); } }
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(
/** * Returns the name space that declares this working set. * * @return the name space declaring this working set */ public String getDeclaringNamespace() { return configElement.getContributor().getName(); }
@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 static String collectContributingExtentionsToDisplay( String patternToFind, IExtension[] extensions) { StringBuilder sb = new StringBuilder(); boolean isFirst = true; for (int i = 0; i < extensions.length; i++) { IConfigurationElement[] configElements = extensions[i] .getConfigurationElements(); for (int j = 0; j < configElements.length; j++) { if (patternToFind.equals(configElements[j] .getAttribute("pattern"))) { //$NON-NLS-1$ if (!isFirst) { sb.append(", "); //$NON-NLS-1$ } isFirst = false; sb.append(extensions[i].getContributor().getName()); } } } return sb.toString(); }
private void displayExtension(IExtension extention, CommandInterpreter ci, boolean full) { if (extention == null) return; if (full) { ci.print("Id: " + extention.getUniqueIdentifier()); //$NON-NLS-1$ ci.print(" PointId: " + extention.getExtensionPointUniqueIdentifier()); //$NON-NLS-1$ ci.println(" [from " + extention.getContributor().getName() + "]"); //$NON-NLS-1$ //$NON-NLS-2$ } else { ci.println(extention.getUniqueIdentifier() + " [from " + extention.getContributor().getName() + "]"); //$NON-NLS-1$ //$NON-NLS-2$ } }
public void fail(String message) throws CoreException { String id= findId(fElement); String extensionPointId= fElement.getDeclaringExtension().getExtensionPointUniqueIdentifier(); Object[] args= { fElement.getContributor().getName(), id, extensionPointId }; String blame= MessageFormat.format(RulerColumnMessages.ExtensionPointHelper_invalid_contribution_msg, args); IStatus status= new Status(IStatus.WARNING, TextEditorPlugin.PLUGIN_ID, IStatus.OK, blame + message, null); throw new CoreException(status); }
@Override public void run() throws Exception { IConfigurationElement[] configElements = extension.getConfigurationElements(); if (configElements.length == 0) { missingStartupElementMessage("The org.eclipse.ui.IStartup extension from '" + //$NON-NLS-1$ extension.getContributor().getName() + "' does not provide a valid '" //$NON-NLS-1$ + IWorkbenchConstants.TAG_STARTUP + "' element."); //$NON-NLS-1$ } // look for the startup tag in each element and run the extension for (IConfigurationElement element : configElements) { if (element != null&& element.getName().equals(IWorkbenchConstants.TAG_STARTUP)) { runEarlyStartup(WorkbenchPlugin.createExtension(element, IWorkbenchConstants.TAG_CLASS)); } } }
@Override public boolean compare(Object extension1, Object extension2) { String s1 = ((IExtension) extension1).getContributor().getName(); String s2 = ((IExtension) extension2).getContributor().getName(); //Return true if elementTwo is 'greater than' elementOne return s2.compareToIgnoreCase(s1) > 0; } };
protected void init( IExtension bridgeExtension ) throws OdaException { assert( bridgeExtension != null ); m_bridgeExtension = bridgeExtension; m_namespace = m_bridgeExtension.getContributor().getName(); m_bridgeElement = ExtensionExplorer.getNamedElement( m_bridgeExtension, BRIDGE_ELEMENT, DRIVER_TYPE_ATTRIBUTE ); if( m_bridgeElement == null ) throw new OdaException( new IllegalArgumentException( m_namespace ) ); m_driverType = m_bridgeElement.getAttribute( DRIVER_TYPE_ATTRIBUTE ); if( m_driverType == null || m_driverType.trim().length() == 0 ) throw new OdaException( new IllegalArgumentException( DRIVER_TYPE_ATTRIBUTE ) ); m_bridgeDataSourceId = m_bridgeElement.getAttribute( BRIDGE_ATTRIBUTE ); if( m_bridgeDataSourceId == null || m_bridgeDataSourceId.trim().length() == 0 ) throw new OdaException( new IllegalArgumentException( BRIDGE_ATTRIBUTE ) ); }
private void loadDefinitions() { IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PT_MARKERS); IExtension[] types = point.getExtensions(); definitions = new HashMap<>(types.length); for (int i = 0; i < types.length; i++) { String markerId = types[i].getUniqueIdentifier(); if (markerId != null) definitions.put(markerId.intern(), new MarkerTypeDefinition(types[i])); else Policy.log(IStatus.WARNING, "Missing marker id from plugin: " + types[i].getContributor().getName(), null); //$NON-NLS-1$ } } }
private Extension createExtensionAdapter(IExtension extension) { Extension adapter = new Extension(); adapter.setNamespaceIdentifier(extension.getNamespaceIdentifier()); adapter.setLabel(extension.getLabel()); adapter.setExtensionPointUniqueIdentifier(extension.getExtensionPointUniqueIdentifier()); adapter.setContributor(getBundleId(extension.getContributor().getName())); IConfigurationElement[] elements = extension.getConfigurationElements(); if (elements.length > 0) { ConfigurationElement[] configurationElements = new ConfigurationElement[elements.length]; for (int i = 0; i < elements.length; i++) { configurationElements[i] = createConfigurationElement(elements[i]); } adapter.setConfigurationElements(configurationElements); } return adapter; }
static public void log(IConfigurationElement element, String elementName, String msg) { String contributorName = element.getContributor().getName(); String extensionID = element.getDeclaringExtension().getUniqueIdentifier(); log(elementName, msg, contributorName, extensionID); }
@Override public String getPluginId() { IConfigurationElement element = getConfigurationElement(); if (!element.isValid()) { crashDisable(); return null; } return element.getContributor().getName(); }
public Bundle getBundle(IContributor contributor) { String name = contributor.getName(); PackageAdmin admin = getPackageAdmin(); Bundle[] bundles = admin.getBundles(name, null); if (bundles == null || bundles.length == 0) return null; return bundles[0]; // if there is more than one we need more work... }
/** * @param configElement */ public StatusHandlerDescriptor(IConfigurationElement configElement) { super(); this.configElement = configElement; id = configElement.getAttribute(IWorkbenchRegistryConstants.ATT_ID); pluginId = configElement.getContributor().getName(); }
/** * Returns the plugin's ID. * * @return The plugin's ID */ private String getPluginID() { return config_element.getDeclaringExtension().getContributor().getName(); }