org.eclipse.core.runtime.IExtensionRegistry Java Examples

The following examples show how to use org.eclipse.core.runtime.IExtensionRegistry. 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: IDEResourcesManager.java    From typescript.java with MIT License 6 votes vote down vote up
private synchronized void loadExtensionResourceParticipants() {
	if (extensionResourceParticipantsLoaded)
		return;
	// Immediately set the flag, as to ensure that this method is never
	// called twice
	extensionResourceParticipantsLoaded = true;

	Trace.trace(Trace.EXTENSION_POINT, "->- Loading .typeScriptResourceParticipants extension point ->-");

	IExtensionRegistry registry = Platform.getExtensionRegistry();
	IConfigurationElement[] cf = registry.getConfigurationElementsFor(TypeScriptCorePlugin.PLUGIN_ID,
			EXTENSION_TYPESCRIPT_RESOURCE_PARTICIPANTS);
	
	addExtensionResourceParticipants(cf);
	addRegistryListenerIfNeeded();

	Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .typeScriptResourceParticipants extension point -<-");
}
 
Example #2
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 #3
Source File: SVNUIPlugin.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public static WorkspaceAction[] getMergeProviders() throws Exception {
	if (mergeProviders == null) {
		ArrayList mergeProviderList = new ArrayList();
		IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
		IConfigurationElement[] configurationElements = extensionRegistry.getConfigurationElementsFor(MERGE_PROVIDERS);
		for (int i = 0; i < configurationElements.length; i++) {
			IConfigurationElement configurationElement = configurationElements[i];
			WorkspaceAction mergeProvider = (WorkspaceAction)configurationElement.createExecutableExtension("class"); //$NON-NLS-1$
			mergeProvider.setName(configurationElement.getAttribute("name")); //$NON-NLS-1$
			mergeProviderList.add(mergeProvider);
		}
		mergeProviders = new WorkspaceAction[mergeProviderList.size()];
		mergeProviderList.toArray(mergeProviders);
	}
	return mergeProviders;
}
 
Example #4
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 #5
Source File: ITextEngine.java    From ganttproject with GNU General Public License v3.0 6 votes vote down vote up
protected void registerFontDirectories() {
  myFontCache.registerDirectory(System.getProperty("java.home") + "/lib/fonts");
  IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
  IConfigurationElement[] configElements = extensionRegistry.getConfigurationElementsFor("org.ganttproject.impex.htmlpdf.FontDirectory");
  for (int i = 0; i < configElements.length; i++) {
    final String dirName = configElements[i].getAttribute("name");
    if (Boolean.TRUE.toString().equalsIgnoreCase(configElements[i].getAttribute("absolute"))) {
      myFontCache.registerDirectory(dirName);
    } else {
      String namespace = configElements[i].getDeclaringExtension().getNamespaceIdentifier();
      URL dirUrl = Platform.getBundle(namespace).getResource(dirName);
      if (dirUrl == null) {
        GPLogger.getLogger(ITextEngine.class).warning(
            "Failed to find directory " + dirName + " in plugin " + namespace);
        continue;
      }
      try {
        URL resolvedDir = Platform.resolve(dirUrl);
        myFontCache.registerDirectory(resolvedDir.getPath());
      } catch (IOException e) {
        GPLogger.getLogger(ITextEngine.class).log(Level.WARNING, e.getMessage(), e);
        continue;
      }
    }
  }
}
 
Example #6
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 #7
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 #8
Source File: LegacyJavadocCompletionProposalComputer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private IJavadocCompletionProcessor[] getContributedProcessors() {
	if (fSubProcessors == null) {
		try {
			IExtensionRegistry registry= Platform.getExtensionRegistry();
			IConfigurationElement[] elements=	registry.getConfigurationElementsFor(JavaUI.ID_PLUGIN, PROCESSOR_CONTRIBUTION_ID);
			IJavadocCompletionProcessor[] result= new IJavadocCompletionProcessor[elements.length];
			for (int i= 0; i < elements.length; i++) {
				result[i]= (IJavadocCompletionProcessor) elements[i].createExecutableExtension("class"); //$NON-NLS-1$
			}
			fSubProcessors= result;
		} catch (CoreException e) {
			JavaPlugin.log(e);
			fSubProcessors= new IJavadocCompletionProcessor[0];
		}
	}
	return fSubProcessors;
}
 
Example #9
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 #10
Source File: RunnerRegistry.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Reads information from extensions defined in plugin.xml files.
 */
private void initialize() {
	if (isInitialized)
		throw new IllegalStateException("may invoke method initialize() only once");
	isInitialized = true;

	final IExtensionRegistry registry = RegistryFactory.getRegistry();
	if (registry != null) {
		final IConfigurationElement[] configElems = registry
				.getConfigurationElementsFor(RUNNERS_EXTENSION_POINT_ID);

		for (IConfigurationElement elem : configElems) {
			try {
				final EclipseRunnerDescriptor descriptor = new EclipseRunnerDescriptor(elem);
				injector.injectMembers(descriptor);
				register(descriptor);
			} catch (Exception ex) {
				log.error("Error while reading extensions for extension point " + RUNNERS_EXTENSION_POINT_ID, ex);
			}
		}
	}
}
 
Example #11
Source File: TesterRegistry.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Reads information from extensions defined in plugin.xml files.
 */
private void initialize() {
	if (isInitialized)
		throw new IllegalStateException("may invoke method initialize() only once");
	isInitialized = true;

	final IExtensionRegistry registry = RegistryFactory.getRegistry();
	if (registry != null) {
		final IConfigurationElement[] configElems = registry
				.getConfigurationElementsFor(TESTERS_EXTENSION_POINT_ID);

		for (IConfigurationElement elem : configElems) {
			try {
				final EclipseTesterDescriptor descriptor = new EclipseTesterDescriptor(elem);
				injector.injectMembers(descriptor);
				register(descriptor);
			} catch (Exception ex) {
				log.error("Error while reading extensions for extension point " + TESTERS_EXTENSION_POINT_ID, ex);
			}
		}
	}
}
 
Example #12
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 #13
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 #14
Source File: ModuleClasspathProvider.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Given a <code>project</code> instance, determines the provider id of a classpath provider that
 * is contributed to the environment via the
 * <code>org.eclipse.jdt.launching.classpathProvider<code> extension point.
 *
 * The method will first query for implementers of the <code>com.google.gwt.eclipse.core.moduleClasspathProvider</code>
 * extension point, to see if an "external" classpath provider is available. If so, it's provider
 * id will be returned. If not, the id corresponding to <code>ModuleClasspathProvider</code> will
 * be returned.
 */
public static String computeProviderId(IProject project) {
  List<ModuleClasspathProviderData> providers = Lists.newArrayList();
  if (project != null) {
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IConfigurationElement[] extensions = registry.getConfigurationElementsFor(EXTENSION_ID);
    for (IConfigurationElement configurationElement : extensions) {
      ModuleClasspathProviderData entry = new ModuleClasspathProviderData(configurationElement);
      if (entry.isProviderAvailable()) {
        providers.add(entry);
      }
    }

    // Sort by provider priority, highest to lowest.
    Collections.sort(providers);
    Collections.reverse(providers);

    for (ModuleClasspathProviderData provider : providers) {
      if (provider.getProvider().getProviderId(project) != null) {
        return provider.getProvider().getProviderId(project);
      }
    }
  }

  return PROVIDER_ID;
}
 
Example #15
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 #16
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 #17
Source File: TextTemplateView.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private void initActiveTextPlugin(){
	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 (Exception e) {
							ExHandler.handle(e);
						}
					}
					
				}
			}
		}
	}
}
 
Example #18
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 #19
Source File: QuickFixesExtensionHelper.java    From spotbugs with GNU Lesser General Public License v2.1 6 votes vote down vote up
/** key is the pattern id, the value is the corresponding contribution */
public static synchronized Map<String, List<QuickFixContribution>> getContributedQuickFixes() {
    if (contributedQuickFixes != null) {
        return contributedQuickFixes;
    }
    HashMap<String, List<QuickFixContribution>> set = new HashMap<>();

    IExtensionRegistry registry = Platform.getExtensionRegistry();
    for (IConfigurationElement configElt : registry.getConfigurationElementsFor(EXTENSION_POINT_ID)) {
        addContribution(set, configElt);
    }
    Set<Entry<String, List<QuickFixContribution>>> entrySet = set.entrySet();
    for (Entry<String, List<QuickFixContribution>> entry : entrySet) {
        entry.setValue(Collections.unmodifiableList(entry.getValue()));
    }
    contributedQuickFixes = Collections.unmodifiableMap(set);
    return contributedQuickFixes;
}
 
Example #20
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 #21
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 #22
Source File: CodeGenerators.java    From JReFrameworker with MIT License 6 votes vote down vote up
/**
 * Registers the contributed plugin code generator definitions
 */
public static void loadCodeGeneratorContributions() {
	IExtensionRegistry registry = Platform.getExtensionRegistry();
	IConfigurationElement[] config = registry.getConfigurationElementsFor(Activator.PLUGIN_CODE_GENERATOR_EXTENSION_ID);
	try {
		for (IConfigurationElement element : config) {
			final Object o = element.createExecutableExtension("class");
			if (o instanceof CodeGenerator) {
				CodeGenerator codeGenerator = (CodeGenerator) o;
				registerCodeGenerator(codeGenerator);
			}
		}
	} catch (CoreException e) {
		Log.error("Error loading code generators.", e);
	}
}
 
Example #23
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 #24
Source File: ListPluginsAction.java    From depan with Apache License 2.0 6 votes vote down vote up
@Override
public void run(IAction action) {
  StringBuffer buffer = new StringBuffer();
  buffer.append("List of installed source plugins:\n\n");

  IExtensionRegistry reg = Platform.getExtensionRegistry();
  // get the list of elements (plugin entries)
  IConfigurationElement[] extensions = reg
      .getConfigurationElementsFor(JoglPluginRegistry.EXTENTION_POINT);
  for (int i = 0; i < extensions.length; i++) {
    IConfigurationElement element = extensions[i];
    buffer.append(element.getAttribute("class"));
    buffer.append("\n");
  }
  MessageDialog.openInformation(window.getShell(),
      "Installed source plugins", buffer.toString());
}
 
Example #25
Source File: NodejsInstallManager.java    From typescript.java with MIT License 6 votes vote down vote up
/**
 * Load the Nodejs installs.
 */
private synchronized void loadNodejsInstalls() {
	if (nodeJSInstalls != null)
		return;

	Trace.trace(Trace.EXTENSION_POINT, "->- Loading .nodeJSInstalls extension point ->-");

	IExtensionRegistry registry = Platform.getExtensionRegistry();
	IConfigurationElement[] cf = registry.getConfigurationElementsFor(TypeScriptCorePlugin.PLUGIN_ID,
			EXTENSION_NODEJS_INSTALLS);
	List<IEmbeddedNodejs> list = new ArrayList<IEmbeddedNodejs>(cf.length);
	addNodejsInstalls(cf, list);
	addRegistryListenerIfNeeded();
	nodeJSInstalls = list;

	Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .nodeJSInstalls extension point -<-");
}
 
Example #26
Source File: TypeScriptConsoleConnectorManager.java    From typescript.java with MIT License 6 votes vote down vote up
/**
 * Load the TypeScript console connectors.
 */
private synchronized void loadTypeScriptConsoleConnectors() {
	if (typeScriptConsoleConnectors != null)
		return;

	Trace.trace(Trace.EXTENSION_POINT, "->- Loading .typeScriptConsoleConnectors extension point ->-");

	IExtensionRegistry registry = Platform.getExtensionRegistry();
	IConfigurationElement[] cf = registry.getConfigurationElementsFor(TypeScriptCorePlugin.PLUGIN_ID,
			EXTENSION_TYPESCRIPT_CONSOLE_CONNECTORS);
	List<ITypeScriptConsoleConnector> list = new ArrayList<ITypeScriptConsoleConnector>(cf.length);
	addTypeScriptConsoleConnectors(cf, list);
	addRegistryListenerIfNeeded();
	typeScriptConsoleConnectors = list;

	Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .typeScriptConsoleConnectors extension point -<-");
}
 
Example #27
Source File: IDETypeScriptRepositoryManager.java    From typescript.java with MIT License 6 votes vote down vote up
private synchronized void loadExtensionRepositories() {
	if (extensionRepositoriesLoaded)
		return;

	// Immediately set the flag, as to ensure that this method is never
	// called twice
	extensionRepositoriesLoaded = true;

	Trace.trace(Trace.EXTENSION_POINT, "->- Loading .typeScriptRepositories extension point ->-");

	IExtensionRegistry registry = Platform.getExtensionRegistry();
	IConfigurationElement[] cf = registry.getConfigurationElementsFor(TypeScriptCorePlugin.PLUGIN_ID,
			EXTENSION_TYPESCRIPT_REPOSITORIES);
	addExtensionRepositories(cf);
	resetDefaultRepository();
	addRegistryListenerIfNeeded();

	Trace.trace(Trace.EXTENSION_POINT, "-<- Done loading .typeScriptRepositories extension point -<-");
}
 
Example #28
Source File: PubListener.java    From dartboard with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Retrieves all registered PubService extensions
 * 
 * All services that have the priority attribute set to true, are at the
 * beginning of the resulting list.
 * 
 * @return a List of all PubService extensions
 */
public static LinkedList<IPubService> getPubServices() {
	LinkedList<IPubService> pubServices = new LinkedList<IPubService>();
	IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
	for (IConfigurationElement e : extensionRegistry.getExtensionPoint(GlobalConstants.PUB_SERVICE_EXTENSION_POINT)
			.getConfigurationElements()) {
		try {
			IPubService pubService = (IPubService) e.createExecutableExtension(EXTENSION_CLASS);
			boolean priority = Boolean.valueOf(e.getAttribute(EXTENSION_PRIORITY));
			if (priority) {
				pubServices.add(0, pubService);
			} else {
				pubServices.add(pubService);
			}
		} catch (CoreException e1) {
			e1.printStackTrace();
		}
	}
	return pubServices;
}
 
Example #29
Source File: JavaEditorTextHoverDescriptor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns all Java editor text hovers contributed to the workbench.
 *
 * @return an array with the contributed text hovers
 */
public static JavaEditorTextHoverDescriptor[] getContributedHovers() {
	IExtensionRegistry registry= Platform.getExtensionRegistry();
	IConfigurationElement[] elements= registry.getConfigurationElementsFor(JAVA_EDITOR_TEXT_HOVER_EXTENSION_POINT);
	JavaEditorTextHoverDescriptor[] hoverDescs= createDescriptors(elements);
	initializeFromPreferences(hoverDescs);
	return hoverDescs;
}
 
Example #30
Source File: IDETypeScriptRepositoryManager.java    From typescript.java with MIT License 5 votes vote down vote up
private void addRegistryListenerIfNeeded() {
	if (registryListenerIntialized)
		return;

	IExtensionRegistry registry = Platform.getExtensionRegistry();
	registry.addRegistryChangeListener(this, TypeScriptCorePlugin.PLUGIN_ID);
	registryListenerIntialized = true;
}