blob: 74b5a621c0e463d9aedbb40d6dec6987a940afe6 [file] [log] [blame]
Stephan Herrmann7b320d82011-06-13 21:31:37 +00001<?xml version="1.0" encoding="UTF-8" ?>
2<cheatsheet title="Simple Object Teams Program">
3
4 <intro
5 href="/org.eclipse.platform.doc.user/reference/ref-cheatsheets.htm">
6 <description>
7 Welcome to the Object Teams tutorial.
8 It will help you build a small Object Teams program.
9 You will create an <b>Object Teams project</b>, a <b>Base class</b>,
10 a <b>Team class</b> and a <b>Role class</b> which contains two
11 kinds of bindings: a <b>callout binding</b> and a <b>callin binding</b>.
12 Let's get started!
13 </description>
14 </intro>
15
16 <item
17 href="/org.eclipse.platform.doc.user/concepts/concepts-4.htm"
18 title="Open the Object Teams Perspective">
19 <action
20 pluginId="org.eclipse.ui.cheatsheets"
21 class="org.eclipse.ui.internal.cheatsheets.actions.OpenPerspective"
22 param1="org.eclipse.objectteams.otdt.ui.OTJavaPerspective"/>
23 <description>
24 Select <b>Window-&gt;Open Perspective-&gt;Object Teams</b> in the menubar at
25 the top of the workbench. This step changes the perspective to
26 set up the Eclipse workbench for Object Teams development. You can
27 click the "Click to Perform" button to have the "Object Teams"
28 perspective opened automatically.
29 </description>
30 </item>
31
32 <item
Stephan Herrmann623423a2013-06-03 22:03:52 +020033 href="/org.eclipse.objectteams.otdt.doc/guide/project.html"
Stephan Herrmann7b320d82011-06-13 21:31:37 +000034 title="Create an Object Teams Project"
35 skip="true">
36 <action
37 pluginId="org.eclipse.objectteams.otdt.ui"
38 class="org.eclipse.objectteams.otdt.internal.ui.wizards.OpenOTProjectWizardAction"/>
39 <description>
40 The first thing you will need is an Object Teams project. If you
41 already have an Object Teams project in your workspace that you
42 would like to use, you may skip this step by clicking the
43 &quot;Click to Skip&quot; button. If not, select <b>File-&gt;New-&gt;</b>
44 and choose <b>Object Teams Project</b> in the list. Complete the subsequent
45 pages as required. The &quot;New Object Teams Project&quot; wizard will be automatically
46 displayed when you click the &quot;Click to Perform&quot; button.
47 After creating the project, it will appear in the <b>Package Explorer</b>
48 view. Select the project by clicking it with the mouse, so that the next actions
49 will know that they apply to this project.
50 </description>
51 </item>
52
53 <item
54 href="/org.eclipse.jdt.doc.user/gettingStarted/qs-9.htm"
55 title="Create a Base class"
56 skip="true">
57 <action
58 pluginId="org.eclipse.jdt.ui"
59 class="org.eclipse.jdt.ui.actions.OpenNewClassWizardAction"/>
60 <description>
61 You should now have an Object Teams project in your workspace. The
62 next step in building your Object Teams application is to first
63 create a normal (Base) class. You may do this by either clicking
64 the "Click to Perform" button below to launch the "New Java Class"
65 wizard, or you may use the Eclipse tools to do it, by using the
66 <b>File-&gt;New-&gt;Class</b> action. Name your class for example
67 "<b>MyBase</b>". If you do not use the "Click to Perform" button below,
68 click the "Click to Skip" button to advance to the next step in
69 building your Object Teams application.
70 </description>
71 </item>
72
73 <item
74 title="Add two methods to your Base class">
75 <description>
76 Now that you have your MyBase class, add, e.g., the following two
77 methods:
78 <br/><b>public void hello() { System.out.println("Hello"); }</b><br/>
79 and
80 <br/><b>public String getWorld() { return "World"; }</b><br/>
81 and save your changes. The first method will be used in a callin binding,
82 the other in a callout binding. These bindings will be members of a
83 Role class which you are going to create in a minute. Click the
84 "Click to Complete" button below when finished.
85 </description>
86 </item>
87
88 <item
Stephan Herrmann623423a2013-06-03 22:03:52 +020089 href="/org.eclipse.objectteams.otdt.doc/guide/wizards.html"
Stephan Herrmann7b320d82011-06-13 21:31:37 +000090 title="Create a Team class"
91 skip="true">
92 <action
93 pluginId="org.eclipse.objectteams.otdt.ui"
94 class="org.eclipse.objectteams.otdt.internal.ui.wizards.OpenTeamWizardAction"/>
95 <description>
96 The next step in building your Object Teams application is to create a
97 Team class, which is going to be the enclosing context for the Role class.
98 You may do this by either clicking the "Click to Perform" button
99 below to launch the "New Team Class wizard", or you may use the Eclipse
100 tools to do it, by using the <b>File-&gt;New-&gt;Team</b> action.
101 Name your class, e.g. "<b>MyTeam</b>". If you do not use the "Click to Perform"
102 button below, click the "Click to Skip" button to advance to the next
103 step in building your Object Teams application.
104 </description>
105 </item>
106
107 <item
Stephan Herrmann623423a2013-06-03 22:03:52 +0200108 href="/org.eclipse.objectteams.otdt.doc/guide/wizards.html"
Stephan Herrmann7b320d82011-06-13 21:31:37 +0000109 title="Create a Role class"
110 skip="true">
111 <action
112 pluginId="org.eclipse.objectteams.otdt.ui"
113 class="org.eclipse.objectteams.otdt.internal.ui.wizards.OpenRoleWizardAction"/>
114 <description>
115 The next step in building your Object Teams application is to create a
116 Role class for the previously created Team class.
117 You may do this by either clicking the "Click to Perform" button
118 below to launch the New Role Class wizard, or you may use the Eclipse
119 tools to do it, by using the <b>File-&gt;New-&gt;Role</b> action.
120 Name your class, e.g. "<b>MyRole</b>". Enter the name of the enclosing Team
121 you have created before, in this case "MyTeam". Now bind the Role class to
122 your previously created Base class, either by typing in its name ("MyBase")
123 into the designated input field, or by choosing the Base class after clicking
124 the "Browse..." button next to the input field. If you do not use the "Click
125 to Perform" button below, click the "Click to Skip" button to advance to the
126 next step.
127 </description>
128 </item>
129
130 <item
131 title="Add two methods and two different bindings to your Role class">
132 <description>
133 Now that you have your "MyRole" class, add, e.g., the following two
134 methods:
135 <br/><b>public abstract String getAddressee();</b><br/>
136 and
137 <br/><b>public void greet() { System.out.println(getAddressee()); }</b><br/>
138 These are the Role methods that will be bound in a callout and callin
139 binding respectively. Let's add a callout binding:
140 <br/><b>getAddressee -&gt; getWorld;</b><br/>
141 and a callin binding:
142 <br/><b>greet &lt;- after hello;</b><br/>
143 and save your changes. Click the "Click to Complete" button below when finished.
144 </description>
145 </item>
146
147 <item
148 title="Add a main method.">
149 <description>
150 In order to complete your application, add a main method to your Team class:
151 <br/><b>public static void main(String[] args) {</b>
152 <br/><b>MyTeam myTeam = new MyTeam();</b>
153 <br/><b>myTeam.activate();</b>
154 <br/><b>new MyBase().hello();</b>
155 <br/><b>}</b><br/>
156 Click the "Click to Complete" button below when finished.
157 </description>
158 </item>
159
160 <item
Stephan Herrmann623423a2013-06-03 22:03:52 +0200161 href="/org.eclipse.objectteams.otdt.doc/guide/running.html"
Stephan Herrmann7b320d82011-06-13 21:31:37 +0000162 title="Tutorial finished!">
163 <description>
164 Congratulations! You have built your first Object Teams program. Now let&apos;s run it!
165 On "MyTeam" (either in the package explorer or in the editor) select from the context menu:
166 <b>Run As-&gt;Java Application</b>.
167 Watch the <b>Console</b> view appear, showing the application&apos;s output!
168 You can later inspect and modify the run configuration by choosing in the menubar
169 <b>Run-&gt;Run-Configurations...</b> and searching the configuration for "MyTeam"
170 under "Java Application". An essential detail you will find in the "JRE" tab of
171 the run configuration dialog: Under the heading <b>Object Teams Runtime</b> there
172 is a checkbox <b>enable OTRE</b> which has to be checked for running OT/J programs
173 (default in Object Teams projects).
174 That&apos;s it, you are now ready for Object Teams development!
175 </description>
176 </item>
177
178</cheatsheet>