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: handling deletion


The incremental builder does not handle deletion in its current implementation. To handle deletion, the IResourceDelta instance needs to be inspected to find out what kind of delta took place and handle deleted resources accordingly.

  1. Run the target Eclipse instance, and delete a .minimark file. An exception is thrown and reported to the user:

  2. To fix this issue, modify the check in the MinimarkVisitor method processResource to see whether the resource exists or not:

    private void processResource(IResource resource) throws
     CoreException {
      if (resource instanceof IFile && resource.exists()) {
  3. This solves the NullPointerException, but the generated HTML file is left behind. If the .minimark file is deleted, and there is a corresponding .html file, that can be deleted as well. Modify the visit(IResourceDelta) method as follows:

    public boolean visit(IResourceDelta delta) throws CoreException {
      boolean deleted = (IResourceDelta.REMOVED & delta.getKind...