Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Eclipse Plug-in Development Beginner's Guide - Second Edition

You're reading from  Eclipse Plug-in Development Beginner's Guide - Second Edition

Product type Book
Published in Aug 2016
Publisher
ISBN-13 9781783980697
Pages 458 pages
Edition 2nd Edition
Languages
Author (1):
Alex Blewitt Alex Blewitt
Profile icon Alex Blewitt

Table of Contents (24) Chapters

Eclipse Plug-in Development Beginner's Guide Second Edition
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
1. Creating Your First Plug-in 2. Creating Views with SWT 3. Creating JFace Viewers 4. Interacting with the User 5. Working with Preferences 6. Working with Resources 7. Creating Eclipse 4 Applications 8. Migrating to Eclipse 4.x 9. Styling Eclipse 4 Applications 10. Creating Features, Update Sites, Applications, and Products 11. Automated Testing of Plug-ins 12. Automated Builds with Tycho 13. Contributing to Eclipse Using OSGi Services to Dynamically Wire Applications Pop Quiz Answers Index

Chapter 3 – Creating JFace Viewers


Understanding JFace

1. getImage() is called to determine what image to show for an entry, while getText() is used to determine the text value of an entry.

2. The hasChildren() method is used to determine whether or not an element is shown with an expandable element, and getChildren() is used to calculate a list of children.

3. An ImageRegistry is used to share images between plug-ins or different views in plug-ins, with a means of clearing up the resources when the view is disposed.

4. Entries can be styled with an IStyledLabelProvider.

Understanding sorting and filters

1. Specifying a ViewerComparator can allow elements to be sorted in a different order other than the default one.

2. The select() method is used to filter elements, which is originally derived from the Smalltalk terminology.

3. Multiple filters can be combined by setting an array of filters, or by writing a filter to combine two or more filters together.

Understanding interaction

1. Add a DoubleClickListener to the view.

2. Dialog subclasses are used to create a Dialog with custom content.

Understanding tables

1. To show the headers, get the Table from the viewer, and use it to call the setHeaderVisible(true).

2. TableViewerColumn instances are used to set properties on individual columns and to bind the label provider for the columns.

3. An ArrayContentProvider can be used to store items as an array.

4. The TableViewerColumn is a class in the JFace package which defines where the data comes from; the TableColumn is the underlying SWT widget that the width of the column.

Understanding selection

1. Viewers have the getSelection and setSelection methods to get and set the selection, using the ISelection interface (or more commonly the IStructuredSelection interface).

2. The ISelectionChangedListener interface is used to receive notifications for selection changes from a viewer.

3. E4 uses the ESelectionService to maintain the selected object in the workspace, which can be injected into a part.

4. Although the currently selected object can be injected as a field into a part, it is more common to use an optional method with a @Named argument of IServiceConstants.ACTIVE_SELECTION.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}