<
From version < 4.1 >
edited by uru
on 2015/04/09 13:36
To version < 3.1 >
edited by uru
on 2015/04/09 13:03
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,4 +1,4 @@
1 -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.
1 +
2 2  
3 3  = Preliminaries =
4 4  
... ... @@ -14,11 +14,13 @@
14 14  
15 15  {{excerpt-include nopanel="true"/}}
16 16  
17 -= First Steps with Eclipse =
17 +
18 18  
19 += Your First Steps with Eclipse =
20 +
19 19  == Starting Eclipse ==
20 20  
21 -1. Eclipse uses workspaces to store, for instance, user preferences. Upon the first start of Eclipse you will be asked to specify a location. Select one as you like.
23 +1. Eclipse uses workspaces to store, for instance, user preferences. Upon the first start of eclipse you will be asked to specify a location. Select one as you like.
22 22  [[image:attach:workspace.jpg]]
23 23  1. Switch to the workbench, you should see something like this
24 24  [[image:attach:wb.jpg]]
... ... @@ -29,52 +29,20 @@
29 29  1. Open the context menu within the //Package-Explorer// (on the very left, right-click the empty space).
30 30  1. Select //Import//. Then chose //General > Existing Projects into Workspace//.
31 31  1. Browse to the location where you unzipped the downloaded plug-ins. Check the checkbox in front of the {{code language="none"}}de.cau.cs.kieler.tutorials.plugins.shouter{{/code}} plug-in and press //Finish.
32 -[[image:attach:import.jpg]]//
34 +[[image:attach:import.jpg]]
35 +//
33 33  
34 -== Running Eclipse ==
35 -
36 -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.
37 -
38 -1. Click //Run// > //Debug Configurations...//
39 -1. Right-click //Eclipse Application// and click //New//. Set the configuration's name to {{code language="none"}}Eclipse Test{{/code}}.
40 -1. On the //Plug-ins// tab, set //Launch with// to //plug-ins selected below only//.\\
41 -11. Click //Deselect All//.
42 -11. Check the //Workspace// item in the tree.
43 -11. Check the{{code language="none"}} org.eclipse.ui.ide.application{{/code}} plugins under //Target Platform//
44 -11. Click //Add Required Plug-ins//. Press it twice (just to be sure!).
45 -1. Click //Apply// to save your changes and then //Debug// to start an Eclipse instance to test with.
46 -1. In the newly started Eclipse, open the context menu of the Project Explorer.
47 -1. You should see a //Hello Shouter// entry which shouts out //Hello// if you press it.
48 -
49 49  == Creating Your First Plug-in ==
50 50  
51 51  1. Open the context menu within the //Package-Explorer// (on the very left, right-click the empty space).
52 52  1. //New// -> //Project...//
53 53  1. In the project wizard, choose //Plug-in Project// and click //Next//.
54 -1. As the project name, enter {{code language="none"}}de.cau.cs.kieler.tutorials.myshouter{{/code}}. Click //Next//.
55 -1. As the name, enter {{code language="none"}}Simple Shouter{{/code}}. 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...)
56 -1. Eclipse has now created your new plug-in and was nice enough to open the //Plug-in Manifest Editor//, which allows you to graphically edit two important files of your plugin: {{code language="none"}}plugin.xml{{/code}} (which has not been created yet) and {{code language="none"}}META-INF/MANIFEST.MF{{/code}}. 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 {{code language="none"}}de.cau.cs.kieler.tutorials.plugins.shouter{{/code}}. Save the editor and close it. (You can always reopen it by opening one of the two mentioned files from the //Package Explorer//.)
42 +1. As the project name, enter {{code language="none"}}de.cau.cs.rtprak.login.simple{{/code}}. Uncheck //Use default location// (which would put the project into your workspace), and put it into your local clone of the Git repository instead (the //Location// should read something like {{code language="none"}}/path/to/git/repository/de.cau.cs.rtprak.login.simple{{/code}}). Click //Next//.
43 +1. As the name, enter {{code language="none"}}Simple (login){{/code}}. Also, make sure that //Generate an activator// and //This plug-in will make contributions to the UI// are both checked. 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...)
44 +1. Eclipse has now created your new plug-in and was nice enough to open the //Plug-in Manifest Editor//, which allows you to graphically edit two important files of your plugin: {{code language="none"}}plugin.xml{{/code}} and {{code language="none"}}META-INF/MANIFEST.MF{{/code}}. (By the way, this would be a great time to research the editor and the two files online.) 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 two other plug-ins, so switch to the //Dependencies// tab of the editor and add dependencies to {{code language="none"}}org.eclipse.ui.editors{{/code}} and {{code language="none"}}org.eclipse.jface.text{{/code}}. Save the editor and close it. (You can always reopen it by opening one of the two mentioned files from the //Package Explorer//.)
57 57  
58 -== Extending Functionality ==
59 -
60 -We will now use the extension point mechanism of Eclipse to add some behavior to the {{code language="none"}}de.cau.cs.kieler.tutorials.plugins.shouter{{/code}} 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 {{code language="none"}}plugin.xml{{/code}} file, so-called //extensions//.
61 -
62 -The {{code language="none"}}de.cau.cs.kieler.tutorials.plugins.shouter{{/code}} plug-in defines such an extension point to register //Shouters//. A shouter is a Java class that implements the following interface.
63 -
64 -{{code language="java"}}
65 -public interface IShouter {
66 - String getShoutString();
67 -}
68 -{{/code}}
69 -
70 -1. In your previously created plugin ({{code language="none"}}de.cau.cs.kieler.tutorials.myshouter{{/code}}) create a new class {{code language="none"}}MyShouter{{/code}} that implements the {{code language="none"}}IShouter{{/code}} interface.
71 -11. From the Package Explorer context menu select //New > Class//.
72 -1. Open the{{code language="none"}} MANIFEST.MF{{/code}} of your plugin and navigate to the //Extensions// tab.
73 -1. Press //Add// and select the {{code language="none"}}de.cau.cs.kieler.tutorials.plugins.shouters{{/code}} extension point. Press //Finish//.
74 -[[image:attach:extension.jpg]]
75 -1. Give it a name and using the //Browse// button select your previously created class implementing the {{code language="none"}}IShouter{{/code}} interface.
76 -1. Start your Eclipse instance again using the created run configuration and test your very own shouter.
77 -
78 78  
79 79  
80 -
48 +Extension Points
49 +
50 +For the final part of the tutorial, we will now use the extension point mechanism of Eclipse to add some behavior to our Turing Machines. 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 {{code language="none"}}plugin.xml{{/code}} file, so-called //extensions//. Our extension point will provide an interface for classes that define behavior of a Turing Machine, and we will call them head controllers (programs that control the tape head).
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -10751604
1 +10751601
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/TUT/pages/10751604/Eclipse Plug-ins
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/TUT/pages/10751601/Eclipse Plug-ins