Welcome to this tutorial! We will walk you through the process of starting Eclipse for the first time, importing existing plug-ins, and creating a simple plugin yourself.
There's a few things to do before we dive into the tutorial itself. For example, to do Eclipse programming, you will have to get your hands on an Eclipse installation first. Read through the following sections to get ready for the tutorial tasks.
Install Eclipse. For what we do, we recommend installing the Eclipse Modeling Tools.
de.cau.cs.kieler.tutorials.plugins.shouter
plug-in and press Finish.In Eclipse, we develop plug-ins that extend the basic functionality of Eclipse itself. As we do not always want to run Eclipse with all the functionality there is, we can use Run Configurations to precisely specify the functionality we want.
Eclipse Test
. org.eclipse.ui.ide.application
plugins under Target PlatformNote that you can run your configuration also by using the debug button in the main menu. In that case you will be able to use debug features and code changes will be directly active in your Eclipse instance after saving. In the rather rare cases where this is impossible you will be notified.
de.cau.cs.kieler.tutorials.myshouter
. Click Next.Simple Shouter
. Uncheck all checkboxes. Click Finish. (Eclipse might ask you whether you want to switch to the Plug-in Development Perspective, which configures Eclipse to provide the views that are important for plug-in development. Choose Yes. Or No. It won't have a big influence on your future...)plugin.xml
(which has not been created yet) and META-INF/MANIFEST.MF
. Basically, those two files provide information that tell Eclipse what other plug-ins your plug-in needs and how it works together with other plug-ins by providing extensions and extension points. Our new plug-in will depend on the previously imported plug-in, so switch to the Dependencies tab of the editor and add a dependency to de.cau.cs.kieler.tutorials.plugins.shouter
. Save the editor and close it. (You can always reopen it by opening one of the two mentioned files from the Package Explorer.)We will now use the extension point mechanism of Eclipse to add some behavior to the de.cau.cs.kieler.tutorials.plugins.shouter
plugin. An extension point is basically a well-defined point where other plug-ins can register to add functionality. The extension point is basically defined by an XML Schema file that defines an interface; other plug-ins may access this interface using XML code in their plugin.xml
file, so-called extensions.
The de.cau.cs.kieler.tutorials.plugins.shouter
plug-in defines such an extension point to register Shouters. A shouter is a Java class that implements the following interface.
public interface IShouter { String getShoutString(); } |
de.cau.cs.kieler.tutorials.myshouter
) create a new class MyShouter
that implements the IShouter
interface. MANIFEST.MF
of your plugin and navigate to the Extensions tab. de.cau.cs.kieler.tutorials.plugins.shouters
extension point. Press Finish.IShouter
interface.