| ... |
... |
@@ -62,10 +62,26 @@ |
| 62 |
62 |
1. //New// -> //Project...// |
| 63 |
63 |
1. In the project wizard, choose //Plug-in Project// and click //Next//. |
| 64 |
64 |
1. As the project name, enter {{code language="none"}}de.cau.cs.rtprakt.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.rtprakt.login.simple{{/code}}). Click //Next//. |
| 65 |
|
-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//. |
|
65 |
+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...) |
|
66 |
+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//.) |
| 66 |
66 |
|
| 67 |
|
- |
|
68 |
+== Create the Main Editor Class == |
| 68 |
68 |
|
|
70 |
+We will now create the class that implements the simple text editor. There won't be any programming involved here since we're lazy; instead, we will just inherit from an existing simple text editor. |
|
71 |
+ |
|
72 |
+1. //New// -> //Class//. |
|
73 |
+1. Package: {{code language="none"}}de.cau.cs.rtprakt.login.simple.editors{{/code}}. Name: {{code language="none"}}SimpleEditorPart{{/code}}. Superclass: {{code language="none"}}org.eclipse.ui.editors.text.TextEditor{{/code}}. Click //Finish//. |
|
74 |
+ |
|
75 |
+== Register the Editor == |
|
76 |
+ |
|
77 |
+For the editor to be available inside Eclipse, we will have to register it by adding an extension to an extension point. |
|
78 |
+ |
|
79 |
+1. Copy [[the attached file>>attach:turing-file.gif]] to a new subfolder icons in the plug-in folder (right-click the plug-in folder in the //Package Explorer// and choose //New// -> //Folder...//). You can copy the file by importing it from inside Eclipse (//File// -> //Import...// -> //File System//) or by copying it from outside Eclipse and refreshing the plug-in project afterwards (right-click the plug-in folder in the //Package Explorer// and choose //Refresh).// |
|
80 |
+1. Open the //Plug-in Manifest Editor// again and switch to the //Extensions// tab. |
|
81 |
+1. Click //Add...//, choose the {{code language="none"}}org.eclipse.ui.editors{{/code}} extension point and click //Finish//. |
|
82 |
+1. The extension point is now shown in the list of extensions, along with an //editor// extension. Select that extension and edit its details using the fields on the right. Set the ID to {{code language="none"}}de.cau.cs.rtprakt.login.simple.editor{{/code}}, the name to {{code language="none"}}Simple Text Editor{{/code}}, the icon to {{code language="none"}}icons/turing-file.gif{{/code}}, the extensions to {{code language="none"}}simple{{/code}}, the class to {{code language="none"}}de.cau.cs.rtprakt.login.simple.editors.SimpleEditorPart{{/code}}, and the default to {{code language="none"}}true{{/code}}. |
|
83 |
+1. Save and close the manifest editor. |
|
84 |
+ |
| 69 |
69 |
|
| 70 |
70 |
|
| 71 |
71 |
|