Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Results View Control"
m |
m (→Example Usage) |
||
Line 39: | Line 39: | ||
== Example Usage == | == Example Usage == | ||
+ | In the org.eclipse.datatools.sqltools.sqlbuilder.examples plugin, there is an example of a dialog which hosts the ResultsViewControl component. This plugin is located in CVS under: | ||
+ | :<tt>:org.eclipse.datatools.sqltools/examples/</tt> | ||
+ | The dialog class is <tt> | ||
+ | :org.eclipse.datatools.sqltools.sqlbuilder.examples.dialogs.SQLBuilderDialog</tt> | ||
+ | and its usage of the <tt>ResultsViewControl</tt> is included below: | ||
<pre> | <pre> | ||
/* | /* | ||
Line 56: | Line 61: | ||
_resultsViewControl.createPartControl(resultsComposite); | _resultsViewControl.createPartControl(resultsComposite); | ||
</pre> | </pre> | ||
+ | |||
+ | <tt>SQLBuilderDialog</tt> also defines a filter for the results history section of the ResultsViewControl in the class <tt>ResultsHistoryFilter</tt>. This filter is given to the ResultsViewControl by passing it to <tt>addResultHistoryFilter(ViewerFilter)</tt>. |
Revision as of 08:04, 17 December 2007
← Back to SQL Development Tools page
Contents
Introduction
The DTP Results View now provides a ResultsViewControl component for displaying SQL execution results. The ResultsViewControl can be consumed by other UI components such as editors, dialogs and wizards, enabling them to show SQL execution results in their own user-interface.
ResultsViewControl
Location
The class for displaying SQL execution results is ResultsViewControl, defined in the plugin
- org.eclipse.datatools.sqltools.result
in the package
- org.eclipse.datatools.sqltools.result.ui.view.
API
The ResultsViewControl should be instantiated using the constructor
- ResultsViewControl(ResultsView)
passing null as the ResultsView parameter.
After instantiation, the ResultsViewControl should be initialized by calling:
- init(IViewSite, IMemento) throws PartInitException
passing two null parameters.
The final part of ResultsViewControl creation is to call
- void createPartControl(Composite parent)
The client can request the ResultsViewControl to use the Preferences defined for the SQL Results View or not, using the method
- setUsePreferences(boolean)
If setUsePreferences(true) is called, the preferences for SQL Results View relating to the user-interface will be used. These control, for example, whether results are shown in a single window or multiple windows, in text mode or grid mode.
If setUsePreferences(false) is called, the preferences defaults for the SQL Results View are used.
For example code, see Example Usage
Filtering Results
Consumers of ResultsViewControl can implement their own filters on the History Section of the results view by extending the org.eclipse.jface.viewers.ViewerFilter class and passing an instance of the new class to:
- addResultHistoryFilter(ViewerFilter)
For an example, see Example Usage
Example Usage
In the org.eclipse.datatools.sqltools.sqlbuilder.examples plugin, there is an example of a dialog which hosts the ResultsViewControl component. This plugin is located in CVS under:
- :org.eclipse.datatools.sqltools/examples/
The dialog class is
- org.eclipse.datatools.sqltools.sqlbuilder.examples.dialogs.SQLBuilderDialog
and its usage of the ResultsViewControl is included below:
/* * Add the results view */ _resultsViewControl = new ResultsViewControl(null); /* * Tell the results view to use preferences */ _resultsViewControl.setUsePreferences(true); try { _resultsViewControl.init(null, null); } catch (PartInitException e) { e.printStackTrace(); } _resultsViewControl.createPartControl(resultsComposite);
SQLBuilderDialog also defines a filter for the results history section of the ResultsViewControl in the class ResultsHistoryFilter. This filter is given to the ResultsViewControl by passing it to addResultHistoryFilter(ViewerFilter).