Java Code Examples for org.eclipse.jface.viewers.TableViewer#update()
The following examples show how to use
org.eclipse.jface.viewers.TableViewer#update() .
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: TypeScriptSearchTableContentProvider.java From typescript.java with MIT License | 6 votes |
public void elementsChanged(Object[] updatedElements) { TableViewer viewer = getViewer(); int elementLimit = getElementLimit(); boolean tableLimited = elementLimit != -1; for (int i = 0; i < updatedElements.length; i++) { if (fResult.getMatchCount(updatedElements[i]) > 0) { if (viewer.testFindItem(updatedElements[i]) != null) viewer.update(updatedElements[i], null); else { if (!tableLimited || viewer.getTable().getItemCount() < elementLimit) viewer.add(updatedElements[i]); } } else viewer.remove(updatedElements[i]); } }
Example 2
Source File: FileTableContentProvider.java From Pydev with Eclipse Public License 1.0 | 6 votes |
@Override public void elementsChanged(Object[] updatedElements) { TableViewer viewer = getViewer(); int elementLimit = getElementLimit(); boolean tableLimited = elementLimit != -1; for (int i = 0; i < updatedElements.length; i++) { if (fResult.getMatchCount(updatedElements[i]) > 0) { if (viewer.testFindItem(updatedElements[i]) != null) viewer.update(updatedElements[i], null); else { if (!tableLimited || viewer.getTable().getItemCount() < elementLimit) viewer.add(updatedElements[i]); } } else viewer.remove(updatedElements[i]); } }
Example 3
Source File: MergeScriptDialog.java From MergeProcessor with Apache License 2.0 | 5 votes |
/** * Updates all items of the given {@link TableViewer}. * * @param tableViewer the {@link TableViewer} * @see TableViewer#update(Object[], String[]) */ private static void updateAllElements(final TableViewer tableViewer) { final int count = tableViewer.getTable().getItemCount(); final Object[] elements = new Object[count]; for (int i = 0; i < count; i++) { elements[i] = tableViewer.getElementAt(i); } tableViewer.update(elements, null); }
Example 4
Source File: UnDefinesViewer.java From cmake4eclipse with Eclipse Public License 2.0 | 5 votes |
private void handleUnDefineEditButton(TableViewer tableViewer) { final IStructuredSelection selection = (IStructuredSelection) tableViewer .getSelection(); if (selection.size() == 1) { Object cmakeDefine = selection.getFirstElement(); // edit the selected variable in-place.. final Shell shell = tableViewer.getControl().getShell(); AddCmakeUndefineDialog dlg = new AddCmakeUndefineDialog(shell, (CmakeUnDefine) cmakeDefine); if (dlg.open() == Dialog.OK) { tableViewer.update(cmakeDefine, null); // updates the display } } }
Example 5
Source File: DefinesViewer.java From cmake4eclipse with Eclipse Public License 2.0 | 5 votes |
private void handleDefineEditButton(TableViewer tableViewer) { final IStructuredSelection selection = (IStructuredSelection) tableViewer .getSelection(); if (selection.size() == 1) { Object cmakeDefine = selection.getFirstElement(); // edit the selected variable in-place.. final Shell shell = tableViewer.getControl().getShell(); AddCmakeDefineDialog dlg = new AddCmakeDefineDialog(shell, cfgd, (CmakeDefine) cmakeDefine); if (dlg.open() == Dialog.OK) { tableViewer.update(cmakeDefine, null); // updates the display } } }
Example 6
Source File: JavaSearchTableContentProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void elementsChanged(Object[] updatedElements) { if (getSearchResult() == null) return; int addLimit= getAddLimit(); TableViewer viewer= (TableViewer) getPage().getViewer(); Set<Object> updated= new HashSet<Object>(); Set<Object> added= new HashSet<Object>(); Set<Object> removed= new HashSet<Object>(); for (int i= 0; i < updatedElements.length; i++) { if (getPage().getDisplayedMatchCount(updatedElements[i]) > 0) { if (viewer.testFindItem(updatedElements[i]) != null) updated.add(updatedElements[i]); else { if (addLimit > 0) { added.add(updatedElements[i]); addLimit--; } } } else { removed.add(updatedElements[i]); } } viewer.add(added.toArray()); viewer.update(updated.toArray(), new String[] { SearchLabelProvider.PROPERTY_MATCH_COUNT }); viewer.remove(removed.toArray()); }