Learn how to use the APIs for Eclipse management applications
Creating application Public Interface (APIs), especially managing the various versions of the APIs, is difficult. Learn how to use Eclipse's PDE API Tools to simplify this process and seamlessly integrate it into day-to-day development. Note that this article is intended specifically for Eclipse V3.4:ganymede.
Before detailing the application public Interface (API) tools within the Eclipse Plug-in Development Environment (PDE), let's talk about the implications of the APIs in eclipse.
What is an API?
Have you ever received the following warnings or errors in Eclipse and want to know what they mean?
Figure 1. Block access
Internal Package
Depending on the naming convention, the ability to actually make a package API in a plug-in depends on whether the package is exported to MANIFEST. MF file. If it is, it is considered an API. To create content that is not an API, you can mark the exported package with the X-internal:=true property. This will indicate that the package exported by Eclipse is available, but is considered an internal package.
The reason for the warning is most likely that you are accessing code that cannot be publicly accessed using some form of API. Typically, API elements are well documented and have some sort of specification. Non-API elements, on the other hand, are treated as internal implementation details and are often not accompanied by publishing documents. Eclipse in the previous illustration informs you that you have accessed these internal elements. Eclipse politely warns you that you are accessing code that may change and is not officially supported. So, exactly what is the API?
Because Eclipse is based on the Java™ programming language, there are four of API elements. Let's look at it one by one.
The API package contains at least one package of API classes or API interfaces.
Table 1. Package naming conventions in the Eclipse platform
Naming conventions |
Sample Package |
org.eclipse.xyz.* |
Org.eclipse.ui, Org.eclipse.swt.widgets |
Org.eclipse.xyz.internal.* |
Org.eclipse.comp are.internal, Org.eclipse.ui.internal |
Org.eclipse.xyz.internal.provisional.* |
Org. eclipse.equinox.internal.provisional.p2.engine |
A public class or interface in an API class or interface API package, or a public or protected class or interface member declared or inherited in one of the other API classes or interfaces. The public or protected method or constructor declared or inherited by an API method in an API class or interface. The public or protected field that the API field declares or inherits in the API class or interface.
Now that we know all kinds of API elements, let's talk about API Tools and how it can manage these API elements for you.