public EditListener(Table table, boolean edit){ this.table = table; this.edit = edit; editor = new TableEditor(table); editor.horizontalAlignment = SWT.LEFT; editor.grabHorizontal = true; } public EditListener(Table table, boolean edit, boolean multiline){
public EditListener(Table table, boolean edit, boolean multiline){ this.table = table; this.edit = edit; this.multiline = multiline; editor = new TableEditor(table); editor.horizontalAlignment = SWT.LEFT; editor.grabHorizontal = true; } @Override
composite.layout( true, true ); final TableEditor editor = new TableEditor( table ); editor.grabHorizontal = true; editor.grabVertical = true;
tb.setDefaultEditor(Object.class,new TableEditor());
editor = new TableEditor( table ); editor.grabHorizontal = true; editor.grabVertical = true;
/** * @param viewer * the viewer the editor is attached to * @param focusCellManager * the cell focus manager if one used or <code>null</code> * @param editorActivationStrategy * the strategy used to decide about the editor activation * @param feature * the feature mask */ TableViewerEditor(TableViewer viewer, SWTFocusCellManager focusCellManager, ColumnViewerEditorActivationStrategy editorActivationStrategy, int feature) { super(viewer, editorActivationStrategy, feature); tableEditor = new TableEditor(viewer.getTable()); this.focusCellManager = focusCellManager; }
/** * @param viewer * the viewer the editor is attached to * @param focusCellManager * the cell focus manager if one used or <code>null</code> * @param editorActivationStrategy * the strategy used to decide about the editor activation * @param feature * the feature mask */ TableViewerEditor(TableViewer viewer, SWTFocusCellManager focusCellManager, ColumnViewerEditorActivationStrategy editorActivationStrategy, int feature) { super(viewer, editorActivationStrategy, feature); tableEditor = new TableEditor(viewer.getTable()); this.focusCellManager = focusCellManager; }
/** * @param viewer * the viewer the editor is attached to * @param focusCellManager * the cell focus manager if one used or <code>null</code> * @param editorActivationStrategy * the strategy used to decide about the editor activation * @param feature * the feature mask */ TableViewerEditor(TableViewer viewer, SWTFocusCellManager focusCellManager, ColumnViewerEditorActivationStrategy editorActivationStrategy, int feature) { super(viewer, editorActivationStrategy, feature); tableEditor = new TableEditor(viewer.getTable()); this.focusCellManager = focusCellManager; }
/** * Returns (and, really, creates) a progress label for the given item. * This is used to display progress while the item's file is being copied. * (We don't actually support "copying" the file, only moving it, but when * the user chooses to "move" it across filesystems, that becomes a copy- * and-delete operation.) * * @param item * the item to create a progress label for * @return * a Label which is set as an editor for the status field of the given item */ public Label getProgressLabel(final TableItem item) { Label progressLabel = new Label(swtTable, SWT.SHADOW_NONE | SWT.CENTER); TableEditor editor = new TableEditor(swtTable); editor.grabHorizontal = true; STATUS_FIELD.setEditor(item, editor, progressLabel); return progressLabel; }
/** * Creates the table control. */ void createTable(Composite parent) { table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); table.setLinesVisible(true); //table.setLayout(new TableLayout()); new TableEditor(table); }
private void createEditors() { final Table table = fConfigurationsTable.getTable(); fLevelColumnEditor = new TableEditor(table); fLevelColumnEditor.horizontalAlignment = SWT.CENTER; fLevelColumnEditor.minimumWidth = 40; fLevelColumnEditor.grabHorizontal = true; if (Util.isMac()) fLevelColumnEditor.minimumHeight = 27; fAutoColumnEditor = new TableEditor(table); fAutoColumnEditor.horizontalAlignment = SWT.CENTER; fAutoColumnEditor.grabHorizontal = true; fAutoColumnEditor.minimumWidth = 50; table.addSelectionListener(widgetSelectedAdapter(e -> showControls())); }
private Button createPermissionEditor(Table table, TableItem item, int index) { Button button = new Button(table, SWT.CHECK); button.pack(); TableEditor editor = new TableEditor(table); editor.grabVertical = true; editor.verticalAlignment = SWT.CENTER; editor.minimumWidth = button.getSize().x; editor.setEditor(button, item, index); editor.getEditor(); return button; }
private void createEditors() { final Table table = fRepositoryTable.getTable(); fEnabledColumnEditor = new TableEditor(table); fEnabledColumnEditor.horizontalAlignment = SWT.CENTER; fEnabledColumnEditor.grabHorizontal = true; fEnabledColumnEditor.minimumWidth = 50; table.addSelectionListener(widgetSelectedAdapter(e -> showControls())); }
private void createEditors() { final Table table = fRepositoryTable.getTable(); fEnabledColumnEditor = new TableEditor(table); fEnabledColumnEditor.horizontalAlignment = SWT.CENTER; fEnabledColumnEditor.grabHorizontal = true; fEnabledColumnEditor.minimumWidth = 50; table.addSelectionListener(widgetSelectedAdapter(e -> showControls())); }
/** * Table must be SWT.VIRTUAL. This is intentional. Labels will never be * retrieved for non-visible items. * * @see SWT#VIRTUAL * @param table the backing table widget */ public AsynchronousTableViewer(Table table) { Assert.isTrue((table.getStyle() & SWT.VIRTUAL) != 0); fTable = table; hookControl(fTable); fTableEditor = new TableEditor(fTable); fTableEditorImpl = createTableEditorImpl(); }
/** * Creates the widgets in the "child" group. */ @Override void createChildWidgets () { /* Add common controls */ super.createChildWidgets (); /* Add TableEditors */ comboEditor = new TableEditor (table); nameEditor = new TableEditor (table); table.addMouseListener(MouseListener.mouseDownAdapter(e -> { resetEditors(); index = table.getSelectionIndex(); if (index == -1) return; TableItem oldItem = comboEditor.getItem(); newItem = table.getItem(index); if (newItem == oldItem || newItem != lastSelected) { lastSelected = newItem; return; } table.showSelection(); combo = new CCombo(table, SWT.READ_ONLY); createComboEditor(combo, comboEditor); nameText = new Text(table, SWT.SINGLE); nameText.setText(data.get(index)[NAME_COL]); createTextEditor(nameText, nameEditor, NAME_COL); })); }
public static Object create(ActionContext actionContext){ Thing self = (Thing) actionContext.get("self"); //创建editor Table parent = (Table) actionContext.get("table"); TableEditor tableEditor = new TableEditor(parent); self.doAction("init", actionContext, UtilMap.toParams(new Object[]{"editor", tableEditor})); parent.setData("_tableEditor", tableEditor); actionContext.getScope(0).put(self.getString("name"), tableEditor); return tableEditor; }
private void setComboBoxProposedDest(final TableItem item, final FileEpisode ep) { if (swtTable.isDisposed() || item.isDisposed()) { return; } final List<String> options = ep.getReplacementOptions(); final int chosen = ep.getChosenEpisode(); final String defaultOption = options.get(chosen); NEW_FILENAME_FIELD.setCellText(item, defaultOption); final Combo combo = newComboBox(); if (combo == null) { return; } options.forEach(combo::add); combo.setText(defaultOption); combo.addModifyListener(e -> ep.setChosenEpisode(combo.getSelectionIndex())); item.setData(combo); final TableEditor editor = new TableEditor(swtTable); editor.grabHorizontal = true; NEW_FILENAME_FIELD.setEditor(item, editor, combo); }
/** * Creates a table viewer to initialize {@link #tableViewer}. * @return the new table viewer. Not <code>null</code>. */ private TableViewer createTableViewer() { final TableViewer viewer = new TableViewer(table); viewer.setContentProvider( new ActionInvocationModeTableContentProvider()); viewer.setLabelProvider( new ActionInvocationModeTableLabelProvider()); new TableEditor(table); viewer.setCellEditors(new CellEditor[] { null, createOnWrongInvocationModeCellEditor()}); viewer.setColumnProperties( new String[] {Column.LABEL.name(), Column.MODE.name()}); viewer.setCellModifier( new ActionInvocationModeTableCellModifier(viewer)); viewer.setInput(actionModes); return viewer; }
/** * Insert a copy of the row at the given position, and then delete the original row. * Note that insertion does not overwrite the row that is already there. It pushes * the row, and every row below it, down one slot. * * @param oldItem * the TableItem to copy * @param positionToInsert * the position where we should insert the row */ private void setSortedItem(final TableItem oldItem, final int positionToInsert) { boolean wasChecked = oldItem.getChecked(); TableItem item = new TableItem(swtTable, SWT.NONE, positionToInsert); item.setChecked(wasChecked); CURRENT_FILE_FIELD.setCellText(item, CURRENT_FILE_FIELD.getCellText(oldItem)); NEW_FILENAME_FIELD.setCellText(item, NEW_FILENAME_FIELD.getCellText(oldItem)); STATUS_FIELD.setCellImage(item, STATUS_FIELD.getCellImage(oldItem)); final Object itemData = oldItem.getData(); // Although the name suggests dispose() is primarily about reclaiming system // resources, it also deletes the item from the Table. oldItem.dispose(); if (itemData != null) { final TableEditor newEditor = new TableEditor(swtTable); newEditor.grabHorizontal = true; NEW_FILENAME_FIELD.setEditor(item, newEditor, (Control) itemData); item.setData(itemData); } }