use of org.eclipse.core.runtime.IConfigurationElement in project translationstudio8 by heartsome.
the class TbMatcher method runExtension.
/**
* 加载记忆库匹配实现 ;
*/
private void runExtension() {
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TERMMATCH_EXTENSION_ID);
try {
for (IConfigurationElement e : config) {
final Object o = e.createExecutableExtension("class");
if (o instanceof ITbMatch) {
ISafeRunnable runnable = new ISafeRunnable() {
public void handleException(Throwable exception) {
logger.error(Messages.getString("match.TbMatcher.logger1"), exception);
}
public void run() throws Exception {
termMatch = (ITbMatch) o;
}
};
SafeRunner.run(runnable);
}
}
} catch (CoreException ex) {
logger.error(Messages.getString("match.TbMatcher.logger1"), ex);
}
}
use of org.eclipse.core.runtime.IConfigurationElement in project translationstudio8 by heartsome.
the class NewProjectWizard method runWizardPageExtension.
/**
* 加载扩展向导页 ;
*/
private void runWizardPageExtension() {
// 加载向导扩展
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(PAGE_EXTENSION_ID);
try {
for (IConfigurationElement e : config) {
final Object o = e.createExecutableExtension("class");
if (o instanceof AbstractNewProjectWizardPage) {
ISafeRunnable runnable = new ISafeRunnable() {
public void handleException(Throwable exception) {
logger.error(Messages.getString("wizard.NewProjectWizard.logger1"), exception);
}
public void run() throws Exception {
extensionPages.add((AbstractNewProjectWizardPage) o);
}
};
SafeRunner.run(runnable);
}
}
} catch (CoreException ex) {
logger.error(Messages.getString("wizard.NewProjectWizard.logger1"), ex);
}
// 加载转换器扩展
IConfigurationElement[] config2 = Platform.getExtensionRegistry().getConfigurationElementsFor("net.heartsome.cat.ts.ui.extension.converter");
try {
for (IConfigurationElement e : config2) {
final Object o = e.createExecutableExtension("class");
if (o instanceof IConverterCaller) {
ISafeRunnable runnable = new ISafeRunnable() {
public void handleException(Throwable exception) {
logger.error(Messages.getString("wizard.NewProjectWizard.logger2"), exception);
}
public void run() throws Exception {
convertImpl = (IConverterCaller) o;
}
};
SafeRunner.run(runnable);
}
}
} catch (CoreException ex) {
logger.error(Messages.getString("wizard.NewProjectWizard.logger2"), ex);
}
}
use of org.eclipse.core.runtime.IConfigurationElement in project tdi-studio-se by Talend.
the class CustomizeJetFilesProviderManager method loadJetsProvidersFromExtension.
private void loadJetsProvidersFromExtension() {
providers = new ArrayList<AbstractJetFileProvider>();
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
//$NON-NLS-1$
IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint("org.talend.designer.codegen.additional_jetfile");
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension extension : extensions) {
IConfigurationElement[] configurationElements = extension.getConfigurationElements();
for (IConfigurationElement configurationElement : configurationElements) {
//$NON-NLS-1$
String id = configurationElement.getAttribute("id");
try {
AbstractJetFileProvider jetProvider = (AbstractJetFileProvider) configurationElement.createExecutableExtension(//$NON-NLS-1$
"class");
jetProvider.setId(id);
providers.add(jetProvider);
} catch (CoreException e) {
//$NON-NLS-1$
log.error(Messages.getString("JetFilesProviderManager.unableLoad", id), e);
}
}
}
}
use of org.eclipse.core.runtime.IConfigurationElement 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(Messages.getString("ComponentsProviderManager.unableLoad") + id, e);
}
}
}
}
}
use of org.eclipse.core.runtime.IConfigurationElement in project tdi-studio-se by Talend.
the class ExtendedNodeManager method getExtendedNodeHandler.
public static List<IExtendedNodeHandler> getExtendedNodeHandler() {
if (extendedNodeHandler == null) {
extendedNodeHandler = new ArrayList<IExtendedNodeHandler>();
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(//$NON-NLS-1$
"org.talend.designer.core.extended_node_handler");
if (extensionPoint != null) {
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension extension : extensions) {
IConfigurationElement[] configurationElements = extension.getConfigurationElements();
for (IConfigurationElement configurationElement : configurationElements) {
try {
//$NON-NLS-1$
Object service = configurationElement.createExecutableExtension("class");
if (service instanceof IExtendedNodeHandler) {
extendedNodeHandler.add((IExtendedNodeHandler) service);
}
} catch (CoreException e) {
ExceptionHandler.process(e);
}
}
}
}
}
return extendedNodeHandler;
}
Aggregations