use of org.eclipse.ui.intro.config.IIntroXHTMLContentProvider in project tesb-studio-se by Talend.
the class EsbStartingHelper method resolveDynamicContent.
private Document resolveDynamicContent(Document dom, IIntroContentProviderSite site) {
// get all content provider elements in DOM.
NodeList contentProviders = //$NON-NLS-1$
dom.getElementsByTagNameNS(//$NON-NLS-1$
"*", IntroContentProvider.TAG_CONTENT_PROVIDER);
// get the array version of the nodelist to work around DOM api design.
Node[] nodes = ModelUtil.getArray(contentProviders);
for (int i = 0; i < nodes.length; i++) {
Element contentProviderElement = (Element) nodes[i];
IntroContentProvider provider = new IntroContentProvider(contentProviderElement, Activator.getDefault().getBundle());
// If we've already loaded the content provider for this element,
// retrieve it, otherwise load the class.
IIntroXHTMLContentProvider providerClass = (IIntroXHTMLContentProvider) ContentProviderManager.getInst().getContentProvider(provider);
if (providerClass == null)
// content provider never created before, create it.
providerClass = (IIntroXHTMLContentProvider) ContentProviderManager.getInst().createContentProvider(provider, site);
if (providerClass != null) {
// create a div with the same id as the contentProvider, pass it
// as the parent to create the specialized content, and then
// replace the contentProvider element with this div.
Properties att = new Properties();
att.setProperty(IIntroHTMLConstants.ATTRIBUTE_ID, provider.getId());
Element contentDiv = ModelUtil.createElement(dom, ModelUtil.TAG_DIV, att);
providerClass.createContent(provider.getId(), contentDiv);
if (contentDiv.getChildNodes().getLength() != 0) {
if (StartingConstants.OPTION_NAME.equals(provider.getId()) || StartingConstants.PRODUCT_NAME.equals(provider.getId())) {
contentProviderElement.getParentNode().replaceChild(contentDiv.getFirstChild(), contentProviderElement);
} else {
contentProviderElement.getParentNode().replaceChild(contentDiv, contentProviderElement);
}
}
// } else {
// we couldn't load the content provider, so add any alternate
// text content if there is any.
// INTRO: do it. 3.0 intro content style uses text element as
// alt text. We can load XHTML content here.
}
}
return dom;
}
use of org.eclipse.ui.intro.config.IIntroXHTMLContentProvider in project tdi-studio-se by Talend.
the class ExchangeManager method resolveDynamicContent.
/**
*
* DOC talend Comment method "resolveDynamicContent".
*
* @param dom
* @param nodes original contentProvider nods parsed from html file
* @return
*/
private Document resolveDynamicContent(Document dom, Node[] nodes) {
for (int i = 0; i < nodes.length; i++) {
Element contentProviderElement = (Element) nodes[i];
IntroContentProvider provider = new IntroContentProvider(contentProviderElement, ExchangePlugin.getDefault().getBundle());
IIntroXHTMLContentProvider providerClass = (IIntroXHTMLContentProvider) ContentProviderManager.getInst().getContentProvider(provider);
if (providerClass == null)
providerClass = (IIntroXHTMLContentProvider) ContentProviderManager.getInst().createContentProvider(provider, null);
if (providerClass != null) {
if (providerClass instanceof ExchangeContentProvider) {
if (getSelectedExtension() != null) {
((ExchangeContentProvider) providerClass).setComponentExtension(getSelectedExtension());
} else {
((ExchangeContentProvider) providerClass).setComponentExtension(getSelectedExtension());
}
} else if (providerClass instanceof AvailableCompositeProvider) {
if (getAvialableFilter() == null) {
((AvailableCompositeProvider) providerClass).setfAvailableExtensions(fAvailableExtensions);
} else {
List<ComponentExtension> fAvailableExtensionsFilter = new ArrayList<ComponentExtension>();
for (ComponentExtension Extension : fAvailableExtensions) {
if (Extension.getLabel().toUpperCase().contains(getAvialableFilter().toUpperCase())) {
fAvailableExtensionsFilter.add(Extension);
}
}
((AvailableCompositeProvider) providerClass).setfAvailableExtensions(fAvailableExtensionsFilter);
}
} else if (providerClass instanceof DownloadExtensionProvider) {
loadDownloadedExtensionsFromFile();
((DownloadExtensionProvider) providerClass).setfInstalledExtensions(fInstalledExtensions);
((DownloadExtensionProvider) providerClass).setfDownloadedExtensions(fDownloadedExtensions);
} else if (providerClass instanceof MyExchangeContentProvider) {
((MyExchangeContentProvider) providerClass).setComponentExtension(getSelectedExtension());
((MyExchangeContentProvider) providerClass).setfContributeExtensions(new ArrayList<ComponentExtension>(fContributedExtensions));
}
// revert the content contentprovider before generate the dynamic content
reinjectDynamicContent(dom, contentProviderElement);
Properties att = new Properties();
att.setProperty(IIntroHTMLConstants.ATTRIBUTE_ID, provider.getId());
// Element contentDiv = ModelUtil.createElement(dom, ModelUtil.TAG_DIV, att);
Element contentDiv = TalendHtmlModelUtil.createElement(dom, TalendHtmlModelUtil.TAG_DIV, att);
providerClass.createContent(provider.getId(), contentDiv);
contentProviderElement.getParentNode().replaceChild(contentDiv, contentProviderElement);
} else {
// we couldn't load the content provider, so add any alternate
// text content if there is any.
// INTRO: do it. 3.0 intro content style uses text element as
// alt text. We can load XHTML content here.
}
}
return dom;
}
use of org.eclipse.ui.intro.config.IIntroXHTMLContentProvider in project tdi-studio-se by Talend.
the class TutorialsHelper method resolveDynamicContent.
private Document resolveDynamicContent(Document dom, IIntroContentProviderSite site) {
// get all content provider elements in DOM.
NodeList contentProviders = //$NON-NLS-1$
dom.getElementsByTagNameNS(//$NON-NLS-1$
"*", IntroContentProvider.TAG_CONTENT_PROVIDER);
// get the array version of the nodelist to work around DOM api design.
// Node[] nodes = ModelUtil.getArray(contentProviders);
Node[] nodes = TalendHtmlModelUtil.getArray(contentProviders);
for (Node node : nodes) {
Element contentProviderElement = (Element) node;
IntroContentProvider provider = new IntroContentProvider(contentProviderElement, TutorialsPlugin.getDefault().getBundle());
// If we've already loaded the content provider for this element,
// retrieve it, otherwise load the class.
IIntroXHTMLContentProvider providerClass = (IIntroXHTMLContentProvider) ContentProviderManager.getInst().getContentProvider(provider);
if (providerClass == null) {
// content provider never created before, create it.
providerClass = (IIntroXHTMLContentProvider) ContentProviderManager.getInst().createContentProvider(provider, site);
}
if (providerClass != null) {
// create a div with the same id as the contentProvider, pass it
// as the parent to create the specialized content, and then
// replace the contentProvider element with this div.
// Properties att = new Properties();
// Element countryListElement = dom.getElementById(ContentConstants.COUNTRY_LIST_ID);
Element element = provider.getElement();
// att.setProperty(IIntroHTMLConstants.ATTRIBUTE_ID, provider.getId());
// Element contentDiv = ModelUtil.createElement(dom, ModelUtil.TAG_DIV, att);
providerClass.createContent(provider.getId(), element);
} else {
// we couldn't load the content provider, so add any alternate
// text content if there is any.
// INTRO: do it. 3.0 intro content style uses text element as
// alt text. We can load XHTML content here.
}
}
return dom;
}
Aggregations