| <?xml version="1.0" encoding="UTF-8"?> |
| <cheatsheet title="Create a plug-in extension"> |
| <intro href="/org.eclipse.platform.doc.user/reference/ref-cheatsheets.htm"> |
| <description> |
| This cheat sheet will demonstrate how to create and test a plug-in extension |
| using PDE. |
| <br/> |
| <br/> |
| To learn more about using cheat sheets, click the help button |
| in the top right corner (?). |
| </description> |
| </intro> |
| <item title="Open the plug-in development perspective" dialog="true" skip="false" href="/org.eclipse.pde.doc.user/guide/tools/views/views.htm"> |
| <description> |
| To open the plug-in development perspective, |
| select <b>Window->Open Perspective->Other...</b> |
| and choose <b>Plug-in Development</b>. |
| <br/> |
| <br/> |
| Alternatively, click the following button to perform the task. |
| </description> |
| <command |
| confirm="false" |
| required="false" |
| translate="" |
| serialization="org.eclipse.ui.perspectives.showPerspective(org.eclipse.ui.perspectives.showPerspective.perspectiveId=org.eclipse.pde.ui.PDEPerspective)"> |
| </command> |
| </item> |
| <item title="Open the plug-in editor" dialog="true" skip="false" href="/org.eclipse.pde.doc.user/guide/tools/editors/manifest_editor/editor.htm"> |
| <description> |
| To open the plug-in editor (if it is not already open), |
| expand the <b>com.example.helloworld</b> tree dialog |
| in the <b>Package Explorer</b> view and double-click |
| on the <b>plugin.xml</b> file. |
| <br/> |
| <br/> |
| Alternatively, click the following button to perform the task. |
| </description> |
| <command |
| confirm="false" |
| required="false" |
| translate="" |
| serialization="org.eclipse.ui.navigate.openResource(filePath=/com.example.helloworld/plugin.xml)"> |
| </command> |
| </item> |
| <item title="Define a view extension" dialog="true" skip="false" href="/org.eclipse.pde.doc.user/guide/tools/editors/manifest_editor/extensions.htm"> |
| <description> |
| To define a view extension, perform the following steps: |
| </description> |
| <subitem label="Select the "Extensions" tab within the plug-in editor to display the "Extensions" page" skip="false"> |
| </subitem> |
| <subitem label="Click the "Add" button to open the "New Extension" wizard" skip="false"> |
| </subitem> |
| <subitem label="Select "org.eclipse.ui.views" from the "Extension Points" list box and click "Finish"" skip="false"> |
| </subitem> |
| </item> |
| <item title="Add a view category" dialog="true" skip="false" href="/org.eclipse.pde.doc.user/guide/tools/editors/manifest_editor/extensions.htm"> |
| <description> |
| To define a view category, perform the following steps: |
| </description> |
| <subitem label="Select "org.eclipse.ui.views" in the list box under "All Extensions" heading in the "Extensions" page" skip="false"> |
| </subitem> |
| <subitem label="Right-click and select "New->category" from the context menu" skip="false"> |
| </subitem> |
| <subitem label="Replace the content of the "id" text box under "Extension Element Details" with "com.example.helloworld.view.helloworldcategory"" skip="false"> |
| </subitem> |
| <subitem label="Replace the content of the "name" text box with "Hello World!"" skip="false"> |
| </subitem> |
| <subitem label="Select "File->Save" from the main menu" skip="false"> |
| </subitem> |
| </item> |
| <item title="Add a view" dialog="true" skip="false" href="/org.eclipse.pde.doc.user/guide/tools/editors/manifest_editor/extensions.htm"> |
| <description> |
| To define a view, perform the following steps: |
| </description> |
| <subitem label="Select "org.eclipse.ui.views" in the list box under "All Extensions" heading in the "Extensions" page" skip="false"> |
| </subitem> |
| <subitem label="Right-click and select "New->view" from the context menu" skip="false"> |
| </subitem> |
| <subitem label="Replace the content of the "id" text box under "Extension Element Details" with "com.example.helloworld.view.helloworldview"" skip="false"> |
| </subitem> |
| <subitem label="Replace the content of the "name" text box with "Hello World!"" skip="false"> |
| </subitem> |
| <subitem label="Replace the content of the "class" text box with "com.example.helloworld.view.SampleView"" skip="false"> |
| </subitem> |
| <subitem label="Replace the content of the "category" text box with "com.example.helloworld.view.helloworldcategory"" skip="false"> |
| </subitem> |
| <subitem label="Select "File->Save" from the main menu" skip="false"> |
| </subitem> |
| </item> |
| <item title="Create a view class" dialog="true" skip="false"> |
| <description> |
| To create a view class, perform the following steps: |
| </description> |
| <subitem label="Click the "class" hyperlink under "Extension Element Details" to start the "New Java Class" wizard" skip="false"> |
| </subitem> |
| <subitem label="Accept the default values and click the "Finish" button to exit the wizard" skip="false"> |
| </subitem> |
| </item> |
| <item title="Add view class code" dialog="true" skip="false"> |
| <description> |
| We are now going to add code to our view class to simply |
| display a "Hello, Eclipse world!" message in the view when |
| it is opened. |
| <br/> |
| <br/> |
| The previous step should have opened the <b>SampleView</b> class |
| in a Java editor. |
| <br/> |
| <br/> |
| Add the following lines of code under the pre-generated |
| <b>createPartControl</b> method: |
| <br/> |
| <br/> |
| Label label = new Label( parent, SWT.LEFT ); |
| <br/> |
| label.setText( "Hello, Eclipse world!" ); |
| <br/> |
| <br/> |
| Note: There will be two import errors to correct. |
| <br/> |
| Either add the following import statements manually or |
| click on the lightbulb icons in the margin of the Java |
| editor to add them: |
| <br/> |
| <br/> |
| import org.eclipse.swt.widgets.Label; |
| <br/> |
| import org.eclipse.swt.SWT; |
| <br/> |
| <br/> |
| Select "File->Save" from the main menu |
| </description> |
| </item> |
| <item title="Test the plug-in" dialog="true" skip="false" href="/org.eclipse.pde.doc.user/guide/tools/launchers/eclipse_application_launcher.htm"> |
| <description> |
| To test your Eclipse plug-in inside a target Eclipse platform, |
| perform the following steps: |
| </description> |
| <subitem label="Open the plug-in editor" skip="false"> |
| <command |
| confirm="false" |
| required="false" |
| translate="" |
| serialization="org.eclipse.ui.navigate.openResource(filePath=/com.example.helloworld/plugin.xml)"> |
| </command> |
| </subitem> |
| <subitem label="Select the "Overview" tab to display the "Overview" page" skip="false"> |
| </subitem> |
| <subitem label="Click the "Launch an Eclipse application" hyperlink under the "Testing" heading" skip="false"> |
| </subitem> |
| <subitem label="Select "Window->Show View->Other..." from the main menu in the newly launched Eclipse platform" skip="false"> |
| </subitem> |
| <subitem label="Note the "Hello World!" category and expand its tree dialog" skip="false"> |
| </subitem> |
| <subitem label="Select the "Hello World!" view and click the "OK" button" skip="false"> |
| </subitem> |
| <subitem label="Select "File->Exit" from the main menu to exit the target Eclipse platform" skip="false"> |
| </subitem> |
| </item> |
| </cheatsheet> |