Skip to content

Commit

Permalink
Fix for issue: Runtime exception links not working in console dcaoyua…
Browse files Browse the repository at this point in the history
…n#161

tidied up debug prints
  • Loading branch information
matthew committed Jun 8, 2016
1 parent 9c517f0 commit e0cfc3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ import java.io.IOException
import javax.swing.JTextPane
import javax.swing.SwingUtilities
import javax.swing.text.BadLocationException
import org.netbeans.api.java.classpath.GlobalPathRegistry
import org.openide.DialogDisplayer
import org.openide.ErrorManager
import org.openide.NotifyDescriptor
import org.openide.cookies.EditorCookie
import org.openide.filesystems.FileObject
import org.openide.filesystems.FileUtil
import org.openide.loaders.DataObject
import org.openide.loaders.DataObjectNotFoundException
Expand Down Expand Up @@ -99,19 +97,12 @@ class ConsoleMouseListener(textPane: JTextPane) extends MouseAdapter {

}

// private def getFileObject(relativePath: String): FileObject = {
// GlobalPathRegistry.getDefault().findResource(relativePath)
// }
//
private def openFile(file: File, lineNo: Int) {
// val fo = FileUtil.toFileObject(file)
// openFile(fo, lineNo)
// }
// private def openFile(fo: FileObject, lineNo: Int) {

ConsoleMouseListener.FileOpenRP.post(new Runnable() {
override def run() {
try {
val fo = FileUtil.toFileObject(file)
val fo = FileUtil.toFileObject(file)
val dob = DataObject.find(fo)
val ed = dob.getLookup.lookup(classOf[EditorCookie])
if (ed != null && /* not true e.g. for *_ja.properties */ (fo eq dob.getPrimaryFile)) {
Expand Down Expand Up @@ -145,11 +136,6 @@ class ConsoleMouseListener(textPane: JTextPane) extends MouseAdapter {
}
} else {
Toolkit.getDefaultToolkit.beep
System.out.println("fo: " + fo)
System.out.println("dob: " + dob)
System.out.println("ed: " + ed)
new RuntimeException().fillInStackTrace().printStackTrace()

}
} catch {
case ex: DataObjectNotFoundException => ErrorManager.getDefault.notify(ErrorManager.WARNING, ex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ class ConsoleOutputLineParser(defaultStyle: AttributeSet) {
val text = lineTexts(i)
val mFile = rFILE_PATH.matcher(text.text)
val mStackFrame = rSTACK_FRAME_PATTERN.matcher(text.text)
println("text.text: " + text.text)
println("mStackFrame: " + mStackFrame.matches + " " + mStackFrame.groupCount)
println("mFile: " + mFile.matches + " " + mFile.groupCount)

if (mStackFrame.matches && mStackFrame.groupCount >= 5) {
val pkg = mStackFrame.group(1)
Expand Down Expand Up @@ -161,13 +158,9 @@ class ConsoleOutputLineParser(defaultStyle: AttributeSet) {
}

private def getFile(relativePath: String): File = {
println("relativePath: " + relativePath)
val fileObject = GlobalPathRegistry.getDefault().findResource(relativePath)
println("FileObject: " + fileObject)
if (fileObject != null)
FileUtil.toFile(fileObject)
else
null

if (fileObject != null) FileUtil.toFile(fileObject) else null
}
}

Expand Down

0 comments on commit e0cfc3b

Please sign in to comment.