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 2 – Creating Views with SWT


Understanding views

1. In the Eclipse 3.x model, views must be subclasses of ViewPart. In the Eclipse 4.x model, parts do not need to have an explicit superclass.

2. In the Eclipse 3.x model, views are registered via an org.eclipse.ui.views extension point in the plugin.xml.

3. The two arguments that most SWT objects have are a Composite parent and an integer flags field.

4. When a widget is disposed, it will have its native resources released to the operating system. Any subsequent actions will throw an SWTException with a Widget is disposed message.

5. The Canvas has many drawing operations; to draw a circle, use drawArc(), and specify a full orbit.

6. To receive drawing events, a PaintListener must be created and associated with the control by using the addPaintListener method.

7. UI updates not on the UI thread will generate an SWTException with an Invalid thread access error.

8. To perform an update on a widget from a non-UI thread, use the asyncExec or syncExec methods from Display (3.x) or UISynchronize (4.x) to wrap a Runnable or lambda that will run on the UI thread.

9. SWT.DEFAULT is used to indicate default options in the flags parameter that is passed to the construction of an SWT widget.

10. Create a RowData object with the given size, and associate it with each widget.

Understanding resources

1. Resource leaks occur when an SWT Resource is acquired from the OS but then not returned to it via a dispose method prior to the object being garbage collected.

2. The different types of resources are Color, Cursor, Font, GC, Image, Path, Pattern, Region, TextLayout, and Transform.

3. Run the Eclipse instance in tracing mode, with org.eclipse.ui/debug and org.eclipse.ui/trace/graphics set, specified in a debug file, and launched with -debug.

4. Use the Display.getDeviceData() to get the objects arrays, and iterate through them.

5. The right way is to register a DisposeListener with the view, and the wrong way is to override the dispose method.

Understanding widgets

1. Using the setFocus method to set the focus on a particular widget.

2. Invoking redraw will allow the widget to redraw itself.

3. The combo can have a SelectionListener associated with it.

4. The widgetDefaultSelected is what is called when the default value is used, typically an empty value.

Using SWT

1. Use the Tray and TrayItem widgets.

2. The NO_TRIM means don't draw the edges of the window, or the close/maximize/minimize buttons.

3. Use setAlpha to control a widget's transparency, including shells.

4. setRegion with a path describing the shape.

5. A Group allows you to group things together with a standard item.

6. Most composites use a null layout manager by default; it's only shells and dialogs that have a non-default value.

7. Use a ScrolledComposite.

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 €14.99/month. Cancel anytime}