org.eclipse.core.runtime.IExtensionPoint Java Examples

The following examples show how to use org.eclipse.core.runtime.IExtensionPoint. 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: 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 #2
Source File: IClient.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This operation retrieves the IClient implementation from the
 * ExtensionRegistry.
 *
 * @return The current default IClient implementation that were found in the registry.
 * @throws CoreException
 *             This exception is thrown if an extension cannot be loaded.
 */
public static IClient getClient() throws CoreException {
	/**
	 * Logger for handling event messages and other information.
	 */
	Logger logger = LoggerFactory.getLogger(IClient.class);

	IClient client = null;
	String id = "org.eclipse.ice.client.clientInstance";
	IExtensionPoint point = Platform.getExtensionRegistry()
			.getExtensionPoint(id);

	// If the point is available, create all the builders and load them into
	// the array.
	if (point != null) {
		IConfigurationElement[] elements = point.getConfigurationElements();
		client = (IClient) elements[0].createExecutableExtension("class");
	} else {
		logger.error("Extension Point " + id + "does not exist");
	}

	return client;
}
 
Example #3
Source File: DNDService.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private DNDService( )
{
	/*
	 * // DesignElementHandle adapter addDNDAdapter( new
	 * DesignElementHandleDNDAdapter( ), IDNDAdapter.CAPABLE_LOW );
	 * addDNDAdapter( new CascadingParameterGroupHandleDNDAdapter( ),
	 * IDNDAdapter.CAPABLE_HIGH ); // addDNDAdapter( new
	 * ParameterGroupHandleDNDAdapter( ), // IDNDAdapter.CAPABLE_HIGH );
	 * addDNDAdapter( new ThemeHandleDNDAdapter( ), IDNDAdapter.CAPABLE_HIGH
	 * ); addDNDAdapter( new SlotHandleDNDAdapter( ),
	 * IDNDAdapter.CAPABLE_HIGH ); addDNDAdapter( new
	 * EmbeddedImageHandleDNDAdapter( ), IDNDAdapter.CAPABLE_HIGH );
	 * addDNDAdapter( new CellHandleDNDAdapter( ), IDNDAdapter.CAPABLE_HIGH
	 * ); addDNDAdapter( new RowHandleDNDAdapter( ),
	 * IDNDAdapter.CAPABLE_HIGH );
	 */
	IExtensionRegistry registry = Platform.getExtensionRegistry( );
	IExtensionPoint extensionPoint = registry.getExtensionPoint( "org.eclipse.birt.report.designer.ui.DNDServices" ); //$NON-NLS-1$
	if ( extensionPoint != null )
	{
		addRegistry( extensionPoint );
	}
}
 
Example #4
Source File: BirtWizardUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Find Configuration Elements from Extension Registry by Extension ID
 * 
 * @param extensionId
 * @return
 */
public static IConfigurationElement[] findConfigurationElementsByExtension(
		String extensionId )
{
	if ( extensionId == null )
		return null;

	// find Extension Point entry
	IExtensionRegistry registry = Platform.getExtensionRegistry( );
	IExtensionPoint extensionPoint = registry
			.getExtensionPoint( extensionId );

	if ( extensionPoint == null )
	{
		return null;
	}

	return extensionPoint.getConfigurationElements( );
}
 
Example #5
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 #6
Source File: BirtWizardUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Find Configuration Elements from Extension Registry by Extension ID
 * 
 * @param extensionId
 * @return
 */
public static IConfigurationElement[] findConfigurationElementsByExtension(
		String extensionId )
{
	if ( extensionId == null )
		return null;

	// find Extension Point entry
	IExtensionRegistry registry = Platform.getExtensionRegistry( );
	IExtensionPoint extensionPoint = registry.getExtensionPoint( extensionId );

	if ( extensionPoint == null )
	{
		return null;
	}

	return extensionPoint.getConfigurationElements( );
}
 
Example #7
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 #8
Source File: AppContextUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns all configuration elements of appcontext extension point
 * 
 * @return
 */
private static IConfigurationElement[] getConfigurationElements( )
{
	// load extension point entry
	IExtensionRegistry registry = Platform.getExtensionRegistry( );
	IExtensionPoint extensionPoint = registry
			.getExtensionPoint( APPCONTEXT_EXTENSION_ID );

	if ( extensionPoint != null )
	{
		// get all configuration elements
		return extensionPoint.getConfigurationElements( );
	}

	return null;
}
 
Example #9
Source File: BasePluginXmlTest.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@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);
  }
}
 
Example #10
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 #11
Source File: IJAXBClassProvider.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This operation pulls the list of JAXB class providers from the registry
 * for classes that need custom handling.
 *
 * @return The list of class providers.
 * @throws CoreException
 */
public static IJAXBClassProvider[] getJAXBProviders() throws CoreException {

	// Logger for handling event messages and other information.
	Logger logger = LoggerFactory.getLogger(IJAXBClassProvider.class);
	IJAXBClassProvider[] jaxbProviders = null;
	String id = "org.eclipse.ice.datastructures.jaxbClassProvider";
	IExtensionPoint point = Platform.getExtensionRegistry()
			.getExtensionPoint(id);

	// If the point is available, create all the builders and load them into
	// the array.
	if (point != null) {
		IConfigurationElement[] elements = point.getConfigurationElements();
		jaxbProviders = new IJAXBClassProvider[elements.length];
		for (int i = 0; i < elements.length; i++) {
			jaxbProviders[i] = (IJAXBClassProvider) elements[i]
					.createExecutableExtension("class");
		}
	} else {
		logger.error("Extension Point " + id + " does not exist");
	}

	return jaxbProviders;
}
 
Example #12
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 #13
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 #14
Source File: ExtensionClassLoader.java    From eclipse-cs with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Creates the extension classloader.
 *
 * @param sourceBundle
 *          the source bundle defining the extension
 * @param extensionPointId
 *          the extension point id
 */
public ExtensionClassLoader(Bundle sourceBundle, String extensionPointId) {

  mBundles = new ArrayList<>();

  mBundles.add(sourceBundle);

  IExtensionRegistry pluginRegistry = Platform.getExtensionRegistry();
  IExtensionPoint extPt = pluginRegistry.getExtensionPoint(extensionPointId);

  IExtension[] extensions = extPt.getExtensions();

  for (IExtension ext : extensions) {
    String contributorId = ext.getContributor().getName();
    Bundle extensionBundle = Platform.getBundle(contributorId);

    if (extensionBundle != null) {
      mBundles.add(extensionBundle);
    }
  }
}
 
Example #15
Source File: IUpdateEventListener.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This operation retrieves the IUpdateEventListener implementation from the
 * ExtensionRegistry.
 *
 * @return The current default IUpdateEventListener implementation that were
 *         found in the registry.
 * @throws CoreException
 *             This exception is thrown if an extension cannot be loaded.
 */
public static IUpdateEventListener getUpdateEventListener() throws CoreException {
	/**
	 * Logger for handling event messages and other information.
	 */
	Logger logger = LoggerFactory.getLogger(IUpdateEventListener.class);

	IUpdateEventListener listener = null;
	String id = "org.eclipse.ice.client.updateEventListener";
	IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(id);

	// If the point is available, create the listener
	if (point != null) {
		IConfigurationElement[] elements = point.getConfigurationElements();
		listener = (IUpdateEventListener) elements[0].createExecutableExtension("class");
	} else {
		logger.error("Extension Point " + id + "does not exist");
	}

	return listener;
}
 
Example #16
Source File: CleanUpRegistry.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private synchronized void ensurePagesRegistered() {
	if (fPageDescriptors != null)
		return;
	
	ArrayList<CleanUpTabPageDescriptor> result= new ArrayList<CleanUpTabPageDescriptor>();

	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 (TABPAGE_CONFIGURATION_ELEMENT_NAME.equals(element.getName())) {
			result.add(new CleanUpTabPageDescriptor(element));
		}
	}

	fPageDescriptors= result.toArray(new CleanUpTabPageDescriptor[result.size()]);
	Arrays.sort(fPageDescriptors, new Comparator<CleanUpTabPageDescriptor>() {
		public int compare(CleanUpTabPageDescriptor o1, CleanUpTabPageDescriptor o2) {
			String name1= o1.getName();
			String name2= o2.getName();
			return Collator.getInstance().compare(name1.replaceAll("&", ""), name2.replaceAll("&", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
		}
	});
}
 
Example #17
Source File: CleanUpRegistry.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private synchronized void ensureCleanUpInitializersRegistered() {
	if (fCleanUpInitializerDescriptors != null)
		return;

	ArrayList<CleanUpInitializerDescriptor> result= new ArrayList<CleanUpInitializerDescriptor>();

	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()]);
}
 
Example #18
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 #19
Source File: BrowserMenuPopulator.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
private void launchExtension(String browserName, String url) throws CoreException {
  if (browserName == null || browserName.isEmpty()) {
    return;
  }

  // remove the id, which sets the default browser id
  browserName = browserName.replace(BROWSER_NAME_EXTENSION, "");

  IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(IDebugLaunch.EXTENSION_ID);
  IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
  if (elements == null || elements.length == 0) {
    return;
  }
  for (IConfigurationElement element : elements) {
    IDebugLaunch debugLaunch = (IDebugLaunch) element.createExecutableExtension("class");
    String label = element.getAttribute("label");
    if (debugLaunch != null && label != null && label.equals(browserName)) {
      debugLaunch.launch(project, url, "debug");
    }
  }
}
 
Example #20
Source File: BrowserMenuPopulator.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
private void addExtensionDebugLauncherMenus(IMenuManager menu, String url) {
  IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(IDebugLaunch.EXTENSION_ID);
  IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
  if (elements == null || elements.length == 0) {
    return;
  }

  for (IConfigurationElement element : elements) {
    try {
      IDebugLaunch debugLaunch = (IDebugLaunch) element.createExecutableExtension("class");
      String label = element.getAttribute("label");
      addExtensionDebugLauncherMenu(menu, label, debugLaunch, url);
    } catch (CoreException e) {
      CorePluginLog.logError("Could not add launcher menu.", e);
    }
  }
}
 
Example #21
Source File: SARLRuntimeEnvironmentTab.java    From sarl with Apache License 2.0 6 votes vote down vote up
private static List<ProjectSREProviderFactory> getProviderFromExtension() {
	final IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(
			SARLEclipsePlugin.PLUGIN_ID,
			SARLEclipseConfig.EXTENSION_POINT_PROJECT_SRE_PROVIDER_FACTORY);
	if (extensionPoint != null) {
		final List<ProjectSREProviderFactory> providers = new ArrayList<>();
		for (final IConfigurationElement element : extensionPoint.getConfigurationElements()) {
			try {
				final Object obj = element.createExecutableExtension("class"); //$NON-NLS-1$
				if (obj instanceof ProjectSREProviderFactory) {
					providers.add((ProjectSREProviderFactory) obj);
				} else {
					SARLEclipsePlugin.getDefault().logErrorMessage(
							"Cannot instance extension point: " + element.getName()); //$NON-NLS-1$
				}
			} catch (CoreException e) {
				SARLEclipsePlugin.getDefault().log(e);
			}
		}
		return providers;
	}
	return null;
}
 
Example #22
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 #23
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 #24
Source File: ClasspathContainerDescriptor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static ClasspathContainerDescriptor[] getDescriptors() {
	ArrayList<ClasspathContainerDescriptor> containers= new ArrayList<ClasspathContainerDescriptor>();

	IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(JavaUI.ID_PLUGIN, ATT_EXTENSION);
	if (extensionPoint != null) {
		ClasspathContainerDescriptor defaultPage= null;
		String defaultPageName= ClasspathContainerDefaultPage.class.getName();

		IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
		for (int i = 0; i < elements.length; i++) {
			try {
				ClasspathContainerDescriptor curr= new ClasspathContainerDescriptor(elements[i]);
				if (!WorkbenchActivityHelper.filterItem(curr)) {
					if (defaultPageName.equals(curr.getPageClass())) {
						defaultPage= curr;
					} else {
						containers.add(curr);
					}
				}
			} catch (CoreException e) {
				JavaPlugin.log(e);
			}
		}
		if (defaultPageName != null && containers.isEmpty()) {
			// default page only added of no other extensions found
			containers.add(defaultPage);
		}
	}
	return containers.toArray(new ClasspathContainerDescriptor[containers.size()]);
}
 
Example #25
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 )
{
	IExtensionPoint extPoint = getExtensionPoint( namespace,
			extensionPointName );
	if ( extPoint == null )
		return new IConfigurationElement[0];
	return extPoint.getConfigurationElements( );
}
 
Example #26
Source File: ExtensionRegistry.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public IExtensionPoint getExtensionPoint( String namespace, String name )
{
	IExtensionPoint[] points = getExtensionPoints( namespace );
	for ( IExtensionPoint point : points )
	{
		if ( name.equals( point.getSimpleIdentifier( ) ) )
		{
			return point;
		}
	}
	return null;
}
 
Example #27
Source File: IPersistenceProvider.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This operation retrieves the persistence from the ExtensionRegistry.
 * 
 * @return The provider 
 * @throws CoreException
 *             This exception is thrown if an extension cannot be loaded.
 */
public static IPersistenceProvider getProvider() throws CoreException {

	// Logger for handling event messages and other information.
	Logger logger = LoggerFactory.getLogger(IPersistenceProvider.class);

	// The string identifying the persistence provider extension point.
	String providerID = "org.eclipse.ice.core.persistenceProvider";

	// The provider
	IPersistenceProvider provider = null;
	// Get the persistence provider from the extension registry.
	IExtensionPoint point = Platform.getExtensionRegistry()
			.getExtensionPoint(providerID);
	// Retrieve the provider from the registry and set it if one has not
	// already been set.
	if (point != null) {
		// We only need one persistence provider, so just pull the
		// configuration element for the first one available.
		IConfigurationElement[] elements = point.getConfigurationElements();
		if (elements.length > 0) {
			IConfigurationElement element = elements[0];
			provider = (IPersistenceProvider) element
					.createExecutableExtension("class");
		} else {
			logger.info("No extensions found for IPersistenceProvider.");
		}
	} else {
		logger.error("Extension Point " + providerID + "does not exist");
	}

	return provider;
}
 
Example #28
Source File: ExtensionRegistry.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public IExtensionPoint[] getExtensionPoints( String namespace )
{
	ArrayList<IExtensionPoint> extPoints = new ArrayList<IExtensionPoint>( );
	Collection<ExtensionPoint> allExtPoints = extensionPoints.values( );
	for ( IExtensionPoint extPoint : allExtPoints )
	{
		if ( namespace.equals( extPoint.getNamespace( ) ) )
		{
			extPoints.add( extPoint );
		}
	}
	return extPoints.toArray( new IExtensionPoint[extPoints.size( )] );
}
 
Example #29
Source File: NewTypeDropDownAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static OpenTypeWizardAction[] getActionFromDescriptors() {
	ArrayList<OpenTypeWizardAction> containers= new ArrayList<OpenTypeWizardAction>();

	IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID, PL_NEW);
	if (extensionPoint != null) {
		IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
		for (int i = 0; i < elements.length; i++) {
			IConfigurationElement element= elements[i];
			if (element.getName().equals(TAG_WIZARD) && isJavaTypeWizard(element)) {
				containers.add(new OpenTypeWizardAction(element));
			}
		}
	}
	return containers.toArray(new OpenTypeWizardAction[containers.size()]);
}
 
Example #30
Source File: ExtensionRegistry.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public IExtension getExtension( String namespace,
		String extensionPointName, String extensionId )
{

	IExtensionPoint point = getExtensionPoint( namespace,
			extensionPointName );
	if ( point != null )
	{
		return point.getExtension( extensionId );
	}
	return null;
}