From: <kp...@us...> - 2007-08-24 13:17:08
|
Revision: 10434 http://jedit.svn.sourceforge.net/jedit/?rev=10434&view=rev Author: kpouer Date: 2007-08-24 06:17:07 -0700 (Fri, 24 Aug 2007) Log Message: ----------- fixed some bugs Modified Paths: -------------- plugins/Hyperlinks/trunk/src/gatchan/jedit/hyperlinks/HyperlinkManager.java Modified: plugins/Hyperlinks/trunk/src/gatchan/jedit/hyperlinks/HyperlinkManager.java =================================================================== --- plugins/Hyperlinks/trunk/src/gatchan/jedit/hyperlinks/HyperlinkManager.java 2007-08-24 13:06:54 UTC (rev 10433) +++ plugins/Hyperlinks/trunk/src/gatchan/jedit/hyperlinks/HyperlinkManager.java 2007-08-24 13:17:07 UTC (rev 10434) @@ -45,8 +45,9 @@ private MyMouseAdapter mouseAdapter; private MyMouseMotionAdapter mouseMotionAdapter; + private HyperlinkManager.MyFocusListener focusListener; - public HyperlinkManager(JEditTextArea textArea) + public HyperlinkManager(JEditTextArea textArea) { this.textArea = textArea; painter = new HyperlinkTextAreaPainter(textArea); @@ -58,7 +59,9 @@ textArea.getPainter().addMouseListener(mouseAdapter); mouseMotionAdapter = new MyMouseMotionAdapter(); textArea.getPainter().addMouseMotionListener(mouseMotionAdapter); - } + focusListener = new MyFocusListener(); + textArea.addFocusListener(focusListener); + } public void dispose() { @@ -66,6 +69,7 @@ textArea.removeKeyListener(keyListener); textArea.removeMouseListener(mouseAdapter); textArea.removeMouseMotionListener(mouseMotionAdapter); + textArea.removeFocusListener(focusListener); } private class MyKeyListener extends KeyAdapter @@ -90,7 +94,16 @@ } } - private class MyMouseAdapter extends MouseAdapter + private class MyFocusListener extends FocusAdapter + { + public void focusLost(FocusEvent e) + { + Log.log(Log.DEBUG, this, "Link tracking inactive"); + active = false; + } + } + + private class MyMouseAdapter extends MouseAdapter { public void mouseClicked(MouseEvent e) { @@ -111,7 +124,9 @@ if (!active) return; Buffer buffer = (Buffer) textArea.getBuffer(); - HyperlinkSource hyperlinkSource = getHyperlinkSource(buffer); + if (!buffer.isLoaded()) + return; + HyperlinkSource hyperlinkSource = getHyperlinkSource(buffer); if (hyperlinkSource == null) { painter.setHyperLink(null); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |