use of org.eclipse.swt.events.TraverseListener 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();
}
});
}
Aggregations