|
1 <?xml version="1.0" encoding="UTF-8"?><!-- |
|
2 Copyright (c) 2005, 2008 IBM Corporation and others. |
|
3 All rights reserved. This program and the accompanying materials |
|
4 are made available under the terms of the Eclipse Public License v1.0 |
|
5 which accompanies this distribution, and is available at |
|
6 http://www.eclipse.org/legal/epl-v10.html |
|
7 |
|
8 Contributors: |
|
9 IBM Corporation - initial API and implementation |
|
10 --> |
|
11 |
|
12 <cheatsheet title="Create a plug-in extension"> |
|
13 <intro href="/org.eclipse.platform.doc.user/reference/ref-cheatsheets.htm"> |
|
14 <description> |
|
15 This cheat sheet will demonstrate how to create and test a plug-in extension |
|
16 using PDE. |
|
17 <br/> |
|
18 <br/> |
|
19 To learn more about using cheat sheets, click the help button |
|
20 in the top right corner (?). |
|
21 </description> |
|
22 </intro> |
|
23 <item title="Open the plug-in development perspective" dialog="true" skip="false" href="/org.eclipse.pde.doc.user/guide/tools/views/views.htm"> |
|
24 <description> |
|
25 To open the plug-in development perspective, |
|
26 select <b>Window->Open Perspective->Other...</b> |
|
27 and choose <b>Plug-in Development</b>. |
|
28 <br/> |
|
29 <br/> |
|
30 Alternatively, click the following button to perform the task. |
|
31 </description> |
|
32 <command |
|
33 confirm="false" |
|
34 required="false" |
|
35 translate="" |
|
36 serialization="org.eclipse.ui.perspectives.showPerspective(org.eclipse.ui.perspectives.showPerspective.perspectiveId=org.eclipse.pde.ui.PDEPerspective)"> |
|
37 </command> |
|
38 </item> |
|
39 <item title="Open the plug-in editor" dialog="true" skip="false" href="/org.eclipse.pde.doc.user/guide/tools/editors/manifest_editor/editor.htm"> |
|
40 <description> |
|
41 To open the plug-in editor (if it is not already open), |
|
42 expand the <b>com.example.helloworld</b> tree dialog |
|
43 in the <b>Package Explorer</b> view and double-click |
|
44 on the <b>plugin.xml</b> file. |
|
45 <br/> |
|
46 <br/> |
|
47 Alternatively, click the following button to perform the task. |
|
48 </description> |
|
49 <command |
|
50 confirm="false" |
|
51 required="false" |
|
52 translate="" |
|
53 serialization="org.eclipse.ui.navigate.openResource(filePath=/com.example.helloworld/plugin.xml)"> |
|
54 </command> |
|
55 </item> |
|
56 <item title="Define a view extension" dialog="true" skip="false" href="/org.eclipse.pde.doc.user/guide/tools/editors/manifest_editor/extensions.htm"> |
|
57 <description> |
|
58 To define a view extension, perform the following steps: |
|
59 </description> |
|
60 <subitem label="Select the "Extensions" tab within the plug-in editor to display the "Extensions" page" skip="false"> |
|
61 </subitem> |
|
62 <subitem label="Click the "Add" button to open the "New Extension" wizard" skip="false"> |
|
63 </subitem> |
|
64 <subitem label="Select "org.eclipse.ui.views" from the "Extension Points" list box and click "Finish"" skip="false"> |
|
65 </subitem> |
|
66 </item> |
|
67 <item title="Add a view category" dialog="true" skip="false" href="/org.eclipse.pde.doc.user/guide/tools/editors/manifest_editor/extensions.htm"> |
|
68 <description> |
|
69 To define a view category, perform the following steps: |
|
70 </description> |
|
71 <subitem label="Select "org.eclipse.ui.views" in the list box under "All Extensions" heading in the "Extensions" page" skip="false"> |
|
72 </subitem> |
|
73 <subitem label="Right-click and select "New->category" from the context menu" skip="false"> |
|
74 </subitem> |
|
75 <subitem label="Replace the content of the "id" text box under "Extension Element Details" with "com.example.helloworld.view.helloworldcategory"" skip="false"> |
|
76 </subitem> |
|
77 <subitem label="Replace the content of the "name" text box with "Hello World!"" skip="false"> |
|
78 </subitem> |
|
79 <subitem label="Select "File->Save" from the main menu" skip="false"> |
|
80 </subitem> |
|
81 </item> |
|
82 <item title="Add a view" dialog="true" skip="false" href="/org.eclipse.pde.doc.user/guide/tools/editors/manifest_editor/extensions.htm"> |
|
83 <description> |
|
84 To define a view, perform the following steps: |
|
85 </description> |
|
86 <subitem label="Select "org.eclipse.ui.views" in the list box under "All Extensions" heading in the "Extensions" page" skip="false"> |
|
87 </subitem> |
|
88 <subitem label="Right-click and select "New->view" from the context menu" skip="false"> |
|
89 </subitem> |
|
90 <subitem label="Replace the content of the "id" text box under "Extension Element Details" with "com.example.helloworld.view.helloworldview"" skip="false"> |
|
91 </subitem> |
|
92 <subitem label="Replace the content of the "name" text box with "Hello World!"" skip="false"> |
|
93 </subitem> |
|
94 <subitem label="Replace the content of the "class" text box with "com.example.helloworld.view.SampleView"" skip="false"> |
|
95 </subitem> |
|
96 <subitem label="Replace the content of the "category" text box with "com.example.helloworld.view.helloworldcategory"" skip="false"> |
|
97 </subitem> |
|
98 <subitem label="Select "File->Save" from the main menu" skip="false"> |
|
99 </subitem> |
|
100 </item> |
|
101 <item title="Create a view class" dialog="true" skip="false"> |
|
102 <description> |
|
103 To create a view class, perform the following steps: |
|
104 </description> |
|
105 <subitem label="Click the "class" hyperlink under "Extension Element Details" to start the "New Java Class" wizard" skip="false"> |
|
106 </subitem> |
|
107 <subitem label="Accept the default values and click the "Finish" button to exit the wizard" skip="false"> |
|
108 </subitem> |
|
109 </item> |
|
110 <item title="Add view class code" dialog="true" skip="false"> |
|
111 <description> |
|
112 We are now going to add code to our view class to simply |
|
113 display a "Hello, Eclipse world!" message in the view when |
|
114 it is opened. |
|
115 <br/> |
|
116 <br/> |
|
117 The previous step should have opened the <b>SampleView</b> class |
|
118 in a Java editor. |
|
119 <br/> |
|
120 <br/> |
|
121 Add the following lines of code under the pre-generated |
|
122 <b>createPartControl</b> method: |
|
123 <br/> |
|
124 <br/> |
|
125 Label label = new Label( parent, SWT.LEFT ); |
|
126 <br/> |
|
127 label.setText( "Hello, Eclipse world!" ); |
|
128 <br/> |
|
129 <br/> |
|
130 Note: There will be two import errors to correct. |
|
131 <br/> |
|
132 Either add the following import statements manually or |
|
133 click on the lightbulb icons in the margin of the Java |
|
134 editor to add them: |
|
135 <br/> |
|
136 <br/> |
|
137 import org.eclipse.swt.widgets.Label; |
|
138 <br/> |
|
139 import org.eclipse.swt.SWT; |
|
140 <br/> |
|
141 <br/> |
|
142 Select "File->Save" from the main menu |
|
143 </description> |
|
144 </item> |
|
145 <item title="Test the plug-in" dialog="true" skip="false" href="/org.eclipse.pde.doc.user/guide/tools/launchers/eclipse_application_launcher.htm"> |
|
146 <description> |
|
147 To test your Eclipse plug-in inside a target Eclipse platform, |
|
148 perform the following steps: |
|
149 </description> |
|
150 <subitem label="Open the plug-in editor" skip="false"> |
|
151 <command |
|
152 confirm="false" |
|
153 required="false" |
|
154 translate="" |
|
155 serialization="org.eclipse.ui.navigate.openResource(filePath=/com.example.helloworld/plugin.xml)"> |
|
156 </command> |
|
157 </subitem> |
|
158 <subitem label="Select the "Overview" tab to display the "Overview" page" skip="false"> |
|
159 </subitem> |
|
160 <subitem label="Click the "Launch an Eclipse application" hyperlink under the "Testing" heading" skip="false"> |
|
161 </subitem> |
|
162 <subitem label="Select "Window->Show View->Other..." from the main menu in the newly launched Eclipse platform" skip="false"> |
|
163 </subitem> |
|
164 <subitem label="Note the "Hello World!" category and expand its tree dialog" skip="false"> |
|
165 </subitem> |
|
166 <subitem label="Select the "Hello World!" view and click the "OK" button" skip="false"> |
|
167 </subitem> |
|
168 <subitem label="Select "File->Exit" from the main menu to exit the target Eclipse platform" skip="false"> |
|
169 </subitem> |
|
170 </item> |
|
171 </cheatsheet> |