Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "JFaceSnippets"
(→Viewers) |
(→Viewers) |
||
Line 27: | Line 27: | ||
===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet006TableMultiLineCells.java?view=markup Snippet006TableMultiLineCells]=== | ===[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 first use case for the new OwnerDraw-Support added to JFace in 3.3 (available at SWT-Level since 3.2). This uses the new Viewers API in this special case the ''OwnerDrawLabelProvider'' to make items with more than one line of text. | + | 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:Snippet006.png]] | ||
Line 45: | Line 45: | ||
[[Image:Snippet009.png]] | [[Image:Snippet009.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]=== | ||
+ | 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]] | ||
+ | |||
+ | ===[http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.snippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippets/viewers/Snippet011CustomTooltips.java?view=markup Snippet011CustomTooltips] | ||
+ | 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]=== | ||
+ | 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 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]=== | ||
+ | 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]=== | ||
+ | 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 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]=== | ||
+ | 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]=== | ||
+ | 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 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]=== | ||
+ | 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]=== | ||
+ | Demonstrates how one can use the new 3.3 API to add tab-editing support to your viewer | ||
[[Category:Snippets]] | [[Category:Snippets]] |
Revision as of 15:36, 18 June 2007
JFace-Snippets are small easy understandable programming example how to use JFace API. You can find them in CVS JFace code snippets:
Contents
- 1 Viewers
- 1.1 Snippet001TableViewer
- 1.2 Snippet002TreeViewer
- 1.3 Snippet003TableLabelProvider
- 1.4 Snippet004HideSelection
- 1.5 Snippet005TreeCustomMenu
- 1.6 Snippet006TableMultiLineCells
- 1.7 Snippet007FullSelection
- 1.8 Snippet008RevealElement
- 1.9 Snippet009CellEditors
- 1.10 Snippet010OwnerDraw
- 1.11 Snippet013TableViewerNoMandatoryLabelProvider
- 1.12 Snippet014TreeViewerNoMandatoryLabelProvider
- 1.13 Snippet015CustomTooltipsForTree
- 1.14 Snippet017TableViewerHideShowColumns
- 1.15 Snippet018TableViewerAddRemoveColumnsWithEditing
- 1.16 Snippet019TableViewerAddRemoveColumnsWithEditingNewAPI
- 1.17 Snippet021CellEditorsOnDoubleClick
- 1.18 Snippet022TableViewerRefreshNoScroll
- 1.19 Snippet024TableViewerExploreNewAPI
- 1.20 Snippet025TabEditing
Viewers
Snippet001TableViewer
Demonstrates a simply TableViewer with one column. It holds all important classes used for all Table-like JFace-Viewers (LabelProvider,IStructuredContentProvider)
Snippet002TreeViewer
Demonstrates a simply TreeViewer with one column. It describes all important classes used for all Tree-like JFace-Viewers (LabelProvider,ITreeContentProvider)
Snippet003TableLabelProvider
Demonstrates tables with more than one column and the usage of ITableLabelProvider
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
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
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.
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.
Snippet008RevealElement
Demonstrates how you can scroll a TableViewer to the specific model element using TableViewer#reveal(Object)
Snippet009CellEditors
Demonstrates minimal example when trying to add inline editing to tables to get familiar with the various classes needed (3.2 API)
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.
===Snippet011CustomTooltips Demonstrates usage of new custom tooltip support in 3.3 used to provide a tooltip for each cell in TableViewer
Snippet013TableViewerNoMandatoryLabelProvider
Demonstrates usage of none mandatory LabelProviders in TableViewers to set colors and fonts with 3.2-API
Snippet014TreeViewerNoMandatoryLabelProvider
Demonstrates usage of none mandatory LabelProviders in TreeViewers to set colors and font with 3.2-API
Snippet015CustomTooltipsForTree
Demonstrates usage of new custom tooltip support in 3.3 used to provide a tooltip for each cell in a TreeViewer
Snippet017TableViewerHideShowColumns
Demonstrates hiding and showing of columns (animated)
Snippet018TableViewerAddRemoveColumnsWithEditing
Demonstrates adding/removing of columns in conjunction with inline editing which makes this a bit tougher than without it (using 3.2 API)
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
Snippet021CellEditorsOnDoubleClick
Demonstrates editor activation on double-click with the 3.2 API which makes this fairly complex
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.
Snippet024TableViewerExploreNewAPI
Demonstrates the base classes of 3.3 API
Snippet025TabEditing
Demonstrates how one can use the new 3.3 API to add tab-editing support to your viewer