Java Code Examples for org.eclipse.jface.viewers.TableViewer#refresh()
The following examples show how to use
org.eclipse.jface.viewers.TableViewer#refresh() .
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: HistoryTableProvider.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public void setSortColumn(final TableViewer tableViewer, int column) { HistorySorter oldSorter = (HistorySorter)tableViewer.getSorter(); if (oldSorter != null && column == oldSorter.getColumnNumber()) { oldSorter.setReversed(!oldSorter.isReversed()); if (oldSorter.isReversed()) tableViewer.getTable().setSortDirection(SWT.DOWN); else tableViewer.getTable().setSortDirection(SWT.UP); tableViewer.refresh(); } else { HistorySorter newSorter = new HistorySorter(column); if (column == 0) newSorter.setReversed(true); tableViewer.setSorter(newSorter); if (column == 0)tableViewer.getTable().setSortDirection(SWT.DOWN); else tableViewer.getTable().setSortDirection(SWT.UP); } // tableViewer.getTable().setSortColumn((TableColumn)e.widget); tableViewer.getTable().setSortColumn(tableViewer.getTable().getColumn(column)); }
Example 2
Source File: MedicationViewerHelper.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
private static SelectionAdapter getSelectionAdapter(final TableViewer viewer, final TableColumn column, final int index){ SelectionAdapter selectionAdapter = new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e){ ViewerSortOrder comparator = MedicationViewHelper.getSelectedComparator(); if (ViewerSortOrder.DEFAULT.equals(comparator)) { comparator.setColumn(index); int dir = comparator.getDirection(); viewer.getTable().setSortColumn(column); viewer.getTable().setSortDirection(dir); viewer.refresh(true); } } }; return selectionAdapter; }
Example 3
Source File: TaskSelectionDialog.java From workspacemechanic with Eclipse Public License 1.0 | 5 votes |
@Override protected Control createDialogArea(Composite container) { Control area = super.createDialogArea(container); TableViewer tableViewer = getTableViewer(); Table table = tableViewer.getTable(); tableViewer.setLabelProvider(new DefaultCellLabelProvider()); ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE); table.setHeaderVisible(true); newTableColumn(table, "Description", 200); newTableColumn(table, "ID", 200); newTableColumn(table, "Name", 200); tableViewer.refresh(); return area; }
Example 4
Source File: SegmentStoreContentProvider.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public void setSortOrder(@Nullable Comparator<?> comparator) { SegmentStoreWithRange<?> store = fStore; final TableViewer tableViewer = fTableViewer; if (comparator == null || store == null || tableViewer == null) { return; } @SuppressWarnings("unchecked") Comparator<ISegment> comp = (Comparator<ISegment>) comparator; fComparator = comp; store.setComparator(comp); tableViewer.refresh(); }
Example 5
Source File: LamiTableContentProvider.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public void setSortOrder(@Nullable Comparator<?> comparator) { if (comparator == null) { return; } final TableViewer tableViewer = fTableViewer; if (tableViewer == null) { return; } @SuppressWarnings("unchecked") Comparator<LamiTableEntry> entryComparator = (Comparator<LamiTableEntry>) comparator; fComparator = entryComparator; Collections.sort(fCurrentEntries, fComparator); tableViewer.refresh(); }
Example 6
Source File: PopulationInspectView.java From gama with GNU General Public License v3.0 | 5 votes |
@Override protected GamaUIJob createUpdateJob() { return new GamaUIJob() { @Override protected UpdatePriority jobPriority() { return UpdatePriority.LOW; } @Override public IStatus runInUIThread(final IProgressMonitor monitor) { final TableViewer v = viewer; if (v == null || v.getTable() == null || v.getTable().isDisposed() || getOutput() == null) { return Status.CANCEL_STATUS; } if (!locked) { final IAgent[] agents = getOutput().getLastValue(); if (Arrays.equals(elements, agents)) { v.refresh(); } else { viewer.setInput(agents); } } else { viewer.refresh(); } return Status.OK_STATUS; } }; }
Example 7
Source File: UsageSettings.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
private MenuManager createMenu(TableViewer tableViewer){ MenuManager menuManager = new MenuManager(); Action clearAction = new Action("Leeren") { //$NON-NLS-1$ { setImageDescriptor(Images.IMG_DELETE.getImageDescriptor()); setToolTipText("Statistik Leeren"); //$NON-NLS-1$ } @Override public void run(){ StatisticsManager.INSTANCE.getStatistics().getStatistics().clear(); tableViewer.refresh(); } }; Action exportAction = new Action("Exportieren") { //$NON-NLS-1$ { setImageDescriptor(Images.IMG_EXPORT.getImageDescriptor()); setToolTipText("Statistik Exportieren"); //$NON-NLS-1$ } @Override public void run(){ FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); dialog.setFilterNames(new String[] { "xml" }); dialog.setFilterExtensions(new String[] { "*.xml" }); dialog.setOverwrite(true); dialog.setFilterPath(CoreHub.getWritableUserDir().getAbsolutePath()); // Windows path dialog.setFileName("statistics_export.xml"); String path = dialog.open(); if (path != null) { try { StatisticsManager.INSTANCE.exportStatisticsToFile(path); } catch (IOException e) { LoggerFactory.getLogger(UsageSettings.class) .error("statistics export error", e); MessageDialog.openError(getShell(), "Fehler", "Statistik Export nicht möglich. [" + e.getMessage() + "]"); } } } }; menuManager.add(clearAction); menuManager.add(exportAction); return menuManager; }
Example 8
Source File: SortMoveHandler.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException{ String direction = event.getParameter("ch.elexis.core.ui.medication.sortmove.direction"); //$NON-NLS-1$ if (direction != null) { IWorkbenchPart part = HandlerUtil.getActivePart(event); if (part instanceof MedicationView) { MedicationComposite composite = ((MedicationView) part).getMedicationComposite(); composite.setViewerSortOrder(ViewerSortOrder.MANUAL); TableViewer activeViewer = composite.getActiveTableViewer(); if (activeViewer != null) { int selectionIndex = activeViewer.getTable().getSelectionIndex(); if(moveNotPossible(selectionIndex, activeViewer, direction)) { return null; } List<TableItem> asList = Arrays.asList(activeViewer.getTable().getItems()); if (directionIsUp(direction)) { Collections.swap(asList, selectionIndex, selectionIndex - 1); } else { Collections.swap(asList, selectionIndex, selectionIndex + 1); } for (int i = 0; i < asList.size(); i++) { TableItem tableItem = asList.get(i); MedicationTableViewerItem pres = (MedicationTableViewerItem) tableItem.getData(); pres.setOrder(i); } activeViewer.refresh(); if (directionIsUp(direction)) { activeViewer.getTable().setSelection(selectionIndex - 1); } else { activeViewer.getTable().setSelection(selectionIndex + 1); } } } } return null; }