The page provides a general outline for contributing examples to TPTP.
2.0 Downloading TPTP's Automated GUI Recorder
2.1 Extension Schema
3.0 Creatings an Example
4.0 Running an Example
5.0 Sample TPTP Examples
TPTP source is contained in the Eclipse CVS Respository. See TPTP Development Guide: Getting Started for information on checking out from CVS.
The top-level example feature and its branding plug-in are stored under the 'platform' directory.
org.eclipse.tptp.examples
This feature includes the individual TPTP Project examples, which are under each project's directory:
platform/org.eclipse.tptp.platform.examples
monitoring/org.eclipse.tptp.monitoring.examples
There are only examples for platform at this time. Feel free to contribute more.
In each project's example plug-in, the individual examples are contained in an 'archive' directory. Each example is a plug-in project with one or more Java classes containing a main() method that the user runs. When the example is created, the plug-in project will be copied into the local workspace. The user can then run the example project as a Java application.
You must define two extensions for your example wizards - extend the Eclipse wizard and the TPTP wizard. For more information on creating extensions, navigate to the Eclipse documentation site, select the appropriate version of Eclipse, and search for "Plug-in Extensions".
1. org.eclipse.ui.newWizards
This extension point is used to register resource creation wizard extensions. Creation wizards appear as choices within the "New Dialog", and are typically used to create folders and files.
<extension point="org.eclipse.ui.newWizards">
<category
id="com.xyz.XYZ"</category>
name="XYZ Wizards">
parentCategory="com.xyz.XYZ">
<wizard
id="com.xyz.wizard1"
name="XYZ artifact"
category="com.xyz.XYZ/com.xyz.XYZ.Web"
icon="./icons/XYZwizard1.gif"
project="true"
finalPerspective="org.eclipse.jdt.ui.JavaPerspective"
icon="icons/newHyadesLoggingCoreSampleProject_wiz.gif"><description>
Create a simple XYZ artifact and set initial content
</description>
</wizard>
</extension>
2. org.eclipse.hyades.ui.sampleWizards
This extension point is used to register sample wizard extensions. Sample wizards appear as choices within the "New Example", and are typically used to create specific samples.
<extension point="org.eclipse.hyades.ui.sampleWizards">
<sampleWizard
id="org.eclipse.mySample.LogCreationWizard"
<projectsetup>
wizardId="org.eclipse.mySample.LogCreationWizard"
banner ="icons\examples\newtestproject_wizbanner.gif"</projectsetup>name="LogProject"
pagedescription="Short description for page1"
pagetitle="Page1"
helpId="context.xml">
<open file="cfg\myadp.adapter" editorId="org.eclipse.hyades.logging.adapter.ui.internal.presentation.AdaptorEditorID"/>
<import src="archive/LogAnalyzerSample" dest="LogAnalyzerSample"/>
<nature id="org.eclipse.jdt.core.javanature"/>
<buildCommand name="org.eclipse.jdt.core.javabuilder"/>
</sampleWizard>
</extension>
To create a Hello World example, follow the steps below and enter the provided values into the appropriate fields.
1. Check-out the examples plug-in from CVS, for the TPTP project that you are contributing to. (i.e. org.eclipse.tptp.platform.examples)
2. Add your sample plug-in project under org.eclipse.tptp.platform.examples/archive.
3. Open org.eclipse.tptp.platform.examples/plugin.xml. In the Extensions tab, notice that our examples define extensions to two extension points.
For more information regarding these extensions and their attributes, select the extension and click on either the "Show extension point description" or the "Open extension point schema" link in the Extension Details pane on the right.
4. Two categories for org.eclipse.ui.newWizards are already created for Logging and UI. Define a new category.
Right-click on the org.eclipse.ui.newWizards extension and select New > Category.
Select the newly created category. In the Extension Element Details pane on the right, fill out the out the appropriate fields:
- id - org.eclipse.tptp.platform.exampleCategory
- name - %TPTP_PLATFORM_EXAMPLES_CATEGORY_NAME
- parentCategory - org.eclipse.ui.Examples
Note: Attribute values preceded by % are externalised string, which are defined in org.eclipse.tptp.platform.examples/plugin.properties. We will specify these at the end.
5. Define an extension to the first extension point. Right-click on the org.eclipse.ui.newWizards extension and select New > Wizard.
Select the newly created wizard. In the Extension Element Details pane on the right, fill out the appropriate fields:
- id - org.eclipse.tptp.platform.examples.helloWorld
- name - %TPTP_PLATFORM_HELLOWORLD_SAMPLE_NAME
- class - org.eclipse.hyades.logging.core.sample.wizard.SampleCreationWizard
- icon - icons/newHyadesLoggingCoreSampleProject_wiz.gif (optional)
- category - org.eclipse.ui.Examples/org.eclipse.tptp.platform.exampleCategory (created in Step 4)
- project - true
- final perspective - org.eclipse.jdt.ui.JavaPerspective
Create a new description for your wizard. Right-click on your wizard and select New > description.
Specify the Body Text as an externalised string, which will later be defined in plugin.properties.
- %TPTP_PLATFORM_HELLOWORLD_SAMPLE_DESC
6. Define an extension to the second extension point. Right-click on org.eclipse.hyades.ui.sampleWizards and select New > sampleWizard.
Select the newly created wizard. In the Extension Element Details pane on the right, fill out the appropriate fields:
- id - org.eclipse.tptp.platform.examples.helloWorld.sample
- wizardId - org.eclipse.tptp.platform.examples.helloWorld
- icons - icons/newTPTPPlatformHelloWorldSampleProject_wizbanner.gif (optional)
7. Define a new projectsetup for your sampleWizard. Right-click on your sampleWizard and select New > projectSetup.
- helpId - leaving as empty (enter a space)
- name - TPTPHelloWorldProject
- pagedescription - %TPTP_PLATFORM_HELLOWORLD_SAMPLE_PAGE1_DESC
- pagetitle - %TPTP_PLATFORM_HELLOWORLD_SAMPLE_PAGE1_NAME
8. For your projectsetup, create and define each of the following attributes.
- open
- file - \org.eclipse.tptp.platform.doc.user\samples\hello_world.html
- editorId - leaving as empty (enter a space)
- import
- src - archive/TPTPPlatformHelloWorldSample (name of the example project from step 2)
- nature - org.eclipse.jdt.core.javanature
- buildcommand - org.eclipse.jdt.core.javabuilder
9. Define all the externalised strings in plugin.properties:
TPTP_PLATFORM_EXAMPLES_CATEGORY_NAME = Example
TPTP_PLATFORM_HELLOWORLD_SAMPLE_NAME = Hello World Sample
TPTP_PLATFORM_HELLOWORLD_SAMPLE_DESC = Information for Hello World.
TPTP_PLATFORM_HELLOWORLD_SAMPLE_PAGE1_NAME = Hello World Example
TPTP_PLATFORM_HELLOWORLD_SAMPLE_PAGE1_DESC = Specify the project to contain the information for Hello World.
10. Create a "how-to" document with the steps needed to run your example application. The "how-to" documents for TPTP examples are stored in the corresponding project's tptp.platform.<project>.doc.user/samples directory.
Use these documents as a guide for your own example. Other documents related to the example should be stored in the ../archive/ <example project>/cfg directory.
1. Run org.eclipse.tptp.platform.examples as an Eclipse application.
2. In the new runtime Eclipse, you can create an example by: File > New > Example... > New Example Wizard: Hello World Sample.
Note: In order for the Example menu option to show up, you must have the TPTP driver installed and also have a TPTP example in the workspace.
2. Click Next. Enter a name for the example project (or leave as default) and click Finish.
3. The TPTPHelloWorldProject project is created in the workspace.
4. The "how-to" document you created from the previous section, automatically opens up in the Eclipse Help window.
5. To run this example, right-click TPTPHelloWorldProject and select Run as > Java Application.
In TPTP 4.5.0, the following platform examples available to demonstrate logging and ui features:
- EMF Common Base Event v1.0.1
- JSR-047 Logging
- Log4J Logging
- Apache Commons Logging
To run these TPTP examples, see Section 4.0 and also refer to the corresponding "how-to" document (as mentioned in Section 3.0) for further instructions.
Author: Kendric Wang