Search in sources :

Example 6 with AbstractComponentsProvider

use of org.talend.core.model.components.AbstractComponentsProvider in project tdi-studio-se by Talend.

the class ComponentsFactory method loadUserComponentsFromComponentsProviderExtension.

@Override
public void loadUserComponentsFromComponentsProviderExtension() {
    getComponents();
    ComponentsProviderManager.getInstance().getProviders();
    ComponentsProviderManager componentsProviderManager = ComponentsProviderManager.getInstance();
    AbstractComponentsProvider componentsProvider = componentsProviderManager.loadUserComponentsProvidersFromExtension();
    // remove old user components
    if (!this.userComponentList.isEmpty()) {
        ComponentsCache cache = ComponentManager.getComponentCache();
        for (IComponent component : userComponentList) {
            if (componentList != null && componentList.contains(component)) {
                componentList.remove(component);
            }
            if (customComponentList.contains(component)) {
                customComponentList.remove(component);
            }
            if (cache.getComponentEntryMap().get(component.getName()) != null) {
                cache.getComponentEntryMap().remove(component.getName());
                ComponentManager.setModified(true);
            }
        }
    }
    loadComponents(componentsProvider);
    ComponentManager.saveResource();
}
Also used : AbstractComponentsProvider(org.talend.core.model.components.AbstractComponentsProvider) IComponent(org.talend.core.model.components.IComponent) ComponentsCache(org.talend.core.model.component_cache.ComponentsCache)

Example 7 with AbstractComponentsProvider

use of org.talend.core.model.components.AbstractComponentsProvider in project tdi-studio-se by Talend.

the class ComponentsProviderManager method loadComponentsProvidersFromExtension.

private void loadComponentsProvidersFromExtension() {
    if (providers == null) {
        providers = new ArrayList<AbstractComponentsProvider>();
        IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
        //$NON-NLS-1$
        IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint("org.talend.core.components_provider");
        IExtension[] extensions = extensionPoint.getExtensions();
        for (IExtension extension : extensions) {
            IConfigurationElement[] configurationElements = extension.getConfigurationElements();
            for (IConfigurationElement configurationElement : configurationElements) {
                //$NON-NLS-1$
                String id = configurationElement.getAttribute("id");
                //$NON-NLS-1$
                String folderName = configurationElement.getAttribute("folderName");
                String contributerName = configurationElement.getContributor().getName();
                IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
                if (!brandingService.isPoweredOnlyCamel() && id.equals("org.talend.designer.camel.components.localprovider.CamelLocalComponentsProvider")) {
                    folderName = "camel";
                }
                try {
                    AbstractComponentsProvider componentsProvider = (AbstractComponentsProvider) configurationElement.createExecutableExtension(//$NON-NLS-1$
                    "class");
                    componentsProvider.setId(id);
                    componentsProvider.setFolderName(folderName);
                    componentsProvider.setContributer(contributerName);
                    providers.add(componentsProvider);
                } catch (CoreException e) {
                    //$NON-NLS-1$
                    log.error("unable to load component provider" + id, e);
                }
            }
        }
    }
}
Also used : AbstractComponentsProvider(org.talend.core.model.components.AbstractComponentsProvider) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) CoreException(org.eclipse.core.runtime.CoreException) IExtension(org.eclipse.core.runtime.IExtension) IBrandingService(org.talend.core.ui.branding.IBrandingService) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Aggregations

AbstractComponentsProvider (org.talend.core.model.components.AbstractComponentsProvider)7 IOException (java.io.IOException)4 IBrandingService (org.talend.core.ui.branding.IBrandingService)3 CoreException (org.eclipse.core.runtime.CoreException)2 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)2 IExtension (org.eclipse.core.runtime.IExtension)2 IExtensionPoint (org.eclipse.core.runtime.IExtensionPoint)2 IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)2 Path (org.eclipse.core.runtime.Path)2 ComponentsCache (org.talend.core.model.component_cache.ComponentsCache)2 IComponent (org.talend.core.model.components.IComponent)2 ComponentBundleToPath (org.talend.designer.core.model.components.ComponentBundleToPath)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 ResourceBundle (java.util.ResourceBundle)1 ComponentProviderInfo (org.talend.core.model.components.ComponentProviderInfo)1 ITisLocalProviderService (org.talend.designer.core.ITisLocalProviderService)1 ResClassLoader (org.talend.designer.core.ITisLocalProviderService.ResClassLoader)1