use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class CodeGeneratorEmittersPoolFactory method initComponent.
/**
* initialization of the available components.
*
* @param codeLanguage
* @param jetBeans
* @param codePart
* @param component
*/
private static void initComponent(ECodeLanguage codeLanguage, List<JetBean> jetBeans, ECodePart codePart, IComponent component) {
if (component.getAvailableCodeParts().contains(codePart)) {
IComponentFileNaming fileNamingInstance = ComponentsFactoryProvider.getFileNamingInstance();
String templateURI = component.getPathSource() + TemplateUtil.DIR_SEP + component.getName() + TemplateUtil.DIR_SEP + fileNamingInstance.getJetFileName(component, codeLanguage.getExtension(), codePart);
String componentsPath = IComponentsFactory.COMPONENTS_LOCATION;
IBrandingService breaningService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
if (breaningService.isPoweredOnlyCamel()) {
componentsPath = IComponentsFactory.CAMEL_COMPONENTS_LOCATION;
}
if (component instanceof EmfComponent) {
componentsPath = ((EmfComponent) component).getSourceBundleName();
}
JetBean jetBean = new JetBean(componentsPath, templateURI, component.getName(), component.getVersion(), codeLanguage.getName(), codePart.getName());
//$NON-NLS-1$ //$NON-NLS-2$
jetBean.addClassPath("EMF_ECORE", "org.eclipse.emf.ecore");
//$NON-NLS-1$ //$NON-NLS-2$
jetBean.addClassPath("EMF_COMMON", "org.eclipse.emf.common");
//$NON-NLS-1$ //$NON-NLS-2$
jetBean.addClassPath("CORERUNTIME_LIBRARIES", "org.talend.core.runtime");
//$NON-NLS-1$ //$NON-NLS-2$
jetBean.addClassPath("MANAGEMENT_LIBRARIES", "org.talend.metadata.managment");
//$NON-NLS-1$
jetBean.addClassPath("CORE_LIBRARIES", CorePlugin.PLUGIN_ID);
//$NON-NLS-1$
jetBean.addClassPath("CODEGEN_LIBRARIES", CodeGeneratorActivator.PLUGIN_ID);
//$NON-NLS-1$
jetBean.addClassPath("COMMON_LIBRARIES", CommonsPlugin.PLUGIN_ID);
//$NON-NLS-1$ //$NON-NLS-2$
jetBean.addClassPath("COMPONENT_FRAMEWORK", "org.talend.components.api");
//$NON-NLS-1$ //$NON-NLS-2$
jetBean.addClassPath("DAIKON", "org.talend.daikon");
//$NON-NLS-1$ //$NON-NLS-2$
jetBean.addClassPath("COMPONENT_CORE", "org.talend.designer.core.generic");
//$NON-NLS-1$ //$NON-NLS-2$
jetBean.addClassPath("DESIGNER_CORE", "org.talend.designer.core");
//$NON-NLS-1$ //$NON-NLS-2$
jetBean.addClassPath("HADOOP_DISTRIBUTIONS", "org.talend.hadoop.distribution");
//$NON-NLS-1$ //$NON-NLS-2$
jetBean.addClassPath("HADOOP_CUSTOM_DISTRIBUTIONS", "org.talend.hadoop.distribution.custom");
if (PluginChecker.isGEFAbstractMapLoaded()) {
//$NON-NLS-1$ //$NON-NLS-2$
jetBean.addClassPath("GEF_MAP", "org.talend.designer.gefabstractmap");
}
for (String pluginDependency : component.getPluginDependencies()) {
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
jetBean.addClassPath(pluginDependency.toUpperCase().replaceAll("\\.", "_") + "_LIBRARIES", pluginDependency);
}
String familyName = component.getOriginalFamilyName();
if (familyName.contains("|")) {
//$NON-NLS-1$
//$NON-NLS-1$
familyName = component.getOriginalFamilyName().substring(0, component.getOriginalFamilyName().indexOf("|"));
}
jetBean.setFamily(StringUtils.removeSpecialCharsForPackage(familyName.toLowerCase()));
// Spark, M/R and Storm requires the plugin org.talend.designer.spark to be in the classpath in order to
// generate the code.
//$NON-NLS-1$
String sparkUtilsPluginName = "org.talend.designer.spark";
//$NON-NLS-1$
String bigDataUtilsPluginName = "org.talend.designer.bigdata";
if (PluginChecker.isPluginLoaded(sparkUtilsPluginName) && (//$NON-NLS-1$
"SPARK".equals(component.getPaletteType()) || "MR".equals(component.getPaletteType()) || //$NON-NLS-1$ //$NON-NLS-2$
"STORM".equals(component.getPaletteType()) || "SPARKSTREAMING".equals(component.getPaletteType()))) {
//$NON-NLS-1$
//$NON-NLS-1$
jetBean.addClassPath("BIGDATA_LIBRARIES", bigDataUtilsPluginName);
//$NON-NLS-1$
jetBean.addClassPath("SPARK_LIBRARIES", sparkUtilsPluginName);
jetBean.setClassLoader(createDelegateClassLoader(createDelegateClassLoader(new CodeGeneratorEmittersPoolFactory().getClass().getClassLoader(), bigDataUtilsPluginName, //$NON-NLS-1$
"org.talend.designer.bigdata.common.BigDataDataProcess"), sparkUtilsPluginName, //$NON-NLS-1$
"org.talend.designer.spark.SparkPlugin"));
// spark as a secondary, delegate classloader.
if (component.getPluginExtension() != null) {
jetBean.addClassPath(//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"EXTERNAL_COMPONENT_" + component.getPluginExtension().toUpperCase().replaceAll("\\.", "_"), component.getPluginExtension());
jetBean.setClassLoader(new DelegateClassLoader(ExternalNodesFactory.getInstance(component.getPluginExtension()).getClass().getClassLoader(), jetBean.getClassLoader()));
}
} else if (component.getPluginExtension() != null) {
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
jetBean.addClassPath(//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"EXTERNAL_COMPONENT_" + component.getPluginExtension().toUpperCase().replaceAll("\\.", "_"), component.getPluginExtension());
jetBean.setClassLoader(ExternalNodesFactory.getInstance(component.getPluginExtension()).getClass().getClassLoader());
} else {
jetBean.setClassLoader(new CodeGeneratorEmittersPoolFactory().getClass().getClassLoader());
}
jetBeans.add(jetBean);
}
// When building the main part of the component, also attempt to build the other parts.
if (codePart.compareTo(ECodePart.MAIN) == 0) {
for (ECodePart otherPart : ECodePart.values()) {
if (otherPart != ECodePart.MAIN && component.getAvailableCodeParts().contains(otherPart)) {
initComponent(codeLanguage, jetBeans, otherPart, component);
}
}
}
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class MultiPageTalendEditor method setName.
/**
* DOC smallet Comment method "setName".
*
* @param label
*/
@Override
public void setName() {
if (getEditorInput() == null) {
return;
}
super.setName();
IProcess2 process2 = this.getProcess();
if (process2 == null) {
return;
}
Property property = process2.getProperty();
if (property == null) {
return;
}
String label = property.getDisplayName();
//$NON-NLS-1$
String jobVersion = "0.1";
if (process2 != null) {
jobVersion = process2.getVersion();
}
// if (getActivePage() == 1) {
ISVNProviderService service = null;
if (PluginChecker.isSVNProviderPluginLoaded()) {
service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(ISVNProviderService.class);
if (revisionChanged && service.isProjectInSvnMode()) {
revisionNumStr = service.getCurrentSVNRevision(process2);
revisionChanged = false;
if (revisionNumStr != null) {
//$NON-NLS-1$
revisionNumStr = ".r" + revisionNumStr;
}
}
}
//$NON-NLS-1$
String title = "MultiPageTalendEditor.Job";
if (process2 != null) {
Item item = process2.getProperty().getItem();
if (item instanceof JobletProcessItem) {
//$NON-NLS-1$
title = "MultiPageTalendEditor.Joblet";
}
}
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
boolean allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
if (allowVerchange) {
if (revisionNumStr != null) {
setPartName(Messages.getString(title, label, jobVersion) + revisionNumStr);
} else {
setPartName(Messages.getString(title, label, jobVersion));
}
} else {
if (revisionNumStr != null) {
//$NON-NLS-1$
setPartName(Messages.getString(title, label, "") + revisionNumStr);
} else {
//$NON-NLS-1$
setPartName(Messages.getString(title, label, ""));
}
}
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class PerformancePreferencePage method createFieldEditors.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
*/
@Override
protected void createFieldEditors() {
IBrandingService breaningService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
if (breaningService.isPoweredOnlyCamel()) {
addField(new BooleanFieldEditor(ITalendCorePrefConstants.DEACTIVE_REPOSITORY_UPDATE, //$NON-NLS-1$
Messages.getString("PerformancePreferencePage.display.deactiveRepositoryUpdate"), getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPERTY_CODE_CHECK, Messages.getString("PerformancePreferencePage.propertyCodeCheck"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.GENERATE_CODE_WHEN_OPEN_JOB, //$NON-NLS-1$
Messages.getString("PerformancePreferencePage.generateCode"), getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.CHECK_ONLY_LAST_VERSION, //$NON-NLS-1$
Messages.getString("PerformancePreferencePage.checkVersion"), getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT_VARIABLE, //$NON-NLS-1$
Messages.getString("PerformancePreferencePage.addOrDeleteVariable"), getFieldEditorParent()));
dbConnTimeoutActive = new CheckBoxFieldEditor(ITalendCorePrefConstants.DB_CONNECTION_TIMEOUT_ACTIVED, Messages.getString("PerformancePreferencePage.ActivedTimeoutSetting"), //$NON-NLS-1$
getFieldEditorParent());
dbConnTimeoutActive.getButton().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
checkDBTimeout();
}
});
dbConnTimeout = new IntegerFieldEditor(ITalendCorePrefConstants.DB_CONNECTION_TIMEOUT, //$NON-NLS-1$
Messages.getString("PerformancePreferencePage.ConnectionTimeout"), getFieldEditorParent());
Text textControl = dbConnTimeout.getTextControl(getFieldEditorParent());
//$NON-NLS-1$
textControl.setToolTipText(Messages.getString("PerformancePreferencePage.ConnectionTimeoutTip"));
dbConnTimeout.setValidRange(0, Short.MAX_VALUE);
textControl.setEnabled(getPreferenceStore().getBoolean(ITalendCorePrefConstants.DB_CONNECTION_TIMEOUT_ACTIVED));
addField(dbConnTimeoutActive);
addField(dbConnTimeout);
addSVNInforAutoCheckFiled();
} else {
addField(new BooleanFieldEditor(ITalendCorePrefConstants.DEACTIVE_REPOSITORY_UPDATE, //$NON-NLS-1$
Messages.getString("PerformancePreferencePage.display.deactiveRepositoryUpdate"), getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPERTY_CODE_CHECK, Messages.getString("PerformancePreferencePage.propertyCodeCheck"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.GENERATE_CODE_WHEN_OPEN_JOB, //$NON-NLS-1$
Messages.getString("PerformancePreferencePage.generateCode"), getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.CHECK_ONLY_LAST_VERSION, //$NON-NLS-1$
Messages.getString("PerformancePreferencePage.checkVersion"), getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT_VARIABLE, //$NON-NLS-1$
Messages.getString("PerformancePreferencePage.addOrDeleteVariable"), getFieldEditorParent()));
dbConnTimeoutActive = new CheckBoxFieldEditor(ITalendCorePrefConstants.DB_CONNECTION_TIMEOUT_ACTIVED, Messages.getString("PerformancePreferencePage.ActivedTimeoutSetting"), //$NON-NLS-1$
getFieldEditorParent());
dbConnTimeoutActive.getButton().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
checkDBTimeout();
}
});
dbConnTimeout = new IntegerFieldEditor(ITalendCorePrefConstants.DB_CONNECTION_TIMEOUT, //$NON-NLS-1$
Messages.getString("PerformancePreferencePage.ConnectionTimeout"), getFieldEditorParent());
Text textControl = dbConnTimeout.getTextControl(getFieldEditorParent());
//$NON-NLS-1$
textControl.setToolTipText(Messages.getString("PerformancePreferencePage.ConnectionTimeoutTip"));
dbConnTimeout.setValidRange(0, Short.MAX_VALUE);
textControl.setEnabled(getPreferenceStore().getBoolean(ITalendCorePrefConstants.DB_CONNECTION_TIMEOUT_ACTIVED));
addField(dbConnTimeoutActive);
addField(dbConnTimeout);
addField(new BooleanFieldEditor(ITalendCorePrefConstants.ADD_USER_ROUTINES, //$NON-NLS-1$
Messages.getString("PerformancePreferencePage.addAllUserRoutines"), getFieldEditorParent()));
// TDI-8323:remove this one,we do not need this since we always add all system routines for new job
// addField(new BooleanFieldEditor(ITalendCorePrefConstants.ADD_SYSTEM_ROUTINES, Messages
// .getString("PerformancePreferencePage.addAllSystemRoutines"),//$NON-NLS-1$
// getFieldEditorParent()));
addSVNInforAutoCheckFiled();
}
IntegerFieldEditor codeFormatTimeout = new IntegerFieldEditor(ITalendCorePrefConstants.PERFORMANCE_JAVA_PROCESS_CODE_FORMATE_TIMEOUT, //$NON-NLS-1$
Messages.getString("PerformancePreferencePage.CodeFormatTimeout"), getFieldEditorParent());
codeFormatTimeout.setValidRange(1, Short.MAX_VALUE);
addField(codeFormatTimeout);
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class HTMLDocGenerator method saveLogoImage.
protected void saveLogoImage(int type, File file) throws IOException {
boolean documentationPluginLoaded = PluginChecker.isDocumentationPluginLoaded();
// get image from cache
ByteArrayOutputStream result = logoImageCache.get(type);
if (documentationPluginLoaded) {
String userLogoPath = CorePlugin.getDefault().getPreferenceStore().getString(ITalendCorePrefConstants.DOC_USER_LOGO);
if (userLogoPath != null && !"".equals(userLogoPath)) {
//$NON-NLS-1$
if (result == null || !userLogoPath.equals(userDocImageOldPath)) {
userDocImageOldPath = userLogoPath;
result = new ByteArrayOutputStream(3072);
File userLogo = new File(userLogoPath);
if (userLogo.exists()) {
Image image = new Image(Display.getCurrent(), userLogoPath);
ImageLoader imageLoader = new ImageLoader();
imageLoader.data = new ImageData[] { image.getImageData() };
imageLoader.save(result, type);
logoImageCache.put(type, result);
image.dispose();
}
}
FileOutputStream fos = new FileOutputStream(file);
fos.write(result.toByteArray());
fos.close();
return;
}
}
// if (result == null) {
result = new ByteArrayOutputStream(3072);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
ImageData imageData = brandingService.getLoginHImage().getImageData();
new ByteArrayOutputStream();
ImageLoader imageLoader = new ImageLoader();
imageLoader.data = new ImageData[] { imageData };
imageLoader.save(result, type);
// put image to cache, no need to generate next time
logoImageCache.put(type, result);
// }
FileOutputStream fos = new FileOutputStream(file);
fos.write(result.toByteArray());
fos.close();
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class VersionManagementProjectSettingPageTester method valid.
/*
* (non-Javadoc)
*
* @see
* org.talend.core.runtime.preference.IProjectSettingPageTester#valid(org.eclipse.core.runtime.IConfigurationElement
* , org.eclipse.jface.preference.IPreferenceNode)
*/
@Override
public boolean valid(IConfigurationElement element, IPreferenceNode node) {
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
boolean allowChengeVersion = brandingService.getBrandingConfiguration().isAllowChengeVersion();
return allowChengeVersion;
}
Aggregations