Search in sources :

Example 21 with IBrandingService

use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.

the class ConnectionsDialog method setTitleImage.

protected void setTitleImage() {
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    ImageDescriptor imgDesc = brandingService.getLoginHImage();
    if (imgDesc == null) {
        return;
    }
    Image originalImage = ImageProvider.getImage(imgDesc);
    if (originalImage == null) {
        return;
    }
    Rectangle originalImageSize = originalImage.getBounds();
    Image scaled = new Image(Display.getDefault(), originalImageSize.width + 10, originalImageSize.height);
    GC gc = new GC(scaled);
    gc.setAntialias(SWT.ON);
    gc.setInterpolation(SWT.HIGH);
    gc.drawImage(originalImage, 0, 0, originalImage.getBounds().width, originalImage.getBounds().height, 0, 0, originalImageSize.width, originalImageSize.height);
    gc.dispose();
    originalImage.dispose();
    setTitleImage(scaled);
}
Also used : Rectangle(org.eclipse.swt.graphics.Rectangle) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) IBrandingService(org.talend.core.ui.branding.IBrandingService) Image(org.eclipse.swt.graphics.Image) GC(org.eclipse.swt.graphics.GC)

Example 22 with IBrandingService

use of org.talend.core.ui.branding.IBrandingService in project tesb-studio-se by Talend.

the class JetUtil method createJetBean.

/**
	 * Initialize Jet Bean to pass to the Jet Generator.
	 * 
	 * @param argument
	 *            the node to convert
	 * @return the initialized JetBean
	 */
public static JetBean createJetBean(CodeGeneratorArgument argument) {
    final JetBean jetBean = new JetBean();
    jetBean.setArgument(argument);
    if (argument != null && argument.getArgument() instanceof INode) {
        INode node = (INode) argument.getArgument();
        String componentsPath = IComponentsFactory.COMPONENTS_LOCATION;
        IBrandingService breaningService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
        if (breaningService.isPoweredOnlyCamel()) {
            componentsPath = IComponentsFactory.CAMEL_COMPONENTS_LOCATION;
        }
        jetBean.setJetPluginRepository(componentsPath);
        initTemplateRelativeUri(jetBean, node, argument.getCodePart());
    }
    if (jetBean.getJetPluginRepository() == null) {
        jetBean.setJetPluginRepository(Activator.getDefault().getBundle().getSymbolicName());
    }
    return jetBean;
}
Also used : JetBean(org.talend.designer.codegen.config.JetBean) INode(org.talend.core.model.process.INode) IBrandingService(org.talend.core.ui.branding.IBrandingService)

Example 23 with IBrandingService

use of org.talend.core.ui.branding.IBrandingService in project tesb-studio-se by Talend.

the class ServiceExportManager method getManifest.

public Manifest getManifest(String artefactName, String serviceVersion, Map<String, String> additionalInfo) {
    boolean useRegistry = Boolean.valueOf(additionalInfo.get(ServiceMetadataDialog.USE_SERVICE_REGISTRY));
    boolean logMessages = Boolean.valueOf(additionalInfo.get(ServiceMetadataDialog.LOG_MESSAGES));
    boolean useSL = Boolean.valueOf(additionalInfo.get(ServiceMetadataDialog.USE_SL));
    boolean useSAM = Boolean.valueOf(additionalInfo.get(ServiceMetadataDialog.USE_SAM));
    boolean useBusinessCorrelation = Boolean.valueOf(additionalInfo.get(ServiceMetadataDialog.USE_BUSINESS_CORRELATION));
    boolean useSecurityToken = Boolean.valueOf(additionalInfo.get(ServiceMetadataDialog.SECURITY_BASIC));
    boolean useSecuritySAML = Boolean.valueOf(additionalInfo.get(ServiceMetadataDialog.SECURITY_SAML));
    boolean useEncryption = useSecuritySAML && Boolean.valueOf(additionalInfo.get(ServiceMetadataDialog.ENCRYPTION));
    Manifest manifest = new Manifest();
    Attributes a = manifest.getMainAttributes();
    //$NON-NLS-1$
    a.put(Attributes.Name.MANIFEST_VERSION, "1.0");
    //$NON-NLS-1$
    a.put(new Attributes.Name("Bundle-Name"), artefactName);
    //$NON-NLS-1$
    a.put(new Attributes.Name("Bundle-SymbolicName"), artefactName);
    //$NON-NLS-1$
    a.put(new Attributes.Name("Bundle-Version"), serviceVersion);
    //$NON-NLS-1$ //$NON-NLS-2$
    a.put(new Attributes.Name("Bundle-ManifestVersion"), "2");
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    a.put(new Attributes.Name("Created-By"), brandingService.getFullProductName() + " (" + brandingService.getAcronym() + '_' + RepositoryPlugin.getDefault().getBundle().getVersion().toString() + ')');
    //$NON-NLS-1$
    a.put(//$NON-NLS-1$
    new Attributes.Name("Import-Package"), //$NON-NLS-1$
    "javax.xml.ws,org.talend.esb.job.controller" + //$NON-NLS-1$
    ",org.osgi.service.cm;version=\"[1.3,2)\"" + //$NON-NLS-1$
    ",org.apache.cxf,org.apache.cxf.metrics" + //$NON-NLS-1$
    (logMessages ? ",org.apache.cxf.feature" : "") + //$NON-NLS-1$
    (useSL ? ",org.talend.esb.servicelocator.cxf" : "") + //$NON-NLS-1$
    (useSAM ? ",org.talend.esb.sam.agent.feature" : "") + //$NON-NLS-1$
    (useBusinessCorrelation ? ",org.talend.esb.policy.correlation.feature" : "") + //$NON-NLS-1$
    (useSecurityToken || useRegistry ? ",org.apache.wss4j.dom.validate" : "") + //$NON-NLS-1$
    (useSecuritySAML || useRegistry ? ",org.talend.esb.security.saml" : "") + //$NON-NLS-1$
    (useEncryption || useRegistry ? ",org.apache.cxf.xkms.crypto" : ""));
    return manifest;
}
Also used : Attributes(java.util.jar.Attributes) IBrandingService(org.talend.core.ui.branding.IBrandingService) Manifest(java.util.jar.Manifest)

Example 24 with IBrandingService

use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.

the class ProcessController method createControl.

@Override
public Control createControl(final Composite subComposite, final IElementParameter param, final int numInRow, final int nbInRow, final int top, final Control lastControl) {
    this.curParameter = param;
    this.paramFieldType = param.getFieldType();
    FormData data;
    IElementParameter processTypeParameter = param.getChildParameters().get(EParameterName.PROCESS_TYPE_PROCESS.getName());
    Text labelText;
    final DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER, new SelectAllTextControlCreator());
    if (param.isRequired()) {
        FieldDecoration decoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED);
        dField.addFieldDecoration(decoration, SWT.RIGHT | SWT.TOP, false);
    }
    Control cLayout = dField.getLayoutControl();
    labelText = (Text) dField.getControl();
    labelText.setData(PARAMETER_NAME, param.getName());
    cLayout.setBackground(subComposite.getBackground());
    labelText.setEditable(false);
    if (elem instanceof Node) {
        labelText.setToolTipText(VARIABLE_TOOLTIP + param.getVariableName());
    }
    addDragAndDropTarget(labelText);
    CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, param.getDisplayName());
    data = new FormData();
    if (lastControl != null) {
        data.left = new FormAttachment(lastControl, 0);
    } else {
        data.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / (nbInRow + 1)), 0);
    }
    data.top = new FormAttachment(0, top);
    labelLabel.setLayoutData(data);
    if (numInRow != 1) {
        labelLabel.setAlignment(SWT.RIGHT);
    }
    // *********************
    data = new FormData();
    int currentLabelWidth = STANDARD_LABEL_WIDTH;
    GC gc = new GC(labelLabel);
    Point labelSize = gc.stringExtent(param.getDisplayName());
    gc.dispose();
    if ((labelSize.x + ITabbedPropertyConstants.HSPACE) > currentLabelWidth) {
        currentLabelWidth = labelSize.x + ITabbedPropertyConstants.HSPACE;
    }
    if (numInRow == 1) {
        if (lastControl != null) {
            data.left = new FormAttachment(lastControl, currentLabelWidth);
        } else {
            data.left = new FormAttachment(0, currentLabelWidth);
        }
    } else {
        data.left = new FormAttachment(labelLabel, 0, SWT.RIGHT);
    }
    data.right = new FormAttachment((numInRow * MAX_PERCENT) / (nbInRow + 1), 0);
    data.top = new FormAttachment(0, top);
    cLayout.setLayoutData(data);
    Button btn;
    Point btnSize;
    //$NON-NLS-1$
    btn = getWidgetFactory().createButton(subComposite, "", SWT.PUSH);
    btnSize = btn.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    btn.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON)));
    btn.addSelectionListener(listenerSelection);
    //$NON-NLS-1$
    btn.setData(PARAMETER_NAME, param.getName() + ":" + processTypeParameter.getName());
    btn.setEnabled(!param.isReadOnly());
    data = new FormData();
    data.left = new FormAttachment(cLayout, 0);
    data.right = new FormAttachment(cLayout, STANDARD_BUTTON_WIDTH, SWT.RIGHT);
    data.top = new FormAttachment(0, top);
    data.height = STANDARD_HEIGHT - 2;
    btn.setLayoutData(data);
    // **********************
    //$NON-NLS-1$
    hashCurControls.put(param.getName() + ":" + processTypeParameter.getName(), labelText);
    Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
    // feature 19312
    IElementParameter useDynamicJobParameter = param.getElement().getElementParameter(EParameterName.USE_DYNAMIC_JOB.getName());
    if (useDynamicJobParameter != null && useDynamicJobParameter instanceof IElementParameter) {
        Object useDynamicJobValue = useDynamicJobParameter.getValue();
        if (useDynamicJobValue != null && useDynamicJobValue instanceof Boolean) {
            isSelectUseDynamic = (Boolean) useDynamicJobValue;
        }
    }
    Control lastControlUsed = btn;
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    boolean allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
    if (allowVerchange) {
        lastControlUsed = addJobVersionCombo(subComposite, param.getChildParameters().get(EParameterName.PROCESS_TYPE_VERSION.getName()), lastControlUsed, numInRow + 1, nbInRow, top);
    }
    if (!isSelectUseDynamic) {
        addContextCombo(subComposite, param.getChildParameters().get(EParameterName.PROCESS_TYPE_CONTEXT.getName()), lastControlUsed, numInRow + 1, nbInRow, top);
    }
    dynamicProperty.setCurRowSize(Math.max(initialSize.y, btnSize.y) + ITabbedPropertyConstants.VSPACE);
    return btn;
}
Also used : FormData(org.eclipse.swt.layout.FormData) CLabel(org.eclipse.swt.custom.CLabel) FieldDecoration(org.eclipse.jface.fieldassist.FieldDecoration) Node(org.talend.designer.core.ui.editor.nodes.Node) RepositoryNode(org.talend.repository.model.RepositoryNode) Text(org.eclipse.swt.widgets.Text) DecoratedField(org.eclipse.jface.fieldassist.DecoratedField) Point(org.eclipse.swt.graphics.Point) IBrandingService(org.talend.core.ui.branding.IBrandingService) Point(org.eclipse.swt.graphics.Point) SelectAllTextControlCreator(org.talend.designer.core.ui.editor.properties.controllers.creator.SelectAllTextControlCreator) Control(org.eclipse.swt.widgets.Control) Button(org.eclipse.swt.widgets.Button) IElementParameter(org.talend.core.model.process.IElementParameter) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) GC(org.eclipse.swt.graphics.GC) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 25 with IBrandingService

use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.

the class UserComponentsProvider method getInstallationFolder.

@Override
public File getInstallationFolder() throws IOException {
    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 installationFolder = null;
    //$NON-NLS-1$
    IPath nullPath = new Path("");
    URL url = FileLocator.find(b, nullPath, null);
    URL fileUrl = FileLocator.toFileURL(url);
    File bundleFolder = new File(fileUrl.getPath());
    IPath path = new Path(IComponentsFactory.COMPONENTS_INNER_FOLDER).append(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER);
    path = path.append(ComponentUtilities.getExtFolder(getFolderName()));
    installationFolder = new File(bundleFolder, path.toOSString());
    return installationFolder;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) Bundle(org.osgi.framework.Bundle) IBrandingService(org.talend.core.ui.branding.IBrandingService) File(java.io.File) URL(java.net.URL)

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