Search in sources :

Example 1 with IBrandingConfiguration

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

the class LoginDialogV2 method getFirstTimeStartupPageIfNeeded.

protected AbstractLoginActionPage getFirstTimeStartupPageIfNeeded() {
    AbstractLoginActionPage loginPage = null;
    IBrandingService service = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    if (service != null) {
        IBrandingConfiguration brandingConfiguration = service.getBrandingConfiguration();
        if (brandingConfiguration != null && brandingConfiguration.isOnlyRemoteConnection()) {
            return null;
        }
    }
    // try to find if there are projects in workspace
    Project[] projects = LoginHelper.getInstance().getProjects(LoginHelper.createDefaultLocalConnection());
    if (projects == null || projects.length == 0) {
        List<ConnectionBean> storedConnections = LoginHelper.getInstance().getStoredConnections();
        if (storedConnections == null || storedConnections.isEmpty() || (storedConnections.size() == 1 && !LoginHelper.isRemoteConnection(storedConnections.get(0)) && LoginHelper.isWorkspaceSame(storedConnections.get(0)))) {
            // for local license case
            loginPage = new LoginFirstTimeStartupActionPage(base, this, SWT.NONE);
        }
    }
    return loginPage;
}
Also used : Project(org.talend.core.model.general.Project) IBrandingConfiguration(org.talend.core.ui.branding.IBrandingConfiguration) ConnectionBean(org.talend.core.model.general.ConnectionBean) IBrandingService(org.talend.core.ui.branding.IBrandingService)

Example 2 with IBrandingConfiguration

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

the class LoginHelper method filterUsableConnections.

protected List<ConnectionBean> filterUsableConnections(List<ConnectionBean> iStoredConnections) {
    if (iStoredConnections == null) {
        return null;
    }
    List<ConnectionBean> filteredConnections = new ArrayList<ConnectionBean>(iStoredConnections);
    boolean isOnlyRemoteConnection = false;
    IBrandingConfiguration brandingConfiguration = brandingService.getBrandingConfiguration();
    if (brandingConfiguration != null) {
        isOnlyRemoteConnection = brandingConfiguration.isOnlyRemoteConnection();
    }
    if (!isOnlyRemoteConnection && PluginChecker.isSVNProviderPluginLoaded()) {
        // if this plugin loaded, then means support remote connections, then no need to filter
        return filteredConnections;
    }
    // can be two case: 1 only local connection, 2 only remote connection
    Iterator<ConnectionBean> connectionBeanIter = filteredConnections.iterator();
    while (connectionBeanIter.hasNext()) {
        boolean isRemoteConnection = LoginHelper.isRemoteConnection(connectionBeanIter.next());
        if (isOnlyRemoteConnection && !isRemoteConnection) {
            // only remote connection, should remove local
            connectionBeanIter.remove();
        } else if (!isOnlyRemoteConnection && isRemoteConnection) {
            // only local connection, should remove remote
            connectionBeanIter.remove();
        }
    }
    return filteredConnections;
}
Also used : IBrandingConfiguration(org.talend.core.ui.branding.IBrandingConfiguration) ArrayList(java.util.ArrayList) ConnectionBean(org.talend.core.model.general.ConnectionBean)

Aggregations

ConnectionBean (org.talend.core.model.general.ConnectionBean)2 IBrandingConfiguration (org.talend.core.ui.branding.IBrandingConfiguration)2 ArrayList (java.util.ArrayList)1 Project (org.talend.core.model.general.Project)1 IBrandingService (org.talend.core.ui.branding.IBrandingService)1