org.eclipse.core.runtime.IExtension Java Examples

The following examples show how to use org.eclipse.core.runtime.IExtension. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ValidExtensionPointManager.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns proxies for all registered extensions; does not cause the extension plug-ins to be loaded.
 * The proxies contain -- and can therefore be queried for -- all the XML attribute values that the
 * extensions provide in their <i>plugin.xml</i> file. Throws IllegalArgumentException
 * if extension point is unknown
 *
 * @return array of proxies
 */
public static ValidExtension[] getExtensions() {
  IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(PLUGIN_ID, EXTENSION_POINT_NAME);
  if (point == null) {
    throw new IllegalArgumentException(MessageFormat.format(UNKNOWN_EXTENSION_POINT, PLUGIN_ID, EXTENSION_POINT_NAME));
  }
  IExtension[] extensions = point.getExtensions();
  List<ValidExtension> found = new ArrayList<ValidExtension>();
  for (IExtension e : extensions) {
    ValidExtension obj = ValidExtension.parseExtension(e);
    if (obj != null) {
      found.add(obj);
    }
  }
  return found.toArray(new ValidExtension[found.size()]);
}
 
Example #2
Source File: Extensions.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Eine Liste von IConfigurationElements (=komplette Definition) liefern, die an einem
 * bestimmten Extensionpoint hängen, und den entsprechenden Elementnamen haben
 * 
 * @param ext
 * @param elementName
 * @return
 * @since 3.3
 */
public static List<IConfigurationElement> getExtensions(String ext, String elementName){
	List<IConfigurationElement> ret = new LinkedList<IConfigurationElement>();
	IExtensionRegistry exr = Platform.getExtensionRegistry();
	IExtensionPoint exp = exr.getExtensionPoint(ext);
	if (exp != null) {
		IExtension[] extensions = exp.getExtensions();
		for (IExtension ex : extensions) {
			IConfigurationElement[] elems = ex.getConfigurationElements();
			for (IConfigurationElement el : elems) {
				if (elementName != null) {
					if (elementName.equals(el.getName())) {
						ret.add(el);
					}
				} else {
					ret.add(el);
				}
			}
		}
		
	}
	return ret;
}
 
Example #3
Source File: ScriptEngineFactoryManagerImpl.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public ScriptEngineFactoryManagerImpl( )
{
	super( );
	configs = new HashMap<String, IConfigurationElement>( );
	IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry( );
	IExtensionPoint extensionPoint = extensionRegistry
			.getExtensionPoint( "org.eclipse.birt.core.ScriptEngineFactory" );

	IExtension[] extensions = extensionPoint.getExtensions( );
	for ( IExtension extension : extensions )
	{
		IConfigurationElement[] configurations = extension
				.getConfigurationElements( );
		for ( IConfigurationElement configuration : configurations )
		{
			String scriptName = configuration.getAttribute( "scriptName" );
			configs.put( scriptName, configuration );
		}
	}
}
 
Example #4
Source File: SelfHelpDisplay.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
private static void createHelpDisplay() {
	IExtensionPoint point = Platform.getExtensionRegistry()
			.getExtensionPoint(HELP_DISPLAY_EXTENSION_ID );
	if (point != null) {
		IExtension[] extensions = point.getExtensions();
		if (extensions.length != 0) {
			// We need to pick up the non-default configuration
			IConfigurationElement[] elements = extensions[0]
					.getConfigurationElements();
			if (elements.length == 0) 
				return;
			IConfigurationElement displayElement  = elements[0];
			// Instantiate the help display
			try {
				helpDisplay = (AbstractHelpDisplay) (displayElement
						.createExecutableExtension(HELP_DISPLAY_CLASS_ATTRIBUTE));
			} catch (CoreException e) {
				HelpBasePlugin.logStatus(e.getStatus());
			}
		}
	}
}
 
Example #5
Source File: ExtendPopupMenu.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
 * plugin.xml����^�O��ǂݍ���.
 * 
 * @throws CoreException
 * 
 * @throws CoreException
 */
public static List<ExtendPopupMenu> loadExtensions(ERDiagramEditor editor)
		throws CoreException {
	List<ExtendPopupMenu> extendPopupMenuList = new ArrayList<ExtendPopupMenu>();

	IExtensionRegistry registry = Platform.getExtensionRegistry();
	IExtensionPoint extensionPoint = registry
			.getExtensionPoint(EXTENSION_POINT_ID);

	if (extensionPoint != null) {
		for (IExtension extension : extensionPoint.getExtensions()) {
			for (IConfigurationElement configurationElement : extension
					.getConfigurationElements()) {

				ExtendPopupMenu extendPopupMenu = ExtendPopupMenu
						.createExtendPopupMenu(configurationElement, editor);

				if (extendPopupMenu != null) {
					extendPopupMenuList.add(extendPopupMenu);
				}
			}
		}
	}

	return extendPopupMenuList;
}
 
Example #6
Source File: SelfHelpDisplay.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
private static void createHelpDisplay() {
	IExtensionPoint point = Platform.getExtensionRegistry()
			.getExtensionPoint(HELP_DISPLAY_EXTENSION_ID );
	if (point != null) {
		IExtension[] extensions = point.getExtensions();
		if (extensions.length != 0) {
			// We need to pick up the non-default configuration
			IConfigurationElement[] elements = extensions[0]
					.getConfigurationElements();
			if (elements.length == 0) 
				return;
			IConfigurationElement displayElement  = elements[0];
			// Instantiate the help display
			try {
				helpDisplay = (AbstractHelpDisplay) (displayElement
						.createExecutableExtension(HELP_DISPLAY_CLASS_ATTRIBUTE));
			} catch (CoreException e) {
				HelpBasePlugin.logStatus(e.getStatus());
			}
		}
	}
}
 
Example #7
Source File: ApplicationActionBarAdvisor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 移除无用的菜单项:<br/>
 * File 菜单下的“open file...”和“Convert Line Delimiters To”
 */
private void removeUnusedAction() {
	ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
	IActionSetDescriptor[] actionSets = reg.getActionSets();

	List<String> actionSetIds = Arrays.asList("org.eclipse.ui.actionSet.openFiles",
			"org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo",
			"org.eclipse.ui.actions.showKeyAssistHandler", "org.eclipse.ui.edit.text.actionSet.navigation",
			"org.eclipse.ui.edit.text.actionSet.annotationNavigation");
	for (int i = 0; i < actionSets.length; i++) {
		if (actionSetIds.contains(actionSets[i].getId())) {
			IExtension ext = actionSets[i].getConfigurationElement().getDeclaringExtension();
			reg.removeExtension(ext, new Object[] { actionSets[i] });
		}
	}
}
 
Example #8
Source File: RegistryReader.java    From eclipsegraphviz with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Apply a reproducable order to the list of extensions provided, such that
 * the order will not change as extensions are added or removed.
 * 
 * @param extensions
 *            the extensions to order
 * @return ordered extensions
 */
public static IExtension[] orderExtensions(IExtension[] extensions) {
    // By default, the order is based on plugin id sorted
    // in ascending order. The order for a plugin providing
    // more than one extension for an extension point is
    // dependent in the order listed in the XML file.
    IExtension[] sortedExtension = new IExtension[extensions.length];
    System.arraycopy(extensions, 0, sortedExtension, 0, extensions.length);
    Comparator<IExtension> comparer = new Comparator<IExtension>() {
        public int compare(IExtension e1, IExtension e2) {
            return e1.getNamespaceIdentifier().compareToIgnoreCase(e2.getNamespaceIdentifier());
        }
    };
    Arrays.sort(sortedExtension, comparer);
    return sortedExtension;
}
 
Example #9
Source File: DataSetProvider.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @param dataSetType
 * @param dataSourceType
 * @return
 */
public static IConfigurationElement findDataSetElement( String dataSetType,
		String dataSourceType )
{
	// NOTE: multiple data source types can support the same data set type
	IConfigurationElement dataSourceElem = findDataSourceElement( dataSourceType );
	if ( dataSourceElem != null )
	{
		// Find data set declared in the same extension
		IExtension ext = dataSourceElem.getDeclaringExtension( );
		IConfigurationElement[] elements = ext.getConfigurationElements( );
		for ( int n = 0; n < elements.length; n++ )
		{
			if ( elements[n].getAttribute( "id" ).equals( dataSetType ) ) //$NON-NLS-1$
			{
				return elements[n];
			}
		}
	}
	return null;
}
 
Example #10
Source File: CordovaEngineRepoProvider.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Create {@link AbstractEngineRepoProvider} instance base on provider class
 * specified in extension's configuration.
 * 
 * @return {@link AbstractEngineRepoProvider} instance
 * @throws CoreException
 */
public AbstractEngineRepoProvider createProvider() throws CoreException {
	IExtension[] extensions = Platform.getExtensionRegistry()
			.getExtensions(contributor);
	if (extensions == null)
		throw new CoreException(new Status(IStatus.ERROR,
				HybridCore.PLUGIN_ID,
				"Contributing platform is no longer available."));
	for (int i = 0; i < extensions.length; i++) {
		if (extensions[i].getExtensionPointUniqueIdentifier().equals(
				EXTENSION_POINT_ID)) {
			IConfigurationElement[] configs = extensions[i]
					.getConfigurationElements();
			for (int j = 0; j < configs.length; j++) {
				if (configs[j].getAttribute(ATTR_ID).equals(getID())) {
					AbstractEngineRepoProvider provider = (AbstractEngineRepoProvider) configs[j]
							.createExecutableExtension(PROVIDER_ID);
					return provider;
				}
			}
		}
	}
	throw new CoreException(new Status(IStatus.ERROR, HybridCore.PLUGIN_ID,
			"Contributing platform has changed"));
}
 
Example #11
Source File: NativeProjectBuilder.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
public AbstractNativeBinaryBuildDelegate createDelegate(IProject project, File destination) throws CoreException{
	IExtension[] extensions = Platform.getExtensionRegistry().getExtensions(contributor);
	if(extensions == null )
		throw new CoreException(new Status(IStatus.ERROR, HybridCore.PLUGIN_ID,"Contributing platform is no longer available."));
	for (int i = 0; i < extensions.length; i++) {
		if(extensions[i].getExtensionPointUniqueIdentifier().equals(EXTENSION_POINT_ID)){
			IConfigurationElement[] configs = extensions[i].getConfigurationElements();
			for (int j = 0; j < configs.length; j++) {
				if(configs[j].getAttribute(ATTR_PLATFORM).equals(getPlatform())){
					AbstractNativeBinaryBuildDelegate delegate = (AbstractNativeBinaryBuildDelegate) configs[j].createExecutableExtension(ATTR_DELEGATE);
					delegate.init(project, destination);
					return delegate;
				}
			}
		}
	}
	throw new CoreException(new Status(IStatus.ERROR, HybridCore.PLUGIN_ID,"Contributing platform has changed"));
}
 
Example #12
Source File: NewICEItemProjectWizard.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a new wizard element for the definition of the java code
 * templates
 * 
 * @return the wizard element corresponding to the project's template
 */
private WizardElement getTemplateWizard() {
	IExtensionRegistry registry = Platform.getExtensionRegistry();
	IExtensionPoint point = registry.getExtensionPoint("org.eclipse.ice.projectgeneration", PLUGIN_POINT);
	if (point == null)
		return null;
	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++) {
			if (elements[j].getName().equals(TAG_WIZARD)) {
				if (TEMPLATE_ID.equals(elements[j].getAttribute(WizardElement.ATT_ID))) {
					return WizardElement.create(elements[j]);
				}
			}
		}
	}
	return null;
}
 
Example #13
Source File: ExtensionPoint.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public IConfigurationElement[] getConfigurationElements( )
{
    if( allExtConfigurations == null )
    {
        ArrayList<IConfigurationElement> extConfigList = new ArrayList<IConfigurationElement>( );
        IExtension[] extensions = getExtensions();
        for( int i= 0; i < extensions.length; i++ )
        {
            IConfigurationElement[] extConfigurations = extensions[i].getConfigurationElements();
            for( int j= 0; j < extConfigurations.length; j++ )
            {
                extConfigList.add( extConfigurations[j] );
            }
        }
        
        allExtConfigurations = extConfigList.toArray( new ConfigurationElement[extConfigList.size( )] );
    }
    
	return allExtConfigurations;
}
 
Example #14
Source File: ExtendPopupMenu.java    From ermasterr with Apache License 2.0 6 votes vote down vote up
/**
 * plugin.xmlからタグを読み込む.
 * 
 * @throws CoreException
 * @throws CoreException
 */
public static List<ExtendPopupMenu> loadExtensions(final ERDiagramEditor editor) throws CoreException {
    final List<ExtendPopupMenu> extendPopupMenuList = new ArrayList<ExtendPopupMenu>();

    final IExtensionRegistry registry = Platform.getExtensionRegistry();
    final IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_POINT_ID);

    if (extensionPoint != null) {
        for (final IExtension extension : extensionPoint.getExtensions()) {
            for (final IConfigurationElement configurationElement : extension.getConfigurationElements()) {

                final ExtendPopupMenu extendPopupMenu = ExtendPopupMenu.createExtendPopupMenu(configurationElement, editor);

                if (extendPopupMenu != null) {
                    extendPopupMenuList.add(extendPopupMenu);
                }
            }
        }
    }

    return extendPopupMenuList;
}
 
Example #15
Source File: BundleUtilities.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #16
Source File: WebAppProjectCreator.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
private void includeExtensionPartipants() throws CoreException {
  IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
  IExtensionPoint extensionPoint = extensionRegistry
      .getExtensionPoint("com.gwtplugins.gdt.eclipse.suite.webAppCreatorParticipant");
  if (extensionPoint == null) {
    return;
  }
  IExtension[] extensions = extensionPoint.getExtensions();
  for (IExtension extension : extensions) {
    IConfigurationElement[] configurationElements = extension.getConfigurationElements();
    for (IConfigurationElement configurationElement : configurationElements) {
      Object createExecutableExtension = configurationElement.createExecutableExtension("class");
      Participant participant = (Participant) createExecutableExtension;
      participant.updateWebAppProjectCreator(this);
    }
  }
}
 
Example #17
Source File: RegisteredGenmodelTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Ignore @Test public void testCanResolveGenmodelURIs() {
	String declaringPlugin = "org.eclipse.emf.ecore";
	String pointId = "generated_package";
	IExtensionPoint point = registry.getExtensionPoint(declaringPlugin + "." + pointId);
	IExtension[] extensions = point.getExtensions();
	for(IExtension extension: extensions) {
		IConfigurationElement[] configurationElements = extension.getConfigurationElements();
		for(IConfigurationElement configurationElement: configurationElements) {
			String attribute = configurationElement.getAttribute("genModel");
			if (attribute != null && attribute.length() != 0) {
				String name = extension.getContributor().getName();
				String uriAsString = "platform:/plugin/" + name + "/" + attribute;
				URI uri = URI.createURI(uriAsString);
				boolean exists = URIConverter.INSTANCE.exists(uri, Collections.emptyMap());
				if (!exists) {
						fail(uriAsString + " does not exist");
				}
			}
		}
	}
}
 
Example #18
Source File: ContributionExtensionManager.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private void loadExtensionPoints()
{
	IExtensionRegistry registry = Platform.getExtensionRegistry();
	IExtension[] extensions = registry.getExtensionPoint(getExtensionPoint()).getExtensions();

	for (int i = 0; i < extensions.length; i++)
	{
		IExtension extension = extensions[i];
		IConfigurationElement[] elements = extension.getConfigurationElements();
		for (IConfigurationElement main : elements)
		{
			if (isContentTypeContribution(main))
			{
				String natureId = main.getAttribute(CONTENT_TYPE);
				IConfigurationElement[] innerElements = main.getChildren();
				loadChildren(natureId, innerElements);
			}
		}
	}
}
 
Example #19
Source File: SVNFileModificationValidator.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private IFileModificationValidator loadUIValidator() {
      IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(ID, DEFAULT_FILE_MODIFICATION_VALIDATOR_EXTENSION);
if (extension != null) {
	IExtension[] extensions =  extension.getExtensions();
	if (extensions.length > 0) {
		IConfigurationElement[] configElements = extensions[0].getConfigurationElements();
		if (configElements.length > 0) {
			try {
                      Object o = configElements[0].createExecutableExtension("class"); //$NON-NLS-1$
                      if (o instanceof IFileModificationValidator) {
                          return (IFileModificationValidator)o;
                      }
                  } catch (CoreException e) {
                      SVNProviderPlugin.log(e.getStatus().getSeverity(), e.getMessage(), e);
                  }
		}
	}
}
return null;
  }
 
Example #20
Source File: ExtendPopupMenu.java    From erflute with Apache License 2.0 6 votes vote down vote up
public static List<ExtendPopupMenu> loadExtensions(MainDiagramEditor editor) throws CoreException {
    final List<ExtendPopupMenu> extendPopupMenuList = new ArrayList<>();

    final IExtensionRegistry registry = Platform.getExtensionRegistry();
    final IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_POINT_ID);

    if (extensionPoint != null) {
        for (final IExtension extension : extensionPoint.getExtensions()) {
            for (final IConfigurationElement configurationElement : extension.getConfigurationElements()) {
                final ExtendPopupMenu extendPopupMenu = ExtendPopupMenu.createExtendPopupMenu(configurationElement, editor);
                if (extendPopupMenu != null) {
                    extendPopupMenuList.add(extendPopupMenu);
                }
            }
        }
    }
    return extendPopupMenuList;
}
 
Example #21
Source File: SelfHelpDisplay.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
private static void createHelpDisplay() {
	IExtensionPoint point = Platform.getExtensionRegistry()
			.getExtensionPoint(HELP_DISPLAY_EXTENSION_ID );
	if (point != null) {
		IExtension[] extensions = point.getExtensions();
		if (extensions.length != 0) {
			// We need to pick up the non-default configuration
			IConfigurationElement[] elements = extensions[0]
					.getConfigurationElements();
			if (elements.length == 0) 
				return;
			IConfigurationElement displayElement  = elements[0];
			// Instantiate the help display
			try {
				helpDisplay = (AbstractHelpDisplay) (displayElement
						.createExecutableExtension(HELP_DISPLAY_CLASS_ATTRIBUTE));
			} catch (CoreException e) {
				HelpBasePlugin.logStatus(e.getStatus());
			}
		}
	}
}
 
Example #22
Source File: EditorContributorManager.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private void createEditorContributorMap( )
{
	synchronized ( this )
	{
		editorContributorMap = new HashMap( );
		for ( Iterator iter = getExtensionElements( EXTENSION_MULTIPAGE_EDITOR_CONTRIBUTOR ).iterator( ); iter.hasNext( ); )
		{
			IExtension extension = (IExtension) iter.next( );
			IConfigurationElement[] elements = extension.getConfigurationElements( );
			for ( int i = 0; i < elements.length; i++ )
			{
				EditorContributor editorContributor = createEditorContributor( elements[i] );
				if ( !editorContributorMap.containsKey( editorContributor.targetEditorId ) )
				{
					editorContributorMap.put( editorContributor.targetEditorId,
							editorContributor );
				}
				else
				{
					EditorContributor exsitContributor = (EditorContributor) editorContributorMap.get( editorContributor.targetEditorId );
					exsitContributor.merge( editorContributor );
				}
			}
		}
	}
}
 
Example #23
Source File: TextContainer.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Der Konstruktor sucht nach dem in den Settings definierten Textplugin Wenn er kein Textplugin
 * findet, wählt er ein rudimentäres Standardplugin aus (das in der aktuellen Version nur eine
 * Fehlermeldung ausgibt)
 */
public TextContainer(){
	if (plugin == null) {
		String ExtensionToUse = CoreHub.localCfg.get(Preferences.P_TEXTMODUL, null);
		IExtensionRegistry exr = Platform.getExtensionRegistry();
		IExtensionPoint exp =
			exr.getExtensionPoint(ExtensionPointConstantsUi.TEXTPROCESSINGPLUGIN);
		if (exp != null) {
			IExtension[] extensions = exp.getExtensions();
			for (IExtension ex : extensions) {
				IConfigurationElement[] elems = ex.getConfigurationElements();
				for (IConfigurationElement el : elems) {
					if ((ExtensionToUse == null) || el.getAttribute("name").equals( //$NON-NLS-1$
						ExtensionToUse)) {
						try {
							plugin = (ITextPlugin) el.createExecutableExtension("Klasse"); //$NON-NLS-1$
						} catch (/* Core */Exception e) {
							ExHandler.handle(e);
						}
					}
					
				}
			}
		}
	}
	if (plugin == null) {
		plugin = new DefaultTextPlugin();
	}
}
 
Example #24
Source File: PythonSourceFolderActionFilter.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Cache them after the 1st request for a given name.
 * 
 * Gets the property testers in org.python.pydev.customizations that match the passed name.
 */
private static synchronized List<PropertyTester> getPropertyTestersFromPydevCustomizations(String name) {
    List<PropertyTester> propertyTester = propertyTesters.get(name);
    if (propertyTester == null) {
        IExtension[] extensions = ExtensionHelper.getExtensions("org.eclipse.core.expressions.propertyTesters");
        // For each extension ...
        propertyTester = new ArrayList<PropertyTester>();
        propertyTesters.put(name, propertyTester);
        for (int i = 0; i < extensions.length; i++) {
            IExtension extension = extensions[i];
            IConfigurationElement[] elements = extension.getConfigurationElements();
            // For each member of the extension ...
            for (int j = 0; j < elements.length; j++) {
                IConfigurationElement element = elements[j];
                //Any property tester that's declared in "org.python.pydev.customizations"
                //is considered to be an object that provides the objectState for an IActionFilter.
                if ("org.python.pydev.customizations".equals(element.getAttribute("namespace"))) {
                    String attribute = element.getAttribute("properties");
                    if (name.equals(attribute)) {//i.e.: app_engine (and future references)
                        try {
                            PropertyTester executableExtension = (PropertyTester) element
                                    .createExecutableExtension("class");
                            propertyTester.add(executableExtension);
                        } catch (Exception e) {
                            Log.log(e);
                        }
                    }
                }
            }
        }
    }
    return propertyTester;
}
 
Example #25
Source File: ContributionRegistry.java    From depan with Apache License 2.0 5 votes vote down vote up
/**
 * Load the plugins from the extension point, and fill the lists of entries.
 */
protected void load(String extensionId) {
  IExtensionRegistry registry = Platform.getExtensionRegistry();
  IExtensionPoint point = registry.getExtensionPoint(extensionId);
  if (null == point) {
    return;
  }
  for (IExtension extension: point.getExtensions()) {
    IContributor contrib = extension.getContributor();
    String bundleId = contrib.getName();
    // ... and for each elements
    for (IConfigurationElement element :
        extension.getConfigurationElements()) {

      // obtain an object on the entry
      ContributionEntry<T> entry = buildEntry(bundleId, element);
      String entryId = entry.getId();
      if (Strings.isNullOrEmpty(entryId)) {
        LOG.warn("Empty entry id in {} for {}", bundleId, extensionId);
      }
      entries.put(entryId, entry);

      // Try to instantiate the contribution and install it.
      try {
        T plugin = entry.prepareInstance();
        installContribution(entryId, plugin);
      } catch (CoreException err) {
        reportException(entryId, err);
        throw new RuntimeException(err);
      }
    }
  }
}
 
Example #26
Source File: LoadersManager.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Gets a list of loader configuration elements from the extension point registry for a given view.
 * @param viewId The view ID
 * @return List of extension point configuration elements.
 */
private List<IConfigurationElement> getLoaderConfigurationElements(String viewId) {
    List<IConfigurationElement> list = fViewLoadersList.get(viewId);
    if (list != null) {
        return list;
    }

    ArrayList<IConfigurationElement> ret = new ArrayList<>();
    IExtensionPoint iep = Platform.getExtensionRegistry().getExtensionPoint(EXT_NAMESPACE, LOADER_TAG);
    if (iep == null) {
        return ret;
    }

    IExtension[] ie = iep.getExtensions();
    if (ie == null) {
        return ret;
    }

    for (int i = 0; i < ie.length; i++) {
        IConfigurationElement c[] = ie[i].getConfigurationElements();
        for (int j = 0; j < c.length; j++) {
            if (viewId.equals(c[j].getAttribute("view"))) { //$NON-NLS-1$
                ret.add(c[j]);
            }
        }
    }
    fViewLoadersList.put(viewId, ret);
    return ret;
}
 
Example #27
Source File: ExtensionRegistry.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public IConfigurationElement[] getConfigurationElementsFor(
		String namespace, String extensionPointName, String extensionId )
{
	IExtension extension = getExtension( namespace, extensionPointName,
			extensionId );
	if ( extension == null )
		return new IConfigurationElement[0];
	return extension.getConfigurationElements( );
}
 
Example #28
Source File: ConfigurationElement.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public IExtension getDeclaringExtension( )
{
    if( extension != null )
        return extension;
       if( parent instanceof IExtension )
           return (IExtension)parent;
    if( parent instanceof ConfigurationElement )
        return ((ConfigurationElement)parent).getDeclaringExtension();
    return null;
}
 
Example #29
Source File: ExtensionPointManager.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private List<IExtension> getExtensionElements( String id )
{
	IExtensionRegistry registry = Platform.getExtensionRegistry( );
	if ( registry == null )
	{// extension registry cannot be resolved
		return Collections.emptyList( );
	}
	IExtensionPoint extensionPoint = registry.getExtensionPoint( id );
	if ( extensionPoint == null )
	{// extension point cannot be resolved
		return Collections.emptyList( );
	}
	return Arrays.asList( extensionPoint.getExtensions( ) );
}
 
Example #30
Source File: CommonVoiceXMLBrowserTab.java    From JVoiceXML with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
    IExtensionPoint iep = Platform
            .getExtensionRegistry()
            .getExtensionPoint(
                    "org.jvoicexml.eclipse.debug.ui.launching.voiceXMLBrowser"); //$NON-NLS-1$
    if (iep != null) {
        IExtension[] extensions = iep.getExtensions();

        for (int i = 0; i < extensions.length; i++) {
            IConfigurationElement[] elements = extensions[i]
                    .getConfigurationElements();
            if (elements == null) {
                continue;
            }
            for (int j = 0; j < elements.length; j++) {
                if (new Boolean(elements[j].getAttributeAsIs("default")).equals(Boolean.TRUE)) { //$NON-NLS-1$
                    defaultBrowser = i;
                }
            }
        }
    }

    if (urlText != null) {
        urlText.setText("");//$NON-NLS-1$
    }
    if (browserCombo != null) {
        browserCombo.select(0);
        browserCombo.select(defaultBrowser);
        refreshActiveConfigurationPane();
        if (currentBrowserUI != null) {
            currentBrowserUI.setDefaults(configuration);
        }
    }
}