Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Eclipse Plug-in Development Beginner's Guide
Eclipse Plug-in Development Beginner's Guide

Eclipse Plug-in Development Beginner's Guide: Extend and customize Eclipse , Second Edition

eBook
€8.99 €32.99
Paperback
€41.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Eclipse Plug-in Development Beginner's Guide

Chapter 2. Creating Views with SWT

SWT – the Standard Widget Toolkit

SWT is the widget toolkit used by Eclipse that gives performant access to the platform's native tools in a portable manner. Unlike Swing, which is rendered with Java native drawing operations, SWT delegates the drawing to the underlying operating system.

In this chapter we will:

  • Create an Eclipse view with SWT widgets
  • Create a custom SWT widget
  • Work with SWT resources and learn how to detect and fix resource leaks
  • Handle focus operations
  • Group components and resize them automatically
  • Create system tray items
  • Display nonrectangular windows
  • Provide scrolling and tabbed navigation

Creating views and widgets

This section introduces views and widgets by creating clocks that can be used to display time zones in Eclipse.

Time for action – creating a view

The Eclipse UI consists of multiple views, which are the rectangular areas that display content, such as the Outline, Console, or Package Explorer. In Eclipse 3.x, views are created by adding an extension point to an existing plug-in, or using a template. A clock.ui plug-in will be created to host the clock widgets and views.

  1. Open the plug-in wizard by navigating to File | New | Other | Plug-in Project. Enter the details as follows:
    1. Set Project name to com.packtpub.e4.clock.ui.
    2. Ensure that Use default location is selected.
    3. Ensure that Create a Java project is selected.
    4. The Eclipse Version should be targeted to 3.5 or greater.
  2. Click on Next again, and fill in the plug-in properties:
    1. Set ID to com.packtpub.e4.clock.ui.
    2. Set Version to 1.0.0.qualifier.
    3. Set Name to Clock.
    4. Set Vendor to PacktPub.
    5. Ensure that Generate an Activator is selected.
    6. Set the Activator to com.packtpub.e4.clock.ui.Activator.
    7. Ensure that This plug-in will make contributions to the UI is selected...

Time for action – drawing a custom view

An SWT Canvas can be used to provide custom rendering for a view. As a starting point for drawing a clock, the Canvas will use drawArc to create a circle.

  1. Remove the content of the ClockView, leaving behind an empty implementation of the setFocus and createPartControl methods.
  2. Run the target Eclipse instance and you will see that the ClockView is now empty.
  3. Create a new method called drawClock that takes a PaintEvent, and use the graphics context gc from the event to draw the circle.
  4. In the createPartControl method, do the following:
    1. Create a new Canvas, which is a drawable widget.
    2. Add a PaintListener to the Canvas that uses a method reference to the drawClock method.
  5. The code will look like this:
    package com.packtpub.e4.clock.ui.views;
    import org.eclipse.swt.*;
    import org.eclipse.swt.events.*;
    import org.eclipse.swt.widgets.*;
    import org.eclipse.ui.part.ViewPart;
    public class ClockView extends ViewPart {
      public void createPartControl(Composite parent...

Time for action – drawing a seconds hand

A clock with no hands and no numbers is just a circle. To change this, a second hand will be drawn using a filled arc.

Since arcs are drawn anticlockwise from 0 (on the right, or 3 o'clock) through 90 degrees (12 o'clock), then 180 degrees (9 o'clock), then 270 degrees (6 o'clock), and finally back to 360 degrees (3 o'clock), it is possible to calculate the arc's position for the second hand using the expression (15 – seconds) * 6 % 360.

  1. Go to the drawClock method of the ClockView class.
  2. Add a variable called seconds that is initialized to LocalTime.now().getSecond().
  3. Get the SWT.COLOR_BLUE via the display, and store it in a local variable, blue.
  4. Set the background color of the graphics context to blue.
  5. Draw an arc using the formula mentioned earlier to draw the second hand.
  6. The code should look like this:
    public void paintControl(PaintEvent e) {
      e.gc.drawArc(e.x, e.y, e.width-1, e.height-1, 0, 360);
      int seconds...

Time for action – animating the second hand

The second hand is drawn with a redraw on the Canvas, but this will need to be run periodically. If it is redrawn once per second, it can emulate a clock ticking.

Eclipse has a jobs plug-in, which would be just right for this task, but this will be covered in Chapter 4, Interacting with the User. So to begin with, a simple Thread will be used to issue the redraw.

  1. Open the ClockView class.
  2. Add the following at the bottom of the createPartControl method:
    Runnable redraw = () -> {
      while (!clock.isDisposed()) {
        clock.redraw();
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e) {
          return;
        }
      }
    };
    new Thread(redraw, "TickTock").start();
  3. Relaunch the test Eclipse instance, and open the Clock View.
  4. Open the host Eclipse instance and look in the Console View for the errors.

What just happened?

When the ClockView is shown, a Thread is created and started, which redraws the clock once per second. When it...

Time for action – running on the UI thread

To execute code on the UI thread, Runnable instances must be posted to the Display via one of two methods, syncExec or asyncExec. The syncExec method runs the code synchronously (the caller blocks until the code has been run) while the asyncExec method runs the code asynchronously (the caller continues while the code is run in the background).

The Display class is SWT's handle to a monitor (so a runtime may have more than one Display object, and each may have its own resolution). To get hold of an instance, call either Display.getCurrent() or Display.getDefault(). However, it's much better to get a Display from an associated view or widget. In this case, the Canvas has an associated Display.

  1. Go to the TickTock thread inside the createPartControl method of the ClockView class.
  2. Inside the redraw lambda, replace the call to clock.redraw() with this:
    // clock.redraw();
    clock.getDisplay().asyncExec(() -> clock.redraw());
  3. Run the target...

Time for action – creating a reusable widget

Although the ClockView shows a single animated clock, creating an independent widget will allow the clock to be reused in other places.

  1. Create a new class in the com.packtpub.e4.clock.ui package, called ClockWidget, that extends Canvas.
  2. Create a constructor that takes a Composite parent and an int style bits parameter, and pass them to the superclass:
    public ClockWidget(Composite parent, int style) {
      super(parent, style);
    }
  3. Move the implementation of the drawClock method from the ClockView to the ClockWidget. Remove the PaintListener references from the ClockView class.
  4. In the ClockWidget constructor, register a PaintListener that delegates the call to the drawClock method:
    addPaintListener(this::drawClock);
  5. Move the TickTock thread from the ClockView to the ClockWidget constructor; this will allow the ClockWidget to operate independently. Change any references for clock to this:
    Runnable redraw = () -> {
      while (!this.isDisposed()) {
     ...

Creating views and widgets


This section introduces views and widgets by creating clocks that can be used to display time zones in Eclipse.

Time for action – creating a view


The Eclipse UI consists of multiple views, which are the rectangular areas that display content, such as the Outline, Console, or Package Explorer. In Eclipse 3.x, views are created by adding an extension point to an existing plug-in, or using a template. A clock.ui plug-in will be created to host the clock widgets and views.

  1. Open the plug-in wizard by navigating to File | New | Other | Plug-in Project. Enter the details as follows:

    1. Set Project name to com.packtpub.e4.clock.ui.

    2. Ensure that Use default location is selected.

    3. Ensure that Create a Java project is selected.

    4. The Eclipse Version should be targeted to 3.5 or greater.

  2. Click on Next again, and fill in the plug-in properties:

    1. Set ID to com.packtpub.e4.clock.ui.

    2. Set Version to 1.0.0.qualifier.

    3. Set Name to Clock.

    4. Set Vendor to PacktPub.

    5. Ensure that Generate an Activator is selected.

    6. Set the Activator to com.packtpub.e4.clock.ui.Activator.

    7. Ensure that This plug-in will make contributions to the UI is selected.

    8. Rich...

Time for action – drawing a custom view


An SWT Canvas can be used to provide custom rendering for a view. As a starting point for drawing a clock, the Canvas will use drawArc to create a circle.

  1. Remove the content of the ClockView, leaving behind an empty implementation of the setFocus and createPartControl methods.

  2. Run the target Eclipse instance and you will see that the ClockView is now empty.

  3. Create a new method called drawClock that takes a PaintEvent, and use the graphics context gc from the event to draw the circle.

  4. In the createPartControl method, do the following:

    1. Create a new Canvas, which is a drawable widget.

    2. Add a PaintListener to the Canvas that uses a method reference to the drawClock method.

  5. The code will look like this:

    package com.packtpub.e4.clock.ui.views;
    import org.eclipse.swt.*;
    import org.eclipse.swt.events.*;
    import org.eclipse.swt.widgets.*;
    import org.eclipse.ui.part.ViewPart;
    public class ClockView extends ViewPart {
      public void createPartControl(Composite parent) ...

Time for action – drawing a seconds hand


A clock with no hands and no numbers is just a circle. To change this, a second hand will be drawn using a filled arc.

Since arcs are drawn anticlockwise from 0 (on the right, or 3 o'clock) through 90 degrees (12 o'clock), then 180 degrees (9 o'clock), then 270 degrees (6 o'clock), and finally back to 360 degrees (3 o'clock), it is possible to calculate the arc's position for the second hand using the expression (15 – seconds) * 6 % 360.

  1. Go to the drawClock method of the ClockView class.

  2. Add a variable called seconds that is initialized to LocalTime.now().getSecond().

  3. Get the SWT.COLOR_BLUE via the display, and store it in a local variable, blue.

  4. Set the background color of the graphics context to blue.

  5. Draw an arc using the formula mentioned earlier to draw the second hand.

  6. The code should look like this:

    public void paintControl(PaintEvent e) {
      e.gc.drawArc(e.x, e.y, e.width-1, e.height-1, 0, 360);
      int seconds = LocalTime.now().getSecond();
      int arc...

Time for action – animating the second hand


The second hand is drawn with a redraw on the Canvas, but this will need to be run periodically. If it is redrawn once per second, it can emulate a clock ticking.

Eclipse has a jobs plug-in, which would be just right for this task, but this will be covered in Chapter 4, Interacting with the User. So to begin with, a simple Thread will be used to issue the redraw.

  1. Open the ClockView class.

  2. Add the following at the bottom of the createPartControl method:

    Runnable redraw = () -> {
      while (!clock.isDisposed()) {
        clock.redraw();
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e) {
          return;
        }
      }
    };
    new Thread(redraw, "TickTock").start();
  3. Relaunch the test Eclipse instance, and open the Clock View.

  4. Open the host Eclipse instance and look in the Console View for the errors.

What just happened?

When the ClockView is shown, a Thread is created and started, which redraws the clock once per second. When it is shown, an exception...

Time for action – running on the UI thread


To execute code on the UI thread, Runnable instances must be posted to the Display via one of two methods, syncExec or asyncExec. The syncExec method runs the code synchronously (the caller blocks until the code has been run) while the asyncExec method runs the code asynchronously (the caller continues while the code is run in the background).

The Display class is SWT's handle to a monitor (so a runtime may have more than one Display object, and each may have its own resolution). To get hold of an instance, call either Display.getCurrent() or Display.getDefault(). However, it's much better to get a Display from an associated view or widget. In this case, the Canvas has an associated Display.

  1. Go to the TickTock thread inside the createPartControl method of the ClockView class.

  2. Inside the redraw lambda, replace the call to clock.redraw() with this:

    // clock.redraw();
    clock.getDisplay().asyncExec(() -> clock.redraw());
  3. Run the target Eclipse instance...

Time for action – creating a reusable widget


Although the ClockView shows a single animated clock, creating an independent widget will allow the clock to be reused in other places.

  1. Create a new class in the com.packtpub.e4.clock.ui package, called ClockWidget, that extends Canvas.

  2. Create a constructor that takes a Composite parent and an int style bits parameter, and pass them to the superclass:

    public ClockWidget(Composite parent, int style) {
      super(parent, style);
    }
  3. Move the implementation of the drawClock method from the ClockView to the ClockWidget. Remove the PaintListener references from the ClockView class.

  4. In the ClockWidget constructor, register a PaintListener that delegates the call to the drawClock method:

    addPaintListener(this::drawClock);
  5. Move the TickTock thread from the ClockView to the ClockWidget constructor; this will allow the ClockWidget to operate independently. Change any references for clock to this:

    Runnable redraw = () -> {
      while (!this.isDisposed()) {
        this.getDisplay...

Time for action – using layouts


Now that the ClockWidget has been created, multiple instances can be added into the ClockView.

  1. Modify the createPartControl method in the ClockView class to create three ClockWidget instances, and assign them to local variables:

    final ClockWidget clock1 = new ClockWidget(parent, SWT.NONE);
    final ClockWidget clock2 = new ClockWidget(parent, SWT.NONE);
    final ClockWidget clock3 = new ClockWidget(parent, SWT.NONE);
  2. Run the target Eclipse instance, and show the Clock View. Three clocks will be shown, counting in seconds:

  3. At the start of the ClockView class's createPartControl method, create a new RowLayout with SWT.HORIZONTAL, and then set it as the layout on the parent Composite:

    public void createPartControl(Composite parent) {
      RowLayout layout = new RowLayout(SWT.HORIZONTAL);
      parent.setLayout(layout);
  4. Run the code again now, and the clocks will be in a horizontal row:

  5. Resize the view; the clocks will flow into different rows:

    Note

    The RowLayout has a number of fields...

Managing resources


One of the challenges in adopting SWT is that native resources must be disposed when they are no longer needed. Unlike AWT or Swing, which perform these operations automatically when an object is garbage-collected, SWT needs manual resource management.

Note

Why does SWT need manual resource management?

A common question asked is why SWT has this rule when Java has had perfectly acceptable garbage collection for many years. In part, it's because SWT pre-dates acceptable garbage collection, but it's also to try and return native resources as soon as they are no longer needed.

From a performance perspective, adding a finalize method to an object also causes the garbage collector to work harder; much of the speed in today's garbage collectors is because they don't need to call methods as they are invariably missing. It also hurts in SWT's case because the object must post its dispose request onto the UI thread, which delays its garbage collection until the object becomes reachable...

Time for action – getting colorful


To add an option for the ClockWidget to have a different color, an instance must be obtained instead of the hardcoded BLUE reference. Since Color objects are Resource objects, they must be disposed correctly when the widget is disposed.

To avoid passing in a Color directly, the constructor will be changed to take an RGB value (which is three int values), and use that to instantiate a Color object to store for later. The lifetime of the Color instance can be tied to the lifetime of the ClockWidget.

  1. Add a private final Color field called color to the ClockWidget:

    private final Color color;
  2. Modify the constructor of the ClockWidget to take an RGB instance, and use it to instantiate a Color object. Note that the color is leaked at this point, and will be fixed later:

    public ClockWidget(Composite parent, int style, RGB rgb) {
      super(parent, style);
      // FIXME color is leaked!
      this.color = new Color(parent.getDisplay(), rgb);
      ...
  3. Modify the drawClock method to...

Time for action – finding the leak


It is necessary to know how many resources are allocated in order to know whether the leak has been plugged or not. Fortunately, SWT provides a mechanism to do this via the Display and the DeviceData class. Normally, this is done by a separate plug-in, but in this example, the ClockView will be modified to show this behavior.

  1. At the start of the ClockView class's createPartControl method, add a call to obtain the number of allocated objects, via the DeviceData of the Display class:

    public void createPartControl(Composite parent) {
      Object[] objects = parent.getDisplay().getDeviceData().objects;
  2. Iterate through the allocated objects, counting how many are instances of Color:

      int count = 0;
      for (int i = 0; i < objects.length; i++) {
        if (objects[i] instanceof Color) {
          count++;
        }
      }
  3. Print the count to the standard error stream:

    System.err.println("There are " + count + " Color instances");
  4. Now run the code in debug mode and show the Clock View...

Time for action – plugging the leak


Now that the leak has been discovered, it needs to be fixed. The solution is to call dispose on the Color once the view itself is removed.

A quick investigation of the ClockWidget suggests that overriding dispose might work, though this is not the correct solution; see later for why.

  1. Create a dispose method in ClockWidget with the following code:

    @Override
    public void dispose() {
      if (color != null && !color.isDisposed())
        color.dispose();
      super.dispose();
    }
  2. Run the target Eclipse application in debug mode (with the tracing enabled, as before) and open and close the view. The output will show something like this:

    There are 87 Color instances
    There are 91 Color instances
    There are 94 Color instances
    There are 98 Color instances
  3. Remove the dispose method (since it doesn't work as intended) and modify the constructor of the ClockWidget to add an anonymous DisposeListener that disposes of the associated Color:

    public ClockWidget(Composite parent, int...

Interacting with the user


The whole point of a user interface is to interact with the user. Having a view that displays information may be useful, but it is often necessary to ask the user for data or respond to user actions.

Time for action – getting in focus


To allow the time zone of the clock widgets to be changed, a drop-down box (known as Combo) as well as a Button will be added to the view. The Combo will be created from a set of ZoneId instances.

  1. Create a timeZones field in the ClockView class:

    private Combo timeZones;
  2. At the end of the createPartControl method, add this snippet to create the drop-down list:

    public void createPartControl(Composite parent) {
      ...
      timeZones = new Combo(parent, SWT.DROP_DOWN);
      timeZones.setVisibleItemCount(5);
      for (String zone : ZoneId.getAvailableZoneIds()) {
        timeZones.add(zone);
      }
    }
  3. Run the target Eclipse and open the Clock View again; a list of time zone names will be shown in a drop-down:

  4. It's conventional to set the focus on a particular widget when a view is opened. Implement the appropriate call in the ClockView method setFocus:

    public void setFocus() {
      timeZones.setFocus();
    }
  5. Run Eclipse and show the Clock View; the time zone drop-down widget will be focused...

Left arrow icon Right arrow icon

Key benefits

  • Create useful plug-ins to make Eclipse work for you
  • Learn how to migrate Eclipse 3.x plug-ins to Eclipse 4.x
  • From automation to testing, find out how to get your IDE performing at an impressive standard

Description

Eclipse is used by everyone from indie devs to NASA engineers. Its popularity is underpinned by its impressive plug-in ecosystem, which allows it to be extended to meet the needs of whoever is using it. This book shows you how to take full advantage of the Eclipse IDE by building your own useful plug-ins from start to finish. Taking you through the complete process of plug-in development, from packaging to automated testing and deployment, this book is a direct route to quicker, cleaner Java development. It may be for beginners, but we're confident that you'll develop new skills quickly. Pretty soon you'll feel like an expert, in complete control of your IDE. Don't let Eclipse define you - extend it with the plug-ins you need today for smarter, happier, and more effective development.

Who is this book for?

This book is for Java developers familiar with Eclipse who need more from the IDE. This book will sharpen your confidence and make you a more productive developer with a tool that supports rather than limits you.

What you will learn

  • Create plug-ins for Eclipse 4.x
  • Test plug-ins automatically with JUnit
  • Display tree and table information in views
  • Upgrade Eclipse 3.x plug-ins to Eclipse 4.x
  • Find out how to build user interfaces from SWT and JFace
  • Run tasks in the background and update the user interface asynchronously
  • Automate builds of plug-ins and features
  • Automate user interface tests with SWTBot /list

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 04, 2016
Length: 458 pages
Edition : 2nd
Language : English
ISBN-13 : 9781783980697
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Aug 04, 2016
Length: 458 pages
Edition : 2nd
Language : English
ISBN-13 : 9781783980697
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 120.97
Implementing Domain-Specific Languages with Xtext and Xtend
€36.99
Mastering Eclipse Plug-in Development
€41.99
Eclipse Plug-in Development Beginner's Guide
€41.99
Total 120.97 Stars icon
Banner background image

Table of Contents

16 Chapters
1. Creating Your First Plug-in Chevron down icon Chevron up icon
2. Creating Views with SWT Chevron down icon Chevron up icon
3. Creating JFace Viewers Chevron down icon Chevron up icon
4. Interacting with the User Chevron down icon Chevron up icon
5. Working with Preferences Chevron down icon Chevron up icon
6. Working with Resources Chevron down icon Chevron up icon
7. Creating Eclipse 4 Applications Chevron down icon Chevron up icon
8. Migrating to Eclipse 4.x Chevron down icon Chevron up icon
9. Styling Eclipse 4 Applications Chevron down icon Chevron up icon
10. Creating Features, Update Sites, Applications, and Products Chevron down icon Chevron up icon
11. Automated Testing of Plug-ins Chevron down icon Chevron up icon
12. Automated Builds with Tycho Chevron down icon Chevron up icon
13. Contributing to Eclipse Chevron down icon Chevron up icon
A. Using OSGi Services to Dynamically Wire Applications Chevron down icon Chevron up icon
B. Pop Quiz Answers Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
(2 Ratings)
5 star 50%
4 star 0%
3 star 50%
2 star 0%
1 star 0%
Madame Sep 20, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
It is a great book for those who want to start programming plugins in Eclipse. It contains easy-to-follow recipes on common programming challenges on the eclipse platform ranging from how to start programming a plugin to how to automate plugin tests. I also liked the fact that it contains the two latest versions of eclipse. I totally recommend it!
Amazon Verified review Amazon
Sunny Zhang Jan 26, 2018
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
This book does not show how to create your own Extension point; If no mistake, it shows only how to use the extension points.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.