@@ -258,21 +258,19 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
258
258
259
259
private def openLink (String link ) {
260
260
val parts = link. split(" /" )
261
- val ownerName = parts. get(0 )
262
- val objectName = parts. get(1 )
263
- var line = Integer . parseInt(parts. get(2 ))
261
+ val type = parts. get(0 )
262
+ val ownerName = parts. get(1 )
263
+ val objectName = parts. get(2 )
264
+ var line = Integer . parseInt(parts. get(3 ))
264
265
val dao = new UtplsqlDao (Connections . instance. getConnection(currentRun. connectionName))
265
- val objectType = dao. getObjectType(ownerName, objectName)
266
- // links to package specification will open the body, there is no way to identify the type without context knowledge
267
- // but the jump to the specification from the body is simple from SQL Developer, so it is a minor issue
268
- val fixedObjectType = ' ' ' «objectType»«IF objectType == "PACKAGE" || objectType == "TYPE"» BODY«ENDIF»' ' '
269
- if (parts. size == 4 ) {
270
- val procedureName = parts. get(3 )
271
- val source = dao. getSource(ownerName, fixedObjectType, objectName). trim
266
+ val objectType = if (type== " UNKNOWN" ) {dao. getObjectType(ownerName, objectName)} else {type}
267
+ if (parts. size == 5 ) {
268
+ val procedureName = parts. get(4 )
269
+ val source = dao. getSource(ownerName, objectType, objectName). trim
272
270
val parser = new UtplsqlParser (source)
273
271
line = parser. getLineOf(procedureName)
274
272
}
275
- openEditor(ownerName, fixedObjectType , objectName. toUpperCase, line, 1 )
273
+ openEditor(ownerName, objectType , objectName. toUpperCase, line, 1 )
276
274
}
277
275
278
276
private def openEditor (String owner , String type , String name , int line , int col ) {
@@ -578,20 +576,23 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
578
576
// at "OWNER.PACKAGE.PROCEDURE", line 42
579
577
// at "OWNER.PROCEDURE", line 42
580
578
// at "OWNER.PACKAGE", line 42
581
- val p1 = Pattern . compile(' ' ' \s +("(\S +?)\. (\S +?)(?:\. (\S +?))?",\s +line\s +([0-9]+))' ' ' )
579
+ // at package "OWNER.PACKAGE", line 42
580
+ val p1 = Pattern . compile(' ' ' \s +(package\s +)?("(\S +?)\. (\S +?)(?:\. (\S +?))?",\s +line\s +([0-9]+))' ' ' )
582
581
var localText = HtmlUtils . htmlEscape(text)
583
582
var m = p1. matcher(localText)
584
583
while (m. find) {
585
- val link = ' ' ' <a href="«m.group(2)»/«m.group(3)»/«m.group(5)»">«m.group(1)»</a>' ' '
586
- localText = localText. replaceFirst(p1. pattern, link)
584
+ val link = ' ' ' <a href="«IF m.group(1) !== null»PACKAGE«ELSE»UNKNOWN«ENDIF»/«m.group(3)»/«m.group(4)»/«m.group(6)»">«m.group(2)»</a>' ' '
585
+ val start = m. start(2 )
586
+ val end = m. end(2 )
587
+ localText = ' ' ' «localText.substring(0, start)»«link»«localText.substring(end)»' ' '
587
588
m = p1. matcher(localText)
588
589
}
589
590
// Patterns (primarily Warnings, without line reference, calculate when opening link):
590
591
// owner.package.procedure
591
592
val p2 = Pattern . compile(' ' ' ^\s {2}((\S +?)\. (\S +?)\. (\S +?))$' ' ' , Pattern . MULTILINE )
592
593
m = p2. matcher(localText)
593
594
while (m. find) {
594
- val link = ' ' ' <a href="«m.group(2).toUpperCase»/«m.group(3).toUpperCase»/1/«m.group(4).toUpperCase»">«m.group(1)»</a>' ' '
595
+ val link = ' ' ' <a href="UNKNOWN/ «m.group(2).toUpperCase»/«m.group(3).toUpperCase»/1/«m.group(4).toUpperCase»">«m.group(1)»</a>' ' '
595
596
val start = m. start(0 )
596
597
val end = m. end(0 )
597
598
localText = ' ' ' «localText.substring(0, start)»«link»«localText.substring(end)»' ' '
0 commit comments