Search in sources :

Example 16 with IBrandingService

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

the class ImportProjectAsWizardPage method evaluateSpecifiedPath.

private void evaluateSpecifiedPath(String path) {
    if (path.equals(lastPath)) {
        return;
    }
    // on an empty path empty selectedProjects
    if (path == null || path.length() == 0) {
        checkFieldsValue();
        return;
    }
    final boolean dirSelected = this.projectFromDirectoryRadio.getSelection();
    File directory = new File(path);
    Collection projectFiles = new ArrayList();
    Collection talendProjectFiles = new ArrayList();
    if (!dirSelected && ArchiveFileManipulations.isTarFile(path)) {
        TarFile sourceTarFile = getSpecifiedTarSourceFile(path);
        if (sourceTarFile == null) {
            return;
        }
        TarLeveledStructureProvider provider = new TarLeveledStructureProvider(sourceTarFile);
        Object child = provider.getRoot();
        if (!ImportProjectsUtilities.collectProjectFilesFromProvider(projectFiles, provider, child, 0, null, IProjectDescription.DESCRIPTION_FILE_NAME)) {
            return;
        }
        if (!ImportProjectsUtilities.collectProjectFilesFromProvider(talendProjectFiles, provider, child, 0, null, FileConstants.LOCAL_PROJECT_FILENAME)) {
            return;
        }
        if (!ImportProjectsUtilities.collectProjectFilesFromProvider(talendProjectFiles, provider, child, 0, null, FileConstants.OLD_TALEND_PROJECT_FILENAME)) {
            return;
        }
    } else if (!dirSelected && ArchiveFileManipulations.isZipFile(path)) {
        ZipFile sourceFile = getSpecifiedZipSourceFile(path);
        if (sourceFile == null) {
            return;
        }
        ZipLeveledStructureProvider provider = new ZipLeveledStructureProvider(sourceFile);
        Object child = provider.getRoot();
        if (!ImportProjectsUtilities.collectProjectFilesFromProvider(projectFiles, provider, child, 0, null, IProjectDescription.DESCRIPTION_FILE_NAME)) {
            return;
        }
        if (!ImportProjectsUtilities.collectProjectFilesFromProvider(talendProjectFiles, provider, child, 0, null, FileConstants.LOCAL_PROJECT_FILENAME)) {
            return;
        }
        if (!ImportProjectsUtilities.collectProjectFilesFromProvider(talendProjectFiles, provider, child, 0, null, FileConstants.OLD_TALEND_PROJECT_FILENAME)) {
            return;
        }
    } else if (dirSelected && directory.isDirectory()) {
        if (!ImportProjectsUtilities.collectProjectFilesFromDirectory(projectFiles, directory, null, IProjectDescription.DESCRIPTION_FILE_NAME)) {
            return;
        }
        if (!ImportProjectsUtilities.collectProjectFilesFromDirectory(talendProjectFiles, directory, null, FileConstants.LOCAL_PROJECT_FILENAME)) {
            return;
        }
        if (!ImportProjectsUtilities.collectProjectFilesFromDirectory(talendProjectFiles, directory, null, FileConstants.OLD_TALEND_PROJECT_FILENAME)) {
            return;
        }
    }
    lastPath = path;
    if (projectFiles.size() != 1 || talendProjectFiles.size() != 1) {
        IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
        String string = //$NON-NLS-1$
        Messages.getString(//$NON-NLS-1$
        "ImportProjectAsWizardPage.error.notATalendProject", brandingService.getShortProductName());
        fileContentStatus = new Status(IStatus.ERROR, RepositoryPlugin.PLUGIN_ID, IStatus.OK, string, null);
    } else {
        fileContentStatus = createOkStatus();
    }
    checkFieldsValue();
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) TarLeveledStructureProvider(org.eclipse.ui.internal.wizards.datatransfer.TarLeveledStructureProvider) ZipFile(java.util.zip.ZipFile) ZipLeveledStructureProvider(org.eclipse.ui.internal.wizards.datatransfer.ZipLeveledStructureProvider) ArrayList(java.util.ArrayList) TarFile(org.eclipse.ui.internal.wizards.datatransfer.TarFile) Collection(java.util.Collection) IBrandingService(org.talend.core.ui.branding.IBrandingService) ZipFile(java.util.zip.ZipFile) File(java.io.File) TarFile(org.eclipse.ui.internal.wizards.datatransfer.TarFile)

Example 17 with IBrandingService

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

the class JobJavaScriptOSGIForESBManager method createAnalyzer.

protected Analyzer createAnalyzer(ExportFileResource libResource, ProcessItem processItem) throws IOException {
    Analyzer analyzer = new Analyzer();
    Jar bin = new Jar(classesLocation);
    analyzer.setJar(bin);
    final String bundleName = processItem.getProperty().getLabel();
    String symbolicName = bundleName;
    // http://jira.talendforge.org/browse/TESB-5382 LiXiaopeng
    Project project = ProjectManager.getInstance().getCurrentProject();
    if (project != null) {
        String proName = project.getLabel();
        if (proName != null) {
            symbolicName = proName.toLowerCase() + '.' + symbolicName;
        }
    }
    analyzer.setProperty(Analyzer.BUNDLE_NAME, bundleName);
    analyzer.setProperty(Analyzer.BUNDLE_SYMBOLICNAME, symbolicName);
    analyzer.setProperty(Analyzer.BUNDLE_VERSION, getBundleVersion());
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    analyzer.setProperty(Analyzer.BUNDLE_VENDOR, //$NON-NLS-1$
    brandingService.getFullProductName() + " (" + brandingService.getAcronym() + '_' + RepositoryPlugin.getDefault().getBundle().getVersion().toString() + //$NON-NLS-1$
    ")");
    addOsgiDependencies(analyzer, libResource, processItem);
    //$NON-NLS-1$
    final StringBuilder bundleClasspath = new StringBuilder(".");
    final StringBuilder bundleNativeCode = new StringBuilder();
    Set<String> relativePathList = libResource.getRelativePathList();
    for (String path : relativePathList) {
        Set<URL> resources = libResource.getResourcesByRelativePath(path);
        for (URL url : resources) {
            File dependencyFile = new File(FilesUtils.getFileRealPath(url.getPath()));
            String relativePath = libResource.getDirectoryName() + PATH_SEPARATOR + dependencyFile.getName();
            bundleClasspath.append(MANIFEST_ITEM_SEPARATOR).append(relativePath);
            bin.putResource(relativePath, new FileResource(dependencyFile));
            // Add dynamic library declaration in manifest
            if (relativePath.toLowerCase().endsWith(DLL_FILE) || relativePath.toLowerCase().endsWith(SO_FILE)) {
                bundleNativeCode.append(libResource.getDirectoryName() + PATH_SEPARATOR + dependencyFile.getName()).append(OSGI_OS_CODE);
            }
        }
    }
    analyzer.setProperty(Analyzer.BUNDLE_CLASSPATH, bundleClasspath.toString());
    // TESB-15680: Add Bundle-NativeCode in manifest
    if (bundleNativeCode.length() > 0) {
        bundleNativeCode.setLength(bundleNativeCode.length() - 1);
        analyzer.setProperty(Analyzer.BUNDLE_NATIVECODE, bundleNativeCode.toString());
    }
    return analyzer;
}
Also used : Project(org.talend.core.model.general.Project) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) FileResource(aQute.bnd.osgi.FileResource) ExportFileResource(org.talend.repository.documentation.ExportFileResource) Jar(aQute.bnd.osgi.Jar) IBrandingService(org.talend.core.ui.branding.IBrandingService) Analyzer(aQute.bnd.osgi.Analyzer) File(java.io.File) URL(java.net.URL)

Example 18 with IBrandingService

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

the class JavaJobScriptsExportWSWizardPage method createControl.

@Override
public void createControl(Composite parent) {
    initializeDialogUnits(parent);
    GridLayout layout = new GridLayout();
    SashForm sash = createExportTree(parent);
    // Added a scrolled composite by Marvin Wang on Feb. 27, 2012 for bug TDI-19198.
    scrolledComposite = new ScrolledComposite(sash, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    pageComposite = new Group(scrolledComposite, SWT.NONE);
    pageComposite.setLayout(layout);
    pageComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    pageComposite.setFont(parent.getFont());
    setControl(sash);
    sash.setWeights(new int[] { 0, 1, 23 });
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.verticalSpacing = 0;
    destinationNameFieldComposite = new Composite(pageComposite, SWT.NONE);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    destinationNameFieldComposite.setLayoutData(gridData);
    destinationNameFieldComposite.setLayout(layout);
    destinationNameFieldInnerComposite = new Composite(destinationNameFieldComposite, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    destinationNameFieldInnerComposite.setLayoutData(gridData);
    destinationNameFieldInnerComposite.setLayout(layout);
    createDestinationGroup(destinationNameFieldInnerComposite);
    // createExportTree(pageComposite);
    if (!isMultiNodes()) {
        IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
        boolean allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
        if (allowVerchange) {
            createJobVersionGroup(pageComposite);
        } else {
            selectedJobVersion = "0.1";
        }
    }
    createExportTypeGroup(pageComposite);
    createOptionsGroupButtons(pageComposite);
    // ie.- local
    restoreResourceSpecificationWidgetValues();
    updateWidgetEnablements();
    setPageComplete(determinePageCompletion());
    giveFocusToDestination();
    pageComposite.setSize(pageComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    scrolledComposite.setMinSize(pageComposite.getSize());
    scrolledComposite.setContent(pageComposite);
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) IBrandingService(org.talend.core.ui.branding.IBrandingService)

Example 19 with IBrandingService

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

the class ConnectionFormComposite method validateFields.

private boolean validateFields() {
    String errorMsg = null;
    boolean valid = true;
    if (dialog.getOKButton() != null) {
        dialog.getOKButton().setEnabled(true);
    }
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    boolean isOnlyRemoteConnection = brandingService.getBrandingConfiguration().isOnlyRemoteConnection();
    boolean usesMailCheck = brandingService.getBrandingConfiguration().isUseMailLoginCheck();
    LabelText emptyUrl = null;
    if (getRepository() != null) {
        for (LabelText currentUrlLabel : dynamicRequiredControls.get(getRepository()).values()) {
            if (valid && currentUrlLabel.getText().length() == 0) {
                emptyUrl = currentUrlLabel;
            }
        }
    }
    if (valid && getRepository() == null) {
        //$NON-NLS-1$
        errorMsg = Messages.getString("connections.form.emptyField.repository");
    } else if (valid && getTextName().length() == 0) {
        //$NON-NLS-1$
        errorMsg = Messages.getString("connections.form.emptyField.connname");
    } else if (valid && getUser().length() == 0) {
        //$NON-NLS-1$
        errorMsg = Messages.getString("connections.form.emptyField.username");
    } else if (valid && isLocalConnection() && !Pattern.matches(RepositoryConstants.MAIL_PATTERN, getUser())) {
        //$NON-NLS-1$
        errorMsg = Messages.getString("connections.form.malformedField.username");
    } else if (valid && emptyUrl != null) {
        //$NON-NLS-1$
        errorMsg = Messages.getString("connections.form.dynamicFieldEmpty", emptyUrl.getLabel());
    } else if (valid && !this.isValidatedWorkspace(this.getWorkspace())) {
        //$NON-NLS-1$
        errorMsg = Messages.getString("ConnectionFormComposite.workspaceInvalid");
    } else if (valid && isOnlyRemoteConnection) {
        // Uniserv feature 8,Add new Extension point to allow Uniserv to add some custom controls during TAC
        // connection check
        List<ILoginConnectionService> loginConnections = LoginConnectionManager.getRemoteConnectionService();
        for (ILoginConnectionService loginConncetion : loginConnections) {
            errorMsg = loginConncetion.checkConnectionValidation(getTextName(), getDesc(), getUser(), getPassword(), getWorkspace(), connection.getDynamicFields().get(RepositoryConstants.REPOSITORY_URL));
        }
    } else if (valid && getTextName() != null) {
        List<ConnectionBean> connectionBeanList = dialog.getConnections();
        if (connectionBeanList != null && connectionBeanList.size() > 1) {
            for (ConnectionBean connectionBean : connectionBeanList) {
                String connectionBeanName = connectionBean.getName();
                if (connectionBeanName != null) {
                    if (this.connection != connectionBean) {
                        if (connectionBeanName.equals(getTextName())) {
                            //$NON-NLS-1$
                            errorMsg = Messages.getString("ConnectionFormComposite.connectionNameInvalid");
                        }
                    }
                }
            }
        }
    }
    if (errorMsg != null && !errorMsg.equals("")) {
        //$NON-NLS-1$
        valid = false;
    }
    if (!valid) {
        dialog.setErrorMessage(errorMsg);
        if (dialog.getOKButton() != null) {
            dialog.getOKButton().setEnabled(false);
        }
    } else {
        dialog.setErrorMessage(null);
    }
    if (connection != null) {
        connection.setComplete(valid);
        connectionsListComposite.refresh(connection);
    }
    return valid;
}
Also used : ILoginConnectionService(org.talend.core.repository.services.ILoginConnectionService) LabelText(org.talend.commons.ui.swt.formtools.LabelText) List(java.util.List) ArrayList(java.util.ArrayList) ConnectionBean(org.talend.core.model.general.ConnectionBean) IBrandingService(org.talend.core.ui.branding.IBrandingService)

Example 20 with IBrandingService

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

the class ConnectionsDialog method configureShell.

@Override
protected void configureShell(final Shell newShell) {
    super.configureShell(newShell);
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    //$NON-NLS-1$
    newShell.setText(Messages.getString("LoginDialog.title", brandingService.getFullProductName()));
}
Also used : IBrandingService(org.talend.core.ui.branding.IBrandingService)

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