use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class CodeGenerator method initializeJetBean.
/**
* Initialize Jet Bean to pass to the Jet Generator.
*
* @param argument the node to convert
* @return the initialized JetBean
*/
private JetBean initializeJetBean(Object argument) {
JetBean jetBean = new JetBean();
if (argument == null) {
jetBean.setJetPluginRepository(CodeGeneratorActivator.PLUGIN_ID);
} else {
if (argument instanceof CodeGeneratorArgument) {
CodeGeneratorArgument codeArgument = (CodeGeneratorArgument) argument;
if (codeArgument.getArgument() instanceof INode) {
String componentsPath = IComponentsFactory.COMPONENTS_LOCATION;
IBrandingService breaningService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
if (breaningService.isPoweredOnlyCamel()) {
componentsPath = IComponentsFactory.CAMEL_COMPONENTS_LOCATION;
}
jetBean.setJetPluginRepository(componentsPath);
} else {
jetBean.setJetPluginRepository(CodeGeneratorActivator.PLUGIN_ID);
}
} else {
jetBean.setJetPluginRepository(CodeGeneratorActivator.PLUGIN_ID);
}
}
jetBean.setArgument(argument);
return jetBean;
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class ComponentsFactory method getComponentsLocation.
/**
* DOC smallet Comment method "checkComponentFolder".
*
* @param currentFolder
* @return
* @throws BusinessException
*/
private File getComponentsLocation(String folder) {
String componentsPath = IComponentsFactory.COMPONENTS_LOCATION;
IBrandingService breaningService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
if (breaningService.isPoweredOnlyCamel()) {
componentsPath = IComponentsFactory.CAMEL_COMPONENTS_LOCATION;
}
Bundle b = Platform.getBundle(componentsPath);
File file = null;
try {
URL url = FileLocator.find(b, new Path(folder), null);
if (url == null) {
return null;
}
URL fileUrl = FileLocator.toFileURL(url);
file = new File(fileUrl.getPath());
} catch (Exception e) {
// e.printStackTrace();
ExceptionHandler.process(e);
}
return file;
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class StandAloneTalendJavaEditor method getTitleText.
private String getTitleText(IRepositoryViewObject object) {
StringBuffer string = new StringBuffer();
string.append(object.getLabel());
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
boolean allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
if (!(object instanceof Folder) && allowVerchange) {
//$NON-NLS-1$
string.append(" " + object.getVersion());
}
// nodes in the recycle bin
if (object.isDeleted()) {
String oldPath = object.getPath();
//$NON-NLS-1$ //$NON-NLS-2$
string.append(" (" + oldPath + ")");
}
return string.toString();
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class MapperMain method createUI.
/**
* Create a shell and init the mapper into it.
*
* @param display
* @return the created shell
*/
public Shell createUI(Display display) {
Shell shell = new Shell(display, SWT.APPLICATION_MODAL | SWT.BORDER | SWT.RESIZE | SWT.CLOSE | SWT.MIN | SWT.MAX | SWT.TITLE);
if (!MapperMain.isStandAloneMode()) {
IComponent component = connector.getComponent();
shell.setImage(CoreImageProvider.getComponentIcon(component, ICON_SIZE.ICON_32));
}
// Shell shell = new Shell(display);
// shell.setImage(ImageProviderMapper.getImage(ImageInfo.MAPPER_ICON));
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
String productName = brandingService.getFullProductName();
//$NON-NLS-1$ //$NON-NLS-2$
shell.setText(productName + " - " + connector.getComponent().getName() + " - " + connector.getUniqueName());
ExternalDbMapUiProperties uiProperties = mapperManager.getUiManager().getUiProperties();
Rectangle boundsMapper = uiProperties.getBoundsMapper();
if (uiProperties.isShellMaximized()) {
shell.setMaximized(uiProperties.isShellMaximized());
} else {
// // move shell at outer of display zone to avoid visual effect on loading
// Rectangle tmpBoundsMapper = new Rectangle(-boundsMapper.width, boundsMapper.y, boundsMapper.width,
// boundsMapper.height);
// shell.setBounds(tmpBoundsMapper);
boundsMapper = uiProperties.getBoundsMapper();
if (boundsMapper.x < 0) {
boundsMapper.x = 0;
}
if (boundsMapper.y < 0) {
boundsMapper.y = 0;
}
shell.setBounds(boundsMapper);
}
createUI(shell);
shell.open();
return shell;
}
use of org.talend.core.ui.branding.IBrandingService 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);
}
}
}
}
}
Aggregations