Difference between revisions of "JFaceSnippets"

From Eclipsepedia

Jump to: navigation, search
(Snippet032TableTreeViewer)
(Removed out-dated Snippet #023)
 
(17 intermediate revisions by 5 users not shown)
Line 1: Line 1:
JFace-Snippets are small easy understandable programming example how to use JFace API. You can find them in CVS [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/ JFace code snippets]:
+
JFace-Snippets are small easy understandable programming example how to use JFace API. To browse the examples, navigate to the[http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets examples GIT repository].
  
'''TODO''' switch the URLs to the current git repo, [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets JFace code snippets]
+
== Dialogs ==
  
==Dialogs==
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/dialogs/Snippet012DialogWithImageButtons.java Snippet012DialogWithImageButtons] ===
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/dialogs/Snippet012DialogWithImageButtons.java?view=markup Snippet012DialogWithImageButtons]===
+
Demonstrates usage of Icons in Buttons of Dialogs
+
  
==Layout==
+
Demonstrates usage of Icons in Buttons of Dialogs
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/layout/Snippet013GridLayoutFactory.java?view=markup Snippet013GridLayoutFactory]===
+
Demonstrates usage of the GridLayoutFactory to make more readable
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/layout/Snippet016TableLayout.java?view=markup Snippet016TableLayout]===
+
== Layout  ==
Demonstrates (dynamic)layout support for TableColumns available as of JFace 3.3
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/layout/Snippet027TreeLayout.java?view=markup Snippet027TreeLayout]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/layout/Snippet013GridLayoutFactory.java Snippet013GridLayoutFactory] ===
Demonstrates (dynamic)layout support for TreeColumns available as of JFace 3.3
+
  
==Viewers==
+
Demonstrates usage of the GridLayoutFactory to make more readable
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet001TableViewer.java?view=markup  Snippet001TableViewer]===
+
Demonstrates a simply TableViewer with one column. It holds all important classes used for all Table-like JFace-Viewers (''[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/LabelProvider.html LabelProvider]'',''[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/IStructuredContentProvider.html IStructuredContentProvider]'')
+
  
[[Image:Snippet1.png]]
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/layout/Snippet016TableLayout.java Snippet016TableLayout] ===
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet002TreeViewer.java?view=markup  Snippet002TreeViewer]===
+
Demonstrates (dynamic)layout support for TableColumns available as of JFace 3.3
Demonstrates a simply TreeViewer with one column. It describes all important classes used for all Tree-like JFace-Viewers (''[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/LabelProvider.html LabelProvider]'',''[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/ITreeContentProvider.html ITreeContentProvider]'')
+
  
[[Image:Snippet2.png]]
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/layout/Snippet027TreeLayout.java Snippet027TreeLayout] ===
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet003TableLabelProvider.java?view=markup Snippet003TableLabelProvider]===
+
Demonstrates (dynamic)layout support for TreeColumns available as of JFace 3.3
Demonstrates tables with more than one column and the usage of ''[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/ITableLabelProvider.html ITableLabelProvider]''
+
  
[[Image:Snippet3.png]]
+
== Viewers  ==
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet004HideSelection.java?view=markup Snippet004HideSelection]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet001TableViewer.java Snippet001TableViewer] ===
Demonstrates how the selection can be hidden when the user click in a tablerow/column which doesn't hold any information. The standard behaviour of SWT-Table is to leave the selection on the last column. This snippet removes the selection if the user clicks in an area not selectable
+
  
[[Image:Snippet004.png]]
+
Demonstrates a simply TableViewer with one column. It holds all important classes used for all Table-like JFace-Viewers (''[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/LabelProvider.html LabelProvider]'',''[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/IStructuredContentProvider.html IStructuredContentProvider]'')
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet005TreeCustomMenu.java?view=markup Snippet005TreeCustomMenu]===
+
[[Image:Snippet1.png]]  
Demonstrates how to create a different context menu depending on which item in the tree is currently selected this can also be used with a table of course
+
  
[[Image:Snippet005.png]]
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet002TreeViewer.java Snippet002TreeViewer] ===
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet006TableMultiLineCells.java?view=markup Snippet006TableMultiLineCells]===
+
Demonstrates a simply TreeViewer with one column. It describes all important classes used for all Tree-like JFace-Viewers (''[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/LabelProvider.html LabelProvider]'',''[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/ITreeContentProvider.html ITreeContentProvider]'')
Demonstrates first use case for the new OwnerDraw-Support added to JFace in 3.3 (available at SWT-Level since 3.2). This example uses the new Viewers API in this special case the ''OwnerDrawLabelProvider'' to make items with more than one line of text.
+
  
[[Image:Snippet006.png]]
+
[[Image:Snippet2.png]]  
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet007FullSelection.java?view=markup Snippet007FullSelection]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet003TableLabelProvider.java Snippet003TableLabelProvider] ===
Demonstrates how you can use a use inline editing in tables with multiple columns which requires to use SWT.FULL_SELECTION but hiding the selection from the user.
+
  
[[Image:Snippet007.png]]
+
Demonstrates tables with more than one column and the usage of ''[http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/viewers/ITableLabelProvider.html ITableLabelProvider]''
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet008RevealElement.java?view=markup Snippet008RevealElement]===
+
[[Image:Snippet3.png]]  
Demonstrates how you can scroll a TableViewer to the specific model element using TableViewer#reveal(Object)
+
  
[[Image:Snippet008.png]]
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet004HideSelection.java Snippet004HideSelection] ===
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet009CellEditors.java?view=markup Snippet009CellEditors]===
+
Demonstrates how the selection can be hidden when the user click in a tablerow/column which doesn't hold any information. The standard behaviour of SWT-Table is to leave the selection on the last column. This snippet removes the selection if the user clicks in an area not selectable
Demonstrates minimal example when trying to add inline editing to tables to get familiar with the various classes needed (3.2 API)
+
  
[[Image:Snippet009.png]]
+
[[Image:Snippet004.png]]  
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet010OwnerDraw.java?view=markup Snippet010OwnerDraw]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet005TreeCustomMenu.java Snippet005TreeCustomMenu] ===
Demonstrates usage of new OwnerDraw-Support feature provided by JFace in 3.3(available in SWT since 3.2). This example uses the new Viewers API in this special case the ''OwnerDrawLabelProvider''.
+
  
[[Image:Snippet010.png]]
+
Demonstrates how to create a different context menu depending on which item in the tree is currently selected this can also be used with a table of course
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet011CustomTooltips.java?view=markup Snippet011CustomTooltips]===
+
[[Image:Snippet005.png]]  
Demonstrates usage of new custom tooltip support in 3.3 used to provide a tooltip for each cell in TableViewer
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet013TableViewerNoMandatoryLabelProvider.java?view=markup Snippet013TableViewerNoMandatoryLabelProvider]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet006TableMultiLineCells.java Snippet006TableMultiLineCells] ===
Demonstrates usage of none mandatory LabelProviders in TableViewers to set colors and fonts with 3.2-API
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet014TreeViewerNoMandatoryLabelProvider.java?view=markup Snippet014TreeViewerNoMandatoryLabelProvider]===
+
Demonstrates first use case for the new OwnerDraw-Support added to JFace in 3.3 (available at SWT-Level since 3.2). This example uses the new Viewers API in this special case the ''OwnerDrawLabelProvider'' to make items with more than one line of text.  
Demonstrates usage of none mandatory LabelProviders in TreeViewers to set colors and font with 3.2-API
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet015CustomTooltipsForTree.java?view=markup Snippet015CustomTooltipsForTree]===
+
[[Image:Snippet006.png]]  
Demonstrates usage of new custom tooltip support in 3.3 used to provide a tooltip for each cell in a TreeViewer
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet017TableViewerHideShowColumns.java?view=markup Snippet017TableViewerHideShowColumns]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet007FullSelection.java Snippet007FullSelection] ===
Demonstrates hiding and showing of columns (animated)
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet018TableViewerAddRemoveColumnsWithEditing.java?view=markup Snippet018TableViewerAddRemoveColumnsWithEditing]===
+
Demonstrates how you can use a use inline editing in tables with multiple columns which requires to use SWT.FULL_SELECTION but hiding the selection from the user.  
Demonstrates adding/removing of columns in conjunction with inline editing which makes this a bit tougher than without it (using 3.2 API)
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet019TableViewerAddRemoveColumnsWithEditingNewAPI.java?view=markup Snippet019TableViewerAddRemoveColumnsWithEditingNewAPI]===
+
[[Image:Snippet007.png]]  
Demonstrates adding/removing of columns in conjunction with the inline editing but with the new JFace-API who makes this a much easier and less error prone
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet021CellEditorsOnDoubleClick.java?view=markup Snippet021CellEditorsOnDoubleClick]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet008RevealElement.java Snippet008RevealElement] ===
Demonstrates editor activation on double-click with the 3.2 API which makes this fairly complex
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet022TableViewerRefreshNoScroll.java?view=markup Snippet022TableViewerRefreshNoScroll]===
+
Demonstrates how you can scroll a TableViewer to the specific model element using TableViewer#reveal(Object)
Demonstrates how to refresh and viewer without scrolling the selection into after the refresh with 3.2 API. In 3.3 a special refresh-API for TableViewers is added.
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet024TableViewerExploreNewAPI.java?view=markup Snippet024TableViewerExploreNewAPI]===
+
[[Image:Snippet008.png]]  
Demonstrates the base classes of 3.3 API
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet025TabEditing.java?view=markup Snippet025TabEditing]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet009CellEditors.java Snippet009CellEditors] ===
Demonstrates how one can use the new 3.3 API to add tab-editing support to your viewer
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet026TreeViewerTabEditing.java?view=markup Snippet026TreeViewerTabEditing]===
+
Demonstrates minimal example when trying to add inline editing to tables to get familiar with the various classes needed (3.2 API)  
Demonstrates all fancy things one can do with new 3.3 API (Tab-Editing, Keyboard-Navigation from Cell to Cell, Editor-Activation with the Keyboard)
+
  
[[Image:Snippet026TreeViewerTabEditing.gif]]
+
[[Image:Snippet009.png]]  
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet027ComboBoxCellEditors.java?view=markup Snippet027ComboBoxCellEditors]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet010OwnerDraw.java Snippet010OwnerDraw] ===
Demonstrates usage of the ComboBoxCellEditor in JFace-Viewers
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet029VirtualTableViewer.java?view=markup Snippet029VirtualTableViewer]===
+
Demonstrates usage of new OwnerDraw-Support feature provided by JFace in 3.3(available in SWT since 3.2). This example uses the new Viewers API in this special case the ''OwnerDrawLabelProvider''.  
Demonstrates usage of JFace-Viewers in virtual mode with an ordinary content provider (often the bottel neck is not the model but the UI). Using this Virtual viewers in conjunction with an ordinary content provider has the advantage that Sorting and Filtering is supported in 3.3.
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet030VirtualLazyTableViewer.java?view=markup Snippet030VirtualLazyTableViewer]===
+
[[Image:Snippet010.png]]  
Demonstrates usage of JFace-Viewer virtual mode with a lazy content provider
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet031TableViewerCustomTooltipsMultiSelection.java?view=markup Snippet031TableViewerCustomTooltipsMultiSelection]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet011CustomTooltips.java Snippet011CustomTooltips] ===
Demonstrates creation of tooltips for cells for pre 3.3 users
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet032TableTreeViewer.java?view=markup Snippet032TableTreeViewer]===
+
Demonstrates usage of new custom tooltip support in 3.3 used to provide a tooltip for each cell in TableViewer
Demonstrates a JFace-Viewer ontop of the old TableTree-Widget.
+
  
<b>NOTE: DO NOT USE THIS VIEWER ANY MORE. IT IS ONLY KEPT FOR BACKWARDS COMPLIANCE. USE TREEVIEWER INSTEAD.</b>
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet013TableViewerNoMandatoryLabelProvider.java Snippet013TableViewerNoMandatoryLabelProvider]  ===
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet033CellEditorPerRowPre33.java?view=markup Snippet033CellEditorPerRowPre33]===
+
Demonstrates usage of none mandatory LabelProviders in TableViewers to set colors and fonts with 3.2-API
Demonstrates how one can handle different CellEditors-Types in one COLUMN before 3.3 and how difficult this has been.
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet034CellEditorPerRowNewAPI.java?view=markup Snippet034CellEditorPerRowNewAPI]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet014TreeViewerNoMandatoryLabelProvider.java Snippet014TreeViewerNoMandatoryLabelProvider] ===
Demonstrates different CellEditor-Types in one COLUMN with 3.3-API of JFace-Viewers
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet035TableCursorCellHighlighter.java?view=markup Snippet035TableCursorCellHighlighter]===
+
Demonstrates usage of none mandatory LabelProviders in TreeViewers to set colors and font with 3.2-API
Demonstrates keyboard navigation in TableViewers using a TableCursor showing the flexibility of the new cell navigation support
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet036FocusBorderCellHighlighter.java?view=markup Snippet036FocusBorderCellHighlighter]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet015CustomTooltipsForTree.java Snippet015CustomTooltipsForTree] ===
Demonstrates keyboard navigation by highlighting the currently selected cell with a focus border showing once more the flexibility of the new cell navigation support
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet037FancyCustomTooltips.java?view=markup Snippet037FancyCustomTooltips]===
+
Demonstrates usage of new custom tooltip support in 3.3 used to provide a tooltip for each cell in a TreeViewer
Demonstrates customizability of the 3.3 JFace-Support for cell tooltips using the Browser-Widget and presenting HTML
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet038TreeViewerInlinelEditingOldAPI.java?view=markup Snippet038TreeViewerInlinelEditingOldAPI]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet017TableViewerHideShowColumns.java Snippet017TableViewerHideShowColumns] ===
Demonstrates editing support as of 3.2 for TreeViewers
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet039ListViewer.java?view=markup Snippet039ListViewer]===
+
Demonstrates hiding and showing of columns (animated)
Demonstrates a very simple usage of ListViewer
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet040TableViewerSorting.java?view=markup Snippet040TableViewerSorting]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet018TableViewerAddRemoveColumnsWithEditing.java Snippet018TableViewerAddRemoveColumnsWithEditing] ===
Demonstrates sorting(asc/desc) in TableViewers by clicking the column header. This snippet uses classes from JFace 3.3 but can be easily adopted to work with JFace from 3.2
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet041TableViewerAlternatingColors.java?view=markup  Snippet041TableViewerAlternatingColors]===
+
Demonstrates adding/removing of columns in conjunction with inline editing which makes this a bit tougher than without it (using 3.2 API)  
Demonstrates how to achieve alternating row-colors with TableViewer and the new JFace 3.3 API which allows for faster algorithms and can be used in conjunction with virtual-bits to even work with big tables (e.g. 100,000 rows in this example).
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet042ToolTipSupportFor32API.java?view=markup  Snippet042ToolTipSupportFor32API]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet019TableViewerAddRemoveColumnsWithEditingNewAPI.java Snippet019TableViewerAddRemoveColumnsWithEditingNewAPI] ===
Because ColumnViewerToolTipSupport forces one to use the new 3.3 CellLabelProvider-API it is of no use for people stuck with the old LabelProvider API. This snippet shows how a potential class for 3.2 API could look like.
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet043NoColumnTreeViewerKeyboardEditing.java?view=markup  Snippet043NoColumnTreeViewerKeyboardEditing]===
+
Demonstrates adding/removing of columns in conjunction with the inline editing but with the new JFace-API who makes this a much easier and less error prone
Demonstrates the JFace 3.3 keyboard editing support for Trees without columns. Tabbing from editor to editor is supported since 3.4.
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet044NoColumnTableViewerKeyboardEditing.java?view=markup  Snippet044NoColumnTableViewerKeyboardEditing]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet021CellEditorsOnDoubleClick.java Snippet021CellEditorsOnDoubleClick] ===
Demonstrates the JFace 3.3 keyboard editing support for Tables without columns. Tabbing from editor to editor is supported since 3.4.
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet045TableViewerFillFromBackgroundThread.java?view=markup  Snippet045TableViewerFillFromBackgroundThread]===
+
Demonstrates editor activation on double-click with the 3.2 API which makes this fairly complex
Demonstrates how a TableViewer with a sorter can be filled from a NON-UI thread
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet046UpdateViewerFromBackgroundThread.java?view=markup  Snippet046UpdateViewerFromBackgroundThread]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet022TableViewerRefreshNoScroll.java Snippet022TableViewerRefreshNoScroll] ===
Demonstrates how to update a viewer from a long running task (which is executed in a thread) and calls back to the UI-Thread using asyncExec
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet047VirtualLazyTreeViewer.java?view=markup Snippet047VirtualLazyTreeViewer]===
+
Demonstrates how to refresh and viewer without scrolling the selection into after the refresh with 3.2 API. In 3.3 a special refresh-API for TableViewers is added.
Demonstrates the usage of ILazyContentProvider in conjunction with a Virtual-TreeViewer
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet048TreeViewerTabWithCheckboxFor3_3.java?view=markup Snippet048TreeViewerTabWithCheckboxFor3_3]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet024TableViewerExploreNewAPI.java Snippet024TableViewerExploreNewAPI] ===
Demonstrates how to overcome a limitation when it comes to key-navigation and CheckBoxEditors in 3.3.1.
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet049StyledCellLabelProvider.java?view=markup Snippet049StyledCellLabelProvider]===
+
Demonstrates the base classes of 3.3 API
Demonstrates a new LabelProvider-Type which uses StyleRanges. This Snippet requires SWT/JFace 3.4.
+
  
[[Image:Snippet050DelegatingStyledCellLabelProvider.gif]]
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet025TabEditing.java Snippet025TabEditing] ===
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet050DelegatingStyledCellLabelProvider.java?view=markup Snippet050DelegatingStyledCellLabelProvider]===
+
Demonstrates how one can use the new 3.3 API to add tab-editing support to your viewer
Demonstrates how you can add styled text by wrapping an existing label provider. This Snippet requires SWT/JFace 3.4.
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet051TableCenteredImage.java?view=markup Snippet051TableCenteredImage]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet026TreeViewerTabEditing.java Snippet026TreeViewerTabEditing] ===
Demonstrate how to center an image using owner draw. This snippet requires SWT/JFace 3.3.
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet052DouleClickCellEditor.java?view=markup Snippet052DouleClickCellEditor]===
+
Demonstrates all fancy things one can do with new 3.3 API (Tab-Editing, Keyboard-Navigation from Cell to Cell, Editor-Activation with the Keyboard)
Demonstrate how to start cell-editors on double click. This snippet requires SWT/JFace 3.3
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet053StartEditorWithContextMenu.java?view=markup Snippet053StartEditorWithContextMenu]===
+
[[Image:Snippet026TreeViewerTabEditing.gif]]  
Demonstrate how to start up an editor with a context menu and not with mouse clicking on the cell.
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet055HideShowColumn.java?view=markup Snippet055HideShowColumn]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet027ComboBoxCellEditors.java Snippet027ComboBoxCellEditors] ===
Demonstrate hiding and showing columns
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet056BooleanCellEditor.java?view=markup Snippet056BooleanCellEditor]===
+
Demonstrates usage of the ComboBoxCellEditor in JFace-Viewers
Demonstrate a custom cell-editor which uses a real Checkbox-Button
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet057TableViewerSkipHiddenCells.java?view=markup Snippet057TableViewerSkipHiddenCells]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet029VirtualTableViewer.java Snippet029VirtualTableViewer] ===
Example of showing how easy cell-navigation with hidden cells is in 3.4
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet058CellNavigationIn34.java?view=markup Snippet058CellNavigationIn34]===
+
Demonstrates usage of JFace-Viewers in virtual mode with an ordinary content provider (often the bottel neck is not the model but the UI). Using this Virtual viewers in conjunction with an ordinary content provider has the advantage that Sorting and Filtering is supported in 3.3.  
Example for full feature cell navigation until bug 230955 is fixed
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet059CellNavigationIn33.java?view=markup Snippet059CellNavigationIn33]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet030VirtualLazyTableViewer.java Snippet030VirtualLazyTableViewer] ===
Example for full feature cell navigation in 3.3. This snippet uses internal API by reflection so its not guaranteed to work for ever. The problem of invisible cells is fixed in 3.4. The problem with horizontal scrolling is going to be fixed in 3.5.
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet060TextCellEditorWithContentProposal.java?view=markup Snippet060TextCellEditorWithContentProposal]===
+
Demonstrates usage of JFace-Viewer virtual mode with a lazy content provider
Show how to use content-proposal inside a CellEditor
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet061FakedNativeCellEditor.java?view=markup Snippet061FakedNativeCellEditor]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet031TableViewerCustomTooltipsMultiSelection.java Snippet031TableViewerCustomTooltipsMultiSelection] ===
Full featured native looking viewer with checkboxes in an arbitary column
+
  
==Window==
+
Demonstrates creation of tooltips for cells for pre 3.3 users
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/window/Snippet020CustomizedControlTooltips.java?view=markup Snippet020CustomizedControlTooltips]===
+
Demonstrates usage of new JFace 3.3 to show really cool ToolTips for your controls
+
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/window/Snippet023TreeViewerCustomTooltips.java?view=markup Snippet023TreeViewerCustomTooltips]===
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet034CellEditorPerRow.java Snippet034CellEditorPerRowNewAPI]  ===
Demonstrates creation of ToolTips for users pre 3.3.
+
 
 +
Demonstrates different CellEditor-Types in one COLUMN of JFace-Viewers
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet035TableCursorCellHighlighter.java Snippet035TableCursorCellHighlighter] ===
 +
 
 +
Demonstrates keyboard navigation in TableViewers using a TableCursor showing the flexibility of the new cell navigation support
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet036FocusBorderCellHighlighter.java Snippet036FocusBorderCellHighlighter]  ===
 +
 
 +
Demonstrates keyboard navigation by highlighting the currently selected cell with a focus border showing once more the flexibility of the new cell navigation support
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet037FancyCustomTooltips.java Snippet037FancyCustomTooltips]  ===
 +
 
 +
Demonstrates customizability of the 3.3 JFace-Support for cell tooltips using the Browser-Widget and presenting HTML
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet038TreeViewerInlinelEditingOldAPI.java Snippet038TreeViewerInlinelEditingOldAPI]  ===
 +
 
 +
Demonstrates editing support as of 3.2 for TreeViewers
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet039ListViewer.java Snippet039ListViewer]  ===
 +
 
 +
Demonstrates a very simple usage of ListViewer
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet040TableViewerSorting.java Snippet040TableViewerSorting]  ===
 +
 
 +
Demonstrates sorting(asc/desc) in TableViewers by clicking the column header. This snippet uses classes from JFace 3.3 but can be easily adopted to work with JFace from 3.2
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet041TableViewerAlternatingColors.java Snippet041TableViewerAlternatingColors]  ===
 +
 
 +
Demonstrates how to achieve alternating row-colors with TableViewer and the new JFace 3.3 API which allows for faster algorithms and can be used in conjunction with virtual-bits to even work with big tables (e.g. 100,000 rows in this example).
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet042ToolTipSupportFor32API.java Snippet042ToolTipSupportFor32API]  ===
 +
 
 +
Because ColumnViewerToolTipSupport forces one to use the new 3.3 CellLabelProvider-API it is of no use for people stuck with the old LabelProvider API. This snippet shows how a potential class for 3.2 API could look like.
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet043NoColumnTreeViewerKeyboardEditing.java Snippet043NoColumnTreeViewerKeyboardEditing]  ===
 +
 
 +
Demonstrates the JFace 3.3 keyboard editing support for Trees without columns. Tabbing from editor to editor is supported since 3.4.
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet044NoColumnTableViewerKeyboardEditing.java Snippet044NoColumnTableViewerKeyboardEditing]  ===
 +
 
 +
Demonstrates the JFace 3.3 keyboard editing support for Tables without columns. Tabbing from editor to editor is supported since 3.4.
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet045TableViewerFillFromBackgroundThread.java Snippet045TableViewerFillFromBackgroundThread]  ===
 +
 
 +
Demonstrates how a TableViewer with a sorter can be filled from a NON-UI thread
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet046UpdateViewerFromBackgroundThread.java Snippet046UpdateViewerFromBackgroundThread]  ===
 +
 
 +
Demonstrates how to update a viewer from a long running task (which is executed in a thread) and calls back to the UI-Thread using asyncExec
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet047VirtualLazyTreeViewer.java Snippet047VirtualLazyTreeViewer]  ===
 +
 
 +
Demonstrates the usage of ILazyContentProvider in conjunction with a Virtual-TreeViewer
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet048TreeViewerTabWithCheckboxFor3_3.java Snippet048TreeViewerTabWithCheckboxFor3_3]  ===
 +
 
 +
Demonstrates how to overcome a limitation when it comes to key-navigation and CheckBoxEditors in 3.3.1.
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet049StyledCellLabelProvider.java Snippet049StyledCellLabelProvider]  ===
 +
 
 +
Demonstrates a new LabelProvider-Type which uses StyleRanges. This Snippet requires SWT/JFace 3.4.
 +
 
 +
[[Image:Snippet050DelegatingStyledCellLabelProvider.gif]]
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet050DelegatingStyledCellLabelProvider.java Snippet050DelegatingStyledCellLabelProvider]  ===
 +
 
 +
Demonstrates how you can add styled text by wrapping an existing label provider. This Snippet requires SWT/JFace 3.4.
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet051TableCenteredImage.java Snippet051TableCenteredImage]  ===
 +
 
 +
Demonstrate how to center an image using owner draw. This snippet requires SWT/JFace 3.3.
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet052DouleClickCellEditor.java Snippet052DouleClickCellEditor]  ===
 +
 
 +
Demonstrate how to start cell-editors on double click. This snippet requires SWT/JFace 3.3
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet053StartEditorWithContextMenu.java Snippet053StartEditorWithContextMenu]  ===
 +
 
 +
Demonstrate how to start up an editor with a context menu and not with mouse clicking on the cell.
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet055HideShowColumn.java Snippet055HideShowColumn]  ===
 +
 
 +
Demonstrate hiding and showing columns
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet056BooleanCellEditor.java Snippet056BooleanCellEditor]  ===
 +
 
 +
Demonstrate a custom cell-editor which uses a real Checkbox-Button
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet057TableViewerSkipHiddenCells.java Snippet057TableViewerSkipHiddenCells]  ===
 +
 
 +
Example of showing how easy cell-navigation with hidden cells is in 3.4
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet058CellNavigationIn34.java Snippet058CellNavigationIn34]  ===
 +
 
 +
Example for full feature cell navigation until bug 230955 is fixed
 +
 
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet060TextCellEditorWithContentProposal.java Snippet060TextCellEditorWithContentProposal]  ===
 +
 
 +
Show how to use content-proposal inside a CellEditor
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet061FakedNativeCellEditor.java Snippet061FakedNativeCellEditor]  ===
 +
 
 +
Full featured native looking viewer with checkboxes in an arbitary column
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet62TextAndDialogCellEditor.java Snippet062TextAndDialogCellEditor] ===
 +
 
 +
Demonstrates usage of TextAndDialogCellEditor. The email column uses the TextAndDialogCellEditor; othe columns use ordinary TextCellEditor.
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet063ComboViewer.java Snippet063ComboViewer] ===
 +
 
 +
Show how to use ComboViewer and set a inital selection
 +
 
 +
== Window  ==
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/window/Snippet020CustomizedControlTooltips.java Snippet020CustomizedControlTooltips]  ===
 +
 
 +
Demonstrates usage of new JFace 3.3 to show really cool ToolTips for your controls
 +
 
 +
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/window/Snippet031TableStaticTooltip.java Snippet031TableStaticTooltip]  ===
  
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/window/Snippet031TableStaticTooltip.java?view=markup Snippet031TableStaticTooltip.java]===
 
 
Demonstrates creation of ToolTips for Tables without using the JFace-Viewers API but only JFace-Tooltips
 
Demonstrates creation of ToolTips for Tables without using the JFace-Viewers API but only JFace-Tooltips
  
==Wizard==
+
== Wizard ==
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/wizard/Snippet047WizardWithLongRunningOperation.java?view=markup  Snippet047WizardWithLongRunningOperation]===
+
 
Demonstrates how to work with JFace-Wizards and fill a TableViewer from a Background-Thread without blocking the UI showing a progress bar in the meanwhile
+
=== [http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/wizard/Snippet047WizardWithLongRunningOperation.java Snippet047WizardWithLongRunningOperation] ===
 +
 
 +
Demonstrates how to work with JFace-Wizards and fill a TableViewer from a Background-Thread without blocking the UI showing a progress bar in the meanwhile  
 +
 
  
[[Category:Snippets]][[Category:RCP]][[Category:Platform UI]]
+
[[Category:Snippets]] [[Category:RCP]] [[Category:Platform_UI]]

Latest revision as of 10:23, 6 May 2014

JFace-Snippets are small easy understandable programming example how to use JFace API. To browse the examples, navigate to theexamples GIT repository.

Contents

[edit] Dialogs

[edit] Snippet012DialogWithImageButtons

Demonstrates usage of Icons in Buttons of Dialogs

[edit] Layout

[edit] Snippet013GridLayoutFactory

Demonstrates usage of the GridLayoutFactory to make more readable

[edit] Snippet016TableLayout

Demonstrates (dynamic)layout support for TableColumns available as of JFace 3.3

[edit] Snippet027TreeLayout

Demonstrates (dynamic)layout support for TreeColumns available as of JFace 3.3

[edit] Viewers

[edit] Snippet001TableViewer

Demonstrates a simply TableViewer with one column. It holds all important classes used for all Table-like JFace-Viewers (LabelProvider,IStructuredContentProvider)

Snippet1.png

[edit] Snippet002TreeViewer

Demonstrates a simply TreeViewer with one column. It describes all important classes used for all Tree-like JFace-Viewers (LabelProvider,ITreeContentProvider)

Snippet2.png

[edit] Snippet003TableLabelProvider

Demonstrates tables with more than one column and the usage of ITableLabelProvider

File:Snippet3.png

[edit] Snippet004HideSelection

Demonstrates how the selection can be hidden when the user click in a tablerow/column which doesn't hold any information. The standard behaviour of SWT-Table is to leave the selection on the last column. This snippet removes the selection if the user clicks in an area not selectable

Snippet004.png

[edit] Snippet005TreeCustomMenu

Demonstrates how to create a different context menu depending on which item in the tree is currently selected this can also be used with a table of course

Snippet005.png

[edit] Snippet006TableMultiLineCells

Demonstrates first use case for the new OwnerDraw-Support added to JFace in 3.3 (available at SWT-Level since 3.2). This example uses the new Viewers API in this special case the OwnerDrawLabelProvider to make items with more than one line of text.

Snippet006.png

[edit] Snippet007FullSelection

Demonstrates how you can use a use inline editing in tables with multiple columns which requires to use SWT.FULL_SELECTION but hiding the selection from the user.

Snippet007.png

[edit] Snippet008RevealElement

Demonstrates how you can scroll a TableViewer to the specific model element using TableViewer#reveal(Object)

Snippet008.png

[edit] Snippet009CellEditors

Demonstrates minimal example when trying to add inline editing to tables to get familiar with the various classes needed (3.2 API)

Snippet009.png

[edit] Snippet010OwnerDraw

Demonstrates usage of new OwnerDraw-Support feature provided by JFace in 3.3(available in SWT since 3.2). This example uses the new Viewers API in this special case the OwnerDrawLabelProvider.

Snippet010.png

[edit] Snippet011CustomTooltips

Demonstrates usage of new custom tooltip support in 3.3 used to provide a tooltip for each cell in TableViewer

[edit] Snippet013TableViewerNoMandatoryLabelProvider

Demonstrates usage of none mandatory LabelProviders in TableViewers to set colors and fonts with 3.2-API

[edit] Snippet014TreeViewerNoMandatoryLabelProvider

Demonstrates usage of none mandatory LabelProviders in TreeViewers to set colors and font with 3.2-API

[edit] Snippet015CustomTooltipsForTree

Demonstrates usage of new custom tooltip support in 3.3 used to provide a tooltip for each cell in a TreeViewer

[edit] Snippet017TableViewerHideShowColumns

Demonstrates hiding and showing of columns (animated)

[edit] Snippet018TableViewerAddRemoveColumnsWithEditing

Demonstrates adding/removing of columns in conjunction with inline editing which makes this a bit tougher than without it (using 3.2 API)

[edit] Snippet019TableViewerAddRemoveColumnsWithEditingNewAPI

Demonstrates adding/removing of columns in conjunction with the inline editing but with the new JFace-API who makes this a much easier and less error prone

[edit] Snippet021CellEditorsOnDoubleClick

Demonstrates editor activation on double-click with the 3.2 API which makes this fairly complex

[edit] Snippet022TableViewerRefreshNoScroll

Demonstrates how to refresh and viewer without scrolling the selection into after the refresh with 3.2 API. In 3.3 a special refresh-API for TableViewers is added.

[edit] Snippet024TableViewerExploreNewAPI

Demonstrates the base classes of 3.3 API

[edit] Snippet025TabEditing

Demonstrates how one can use the new 3.3 API to add tab-editing support to your viewer

[edit] Snippet026TreeViewerTabEditing

Demonstrates all fancy things one can do with new 3.3 API (Tab-Editing, Keyboard-Navigation from Cell to Cell, Editor-Activation with the Keyboard)

Snippet026TreeViewerTabEditing.gif

[edit] Snippet027ComboBoxCellEditors

Demonstrates usage of the ComboBoxCellEditor in JFace-Viewers

[edit] Snippet029VirtualTableViewer

Demonstrates usage of JFace-Viewers in virtual mode with an ordinary content provider (often the bottel neck is not the model but the UI). Using this Virtual viewers in conjunction with an ordinary content provider has the advantage that Sorting and Filtering is supported in 3.3.

[edit] Snippet030VirtualLazyTableViewer

Demonstrates usage of JFace-Viewer virtual mode with a lazy content provider

[edit] Snippet031TableViewerCustomTooltipsMultiSelection

Demonstrates creation of tooltips for cells for pre 3.3 users

[edit] Snippet034CellEditorPerRowNewAPI

Demonstrates different CellEditor-Types in one COLUMN of JFace-Viewers

[edit] Snippet035TableCursorCellHighlighter

Demonstrates keyboard navigation in TableViewers using a TableCursor showing the flexibility of the new cell navigation support

[edit] Snippet036FocusBorderCellHighlighter

Demonstrates keyboard navigation by highlighting the currently selected cell with a focus border showing once more the flexibility of the new cell navigation support

[edit] Snippet037FancyCustomTooltips

Demonstrates customizability of the 3.3 JFace-Support for cell tooltips using the Browser-Widget and presenting HTML

[edit] Snippet038TreeViewerInlinelEditingOldAPI

Demonstrates editing support as of 3.2 for TreeViewers

[edit] Snippet039ListViewer

Demonstrates a very simple usage of ListViewer

[edit] Snippet040TableViewerSorting

Demonstrates sorting(asc/desc) in TableViewers by clicking the column header. This snippet uses classes from JFace 3.3 but can be easily adopted to work with JFace from 3.2

[edit] Snippet041TableViewerAlternatingColors

Demonstrates how to achieve alternating row-colors with TableViewer and the new JFace 3.3 API which allows for faster algorithms and can be used in conjunction with virtual-bits to even work with big tables (e.g. 100,000 rows in this example).

[edit] Snippet042ToolTipSupportFor32API

Because ColumnViewerToolTipSupport forces one to use the new 3.3 CellLabelProvider-API it is of no use for people stuck with the old LabelProvider API. This snippet shows how a potential class for 3.2 API could look like.

[edit] Snippet043NoColumnTreeViewerKeyboardEditing

Demonstrates the JFace 3.3 keyboard editing support for Trees without columns. Tabbing from editor to editor is supported since 3.4.

[edit] Snippet044NoColumnTableViewerKeyboardEditing

Demonstrates the JFace 3.3 keyboard editing support for Tables without columns. Tabbing from editor to editor is supported since 3.4.

[edit] Snippet045TableViewerFillFromBackgroundThread

Demonstrates how a TableViewer with a sorter can be filled from a NON-UI thread

[edit] Snippet046UpdateViewerFromBackgroundThread

Demonstrates how to update a viewer from a long running task (which is executed in a thread) and calls back to the UI-Thread using asyncExec

[edit] Snippet047VirtualLazyTreeViewer

Demonstrates the usage of ILazyContentProvider in conjunction with a Virtual-TreeViewer

[edit] Snippet048TreeViewerTabWithCheckboxFor3_3

Demonstrates how to overcome a limitation when it comes to key-navigation and CheckBoxEditors in 3.3.1.

[edit] Snippet049StyledCellLabelProvider

Demonstrates a new LabelProvider-Type which uses StyleRanges. This Snippet requires SWT/JFace 3.4.

Snippet050DelegatingStyledCellLabelProvider.gif

[edit] Snippet050DelegatingStyledCellLabelProvider

Demonstrates how you can add styled text by wrapping an existing label provider. This Snippet requires SWT/JFace 3.4.

[edit] Snippet051TableCenteredImage

Demonstrate how to center an image using owner draw. This snippet requires SWT/JFace 3.3.

[edit] Snippet052DouleClickCellEditor

Demonstrate how to start cell-editors on double click. This snippet requires SWT/JFace 3.3

[edit] Snippet053StartEditorWithContextMenu

Demonstrate how to start up an editor with a context menu and not with mouse clicking on the cell.

[edit] Snippet055HideShowColumn

Demonstrate hiding and showing columns

[edit] Snippet056BooleanCellEditor

Demonstrate a custom cell-editor which uses a real Checkbox-Button

[edit] Snippet057TableViewerSkipHiddenCells

Example of showing how easy cell-navigation with hidden cells is in 3.4

[edit] Snippet058CellNavigationIn34

Example for full feature cell navigation until bug 230955 is fixed


[edit] Snippet060TextCellEditorWithContentProposal

Show how to use content-proposal inside a CellEditor

[edit] Snippet061FakedNativeCellEditor

Full featured native looking viewer with checkboxes in an arbitary column

[edit] Snippet062TextAndDialogCellEditor

Demonstrates usage of TextAndDialogCellEditor. The email column uses the TextAndDialogCellEditor; othe columns use ordinary TextCellEditor.

[edit] Snippet063ComboViewer

Show how to use ComboViewer and set a inital selection

[edit] Window

[edit] Snippet020CustomizedControlTooltips

Demonstrates usage of new JFace 3.3 to show really cool ToolTips for your controls

[edit] Snippet031TableStaticTooltip

Demonstrates creation of ToolTips for Tables without using the JFace-Viewers API but only JFace-Tooltips

[edit] Wizard

[edit] Snippet047WizardWithLongRunningOperation

Demonstrates how to work with JFace-Wizards and fill a TableViewer from a Background-Thread without blocking the UI showing a progress bar in the meanwhile