From: <sh...@us...> - 2010-02-27 20:50:53
|
Revision: 17397 http://jedit.svn.sourceforge.net/jedit/?rev=17397&view=rev Author: shlomy Date: 2010-02-27 20:50:47 +0000 (Sat, 27 Feb 2010) Log Message: ----------- Added support for going to the next / previous source link. Ensure that the error message on failing to read the marker sets configuration file is shown in the AWT thread. Modified Paths: -------------- plugins/MarkerSets/trunk/src/marker/MarkerSetsPlugin.java plugins/MarkerSets/trunk/src/marker/tree/SourceLinkTree.java Modified: plugins/MarkerSets/trunk/src/marker/MarkerSetsPlugin.java =================================================================== --- plugins/MarkerSets/trunk/src/marker/MarkerSetsPlugin.java 2010-02-27 18:18:37 UTC (rev 17396) +++ plugins/MarkerSets/trunk/src/marker/MarkerSetsPlugin.java 2010-02-27 20:50:47 UTC (rev 17397) @@ -255,9 +255,18 @@ activeName = doc.getDocumentElement().getAttribute(ACTIVE_ATTR); if ((activeName == null) || (activeName.length() == 0)) activeName = GLOBAL_SET; - } catch (Exception e) { - JOptionPane.showMessageDialog(jEdit.getActiveView(), - "Failed to load marker sets from XML. Error: " + e.getMessage()); + } catch (final Exception e) { + try + { + SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + JOptionPane.showMessageDialog(jEdit.getActiveView(), + "Failed to load marker sets from XML. Error: " + e.getMessage()); + } + }); + } catch (Exception e1) { + e1.printStackTrace(); + } } } active = markerSets.get(activeName); Modified: plugins/MarkerSets/trunk/src/marker/tree/SourceLinkTree.java =================================================================== --- plugins/MarkerSets/trunk/src/marker/tree/SourceLinkTree.java 2010-02-27 18:18:37 UTC (rev 17396) +++ plugins/MarkerSets/trunk/src/marker/tree/SourceLinkTree.java 2010-02-27 20:50:47 UTC (rev 17397) @@ -117,6 +117,50 @@ }); } + public void goToNextLink() + { + TreePath tp = getSelectionPath(); + if (tp == null) + tp = new TreePath(root); + DefaultMutableTreeNode current = (DefaultMutableTreeNode) + tp.getLastPathComponent(); + DefaultMutableTreeNode next = null; + if (! current.isLeaf()) + { + next = current; + while (next.getChildCount() > 0) + next = (DefaultMutableTreeNode) current.getChildAt(0); + } + if (next == null) + next = current.getNextLeaf(); + if (next == null) + return; + TreePath newPath = new TreePath(next.getPath()); + scrollPathToVisible(newPath); + setSelectionPath(newPath); + ((SourceLinkLeafNode) next).goToNode(view); + } + + public void goToPreviousLink() + { + TreePath tp = getSelectionPath(); + if (tp == null) + tp = new TreePath(root); + DefaultMutableTreeNode current = (DefaultMutableTreeNode) + tp.getLastPathComponent(); + DefaultMutableTreeNode prev = current.getPreviousLeaf(); + if (prev == null) + prev = root.getPreviousLeaf(); + while ((prev != null) && (! (prev instanceof SourceLinkLeafNode))) + prev = prev.getNextLeaf(); + if (prev == null) + return; + TreePath newPath = new TreePath(prev.getPath()); + scrollPathToVisible(newPath); + setSelectionPath(newPath); + ((SourceLinkLeafNode) prev).goToNode(view); + } + public void startBatch() { batch = true; @@ -267,7 +311,7 @@ } }); } - private void goToNode(View v) + public void goToNode(View v) { getMarker().jump(v); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |