Java Code Examples for org.eclipse.swt.SWT#MULTI
The following examples show how to use
org.eclipse.swt.SWT#MULTI .
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: ExportToTranslationDictionaryDialog.java From ermasterr with Apache License 2.0 | 6 votes |
private void createTable(final Composite parent) { final GridData gridData = new GridData(); gridData.heightHint = 150; gridData.horizontalSpan = 2; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; dictionaryTable = new Table(parent, SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI); dictionaryTable.setHeaderVisible(true); dictionaryTable.setLinesVisible(true); dictionaryTable.setLayoutData(gridData); parent.pack(); final int width = dictionaryTable.getBounds().width; final TableColumn physicalNameTableColumn = new TableColumn(dictionaryTable, SWT.LEFT); physicalNameTableColumn.setText(ResourceString.getResourceString("label.physical.name")); physicalNameTableColumn.setWidth(width / 2 - 5); final TableColumn logicalNameTableColumn = new TableColumn(dictionaryTable, SWT.LEFT); logicalNameTableColumn.setText(ResourceString.getResourceString("label.logical.name")); logicalNameTableColumn.setWidth(width / 2 - 5); }
Example 2
Source File: Translator.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private void addList() { Composite composite = new Composite( sashform, SWT.NONE ); props.setLook( composite ); FillLayout fillLayout = new FillLayout(); fillLayout.marginWidth = Const.FORM_MARGIN; fillLayout.marginHeight = Const.FORM_MARGIN; composite.setLayout( fillLayout ); // Make a listbox wList = new List( composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL ); // Add a selection listener. wList.addSelectionListener( new SelectionAdapter() { public void widgetSelected( SelectionEvent arg0 ) { refreshGrid(); } } ); }
Example 3
Source File: Trees.java From olca-app with Mozilla Public License 2.0 | 6 votes |
public static TreeViewer createViewer( Composite parent, String[] headers, IBaseLabelProvider label) { TreeViewer viewer = new TreeViewer(parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL | SWT.MULTI); Tree tree = viewer.getTree(); boolean hasColumns = headers != null && headers.length > 0; tree.setLinesVisible(hasColumns); tree.setHeaderVisible(hasColumns); if (hasColumns) { createColumns(viewer, headers, label); } if (label != null) { viewer.setLabelProvider(label); } GridData data = UI.gridData(tree, true, true); data.minimumHeight = 120; Point p = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT); data.heightHint = p.y < 120 ? 120 : p.y; return viewer; }
Example 4
Source File: TMXValidatorDialog.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent) { Composite tparent = (Composite) super.createDialogArea(parent); GridDataFactory.fillDefaults().grab(true, true).hint(500, 450).applyTo(tparent); GridLayoutFactory.fillDefaults().spacing(0, 0).extendedMargins(8, 8, 0, 8).applyTo(tparent); createMenu(tparent); createToolBar(tparent); styledText = new StyledText(tparent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(100, 100).grab(true, true).applyTo(styledText); styledText.setText(""); tparent.layout(); getShell().layout(); return tparent; }
Example 5
Source File: Grid_Test.java From nebula with Eclipse Public License 2.0 | 6 votes |
@Test public void testSetSelectionByIndices_DuplicateIndex() { grid = new Grid( shell, SWT.MULTI ); GridItem[] items = createGridItems( grid, 5, 0 ); grid.setSelection( new int[] { 1, 2, 2, 3 } ); GridItem[] expected = new GridItem[] { items[ 1 ], items[ 2 ], items[ 3 ] }; assertTrue( Arrays.equals( expected, grid.getSelection() ) ); }
Example 6
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 7
Source File: ExportWizardPage.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private void createProcessTree(Composite container) { Composite composite = new Composite(container, SWT.NONE); composite.setLayout(new FillLayout()); UI.gridData(composite, true, true); viewer = new CheckboxTreeViewer(composite, SWT.MULTI | SWT.BORDER); viewer.setUseHashlookup(true); viewer.setContentProvider(new NavigationContentProvider()); viewer.setLabelProvider(new NavigationLabelProvider(false)); viewer.setInput(Navigator.getNavigationRoot()); viewer.addCheckStateListener(new NavigationTreeCheck(viewer)); viewer.addCheckStateListener(this); viewer.addFilter(new NavigationTreeFilter()); viewer.setComparator(new NavigationComparator()); }
Example 8
Source File: Grid_Test.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Test public void testSetSelectionByRange_Multi() { grid = new Grid( shell, SWT.MULTI ); GridItem[] items = createGridItems( grid, 5, 0 ); grid.select( 0 ); grid.setSelection( 1, 3 ); GridItem[] expected = new GridItem[] { items[ 1 ], items[ 2 ], items[ 3 ] }; assertTrue( Arrays.equals( expected, grid.getSelection() ) ); }
Example 9
Source File: LanguageConfigurationInfoWidget.java From tm4e with Eclipse Public License 1.0 | 5 votes |
private Table createTable(Composite parent) { Composite tableComposite = new Composite(parent, SWT.NONE); tableComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); tableComposite.setLayout(new TableColumnLayout()); Table table = new Table(tableComposite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); table.setHeaderVisible(true); table.setLinesVisible(true); return table; }
Example 10
Source File: AppGui.java From gradle-and-eclipse-rcp with Apache License 2.0 | 5 votes |
private void needsBoth(Composite parent) { Layouts.setFill(parent); Text text = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.WRAP); text.setFont(Fonts.systemLarge()); text.setText(StringPrinter.buildString(printer -> { try { printer.println("Calling NeedsBoth.parse..."); printer.println("parse MAVEN: " + NeedsBoth.parse("MAVEN")); printer.println("parse P2: " + NeedsBoth.parse("P2")); } catch (Throwable e) { e.printStackTrace(printer.toPrintWriter()); } })); }
Example 11
Source File: CustomMatchConditionDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 初始化已保存的条件列表 * @param comp 父容器 */ private void initCustomFilterList(Composite comp) { customFilterList = new List(comp, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); customFilterList.setLayoutData(new GridData(GridData.FILL_BOTH)); setListData(customFilterList, customFilters); customFilterList.addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { // 调编辑的方法 edit(); } }); }
Example 12
Source File: ListDialogField.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected int getListStyle() { int style = SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL; if (fTableColumns != null) { style |= SWT.FULL_SELECTION; } return style; }
Example 13
Source File: Grid_Test.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Test public void testSetSelectionByRange_WithSelectionDisabled() { grid = new Grid( shell, SWT.MULTI ); grid.setSelectionEnabled( false ); createGridItems( grid, 5, 0 ); grid.setSelection( 1, 3 ); assertTrue( Arrays.equals( new Grid[ 0 ], grid.getSelection() ) ); }
Example 14
Source File: CompositeFactory.java From ermasterr with Apache License 2.0 | 5 votes |
public static Text createTextArea(final AbstractDialog dialog, final Composite composite, final String title, final int width, final int height, final int span, final boolean selectAll, final boolean imeOn, final boolean indent) { if (title != null) { final Label label = new Label(composite, SWT.NONE); final GridData labelGridData = new GridData(); labelGridData.verticalAlignment = SWT.TOP; labelGridData.horizontalAlignment = SWT.LEFT; label.setLayoutData(labelGridData); label.setText(ResourceString.getResourceString(title)); } final GridData textAreaGridData = new GridData(); textAreaGridData.heightHint = height; textAreaGridData.horizontalSpan = span; if (width > 0) { textAreaGridData.widthHint = width; } else { textAreaGridData.horizontalAlignment = GridData.FILL; textAreaGridData.grabExcessHorizontalSpace = true; } if (title != null && indent) { textAreaGridData.horizontalIndent = Resources.INDENT; } final Text text = new Text(composite, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER); text.setLayoutData(textAreaGridData); ListenerAppender.addTextAreaListener(text, dialog, selectAll, imeOn); return text; }
Example 15
Source File: ColumnCategoriesDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@Override public void populateDialogArea(Composite parent) { GridDataFactory.fillDefaults().grab(true, true).applyTo(parent); parent.setLayout(new GridLayout(4, false)); // Labels createLabels(parent, "Available columns", "Selected columns"); GridData gridData = GridDataFactory.fillDefaults().grab(true, true).create(); // Left tree - column categories treeViewer = new TreeViewer(parent); populateAvailableTree(); treeViewer.getControl().setLayoutData(gridData); // Add/remove buttons Composite buttonComposite = new Composite(parent, SWT.NONE); buttonComposite.setLayout(new GridLayout(1, true)); createAddButton(buttonComposite); createRemoveButton(buttonComposite); addListenersToTreeViewer(); // Right list - selected columns listViewer = new ListViewer(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); populateSelectedList(); addListenersToListViewer(); // Up/down buttons Composite upDownbuttonComposite = new Composite(parent, SWT.NONE); upDownbuttonComposite.setLayout(new GridLayout(1, true)); createUpButton(upDownbuttonComposite); createDownButton(upDownbuttonComposite); }
Example 16
Source File: CancelBuyOrderWizard.java From offspring with MIT License | 5 votes |
@Override public Control createReadonlyControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(1).applyTo(comp); textDescrReadonly = new Text(comp, SWT.BORDER | SWT.MULTI); textDescrReadonly.setEditable(false); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true) .hint(SWT.DEFAULT, 100).applyTo(textDescrReadonly); return comp; }
Example 17
Source File: TransExecutorDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void addResultRowsTab() { final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE ); wTab.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultRows.Title" ) ); wTab.setToolTipText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultRows.Tooltip" ) ); ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL ); scrolledComposite.setLayout( new FillLayout() ); Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE ); props.setLook( wInputComposite ); FormLayout tabLayout = new FormLayout(); tabLayout.marginWidth = 15; tabLayout.marginHeight = 15; wInputComposite.setLayout( tabLayout ); wlResultRowsTarget = new Label( wInputComposite, SWT.RIGHT ); props.setLook( wlResultRowsTarget ); wlResultRowsTarget.setText( BaseMessages.getString( PKG, "TransExecutorDialog.OutputRowsSource.Label" ) ); FormData fdlResultRowsTarget = new FormData(); fdlResultRowsTarget.top = new FormAttachment( 0, 0 ); fdlResultRowsTarget.left = new FormAttachment( 0, 0 ); // First one in the left wlResultRowsTarget.setLayoutData( fdlResultRowsTarget ); wOutputRowsSource = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER ); props.setLook( wOutputRowsSource ); wOutputRowsSource.addModifyListener( lsMod ); FormData fdResultRowsTarget = new FormData(); fdResultRowsTarget.width = 250; fdResultRowsTarget.top = new FormAttachment( wlResultRowsTarget, 5 ); fdResultRowsTarget.left = new FormAttachment( 0, 0 ); // To the right wOutputRowsSource.setLayoutData( fdResultRowsTarget ); wlOutputFields = new Label( wInputComposite, SWT.NONE ); wlOutputFields.setText( BaseMessages.getString( PKG, "TransExecutorDialog.ResultFields.Label" ) ); props.setLook( wlOutputFields ); FormData fdlResultFields = new FormData(); fdlResultFields.left = new FormAttachment( 0, 0 ); fdlResultFields.top = new FormAttachment( wOutputRowsSource, 10 ); wlOutputFields.setLayoutData( fdlResultFields ); int nrRows = ( transExecutorMeta.getOutputRowsField() != null ? transExecutorMeta.getOutputRowsField().length : 1 ); ColumnInfo[] ciResultFields = new ColumnInfo[] { new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Field" ), ColumnInfo.COLUMN_TYPE_TEXT, false, false ), new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Type" ), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames() ), new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Length" ), ColumnInfo.COLUMN_TYPE_TEXT, false ), new ColumnInfo( BaseMessages.getString( PKG, "TransExecutorDialog.ColumnInfo.Precision" ), ColumnInfo.COLUMN_TYPE_TEXT, false ), }; wOutputFields = new TableView( transMeta, wInputComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL, ciResultFields, nrRows, false, lsMod, props, false ); FormData fdResultFields = new FormData(); fdResultFields.left = new FormAttachment( 0, 0 ); fdResultFields.top = new FormAttachment( wlOutputFields, 5 ); fdResultFields.right = new FormAttachment( 100, 0 ); fdResultFields.bottom = new FormAttachment( 100, 0 ); wOutputFields.setLayoutData( fdResultFields ); wOutputFields.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 25, 25, 25, 25 ) ); wInputComposite.pack(); Rectangle bounds = wInputComposite.getBounds(); scrolledComposite.setContent( wInputComposite ); scrolledComposite.setExpandHorizontal( true ); scrolledComposite.setExpandVertical( true ); scrolledComposite.setMinWidth( bounds.width ); scrolledComposite.setMinHeight( bounds.height ); wTab.setControl( scrolledComposite ); wTabFolder.setSelection( wTab ); }
Example 18
Source File: VariableAndOptionPage.java From M2Doc with Eclipse Public License 1.0 | 4 votes |
/** * Creates the {@link Generation#getOptions() options} {@link TableViewer}. * * @param gen * the {@link Generation} * @param composite * the container {@link Composite} * @param factory * the {@link AdapterFactory} * @param provider * the {@link ITemplateCustomPropertiesProvider} * @return the created {@link TableViewer} */ private TableViewer createVariablesTable(final Generation gen, Composite composite, AdapterFactory factory, ITemplateCustomPropertiesProvider provider) { composite.setLayout(new GridLayout(2, false)); TableViewer res = new TableViewer(composite, SWT.MULTI); Table table = res.getTable(); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); res.getTable().setHeaderVisible(true); TableViewerColumn nameColumn = new TableViewerColumn(res, composite.getStyle()); nameColumn.getColumn().setText("Variable name"); nameColumn.getColumn().setWidth(WIDTH); TableViewerColumn valueColumn = new TableViewerColumn(res, composite.getStyle()); valueColumn.getColumn().setText("Variable value"); valueColumn.getColumn().setWidth(WIDTH); res.setContentProvider(new IStructuredContentProvider() { @Override public Object[] getElements(Object inputElement) { return ((Generation) inputElement).getDefinitions().toArray(); } @Override public void dispose() { // nothing to do here } @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // nothing to do here } }); nameColumn.setLabelProvider(new CellLabelProvider() { @Override public void update(ViewerCell cell) { final Definition definition = (Definition) cell.getElement(); cell.setText(definition.getKey()); } }); valueColumn.setLabelProvider(new VariableValueCellLabelProvider(factory)); res.setInput(gen); return res; }
Example 19
Source File: CTree.java From nebula with Eclipse Public License 2.0 | 4 votes |
private static int checkStyle(int style) { int mask = SWT.BORDER | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.MULTI | SWT.NO_FOCUS | SWT.CHECK; return (style & mask); }
Example 20
Source File: AbstractTmfTreeViewer.java From tracecompass with Eclipse Public License 2.0 | 2 votes |
/** * Constructor * * @param parent * The parent composite that holds this viewer * @param allowMultiSelect * Whether multiple selections are allowed */ public AbstractTmfTreeViewer(Composite parent, boolean allowMultiSelect) { this(parent, new TreeViewer(parent, SWT.FULL_SELECTION | SWT.H_SCROLL | (allowMultiSelect ? SWT.MULTI : 0))); }