Contributing Examples to TPTP
Contributing Examples to TPTP

The page provides a general outline for contributing examples to TPTP.

Table of Contents:
1.0 Overview of TPTP Examples Infracture
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

1.0 Overview of TPTP Examples Infracture

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.

2.0 Structure of Examples Plug-in

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.

2.1 Extension Schema

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"
name="XYZ Wizards">
parentCategory="com.xyz.XYZ">
</category>
<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"
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"/>

</projectsetup>

</sampleWizard>
</extension>

3.0 Creating a Hello World Example

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:

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:

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.

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:

7. Define a new projectsetup for your sampleWizard. Right-click on your sampleWizard and select New > projectSetup.

8. For your projectsetup, create and define each of the following attributes.

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.

4.0 Running an Example

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.

5.0 Sample Logging and UI Examples

In TPTP 4.5.0, the following platform examples available to demonstrate logging and ui features:

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.