protected Control createControl() { m_Text = new Text(m_Table, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP); m_Text.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { try { onKeyPressed(e); } catch (Exception ex) { } } }); m_Text.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent arg0) { onTraverse(arg0); } }); return m_Text; }
protected Control createControl() { // System.out.println("Created a new one."); m_Text = new Text(m_Table, SWT.NONE); m_Text.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { try { onKeyPressed(e); } catch (Exception ex) { } } }); m_Text.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent arg0) { onTraverse(arg0); } }); return m_Text; }
protected Control createControl() { m_Text = new Text(m_Table, SWT.MULTI | SWT.V_SCROLL); m_Text.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { try { onKeyPressed(e); } catch (Exception ex) { } } }); m_Text.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent arg0) { onTraverse(arg0); } }); return m_Text; }
/** * Create the dialog. * @param parentShell */ public ParameterGridDialog(Shell parentShell) { super(parentShell); setShellStyle(SWT.CLOSE | SWT.RESIZE | SWT.TITLE | SWT.WRAP | SWT.APPLICATION_MODAL); runGraph=false; lastRowLastColumnTraverseListener=new TraverseListener() { @Override public void keyTraversed(TraverseEvent e) { if(e.detail == SWT.TRAVERSE_TAB_NEXT) addRowToTextGrid(); } }; }
public ToolStripTabs(final Composite parent, final ToolStripTabPage[] tabs, final int style) { super(parent, style); this.tabs = tabs; imageHelper = new ImageHelper(TFSTeamBuildPlugin.PLUGIN_ID); createControls(this); setSelectedPage(0); addTraverseListener(new TraverseListener() { @Override public void keyTraversed(final TraverseEvent e) { if (e.detail == SWT.TRAVERSE_PAGE_NEXT) { traverseToNextPage(true); return; } if (e.detail == SWT.TRAVERSE_PAGE_PREVIOUS) { traverseToNextPage(false); return; } } }); }
private void addTraverseListener() { addTraverseListener(new TraverseListener() { @Override public void keyTraversed(final TraverseEvent event) { /* * traverse with the tab key to the next/previous control */ switch (event.detail) { case SWT.TRAVERSE_TAB_NEXT: case SWT.TRAVERSE_TAB_PREVIOUS: event.doit = true; break; } } }); }
private Control createHeader(Composite parent, Font font, String message) { Composite header= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); layout.numColumns= 2; layout.marginWidth= 0; layout.marginHeight= 0; header.setLayout(layout); header.setFont(font); Label label= new Label(header, SWT.NONE); label.setText(message); label.setFont(font); label.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) { e.detail= SWT.TRAVERSE_NONE; fFilter.setFocus(); } } }); GridData gd= new GridData(GridData.FILL_HORIZONTAL); label.setLayoutData(gd); createViewMenu(header); return header; }
@Override protected Text createTextControl(Composite parent) { Text text= new Text(parent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); text.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent event) { switch (event.detail) { case SWT.TRAVERSE_ESCAPE: case SWT.TRAVERSE_PAGE_NEXT: case SWT.TRAVERSE_PAGE_PREVIOUS: event.doit= true; break; case SWT.TRAVERSE_RETURN: case SWT.TRAVERSE_TAB_NEXT: case SWT.TRAVERSE_TAB_PREVIOUS: if ((event.stateMask & SWT.MODIFIER_MASK) != 0) { event.doit= true; } break; } } }); return text; }
private TraverseListener getTraverseListener( ) { return new TraverseListener( ) { /** * @see org.eclipse.swt.events.TraverseListener#keyTraversed(TraverseEvent) */ public void keyTraversed( TraverseEvent e ) { if ( e.widget instanceof StyledText ) { if ( ( e.detail == SWT.TRAVERSE_TAB_NEXT ) || ( e.detail == SWT.TRAVERSE_TAB_PREVIOUS ) ) e.doit = true; } } }; }
@Override public void createListeners() { write.addTraverseListener(new TraverseListener() { @Override public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_RETURN) { if (write.getText().replaceAll(" ", "").isEmpty()) return; Messaging.getInstance().sendChatMessage(staff, write.getText()); write.setText(""); } } }); }
public TableViewer createTableViewer(Composite composite, String[] prop, int[] bounds, int columnWidth, IStructuredContentProvider iStructuredContentProvider, ITableLabelProvider iTableLabelProvider) { final TableViewer tableViewer = new TableViewer(composite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL); Table table = tableViewer.getTable(); table.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]); tableViewer.setContentProvider(iStructuredContentProvider); tableViewer.setLabelProvider(iTableLabelProvider); tableViewer.setColumnProperties(prop); tableViewer.getTable().addTraverseListener(new TraverseListener() { @Override public void keyTraversed(TraverseEvent e) { if (e.keyCode == SWT.ARROW_UP) { e.doit = false; } else if (e.keyCode == SWT.ARROW_DOWN) { e.doit = false; } else if (e.keyCode == SWT.TRAVERSE_ARROW_NEXT) { e.doit = false; } else if (e.keyCode == SWT.TRAVERSE_ARROW_PREVIOUS) { e.doit = false; } } }); table.setVisible(true); table.setLinesVisible(true); table.setHeaderVisible(true); /* * createTableColumns(table,prop, columnWidth); CellEditor[] editors * =createCellEditorList(table,1); tableViewer.setCellEditors(editors); */ return tableViewer; }
@Override protected void configureShell(Shell shell) { super.configureShell(shell); shell.setText(job.getName()); shell.addTraverseListener(new TraverseListener() { @Override public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_ESCAPE) { cancelPressed(); e.detail = SWT.TRAVERSE_NONE; e.doit = true; } } }); }
@Override protected void hookAddToDialogArea(final Composite dialogArea) { final GridLayout layout = new GridLayout(); layout.marginWidth = getHorizontalMargin(); layout.marginHeight = getVerticalMargin(); layout.horizontalSpacing = getHorizontalSpacing(); layout.verticalSpacing = getVerticalSpacing(); dialogArea.setLayout(layout); SWTUtil.createLabel(dialogArea, Messages.getString("WorkspacesDialog.WorkspacesLabelText")); //$NON-NLS-1$ control = new WorkspacesControl(dialogArea, SWT.NONE); GridDataBuilder.newInstance().grab().fill().applyTo(control); control.getWorkspacesTable().addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(final DoubleClickEvent event) { WorkspacesDialog.this.onWorkspacesTableDoubleClick(event); } }); control.getWorkspacesTable().addTraverseListener(new TraverseListener() { @Override public void keyTraversed(final TraverseEvent e) { WorkspacesDialog.this.onWorkspacesTableKeyTraversed(e); } }); control.refresh(connection, createWorkspaceIfNone, true); }
private void createControls(final Composite composite) { final GridLayout layout = SWTUtil.gridLayout(composite, 1); layout.marginWidth = 0; layout.marginHeight = 0; layout.horizontalSpacing = getHorizontalSpacing(); layout.verticalSpacing = getVerticalSpacing(); SWTUtil.createLabel(composite, Messages.getString("GeneralTabPage.BuildNameLabelText")); //$NON-NLS-1$ nameText = new Text(composite, SWT.BORDER); GridDataBuilder.newInstance().fill().applyTo(nameText); SWTUtil.createLabel(composite, Messages.getString("GeneralTabPage.DescriptionLabelText")); //$NON-NLS-1$ descText = new Text(composite, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); descText.addTraverseListener(new TraverseListener() { @Override public void keyTraversed(final TraverseEvent e) { if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) { e.doit = true; } } }); GridDataBuilder.newInstance().fill().grab().applyTo(descText); disableButton = SWTUtil.createButton(composite, SWT.CHECK, Messages.getString("GeneralTabPage.DisableButtonText")); //$NON-NLS-1$ }
protected void createButtonsForButtonBar( Composite parent){ Button ok = createButton(parent, IDialogConstants.OK_ID, "Import Packet", true); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); ok.addMouseListener(okListener); ok.addTraverseListener(new TraverseListener() { public void keyTraversed( TraverseEvent e){ if (SWT.TRAVERSE_RETURN == e.detail) { } } }); }
protected void createButtonsForButtonBar( Composite parent){ Button ok = createButton(parent, IDialogConstants.OK_ID, "Close", true); // createButton(parent, IDialogConstants.CANCEL_ID, // IDialogConstants.CANCEL_LABEL, false); ok.addMouseListener(okListener); ok.addTraverseListener(new TraverseListener() { public void keyTraversed( TraverseEvent e){ if (SWT.TRAVERSE_RETURN == e.detail) { } } }); }
private TraverseListener getTraverseListener() { return new TraverseListener() { /** * @see org.eclipse.swt.events.TraverseListener#keyTraversed(TraverseEvent) */ public void keyTraversed(TraverseEvent e) { if (e.widget instanceof StyledText) { if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS)) e.doit = true; } } }; }
public static void addTraverseListener(final Text textArea) { textArea.addTraverseListener(new TraverseListener() { @Override public void keyTraversed(final TraverseEvent e) { if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) { e.doit = true; } } }); }
public static boolean addTraverseListener(Text ti, TraverseListener l) { if (isDisposed(ti)) return false; ti.addTraverseListener(l); return true; }
public static void addTraverseListener(final Text textArea) { textArea.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) { e.doit = true; } } }); }
/** * Create a new header which is labelled by headerLabel. * * @param parent * @return Label the label of the header */ private Label createHeader(Composite parent) { Composite header = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; layout.marginHeight = 0; header.setLayout(layout); Label headerLabel = new Label(header, SWT.NONE); headerLabel.setText((getMessage() != null && getMessage().trim() .length() > 0) ? getMessage() : WorkbenchMessages.FilteredItemsSelectionDialog_patternLabel); headerLabel.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) { e.detail = SWT.TRAVERSE_NONE; pattern.setFocus(); } } }); GridData gd = new GridData(GridData.FILL_HORIZONTAL); headerLabel.setLayoutData(gd); createViewMenu(header); header.setLayoutData(gd); return headerLabel; }
/** * Create the labels for the list and the progress. Return the list label. * * @param parent * @return Label */ private Label createLabels(Composite parent) { Composite labels = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; layout.marginHeight = 0; labels.setLayout(layout); Label listLabel = new Label(labels, SWT.NONE); listLabel .setText(WorkbenchMessages.FilteredItemsSelectionDialog_listLabel); listLabel.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) { e.detail = SWT.TRAVERSE_NONE; list.getTable().setFocus(); } } }); GridData gd = new GridData(GridData.FILL_HORIZONTAL); listLabel.setLayoutData(gd); progressLabel = new Label(labels, SWT.RIGHT); progressLabel.setLayoutData(gd); labels.setLayoutData(gd); return listLabel; }
public static Observable<TraverseEvent> fromTraverseListener(Control control) { Observable<TraverseEvent> observable = Observable.create(subscriber -> { TraverseListener traverseListener = traverseEvent -> { // TODO: doit ? subscriber.onNext(traverseEvent); }; control.addTraverseListener(traverseListener); subscriber.setDisposable(Disposables.fromAction(() -> control.removeTraverseListener(traverseListener))); }); return wrap(control, observable); }
/** * Creates a multi-line textbox. * * @param parent a composite control which will be the parent of the new * instance (cannot be null) * @param style the style of control to construct * @param allowTabs set to <code>true</code> to allow \t characters to be * inserted. * @return the new textbox */ public static Text createMultilineTextbox(Composite parent, int style, final boolean allowTabs) { Text text = new Text(parent, style | SWT.MULTI); text.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { switch (e.detail) { case SWT.TRAVERSE_TAB_NEXT: e.doit = !allowTabs; } } }); return text; }
public static void addTraverseListener(final Text textArea) { textArea.addTraverseListener(new TraverseListener() { @Override public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) { e.doit = true; } } }); }
public static void addRecursiveTraverseListener(final Control control, final TraverseListener listener) { control.addTraverseListener(listener); if (control instanceof Composite) { final Composite composite = (Composite) control; for (final Control child : composite.getChildren()) { addRecursiveTraverseListener(child, listener); } } }
private void createText() { Text t = new Text(parent, SWT.BORDER); t.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (e.keyCode == SWT.TAB && e.stateMask != SWT.SHIFT) { createText(); } } }); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP) .grab(true, false).applyTo(t); parent.layout(); t.setFocus(); }
private Text createTextCell(Composite composite, int heightFactor, int widthFactor) { Text text = toolkit.createText(composite, null, SWT.BORDER | SWT.MULTI | SWT.WRAP); text.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) { e.doit = true; } } }); setGridData(text, heightFactor, widthFactor); return text; }
public void swt_open(String section) { if (null != shell && !shell.isDisposed()) { configView.selectSection(section, true); if (shell.getMinimized()) { shell.setMinimized(false); } shell.forceActive(); shell.forceFocus(); } else { shell = ShellFactory.createMainShell(SWT.SHELL_TRIM & ~SWT.MIN); shell.setLayout(new GridLayout()); shell.setText(MessageText.getString("ConfigView.title.full")); Utils.setShellIcon(shell); configView = new ConfigView(); try { swtView = new UISWTViewImpl("ConfigView", null, false); swtView.setDatasource(section); swtView.setEventListener(configView, true); } catch (Exception e1) { Debug.out(e1); } swtView.initialize(shell); configView.selectSection(section,true); /* * Set default size and centers the shell if it's configuration does not exist yet */ if (null == COConfigurationManager.getStringParameter( "options.rectangle", null)) { Rectangle shellBounds = shell.getMonitor().getBounds(); Point size = new Point(shellBounds.width * 10 / 11, shellBounds.height * 10 / 11); if (size.x > 1400) { size.x = 1400; } if (size.y > 700) { size.y = 700; } shell.setSize(size); Utils.centerWindowRelativeTo(shell, getMainShell()); } Utils.linkShellMetricsToConfig(shell, "options"); /* * Auto-save when the shell closes */ shell.addListener(SWT.Close, new Listener() { @Override public void handleEvent(Event event) { configView.save(); event.doit = true; } }); shell.addTraverseListener(new TraverseListener() { @Override public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_ESCAPE) { shell.dispose(); } } }); shell.addDisposeListener( new DisposeListener() { @Override public void widgetDisposed( DisposeEvent arg0 ) { close(); } }); shell.open(); } }
/** * Hook an SWT listener on the canvas where the chart is drawn. * The purpose of this method is to allow some degree of customization. * * @param listener The SWT listener to attach to the canvas. */ public void addSWTListener(EventListener listener) { if (listener instanceof ControlListener) { this.canvas.addControlListener((ControlListener) listener); } else if (listener instanceof DisposeListener) { this.canvas.addDisposeListener((DisposeListener) listener); // } // else if (listener instanceof DragDetectListener) { // this.canvas.addDragDetectListener((DragDetectListener) listener); } else if (listener instanceof FocusListener) { this.canvas.addFocusListener((FocusListener) listener); } else if (listener instanceof HelpListener) { this.canvas.addHelpListener((HelpListener) listener); } else if (listener instanceof KeyListener) { this.canvas.addKeyListener((KeyListener) listener); // } // else if (listener instanceof MenuDetectListener) { // this.canvas.addMenuDetectListener((MenuDetectListener) listener); } else if (listener instanceof MouseListener) { this.canvas.addMouseListener((MouseListener) listener); } else if (listener instanceof MouseMoveListener) { this.canvas.addMouseMoveListener((MouseMoveListener) listener); } else if (listener instanceof MouseTrackListener) { this.canvas.addMouseTrackListener((MouseTrackListener) listener); // } else if (listener instanceof MouseWheelListener) { // this.canvas.addMouseWheelListener((MouseWheelListener) listener); } else if (listener instanceof PaintListener) { this.canvas.addPaintListener((PaintListener) listener); } else if (listener instanceof TraverseListener) { this.canvas.addTraverseListener((TraverseListener) listener); } }
public WorkingFolderDataTable( final Composite parent, final int style, final String viewDataKey, final TFSTeamProjectCollection connection) { super(parent, style, WorkingFolderData.class, viewDataKey); final TableColumnData[] columnData = new TableColumnData[] { new TableColumnData().setText(Messages.getString("WorkingFolderDataTable.ColumnNameStatus")).setIdentifier( //$NON-NLS-1$ COLUMN_TYPE).setCharWidth(20), new TableColumnData().setText( Messages.getString("WorkingFolderDataTable.ColumnNameServerFolder")).setIdentifier( //$NON-NLS-1$ COLUMN_SERVER).setCharWidth(40), new TableColumnData().setText( Messages.getString("WorkingFolderDataTable.ColumnNameLocalFolder")).setIdentifier( //$NON-NLS-1$ COLUMN_LOCAL).setCharWidth(40) }; setupTable(true, true, columnData); setUseDefaultLabelProvider(); getViewer().setContentProvider(new ContentProvider()); final TableViewerSorter sorter = new TableViewerSorter(getViewer()); sorter.setCategoryProvider(new TableViewerSorter.CategoryProvider() { @Override public int getCategory(final Object element) { if (LAST_ROW_PLACEHOLDER == element) { return 1; } return 0; } }); getViewer().setSorter(sorter); setCellEditor(COLUMN_TYPE, new ComboBoxCellEditor(getTable(), new String[] { TYPE_ACTIVE, TYPE_CLOAKED })); setCellEditor(COLUMN_SERVER, new ServerFolderPathCellEditor(getTable(), SWT.NONE, connection)); setCellEditor(COLUMN_LOCAL, new LocalPathCellEditor(getTable(), SWT.NONE)); getTable().addTraverseListener(new TraverseListener() { @Override public void keyTraversed(final TraverseEvent e) { WorkingFolderDataTable.this.keyTraversed(e); } }); // Ensure doubleclick edits column. getTable().addListener(SWT.MouseDoubleClick, new Listener() { @Override public void handleEvent(final Event event) { final Table table = WorkingFolderDataTable.this.getTable(); final TableItem[] selection = table.getSelection(); if (selection.length != 1) { return; } final TableItem item = table.getSelection()[0]; for (int i = 0; i < table.getColumnCount(); i++) { if (item.getBounds(i).contains(event.x, event.y)) { WorkingFolderDataTable.this.getViewer().editElement(item.getData(), i); break; } } } }); createActions(); getContextMenu().addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(final IMenuManager manager) { WorkingFolderDataTable.this.onMenuAboutToShow(manager); } }); setClipboardTransferType(TextTransfer.getInstance()); }
/** * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(Composite) */ public void createControl(Composite parent) { Font font = parent.getFont(); Composite comp = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, true); comp.setLayout(layout); comp.setFont(font); GridData gd = new GridData(GridData.FILL_BOTH); comp.setLayoutData(gd); setControl(comp); setHelpContextId(); // Group group = new Group(comp, SWT.NONE); // group.setFont(font); // layout = new GridLayout(); // group.setLayout(layout); // group.setLayoutData(new GridData(GridData.FILL_BOTH)); // String controlName = (LauncherMessages.JavaArgumentsTab__Program_arguments__5); // group.setText(controlName); fPrgmArgumentsText = new Text(parent, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL); fPrgmArgumentsText.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { switch (e.detail) { case SWT.TRAVERSE_ESCAPE: case SWT.TRAVERSE_PAGE_NEXT: case SWT.TRAVERSE_PAGE_PREVIOUS: e.doit = true; break; case SWT.TRAVERSE_RETURN: case SWT.TRAVERSE_TAB_NEXT: case SWT.TRAVERSE_TAB_PREVIOUS: if ((fPrgmArgumentsText.getStyle() & SWT.SINGLE) != 0) { e.doit = true; } else { if (!fPrgmArgumentsText.isEnabled() || (e.stateMask & SWT.MODIFIER_MASK) != 0) { e.doit = true; } } break; } } }); gd = new GridData(GridData.FILL_BOTH); gd.heightHint = 40; gd.widthHint = 100; // fPrgmArgumentsText.setLayoutData(gd); fPrgmArgumentsText.setFont(font); fPrgmArgumentsText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent evt) { scheduleUpdateJob(); } }); // ControlAccessibleListener.addListener(fPrgmArgumentsText, group.getText()); // String buttonLabel = LauncherMessages.JavaArgumentsTab_5; // Button pgrmArgVariableButton = createPushButton(group, buttonLabel, null); // pgrmArgVariableButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); // pgrmArgVariableButton.addSelectionListener(new SelectionAdapter() { // @Override // public void widgetSelected(SelectionEvent e) { // StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell()); // dialog.open(); // String variable = dialog.getVariableExpression(); // if (variable != null) { // fPrgmArgumentsText.insert(variable); // } // } // }); fPrgmArgumentsText.setVisible(false); fVMArgumentsBlock.createControl(comp); fWorkingDirectoryBlock.createControl(comp); }
private void createUpperMenu(Composite composite) { Group parentGroup = new Group(composite, SWT.NONE); parentGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); GridLayout layout = new GridLayout(9, false); parentGroup.setLayout(layout); date = new DateTime(parentGroup, SWT.DATE); fromTime = new DateTime(parentGroup, SWT.TIME); fromTime.setTime(0, 0, 0); Label label = new Label(parentGroup, SWT.CENTER); label.setText(" ~ "); toTime = new DateTime(parentGroup, SWT.TIME); toTime.setTime(23, 59, 59); label = new Label(parentGroup, SWT.RIGHT); label.setText("Job ID"); searchText = new Text(parentGroup, SWT.LEFT | SWT.BORDER); GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, true, false); gridData.minimumWidth = 150; searchText.setLayoutData(gridData); label = new Label(parentGroup, SWT.RIGHT); label.setText("Min Response Time"); responseTimeText = new Text(parentGroup, SWT.LEFT | SWT.BORDER); gridData = new GridData(SWT.LEFT, SWT.CENTER, true, false); gridData.minimumWidth = 80; responseTimeText.setLayoutData(gridData); final Button applyButton = new Button(parentGroup, SWT.PUSH); applyButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); applyButton.setImage(Images.filter); applyButton.setText("Search"); applyButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { ExUtil.exec(new Runnable() { public void run() { search(); } }); } }); searchText.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_RETURN) { applyButton.notifyListeners(SWT.Selection, new Event()); } } }); }