Search in sources :

Example 56 with ModifyListener

use of org.eclipse.swt.events.ModifyListener in project tdi-studio-se by Talend.

the class SpagoBiServerDialog method createDialogArea.

/*
     * (non-Javadoc) Method declared on Dialog.
     */
@Override
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // ((GridData) composite.getLayoutData()).widthHint = 400;
    // ((GridData) composite.getLayoutData()).heightHint = 400;
    // create message
    // if (message != null) {
    // Label label = new Label(composite, SWT.WRAP);
    // label.setText(message);
    // GridData data = new GridData(GridData.GRAB_HORIZONTAL
    // | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
    // | GridData.VERTICAL_ALIGN_CENTER);
    // data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    // label.setLayoutData(data);
    // label.setFont(parent.getFont());
    // }
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    composite.setLayout(layout);
    Label engineNameLabel = new Label(composite, SWT.None);
    //$NON-NLS-1$
    engineNameLabel.setText(Messages.getString("SpagoBiServerDialog.engineNameText"));
    // GridData data = new GridData(GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL |
    // GridData.VERTICAL_ALIGN_CENTER);
    // engineNameLabel.setLayoutData(data);
    engineNameLabel.setFont(parent.getFont());
    engineNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    GridData data1 = new GridData(GridData.GRAB_HORIZONTAL);
    data1.minimumWidth = 150;
    engineNameText.setLayoutData(data1);
    engineNameText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    Label shortDescriptionLabel = new Label(composite, SWT.WRAP);
    // data = new GridData(GridData.FILL_HORIZONTAL);
    // shortDescriptionLabel.setLayoutData(data);
    shortDescriptionLabel = new Label(composite, SWT.WRAP);
    //$NON-NLS-1$
    shortDescriptionLabel.setText(Messages.getString("SpagoBiServerDialog.shortDescription"));
    shortDescriptionLabel.setFont(parent.getFont());
    shortDescriptionText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    shortDescriptionText.setLayoutData(data1);
    shortDescriptionText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    Label hostLabel = new Label(composite, SWT.WRAP);
    // data = new GridData(GridData.FILL_HORIZONTAL);
    // hostLabel.setLayoutData(data);
    hostLabel = new Label(composite, SWT.WRAP);
    //$NON-NLS-1$
    hostLabel.setText(Messages.getString("SpagoBiServerDialog.host"));
    hostLabel.setFont(parent.getFont());
    hostText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    hostText.setLayoutData(data1);
    hostText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    Label portLabel = new Label(composite, SWT.WRAP);
    // data = new GridData(GridData.FILL_HORIZONTAL);
    // portLabel.setLayoutData(data);
    portLabel = new Label(composite, SWT.WRAP);
    //$NON-NLS-1$
    portLabel.setText(Messages.getString("SpagoBiServerDialog.port"));
    portLabel.setFont(parent.getFont());
    portText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    portText.setLayoutData(data1);
    portText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    Label loginLabel = new Label(composite, SWT.WRAP);
    // data = new GridData(GridData.FILL_HORIZONTAL);
    // loginLabel.setLayoutData(data);
    loginLabel = new Label(composite, SWT.WRAP);
    //$NON-NLS-1$
    loginLabel.setText(Messages.getString("SpagoBiServerDialog.login"));
    loginLabel.setFont(parent.getFont());
    loginText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    loginText.setLayoutData(data1);
    loginText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    Label passwordLabel = new Label(composite, SWT.WRAP);
    // data = new GridData(GridData.FILL_HORIZONTAL);
    // passwordLabel.setLayoutData(data);
    passwordLabel = new Label(composite, SWT.WRAP);
    //$NON-NLS-1$
    passwordLabel.setText(Messages.getString("SpagoBiServerDialog.password"));
    passwordLabel.setFont(parent.getFont());
    passwordText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
    passwordText.setLayoutData(data1);
    passwordText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    // Label applicationContextLabel = new Label(composite, SWT.WRAP);
    // data = new GridData(GridData.FILL_HORIZONTAL);
    // applicationContextLabel.setLayoutData(data);
    //
    // applicationContextLabel = new Label(composite, SWT.WRAP);
    // applicationContextLabel.setText(Messages.getString("SpagoBiServerDialog.applicationContext")); //$NON-NLS-1$
    // applicationContextLabel.setFont(parent.getFont());
    // applicationContextText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    // applicationContextText.addModifyListener(new ModifyListener() {
    //
    // public void modifyText(ModifyEvent e) {
    // validateInput();
    // }
    // });
    errorMessageText = new Label(composite, SWT.NONE);
    // GridData data = new GridData(GridData.FILL_HORIZONTAL);
    // errorMessageText.setLayoutData(data);
    // errorMessageText.setLayoutData(data);
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    applyDialogFont(composite);
    return composite;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text)

Example 57 with ModifyListener

use of org.eclipse.swt.events.ModifyListener in project tdi-studio-se by Talend.

the class SpagicServerDialog method createDialogArea.

/*
     * (non-Javadoc) Method declared on Dialog.
     */
@Override
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // ((GridData) composite.getLayoutData()).widthHint = 400;
    // ((GridData) composite.getLayoutData()).heightHint = 400;
    // create message
    // if (message != null) {
    // Label label = new Label(composite, SWT.WRAP);
    // label.setText(message);
    // GridData data = new GridData(GridData.GRAB_HORIZONTAL
    // | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
    // | GridData.VERTICAL_ALIGN_CENTER);
    // data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    // label.setLayoutData(data);
    // label.setFont(parent.getFont());
    // }
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    composite.setLayout(layout);
    Label engineNameLabel = new Label(composite, SWT.None);
    //$NON-NLS-1$
    engineNameLabel.setText(Messages.getString("SpagicServerDialog.engineNameText"));
    // GridData data = new GridData(GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL |
    // GridData.VERTICAL_ALIGN_CENTER);
    // engineNameLabel.setLayoutData(data);
    engineNameLabel.setFont(parent.getFont());
    engineNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    GridData data1 = new GridData(GridData.GRAB_HORIZONTAL);
    data1.minimumWidth = 150;
    engineNameText.setLayoutData(data1);
    engineNameText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    Label shortDescriptionLabel = new Label(composite, SWT.WRAP);
    // data = new GridData(GridData.FILL_HORIZONTAL);
    // shortDescriptionLabel.setLayoutData(data);
    shortDescriptionLabel = new Label(composite, SWT.WRAP);
    //$NON-NLS-1$
    shortDescriptionLabel.setText(Messages.getString("SpagicServerDialog.shortDescription"));
    shortDescriptionLabel.setFont(parent.getFont());
    shortDescriptionText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    shortDescriptionText.setLayoutData(data1);
    shortDescriptionText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    Label hostLabel = new Label(composite, SWT.WRAP);
    // data = new GridData(GridData.FILL_HORIZONTAL);
    // hostLabel.setLayoutData(data);
    hostLabel = new Label(composite, SWT.WRAP);
    //$NON-NLS-1$
    hostLabel.setText(Messages.getString("SpagicServerDialog.host"));
    hostLabel.setFont(parent.getFont());
    hostText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    hostText.setLayoutData(data1);
    hostText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    Label portLabel = new Label(composite, SWT.WRAP);
    // data = new GridData(GridData.FILL_HORIZONTAL);
    // portLabel.setLayoutData(data);
    portLabel = new Label(composite, SWT.WRAP);
    //$NON-NLS-1$
    portLabel.setText(Messages.getString("SpagicServerDialog.port"));
    portLabel.setFont(parent.getFont());
    portText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    portText.setLayoutData(data1);
    portText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    Label loginLabel = new Label(composite, SWT.WRAP);
    // data = new GridData(GridData.FILL_HORIZONTAL);
    // loginLabel.setLayoutData(data);
    loginLabel = new Label(composite, SWT.WRAP);
    //$NON-NLS-1$
    loginLabel.setText(Messages.getString("SpagicServerDialog.login"));
    loginLabel.setFont(parent.getFont());
    loginText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    loginText.setLayoutData(data1);
    loginText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    Label passwordLabel = new Label(composite, SWT.WRAP);
    // data = new GridData(GridData.FILL_HORIZONTAL);
    // passwordLabel.setLayoutData(data);
    passwordLabel = new Label(composite, SWT.WRAP);
    //$NON-NLS-1$
    passwordLabel.setText(Messages.getString("SpagicServerDialog.password"));
    passwordLabel.setFont(parent.getFont());
    passwordText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
    passwordText.setLayoutData(data1);
    passwordText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    // Label applicationContextLabel = new Label(composite, SWT.WRAP);
    // data = new GridData(GridData.FILL_HORIZONTAL);
    // applicationContextLabel.setLayoutData(data);
    //
    // applicationContextLabel = new Label(composite, SWT.WRAP);
    // applicationContextLabel.setText(Messages.getString("SpagoBiServerDialog.applicationContext")); //$NON-NLS-1$
    // applicationContextLabel.setFont(parent.getFont());
    // applicationContextText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    // applicationContextText.addModifyListener(new ModifyListener() {
    //
    // public void modifyText(ModifyEvent e) {
    // validateInput();
    // }
    // });
    errorMessageText = new Label(composite, SWT.NONE);
    // GridData data = new GridData(GridData.FILL_HORIZONTAL);
    // errorMessageText.setLayoutData(data);
    // errorMessageText.setLayoutData(data);
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    applyDialogFont(composite);
    return composite;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text)

Example 58 with ModifyListener

use of org.eclipse.swt.events.ModifyListener in project tdi-studio-se by Talend.

the class FindDialog method createDialogArea.

protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout(3, false);
    container.setLayout(layout);
    Label label = new Label(container, SWT.CENTER);
    final Text text = new Text(container, SWT.BORDER);
    final Group group = new Group(container, SWT.SHADOW_ETCHED_IN);
    group.setText("Direction");
    group.setLayout(new RowLayout(SWT.VERTICAL));
    final Button forwardButton = new Button(group, SWT.RADIO);
    forwardButton.setText("Forward");
    forwardButton.setSelection(true);
    final Button backwardButton = new Button(group, SWT.RADIO);
    backwardButton.setText("Backward");
    final Label tempLabel = new Label(container, SWT.NONE);
    text.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            selectionLoaction = 0;
            tempLabel.setText("");
            locationRecord.clear();
            firstSearch = true;
        }
    });
    forwardButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            tempLabel.setText("");
        }
    });
    backwardButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            tempLabel.setText("");
        }
    });
    Button findButton = new Button(container, SWT.NONE);
    findButton.setText("Find");
    findButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            if (consoleText.getText().length() > 0) {
                this.searchString(text.getText());
            } else
                tempLabel.setText("String not found");
        }

        private void searchString(String parameter) {
            if (!parameter.equals("")) {
                if (firstSearch == true) {
                    findAll(parameter);
                    firstSearch = false;
                }
                selectionLoaction = consoleText.getSelection().x;
                boolean selected = false;
                if (backwardButton.getSelection() == true) {
                    if (locationRecord.size() > 0) {
                        for (int i = locationRecord.size() - 1; i >= 0; i--) {
                            if (Integer.parseInt(locationRecord.get(i).toString()) - parameter.length() < selectionLoaction) {
                                selectionLoaction = Integer.parseInt(locationRecord.get(i).toString());
                                consoleText.setSelection(selectionLoaction - parameter.length(), selectionLoaction);
                                selected = true;
                                break;
                            }
                            selected = false;
                        }
                        if (selected == false)
                            tempLabel.setText("String not found");
                    } else
                        tempLabel.setText("String not found");
                } else {
                    if (locationRecord.size() > 0) {
                        for (int i = 0; i < locationRecord.size(); i++) {
                            if (Integer.parseInt(locationRecord.get(i).toString()) - parameter.length() > selectionLoaction) {
                                selectionLoaction = Integer.parseInt(locationRecord.get(i).toString());
                                consoleText.setSelection(selectionLoaction - parameter.length(), selectionLoaction);
                                selected = true;
                                break;
                            }
                            selected = false;
                        }
                        if (selected == false)
                            tempLabel.setText("String not found");
                    } else
                        tempLabel.setText("String not found");
                }
            }
        }

        private void findAll(String parameter) {
            if (!parameter.equals("")) {
                int location = -1;
                do {
                    location = consoleText.getText().substring(selectionLoaction).indexOf(parameter);
                    if (location > -1) {
                        selectionLoaction = selectionLoaction + location + parameter.length();
                        locationRecord.add(selectionLoaction);
                    } else
                        break;
                } while ((selectionLoaction + parameter.length()) <= consoleText.getText().length());
            }
        }
    });
    GridData data = new GridData(GridData.CENTER);
    data.horizontalSpan = 1;
    label.setText("Find: ");
    label.setLayoutData(data);
    GridData data1 = new GridData(GridData.CENTER);
    data1.horizontalSpan = 2;
    data1.widthHint = 180;
    data1.grabExcessVerticalSpace = true;
    text.setLayoutData(data1);
    GridData data2 = new GridData(GridData.CENTER);
    data2.horizontalSpan = 3;
    data2.widthHint = 215;
    data2.grabExcessVerticalSpace = true;
    group.setLayoutData(data2);
    GridData data3 = new GridData(GridData.CENTER);
    data3.horizontalSpan = 2;
    data3.widthHint = 150;
    tempLabel.setLayoutData(data3);
    GridData data4 = new GridData(GridData.CENTER);
    data4.horizontalSpan = 1;
    data4.widthHint = 65;
    findButton.setLayoutData(data4);
    return container;
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) StyledText(org.eclipse.swt.custom.StyledText) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 59 with ModifyListener

use of org.eclipse.swt.events.ModifyListener in project tdi-studio-se by Talend.

the class InvokeDialog method createParameterGroup.

/**
     * Creates the parameter group.
     * 
     * @param parent The parent composite
     */
private void createParameterGroup(Composite parent) {
    if (info.getSignature().length == 0) {
        return;
    }
    Group group = new Group(parent, SWT.NONE);
    group.setText(Messages.parametersGroupLabel);
    GridLayout layout = new GridLayout(2, false);
    group.setLayout(layout);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    for (MBeanParameterInfo signature : info.getSignature()) {
        Label label = new Label(group, SWT.NONE);
        String type = signature.getType();
        if (type.startsWith("[")) {
            //$NON-NLS-1$
            type = Signature.toString(type);
            label.setToolTipText(Messages.enterCommaSeparatedValuesToolTip);
        }
        int index = type.lastIndexOf('.');
        if (index > 0) {
            type = type.substring(index + 1);
        }
        //$NON-NLS-1$
        label.setText(type + ":");
        if (Boolean.class.getSimpleName().equalsIgnoreCase(type)) {
            Combo combo = new Combo(group, SWT.READ_ONLY);
            combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            combo.add(Boolean.TRUE.toString());
            combo.add(Boolean.FALSE.toString());
            combo.select(0);
            controls.put(signature, combo);
        } else {
            Text text = new Text(group, SWT.BORDER);
            text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            text.addModifyListener(new ModifyListener() {

                @Override
                public void modifyText(ModifyEvent e) {
                    validate();
                }
            });
            controls.put(signature, text);
        }
    }
}
Also used : Group(org.eclipse.swt.widgets.Group) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridData(org.eclipse.swt.layout.GridData) MBeanParameterInfo(javax.management.MBeanParameterInfo)

Example 60 with ModifyListener

use of org.eclipse.swt.events.ModifyListener in project tdi-studio-se by Talend.

the class LoginFirstTimeStartupActionPage method addListeners.

@Override
protected void addListeners() {
    super.addListeners();
    finishButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (FINISH_BUTTON_ACTION_CREATE_NEW_PROJECT.equals(finishButtonAction)) {
                createNewProject();
            } else if (FINISH_BUTTON_ACTION_IMPORT_DEMO_PROJECT.equals(finishButtonAction)) {
                importDemoProject();
            } else if (FINISH_BUTTON_ACTION_IMPORT_EXISTING_PROJECT.equals(finishButtonAction)) {
                importExistingProject();
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
    createNewProject.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (createNewProject.getSelection()) {
                selectNewProjectName();
                validateNewProjectName();
                finishButtonAction = FINISH_BUTTON_ACTION_CREATE_NEW_PROJECT;
            } else {
                //$NON-NLS-1$                    
                createNewProject.setText(Messages.getString("LoginFirstTimeStartupActionPage.createNewProject"));
                getErrorManager().clearCreateNewProjectError();
                newProjectName.setVisible(false);
                newProjectName.setBackground(null);
                finishButton.setEnabled(true);
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
    newProjectName.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            validateNewProjectName();
        }
    });
    importDemoProject.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            finishButtonAction = FINISH_BUTTON_ACTION_IMPORT_DEMO_PROJECT;
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
    importExistingProject.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            finishButtonAction = FINISH_BUTTON_ACTION_IMPORT_EXISTING_PROJECT;
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
    manageConnections.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ConnectionsDialog connectionsDialog = new ConnectionsDialog(getShell());
            int open = connectionsDialog.open();
            if (open == Window.OK) {
                LoginFirstTimeStartupActionPageErrorManager iErrorManager = getErrorManager();
                iErrorManager.clearManageConnectionsError();
                iErrorManager.clearManageConnectionsWarn();
                refreshOperationAreaEnable(true);
                List<ConnectionBean> storedConnections = connectionsDialog.getConnections();
                if (storedConnections == null || storedConnections.isEmpty()) {
                    defaultConnectionBean = LoginHelper.createDefaultLocalConnection();
                    storedConnections = new ArrayList<ConnectionBean>();
                    storedConnections.add(defaultConnectionBean);
                    LoginHelper.getInstance().setStoredConnections(storedConnections);
                    LoginHelper.getInstance().saveConnections(storedConnections);
                    setRepositoryContextInContext();
                } else if (storedConnections.size() == 1) {
                    defaultConnectionBean = storedConnections.get(0);
                    if (defaultConnectionBean.isComplete()) {
                        LoginHelper.getInstance().setStoredConnections(storedConnections);
                        LoginHelper.getInstance().saveConnections(storedConnections);
                        boolean shouldGotoNextPage = false;
                        if (LoginHelper.isRemoteConnection(defaultConnectionBean)) {
                            shouldGotoNextPage = true;
                        } else if (!LoginHelper.isWorkspaceSame(defaultConnectionBean)) {
                            shouldGotoNextPage = true;
                        } else {
                            shouldGotoNextPage = false;
                        }
                        if (shouldGotoNextPage) {
                            try {
                                gotoNextPage();
                                return;
                            } catch (Throwable e1) {
                                CommonExceptionHandler.process(e1);
                            }
                        } else {
                            setRepositoryContextInContext();
                        }
                    } else {
                        iErrorManager.setManageConnectionsError(Messages.getString(//$NON-NLS-1$
                        "LoginFirstTimeStartupActionPage.manageConnection.incomplete"));
                        refreshOperationAreaEnable(false);
                    }
                } else {
                    try {
                        LoginHelper.getInstance().setStoredConnections(storedConnections);
                        LoginHelper.getInstance().saveConnections(storedConnections);
                        gotoNextPage();
                        return;
                    } catch (Throwable e1) {
                        CommonExceptionHandler.process(e1);
                    }
                }
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        // nothing need to do
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ConnectionsDialog(org.talend.repository.ui.login.connections.ConnectionsDialog) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

ModifyListener (org.eclipse.swt.events.ModifyListener)308 ModifyEvent (org.eclipse.swt.events.ModifyEvent)296 GridData (org.eclipse.swt.layout.GridData)209 GridLayout (org.eclipse.swt.layout.GridLayout)185 Text (org.eclipse.swt.widgets.Text)185 Composite (org.eclipse.swt.widgets.Composite)171 Label (org.eclipse.swt.widgets.Label)165 SelectionEvent (org.eclipse.swt.events.SelectionEvent)158 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)127 Button (org.eclipse.swt.widgets.Button)101 Combo (org.eclipse.swt.widgets.Combo)65 Group (org.eclipse.swt.widgets.Group)50 SelectionListener (org.eclipse.swt.events.SelectionListener)48 File (java.io.File)30 KeyEvent (org.eclipse.swt.events.KeyEvent)26 StyledText (org.eclipse.swt.custom.StyledText)24 FileDialog (org.eclipse.swt.widgets.FileDialog)23 Point (org.eclipse.swt.graphics.Point)22 DirectoryDialog (org.eclipse.swt.widgets.DirectoryDialog)21 ArrayList (java.util.ArrayList)18