use of org.eclipse.core.runtime.IExtensionPoint in project tdi-studio-se by Talend.
the class SchemaNode method addExtensionNodes.
/**
* Add Extension nodes.
*/
//$NON-NLS-1$
@SuppressWarnings("unchecked")
private void addExtensionNodes() {
String databaseProductName = getSession().getRoot().getDatabaseProductName().toLowerCase().trim();
IExtensionRegistry registry = Platform.getExtensionRegistry();
//$NON-NLS-1$ //$NON-NLS-2$
IExtensionPoint point = registry.getExtensionPoint("net.sourceforge.sqlexplorer", "node");
IExtension[] extensions = point.getExtensions();
for (int i = 0; i < extensions.length; i++) {
IExtension e = extensions[i];
IConfigurationElement[] ces = e.getConfigurationElements();
for (int j = 0; j < ces.length; j++) {
try {
// include only nodes that are attachted to the schema
// node..
//$NON-NLS-1$
String parent = ces[j].getAttribute("parent-node");
if (parent.indexOf("schema") == -1) {
//$NON-NLS-1$
continue;
}
boolean isValidProduct = false;
//$NON-NLS-1$ //$NON-NLS-2$
String[] validProducts = ces[j].getAttribute("database-product-name").split(",");
// include only nodes valid for this database
for (int k = 0; k < validProducts.length; k++) {
String product = validProducts[k].toLowerCase().trim();
if (product.length() == 0) {
continue;
}
if (product.equals("*")) {
//$NON-NLS-1$
isValidProduct = true;
break;
}
//$NON-NLS-1$
String regex = TextUtil.replaceChar(product, '*', ".*");
if (databaseProductName.matches(regex)) {
isValidProduct = true;
break;
}
}
if (!isValidProduct) {
continue;
}
//$NON-NLS-1$
String imagePath = ces[j].getAttribute("icon");
//$NON-NLS-1$
String id = ces[j].getAttribute("id");
//$NON-NLS-1$
String type = ces[j].getAttribute("table-type").trim();
//$NON-NLS-1$
AbstractNode childNode = (AbstractNode) ces[j].createExecutableExtension("class");
childNode.setParent(this);
childNode.setSession(psessionNode);
childNode.setType(type);
String fragmentId = id.substring(0, id.indexOf('.', END_INDEX));
if (imagePath != null && imagePath.trim().length() != 0) {
childNode.setImage(ImageUtil.getFragmentImage(fragmentId, imagePath));
}
pchildNames.add(childNode.getLabelText());
if (!isExcludedByFilter(childNode.getLabelText())) {
addChildNode(childNode);
}
} catch (Throwable ex) {
//$NON-NLS-1$
SqlBuilderPlugin.log(Messages.getString("SchemaNode.logMessage1"), ex);
}
}
}
}
use of org.eclipse.core.runtime.IExtensionPoint 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;
}
use of org.eclipse.core.runtime.IExtensionPoint in project tdi-studio-se by Talend.
the class TalendPaletteSearchIndex method getTalendDocPlugins.
protected PluginVersionInfo getTalendDocPlugins() {
Set<String> totalIds = new HashSet<String>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint(TocFileProvider.EXTENSION_POINT_ID_TOC);
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension extension : extensions) {
try {
totalIds.add(extension.getNamespaceIdentifier());
} catch (InvalidRegistryObjectException e) {
// ignore this extension and move on
}
}
Collection<String> additionalPluginIds = BaseHelpSystem.getLocalSearchManager().getPluginsWithSearchParticipants();
totalIds.addAll(additionalPluginIds);
Iterator<String> idIter = totalIds.iterator();
while (idIter.hasNext()) {
String id = idIter.next();
if (!id.startsWith("org.talend.")) {
idIter.remove();
}
}
return new PluginVersionInfo(INDEXED_CONTRIBUTION_INFO_FILE, totalIds, indexDir, !exists());
}
use of org.eclipse.core.runtime.IExtensionPoint 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.IExtensionPoint 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);
}
}
}
}
}
Aggregations