Search in sources :

Example 26 with IBrandingService

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;
}
Also used : JetBean(org.talend.designer.codegen.config.JetBean) INode(org.talend.core.model.process.INode) CodeGeneratorArgument(org.talend.designer.codegen.config.CodeGeneratorArgument) IBrandingService(org.talend.core.ui.branding.IBrandingService)

Example 27 with IBrandingService

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;
}
Also used : Path(org.eclipse.core.runtime.Path) ComponentBundleToPath(org.talend.designer.core.model.components.ComponentBundleToPath) Bundle(org.osgi.framework.Bundle) ResourceBundle(java.util.ResourceBundle) IBrandingService(org.talend.core.ui.branding.IBrandingService) File(java.io.File) URL(java.net.URL) FileNotFoundException(java.io.FileNotFoundException) BusinessException(org.talend.commons.exception.BusinessException) IOException(java.io.IOException)

Example 28 with IBrandingService

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();
}
Also used : IBrandingService(org.talend.core.ui.branding.IBrandingService) Folder(org.talend.core.model.repository.Folder)

Example 29 with IBrandingService

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;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IComponent(org.talend.core.model.components.IComponent) Rectangle(org.eclipse.swt.graphics.Rectangle) IBrandingService(org.talend.core.ui.branding.IBrandingService) ExternalDbMapUiProperties(org.talend.designer.dbmap.external.data.ExternalDbMapUiProperties)

Example 30 with IBrandingService

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);
                }
            }
        }
    }
}
Also used : AbstractComponentsProvider(org.talend.core.model.components.AbstractComponentsProvider) IExtensionPoint(org.eclipse.core.runtime.IExtensionPoint) CoreException(org.eclipse.core.runtime.CoreException) IExtension(org.eclipse.core.runtime.IExtension) IBrandingService(org.talend.core.ui.branding.IBrandingService) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Aggregations

IBrandingService (org.talend.core.ui.branding.IBrandingService)49 GridData (org.eclipse.swt.layout.GridData)11 GridLayout (org.eclipse.swt.layout.GridLayout)10 Composite (org.eclipse.swt.widgets.Composite)9 File (java.io.File)8 Button (org.eclipse.swt.widgets.Button)7 Shell (org.eclipse.swt.widgets.Shell)7 Path (org.eclipse.core.runtime.Path)6 URL (java.net.URL)5 Point (org.eclipse.swt.graphics.Point)5 Rectangle (org.eclipse.swt.graphics.Rectangle)5 Bundle (org.osgi.framework.Bundle)5 Project (org.talend.core.model.general.Project)5 CoreException (org.eclipse.core.runtime.CoreException)4 Text (org.eclipse.swt.widgets.Text)4 BusinessException (org.talend.commons.exception.BusinessException)4 IComponent (org.talend.core.model.components.IComponent)4 ConnectionBean (org.talend.core.model.general.ConnectionBean)4 IOException (java.io.IOException)3 ResourceBundle (java.util.ResourceBundle)3