cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

QueryEditorTextEditor

Query Editor Text Editor Alignment & Upgrades

Contents


This page describes the high level plan for upgrading the Query Editor text pane, modifying it to use the Netbeans Editor framework (http://editor.netbeans.org), and merging functionality with the Netbeans SQL Editor.

NetBeans has a text-based SQL Editor. VWP has a visual Query Editor. The VWP Query Editor is used for defining queries used in data binding; the NetBeans SQL Editor is for editing and executing SQL script files. Although they serve different purposes, there is some functionality, such as the editor pane, that can be reused.

This will enable additions of extra functionality such as code completion and SQL syntax highlighting, which are currently implemented in limited form.

Current Situation

SqlEditor

Appears to be based on Editor module, but only uses certain features:

  • syntax coloring

Query Editor

The Query Editor contains three input panes, one of which (the "Text Pane") is implemented as a JTextPane, which provides the following features:

  • syntax coloring
  • case conversion on all names, including table/column names
  • code completion on reserved words


Planned: Tentative partitioning of Editor module features

The following lists most of the features of the Editor module, grouped by whether they will be included in the unified SQL editor. Note that most of the features that are planned for omission are not meaningful in the context of an editor for SQL statements.

In:

  • Text selection and scrolling shortcuts
  • Navigation shortcuts (some)
  • Working with braces/brackets/parens
  • Code completion
  • Formatting code
  • Find and replace

Possible:

  • Abbreviations
  • Code templates

Out:

  • Navigation functions (Go to {Source, Declaration, Super Implementation, Line, Class})
  • Show Javadoc
  • Refactoring
  • Fix imports
  • Macro recording
  • Breakpoints
  • Bookmarks
  • Jump list

The most significant new feature is code completion, which requires some elaboration.

The Editor module supports three different forms of code completion, which vary according to the range of completions supported.

For a SQL editor, the most natural approach is to use database metadata (tables/columns). Gathering metadata is potentially very expensive, so must be done selectively. Some details need to be worked out.

Discussion

Most of the new features could implemented with Project Schliemann, which provides a lightweight mechanism for rapidly adding limited support to languages.

http://wiki.netbeans.org/wiki/view/Schliemann


Open Issues

Need to verify that an Editor Module window can run as a pane in a larger component hierarchy, rather than a TopComponent.

Update: this has been verified.


Tasks and Priorities

1. Port current text pane onto Netbeans Editor Module.

2. Modify both SQLEditor and QE Text Editor to share code (as much as possible).

Note that certain functions will not be shared; for example, the QE Text Editor operates only on properties, and does not have provision for reading/writing files.

3. Extend both editors to add additional functionality, notably code completion

  for table/column names, and other features identified in the "In" list above.  Most of these       
  should required minimal extra work, beyond the functionality already present in the Editor Module.  

Task (1) will be addressed initially, and should be straightforward.

Task (2) may or may not be addressed, depending on the effort required.

Task (3), which extends both SQL editors, is lower priority, and will be addressed only after other features are completed.

Status (Milestone 8)

Tasks (1) and (2) have been completed. The SQLTextPane uses the Netbeans SQLEditorKit, with the attendant functionality (mainly syntax coloring).

In addition, the Results Pane now provides the same functionality as the SQLEditor, notably menu items for copying either the current cell or the current row to the clipboard.