Java Code Examples for org.eclipse.swt.widgets.Text#addTraverseListener()
The following examples show how to use
org.eclipse.swt.widgets.Text#addTraverseListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextBoxDialogField.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@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; }
Example 2
Source File: DataWizardPage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void createNameAndDescription(final Composite parent) { final Label nameLabel = new Label(parent, SWT.NONE); nameLabel.setText(Messages.name + " *"); nameLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create()); nameText = new Text(parent, SWT.BORDER); nameText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create()); final Label descriptionLabel = new Label(parent, SWT.NONE); descriptionLabel.setText(Messages.dataDescriptionLabel); descriptionLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.TOP).create()); descriptionText = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); descriptionText .setLayoutData( GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 70).span(2, 1).create()); descriptionText.addTraverseListener(e -> { if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) { e.doit = true; } }); }
Example 3
Source File: SearchText.java From olca-app with Mozilla Public License 2.0 | 6 votes |
@Override protected Control createControl(Composite parent) { parent.getParent().setRedraw(true); // fix tool-bar size on Windows parent.setLayout(new FillLayout()); log.trace("create search text control"); Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.horizontalSpacing = 5; layout.marginHeight = 0; layout.marginWidth = 5; layout.verticalSpacing = 0; composite.setLayout(layout); text = new Text(composite, SWT.BORDER | SWT.SEARCH); text.addTraverseListener(e -> { if (e.detail == SWT.TRAVERSE_RETURN) { doSearch(action.typeFilter); } }); UI.gridData(text, true, false).minimumWidth = 180; createActionMenu(composite); return composite; }
Example 4
Source File: ListenerAppender.java From ermasterr with Apache License 2.0 | 5 votes |
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; } } }); }
Example 5
Source File: SWTUtilities.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
/** * 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; }
Example 6
Source File: ListenerAppender.java From erflute with Apache License 2.0 | 5 votes |
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; } } }); }
Example 7
Source File: ProcessSearchPage.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private void createSearchSection(Composite container) { Composite composite = new Composite(container, SWT.NONE); composite.setLayout(new GridLayout(3, false)); UI.gridData(composite, true, false); new ConnectionText(composite); new Label(composite, SWT.NONE).setText(M.Process); text = new Text(composite, SWT.BORDER); UI.gridData(text, true, false); SearchAction action = new SearchAction(); text.addTraverseListener(action); createButton(composite, M.Search, action); }
Example 8
Source File: DQSystemInfoPage.java From olca-app with Mozilla Public License 2.0 | 5 votes |
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; }
Example 9
Source File: ListenerAppender.java From ermaster-b with Apache License 2.0 | 5 votes |
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; } } }); }
Example 10
Source File: StringSortPageableTableExample.java From nebula with Eclipse Public License 2.0 | 4 votes |
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); GridLayout layout = new GridLayout(2, false); shell.setLayout(layout); final List<String> items = createList(); // 1) Create pageable table with 10 items per page // This SWT Component create internally a SWT Table+JFace TreeViewer int pageSize = 10; paginationTable = new PageableTable(shell, SWT.BORDER, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, pageSize); paginationTable.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); // 2) Initialize the table viewer + SWT Table TableViewer viewer = paginationTable.getViewer(); viewer.setContentProvider(ArrayContentProvider.getInstance()); viewer.setLabelProvider(new LabelProvider()); Table table = viewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); // 3) Create column by adding SortTableColumnSelectionListener listener // to sort the paginated table. TableViewerColumn col = createTableViewerColumn(viewer, "Name", 150); col.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { String p = (String) element; return p; } }); // Call SortTableColumnSelectionListener with null property name because // it's a list of String. col.getColumn().addSelectionListener(new SortTableColumnSelectionListener(null)); // 4) Set the page loader used to load a page (sublist of String) // according the page index selected, the page size etc. paginationTable.setPageLoader(new PageResultLoaderList<>(items)); // 5) Set current page to 0 to display the first page paginationTable.setCurrentPage(0); Label lbl = new Label(shell, SWT.NONE); lbl.setText("Max rows per page: "); lbl.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); txt = new Text(shell, SWT.BORDER); txt.setText("10"); GridData gd = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); gd.widthHint = 30; txt.setLayoutData(gd); txt.addTraverseListener(e -> updatePageSize()); txt.addListener(SWT.FocusOut, e -> updatePageSize()); // paginationTable.getController().setPageSize(10); shell.setSize(550, 320); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }