Working with the Application Context Extension sample
This sample demonstrates how to extend application context support for Trace UI artifacts (statistical views, graphical views, and filter support
If you have not already done so, create the example by File >
New > Example... > Context Language Sample.
The "application context" system lets the profiling views display data using the proper terms no matter what kind of data was collected. For
example, the Java term "method," the C term "function," and the Fortran term "procedure" all mean to the same thing. If you collect data from a C
program, you want to display the data using C terms and syntax. The application context system lets you do that.
This sample builds a plug-in that registers an application context formatter for the "C/C++" context. It provides terms that the views can use in
table headers and other places, and it provides a syntax formatter for displaying namespace names (using the C++ separator "::" instead of the Java
The sample contains code for simple extensions to the context sensitive support. The Package, Class, and Method structure used in Java are replaced
by C/C++ structures in various locations, such as in the view header, formatting, and filter dialog.
The sample contains the following elements which contribute to the context sensitive extension available in TPTP:
Contains the extension point for the C/C++ context definition, the C/C++ context provider declaration, as well as C/C++ context open source action.
org.eclipse.tptp.context.sample.clanguage.CContextProvider: This is the context formatter that is declared in plugin.xml, which mainly describes a format provider in a C/C++ context for the TPTP profiling view attribute replacement.
org.eclipse.tptp.context.sample.clanguage.ContextOpenSourceProviderSample: This is a C/C++ context sensitive open source action provider.
org.eclipse.tptp.context.sample.clanguage.*Formatter: Various formatters are available from the context provider when querying for C/C++ context sensitive label and formatter support.
The following procedure outlines the steps needed to view the contributions to the TPTP views made by this sample extension:
- Launch an instance of a runtime workbench by selecting Run >
Run As > Eclipse Application.
- Switch to the Profiling Monitor navigator view in the Profiling
Populate the Profiling Monitor view by importing a C/C++ context profiling file. The navigator should contain a Project, Monitor, Node, Process, and Agent.
- Open any TPTP profiling view, e.g. Memory Statistic view, Execution Statistic view. Note that the column headers and their content are formatted. Note also that attributes are formatted to C/C++ in view filter dialogs.
- Note: If you choose to import the context profiling file included in this example you will only be able to see Execution Statistics data as this is the only type contained in the file. The other TPTP profiling views are expected to be empty.
(C) Copyright IBM Corporation 2005, 2007. All Rights Reserved.