Navigating to Database Grid from Line Marker Provider
Answered
Hi JetBrains,
In my plugin I'm implementing a LineMarkerProvider to navigate from a Java source file to the database grid of a related database table. So far I've been able to navigate to the table's DDL:
class DatabaseTableLineMarkerProvider : RelatedItemLineMarkerProvider() {
override fun collectNavigationMarkers(element: PsiElement, result: MutableCollection<in RelatedItemLineMarkerInfo<*>>) {
val targets : Collection<DbTable> = [...]
if (targets.isEmpty())
return
val builder = NavigationGutterIconBuilder.create(Icons.TABLE)
.setTargets(targets)
.setTooltipText("...")
result.add(builder.createLineMarkerInfo(element))
}
}
This is working fine. However, I want to navigate to the database grid / table editor instead. What would be the proper way to do this?
I've tried several approaches, but none of those really worked out. If you could give me some pointers then that would be much appreciated.
Thanks,
Guno
Please sign in to leave a comment.
Hi Guno Heitman!
You can use the following method for your purpose: com.intellij.database.view.DbNavigationUtils#navigateToData(com.intellij.database.psi.DbElement, boolean).
Thanks Anna, that helps!
Moved my follow-up question to a new post as this one is already labelled as answered.