@@ -258,21 +258,19 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
258258
259259 private def openLink (String link ) {
260260 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 ))
264265 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
272270 val parser = new UtplsqlParser (source)
273271 line = parser. getLineOf(procedureName)
274272 }
275- openEditor(ownerName, fixedObjectType , objectName. toUpperCase, line, 1 )
273+ openEditor(ownerName, objectType , objectName. toUpperCase, line, 1 )
276274 }
277275
278276 private def openEditor (String owner , String type , String name , int line , int col ) {
@@ -578,20 +576,23 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
578576 // at "OWNER.PACKAGE.PROCEDURE", line 42
579577 // at "OWNER.PROCEDURE", line 42
580578 // 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]+))' ' ' )
582581 var localText = HtmlUtils . htmlEscape(text)
583582 var m = p1. matcher(localText)
584583 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)»' ' '
587588 m = p1. matcher(localText)
588589 }
589590 // Patterns (primarily Warnings, without line reference, calculate when opening link):
590591 // owner.package.procedure
591592 val p2 = Pattern . compile(' ' ' ^\s {2}((\S +?)\. (\S +?)\. (\S +?))$' ' ' , Pattern . MULTILINE )
592593 m = p2. matcher(localText)
593594 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>' ' '
595596 val start = m. start(0 )
596597 val end = m. end(0 )
597598 localText = ' ' ' «localText.substring(0, start)»«link»«localText.substring(end)»' ' '
0 commit comments