This chapter provides an overview of how plug-ins function in Eclipse in the form of Frequently Asked Questions. Included are questions about the core concepts of the Eclipse kernel, including plug-ins, extension points, fragments.

This chapter is from the book

This chapter is from the book

Part I discussed the Eclipse ecosystem: how to run it, how to use it, and how to extend it. In this chapter, we revisit the topic
of plug-ins and lay the groundwork for all plug-in development topics to be discussed in later chapters. This chapter answers
questions about the core concepts of the Eclipse kernel, including plug-ins, extension points, fragments, and more. All APIs
mentioned in this chapter are found in the org.eclipse.core.runtime plug-in.

FAQ 94: What is a plug-in?

In retrospect, plug-in, perhaps wasn’t the most appropriate term for the components that build up an Eclipse application. The term implies the existence
of a socket, a monolithic machine or grid that is being plugged into. In Eclipse, this isn’t the case. A plug-in connects
with a universe of other plug-ins to form a running application. The best software analogy compares a plug-in to an object
in object-oriented programming. A plug-in, like an object, is an encapsulation of behavior and/or data that interacts with
other plug-ins to form a running program.

A better question in the context of Eclipse is, What isn’t a plug-in? A single Java source file, Main.java, is not part of a plug-in. This class is used only to find and invoke the plug-in responsible for starting up the Eclipse
Platform. This class will typically in turn be invoked by a native executable, such as eclipse.exe on Windows, although this is just icing to hide the incantations required to find and launch a Java virtual machine. In short,
just about everything in Eclipse is a plug-in.

More concretely, a plug-in minimally consists of a plug-in manifest file, plugin.xml. This manifest provides important details about the plug-in, such as its name, ID, and version number. The manifest may also
tell the platform what Java code it supplies and what other plug-ins it requires, if any. Note that everything except the
basic plug-in description is optional. A plug-in may provide code, or it may provide only documentation, resource bundles,
or other data to be used by other plug-ins.

A plug-in that provides Java code may specify in the manifest a concrete subclass of org.eclipse.core.runtime.Plugin. This class consists mostly of convenience methods for accessing various platform utilities, and it may also implement startup and shutdown methods that define the lifecycle of the plug-in within the platform.