Book Image

Eclipse Plug-in Development Beginner's Guide - Second Edition

By : Alex Blewitt
Book Image

Eclipse Plug-in Development Beginner's Guide - Second Edition

By: Alex Blewitt

Overview of this book

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.
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
Index

Time for action – using subtasks and sub-progress monitors


When performing a set of operations, subtasks can give the user additional details about the state of the operation. A subtask is merely a named message that is displayed along with the task name in the Progress view.

  1. Add a monitor.subTask during the operation to give feedback:

    for (int i=0; i<50 && !monitor.isCanceled(); i++) {
      if (i == 10) {
        monitor.subTask("Doing something");
      } else if (i == 25) {
        monitor.subTask("Doing something else");
      } else if (i == 40) {
        monitor.subTask("Nearly there");
      }
      Thread.sleep(100);
      monitor.worked(100);
    }
  2. Run the Eclipse instance, and look at the Progress view. The subtask should be shown underneath the status bar:

  3. When calling another method with a progress monitor, if the monitor is passed as is, it can have undesirable effects. Add a new method, checkDozen, to the anonymous Job class inside the HelloHandler class, and add a condition in the for loop that breaks out...