Search in sources :

Example 26 with TraverseEvent

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

the class ImportItemWizardPage method createItemRoot.

private void createItemRoot(Composite workArea) {
    Composite projectGroup = new Composite(workArea, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 4;
    layout.makeColumnsEqualWidth = false;
    layout.marginWidth = 0;
    projectGroup.setLayout(layout);
    projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    itemFromDirectoryRadio = new Button(projectGroup, SWT.RADIO);
    // itemFromDirectoryRadio.setText(DataTransferMessages.WizardProjectsImportPage_RootSelectTitle);
    //$NON-NLS-1$
    itemFromDirectoryRadio.setText(Messages.getString("DataTransferMessages.WizardProjectsImportPage_RootSelectTitle"));
    this.directoryPathField = new Text(projectGroup, SWT.BORDER);
    this.directoryPathField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    browseDirectoriesButton = new Button(projectGroup, SWT.PUSH);
    // browseDirectoriesButton.setText(DataTransferMessages.DataTransfer_browse);
    //$NON-NLS-1$
    browseDirectoriesButton.setText(Messages.getString("DataTransferMessages.DataTransfer_browse"));
    setButtonLayoutData(browseDirectoriesButton);
    nothing = new Label(projectGroup, SWT.NONE);
    //$NON-NLS-1$
    nothing.setText(" ");
    // new project from archive radio button
    itemFromArchiveRadio = new Button(projectGroup, SWT.RADIO);
    // itemFromArchiveRadio.setText(DataTransferMessages.WizardProjectsImportPage_ArchiveSelectTitle);
    //$NON-NLS-1$
    itemFromArchiveRadio.setText(Messages.getString("DataTransferMessages.WizardProjectsImportPage_ArchiveSelectTitle"));
    // project location entry field
    archivePathField = new Text(projectGroup, SWT.BORDER);
    archivePathField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    // browse button
    // Composite buttonCom = new Composite(projectGroup, SWT.NONE);
    // GridLayout buttonlayout = new GridLayout();
    // buttonlayout.numColumns = 2;
    // buttonlayout.makeColumnsEqualWidth = false;
    // buttonlayout.marginWidth = 0;
    // buttonCom.setLayout(buttonlayout);
    // buttonCom.setLayoutData(new GridData());
    browseArchivesButton = new Button(projectGroup, SWT.PUSH);
    // browseArchivesButton.setText(DataTransferMessages.DataTransfer_browse);
    //$NON-NLS-1$
    browseArchivesButton.setText(Messages.getString("DataTransferMessages.DataTransfer_browse"));
    setButtonLayoutData(browseArchivesButton);
    if (PluginChecker.isExchangeSystemLoaded() && !TalendPropertiesUtil.isHideExchange()) {
        selectExchangeButton = new Button(projectGroup, SWT.PUSH);
        //$NON-NLS-1$
        selectExchangeButton.setText(Messages.getString("ImportItemWizardPage.browseTalend"));
        setButtonLayoutData(selectExchangeButton);
        selectExchangeButton.setEnabled(false);
    }
    itemFromDirectoryRadio.setSelection(true);
    archivePathField.setEnabled(false);
    browseArchivesButton.setEnabled(false);
    browseDirectoriesButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            handleLocationDirectoryButtonPressed();
        }
    });
    browseArchivesButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            handleLocationArchiveButtonPressed();
        }
    });
    if (selectExchangeButton != null) {
        selectExchangeButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                archivePathField.setEditable(false);
                IExchangeService service = (IExchangeService) GlobalServiceRegister.getDefault().getService(IExchangeService.class);
                selectedArchive = service.openExchangeDialog();
                if (selectedArchive != null) {
                    previouslyBrowsedArchive = selectedArchive;
                    archivePathField.setText(previouslyBrowsedArchive);
                    updateItemsList(selectedArchive, false);
                }
            }
        });
    }
    directoryPathField.addTraverseListener(new TraverseListener() {

        @Override
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_RETURN) {
                e.doit = false;
                updateItemsList(directoryPathField.getText().trim(), false);
            }
        }
    });
    directoryPathField.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(org.eclipse.swt.events.FocusEvent e) {
            updateItemsList(directoryPathField.getText().trim(), false);
        }
    });
    archivePathField.addTraverseListener(new TraverseListener() {

        @Override
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_RETURN) {
                e.doit = false;
                updateItemsList(archivePathField.getText().trim(), false);
            }
        }
    });
    archivePathField.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(org.eclipse.swt.events.FocusEvent e) {
            updateItemsList(archivePathField.getText().trim(), false);
        }
    });
    itemFromDirectoryRadio.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            directoryRadioSelected();
        }
    });
    itemFromArchiveRadio.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            archiveRadioSelected();
        }
    });
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) TraverseEvent(org.eclipse.swt.events.TraverseEvent) Composite(org.eclipse.swt.widgets.Composite) TraverseListener(org.eclipse.swt.events.TraverseListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) GridLayout(org.eclipse.swt.layout.GridLayout) IExchangeService(org.talend.core.service.IExchangeService) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Aggregations

TraverseEvent (org.eclipse.swt.events.TraverseEvent)26 TraverseListener (org.eclipse.swt.events.TraverseListener)26 FocusAdapter (org.eclipse.swt.events.FocusAdapter)9 FocusEvent (org.eclipse.swt.events.FocusEvent)8 SelectionEvent (org.eclipse.swt.events.SelectionEvent)8 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)7 Text (org.eclipse.swt.widgets.Text)7 StyledText (org.eclipse.swt.custom.StyledText)6 ModifyEvent (org.eclipse.swt.events.ModifyEvent)6 ModifyListener (org.eclipse.swt.events.ModifyListener)6 MouseEvent (org.eclipse.swt.events.MouseEvent)6 Point (org.eclipse.swt.graphics.Point)6 Button (org.eclipse.swt.widgets.Button)6 KeyEvent (org.eclipse.swt.events.KeyEvent)5 MouseAdapter (org.eclipse.swt.events.MouseAdapter)5 Composite (org.eclipse.swt.widgets.Composite)5 GridData (org.eclipse.swt.layout.GridData)4 Label (org.eclipse.swt.widgets.Label)4 ComboWithEnableFix (edu.cmu.cs.hcii.cogtool.util.ComboWithEnableFix)3 TextWithEnableFix (edu.cmu.cs.hcii.cogtool.util.TextWithEnableFix)3