<
From version < 25.1 >
edited by cds
on 2012/10/24 17:49
To version < 23.1 >
edited by cds
on 2012/10/24 17:31
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,9 +1,11 @@
1 +{{warning title="Warning"}}
2 +This tutorial isn't complete yet!
3 +{{/warning}}
4 +
1 1  This tutorial will teach you the basics of writing plugins that run inside the Eclipse framework. You will learn about editors, views, and extension points by creating one of each yourself.
2 2  
3 -You may want to download [[the slides>>attach:presentation.pdf]] of the presentation explaining the basic concepts you will explore in this tutorial.
4 4  
5 5  
6 -
7 7  {{toc/}}
8 8  
9 9  = Preliminaries =
... ... @@ -407,7 +407,7 @@
407 407  We will now add a class that will be in charge of loading all extensions registered at our new extension point.
408 408  
409 409  1. (((
410 -Add a class {{code language="none"}}HeadControllers{{/code}} to the package {{code language="none"}}de.cau.cs.rtprak.login.simple.controller{{/code}}. Add the following code, replacing {{code language="none"}}login{{/code}} with your login name in {{code language="none"}}EXTENSION_POINT_ID{{/code}} as usual:
412 +Add a class {{code language="none"}}HeadControllers{{/code}} to the package {{code language="none"}}de.cau.cs.rtprak.login.simple.controller{{/code}}. Add the following code:
411 411  
412 412  {{code language="java"}}
413 413  /**
... ... @@ -417,7 +417,7 @@
417 417   */
418 418  public class HeadControllers {
419 419   /** Identifier of the extension point */
420 - public final static String EXTENSION_POINT_ID = "de.cau.cs.rtprak.login.simple.headControllers";
422 + public final static String EXTENSION_POINT_ID = "de.cau.cs.rtprak.groupx.simple.headControllers";
421 421   /** The singleton instance of the {@code HeadControllers} class */
422 422   public final static HeadControllers INSTANCE = new HeadControllers();
423 423   /** list of head controller ids with associated names. */
... ... @@ -550,51 +550,32 @@
550 550  1*. Set the current head position to 1.
551 551  1*. Refresh the table viewer with its {{code language="none"}}refresh(){{/code}} method.
552 552  
553 -== Adding a Test Head Controller ==
555 +
554 554  
555 -Before creating a proper head controller in another plug-in, we will add a test controller to check whether all this stuff works.
557 +
556 556  
557 -1. (((
558 -Add a new class {{code language="none"}}NullController{{/code}} to the {{code language="none"}}de.cau.cs.rtprak.login.simple.controllers{{/code}} package:
559 +
559 559  
560 -{{code language="java"}}
561 -/**
562 - * Head controller that does nothing, for testing.
563 - * @author msp
564 - */
565 -public class NullController implements IHeadController {
566 - /**
567 - * {@inheritDoc}
568 - */
569 - public HeadCommand nextCommand(final char character) {
570 - return new HeadCommand(Action.NULL, Direction.NONE, '_');
571 - }
572 -
573 - /**
574 - * {@inheritDoc}
575 - */
576 - public void reset() {
577 - }
578 -}
579 -{{/code}}
580 -)))
581 -1. Open the //Plugin Manifest Editor// and switch to the //Extensions// tab. Add your {{code language="none"}}de.cau.cs.rtprak.login.simple.headControllers{{/code}} extension point. Add a {{code language="none"}}controller{{/code}} element with ID {{code language="none"}}de.cau.cs.rtprak.login.simple.nullController{{/code}}, name {{code language="none"}}Null Controller{{/code}}, and class {{code language="none"}}de.cau.cs.rtprak.login.simple.controller.NullController{{/code}}.
582 -1. Start the application and observe how your program behaves if you change the action and direction in the {{code language="none"}}NullController{{/code}} class. You can actually change both while the application is running, but only if you have started it in the Debug mode. In that case, Eclipse will actually hot-swap your changes into the running application. Sorcery!
561 +
583 583  
584 -== Implementing Your Own Head Controller ==
563 +
585 585  
586 -We will now create a new plug-in with a new head controller:
565 +
587 587  
588 -1. Create a new plug-in {{code language="none"}}de.cau.cs.rtprak.login.simple.extension{{/code}}. In the //Plugin Manifest Editor//, add {{code language="none"}}de.cau.cs.rtprak.login.simple{{/code}} to the dependencies of the new plug-in.
589 -1. Create a new class that implements {{code language="none"}}IHeadController{{/code}}:\\
590 -1*. Assuming that the initial head position is 1, the controller shall copy the input text infinitely often. So if the tape initially contains the word {{code language="none"}}hello{{/code}}, the controller shall generate {{code language="none"}}hellohellohellohe...{{/code}} .
591 -1*. Your class needs some private fields to store the internal state of the controller, and you may need some special character as marker. Imagine how a Turing Machine would do this.
592 -1*. It is not allowed to store data that can grow infinitely, since a Turing Machine may only have a finite number of states. This means that you may store single characters or numbers, but you must not store Strings, StringBuffers, arrays, lists, or sets.
593 -1. Register the new controller class using an extension in the new plug-in.
594 -1. Test your controller.
567 +
595 595  
596 -= Congratulations! =
569 +
597 597  
598 -Congratulations, you just made a big step towards understanding how Eclipse works. Plus, you've refreshed your knowledge on Turing Machines along the way. Eclipse is an industry standard technology, and having experience programming against it is a valuable skill for you.
571 +
599 599  
600 -If you have any comments and suggestions for improvement concerning this tutorial, please don't hesitate to tell us about them!
573 +
574 +
575 +
576 +
577 +
578 +
579 +
580 +
581 +
582 +
583 +
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -2982320
1 +2982314
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/2982320/The Plug-in Architecture of Eclipse
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/2982314/The Plug-in Architecture of Eclipse