utPLSQL/utPLSQL-SQLDeveloper

Link to files instead of database objects

PhilippSalvisberg opened this issue · 2 comments

The realtime reporter can open source objects from various contexts.

Location Object Double click action
Overview table Row Opens test package specification at line of test procedure
Failures table Row Opens test package body at failed line
Failure text Hyperlink Opens referenced object at referenced line
Errors Hyperlink Opens referenced object at referenced line
Warnings Hyperlink Opens referenced object at referenced line
Info Hyperlink Opens referenced object at referenced line

These links always open a database object (see use of DrllLinkClass in v1.1.0). This is unwanted in a file based development, where you want to maintain files under version control and deploy them in a subsequent step.

As @thatjeffsmith pointed out on this Twitter post it is possible to configure SQL Developer to use files instead of database objects. Unfortunately this works only for debugging sessions. However, SQL Developer stores the associated files and has a built-in feature to open it. The question is, if the relevant classes are exposed via OSGi bundles and can be used in our extension.

Even if the underlying API is not exposed, we can access the necessary information directly. The associated files are stored in project.qbql. In the folder ${ide.system.dir}/o.sqldeveloper/. The file structure is quite simple and can be easily parsed and used to implement a custom link feature. Here's an example of the file content:

[fileURL dbURL]
 "file:/Users/phs/github/plscope-utils/database/utils/package/parse_util.pks" "sqldev.nav:IdeConnections%2523plscope-odb-macphs//PLSCOPE/PACKAGE/PARSE_UTIL"
 "file:/Users/phs/github/plscope-utils/database/utils/package/dd_util.pkb" "sqldev.nav:IdeConnections%2523plscope-odb-macphs//PLSCOPE/PACKAGE/DD_UTIL/PACKAGE+BODY/DD_UTIL"
 "file:/Users/phs/github/plscope-utils/database/utils/package/lineage_util.pks" "sqldev.nav:IdeConnections%2523plscope-odb-macphs//PLSCOPE/PACKAGE/LINEAGE_UTIL"
 "file:/Users/phs/github/plscope-utils/database/utils/package/plscope_context.pkb" "sqldev.nav:IdeConnections%2523plscope-odb-macphs//PLSCOPE/PACKAGE/PLSCOPE_CONTEXT/PACKAGE+BODY/PLSCOPE_CONTEXT"
 "file:/Users/phs/github/plscope-utils/database/utils/package/plscope_context.pks" "sqldev.nav:IdeConnections%2523plscope-odb-macphs//PLSCOPE/PACKAGE/PLSCOPE_CONTEXT"
 "file:/Users/phs/github/plscope-utils/database/utils/package/type_util.pkb" "sqldev.nav:IdeConnections%2523plscope-odb-macphs//PLSCOPE/PACKAGE/TYPE_UTIL/PACKAGE+BODY/TYPE_UTIL"
 "file:/Users/phs/github/plscope-utils/database/utils/package/dd_util.pks" "sqldev.nav:IdeConnections%2523plscope-odb-macphs//PLSCOPE/PACKAGE/DD_UTIL"
 "file:/Users/phs/github/plscope-utils/database/utils/package/type_util.pks" "sqldev.nav:IdeConnections%2523plscope-odb-macphs//PLSCOPE/PACKAGE/TYPE_UTIL"
 "file:/Users/phs/github/plscope-utils/database/utils/package/lineage_util.pkb" "sqldev.nav:IdeConnections%2523plscope-odb-macphs//PLSCOPE/PACKAGE/LINEAGE_UTIL/PACKAGE+BODY/LINEAGE_UTIL"
 "file:/Users/phs/github/plscope-utils/database/utils/package/parse_util.pkb" "sqldev.nav:IdeConnections%2523plscope-odb-macphs//PLSCOPE/PACKAGE/PARSE_UTIL/PACKAGE+BODY/PARSE_UTIL"

So, this is doable. We could even think about providing a bulk-link-file-population-feature. Maybe we should do that anyway to be independent of the SQL Developer's file linking feature which has a different scope.

In another project we are building a custom workspace for SQL Developer. These concepts might be used here as well. Therefore I moved this issue to milestone v1.3.0

Too complicated. Closing issue.