blob: 45c6b130e09e29496a9004953ab83af7774a2b84 [file] [log] [blame]
Stephan Herrmann01664412010-04-01 20:28:43 +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
33 title="Create an Object Teams Project"
34 skip="true">
35 <action
36 pluginId="org.eclipse.objectteams.otdt.ui"
37 class="org.eclipse.objectteams.otdt.internal.ui.wizards.OpenOTProjectWizardAction"/>
38 <description>
39 The first thing you will need is an Object Teams project. If you
40 already have an Object Teams project in your workspace that you
41 would like to use, you may skip this step by clicking the
42 "Click to Skip" button. If not, select <b>File-&gt;New-&gt;Project...</b>
43 and choose <b>Object Teams Project</b> in the list. Complete the subsequent
44 pages as required. The "New Object Teams Project" wizard will be automatically
45 displayed when you click the "Click to Perform" button.
46 After creating the project, it will appear in the <b>OT Package Explorer</b>
47 view. Select the project by clicking it with the mouse, so that the next actions
48 will know that they apply to this project.
49 </description>
50 </item>
51
52 <item
53 href="/org.eclipse.jdt.doc.user/gettingStarted/qs-9.htm"
54 title="Create a Base class"
55 skip="true">
56 <action
57 pluginId="org.eclipse.jdt.ui"
58 class="org.eclipse.jdt.ui.actions.OpenNewClassWizardAction"/>
59 <description>
60 You should now have an Object Teams project in your workspace. The
61 next step in building your Object Teams application is to first
62 create a normal (Base) class. You may do this by either clicking
63 the "Click to Perform" button below to launch the "New Java Class"
64 wizard, or you may use the Eclipse tools to do it, by using the
65 <b>File-&gt;New-&gt;Class</b> action. Name your class for example
66 "<b>MyBase</b>". If you do not use the "Click to Perform" button below,
67 click the "Click to Skip" button to advance to the next step in
68 building your Object Teams application.
69 </description>
70 </item>
71
72 <item
73 title="Add two methods to your Base class">
74 <description>
75 Now that you have your MyBase class, add, e.g., the following two
76 methods:
77 <br/><b>public void hello() { System.out.println("Hello"); }</b><br/>
78 and
79 <br/><b>public String getWorld() { return "World"; }</b><br/>
80 and save your changes. The first method will be used in a callin binding,
81 the other in a callout binding. These bindings will be members of a
82 Role class which you are going to create in a minute. Click the
83 "Click to Complete" button below when finished.
84 </description>
85 </item>
86
87 <item
88 title="Create a Team class"
89 skip="true">
90 <action
91 pluginId="org.eclipse.objectteams.otdt.ui"
92 class="org.eclipse.objectteams.otdt.internal.ui.wizards.OpenTeamWizardAction"/>
93 <description>
94 The next step in building your Object Teams application is to create a
95 Team class, which is going to be the enclosing context for the Role class.
96 You may do this by either clicking the "Click to Perform" button
97 below to launch the "New Team Class wizard", or you may use the Eclipse
98 tools to do it, by using the <b>File-&gt;New-&gt;Team</b> action.
99 Name your class, e.g. "<b>MyTeam</b>". If you do not use the "Click to Perform"
100 button below, click the "Click to Skip" button to advance to the next
101 step in building your Object Teams application.
102 </description>
103 </item>
104
105 <item
106 title="Create a Role class"
107 skip="true">
108 <action
109 pluginId="org.eclipse.objectteams.otdt.ui"
110 class="org.eclipse.objectteams.otdt.internal.ui.wizards.OpenRoleWizardAction"/>
111 <description>
112 The next step in building your Object Teams application is to create a
113 Role class for the previously created Team class.
114 You may do this by either clicking the "Click to Perform" button
115 below to launch the New Role Class wizard, or you may use the Eclipse
116 tools to do it, by using the <b>File-&gt;New-&gt;Role</b> action.
117 Name your class, e.g. "<b>MyRole</b>". Enter the name of the enclosing Team
118 you have created before, in this case "MyTeam". Now bind the Role class to
119 your previously created Base class, either by typing in its name ("MyBase")
120 into the designated input field, or by choosing the Base class after clicking
121 the "Browse..." button next to the input field. If you do not use the "Click
122 to Perform" button below, click the "Click to Skip" button to advance to the
123 next step.
124 </description>
125 </item>
126
127 <item
128 title="Add two methods and two different bindings to your Role class">
129 <description>
130 Now that you have your "MyRole" class, add, e.g., the following two
131 methods:
132 <br/><b>public abstract String getAddressee();</b><br/>
133 and
134 <br/><b>public void greet() { System.out.println(getAddressee()); }</b><br/>
135 These are the Role methods that will be bound in a callout and callin
136 binding respectively. Let's add a callout binding:
137 <br/><b>getAddressee -&gt; getWorld;</b><br/>
138 and a callin binding:
139 <br/><b>greet &lt;- after hello;</b><br/>
140 and save your changes. Click the "Click to Complete" button below when finished.
141 </description>
142 </item>
143
144 <item
145 title="Add a main method.">
146 <description>
147 In order to complete your application, add a main method to your Team class:
148 <br/><b>public static void main(String[] args) {</b>
149 <br/><b>MyTeam myTeam = new MyTeam();</b>
150 <br/><b>myTeam.activate();</b>
151 <br/><b>new MyBase().hello();</b>
152 <br/><b>}</b><br/>
153 Click the "Click to Complete" button below when finished.
154 </description>
155 </item>
156
157 <item
158 href="/org.eclipse.jdt.doc.user/gettingStarted/qs-12.htm"
159 title="Tutorial finished!">
160 <description>
161 Congratulations! You have built your first Object Teams program. Now let's run it!
162 Open the <b>Run-Configuration</b> by choosing in the menubar <b>Run->Run...</b>.
163 Select <b>New Object Teams Application</b>
164 and click the "New" button at the bottom. Your project's name and main-class should
165 already be in place, otherwise please add them manually. All other settings can keep
166 their defaults, so simply press the <b>Run</b> button and watch the <b>Console</b>
167 view appear, showing the application's output!
168 That's it, you are now ready for Object Teams development!
169 </description>
170 </item>
171
172</cheatsheet>