logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From psm...@apache.org
Subject svn commit: r555187 - in /logging/chainsaw/trunk/src: changes/changes.xml main/java/org/apache/log4j/chainsaw/LogPanel.java main/java/org/apache/log4j/chainsaw/LogUI.java
Date Wed, 11 Jul 2007 06:49:23 GMT
Author: psmith
Date: Tue Jul 10 23:49:22 2007
New Revision: 555187

URL: http://svn.apache.org/viewvc?view=rev&rev=555187
Log:
Bug 42851 Applied patch by Isuru Suriarachchi 
which adds a Goto Line feature.


Modified:
    logging/chainsaw/trunk/src/changes/changes.xml
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java

Modified: logging/chainsaw/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/changes/changes.xml?view=diff&rev=555187&r1=555186&r2=555187
==============================================================================
--- logging/chainsaw/trunk/src/changes/changes.xml (original)
+++ logging/chainsaw/trunk/src/changes/changes.xml Tue Jul 10 23:49:22 2007
@@ -24,6 +24,9 @@
       <action dev="psmith" issue="42789" type="add" due-to=" Isuru Suriarachchi  " due-to-email="">
 		Added support for remembering filter expressions for each LogPanel
       </action>
+      <action dev="psmith" issue="42851" type="add" due-to=" Isuru Suriarachchi  " due-to-email="">
+		Added 'Go To Line' feature to navigate to a particular event #
+      </action>
     </release>
   </body>
 </document>

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java?view=diff&rev=555187&r1=555186&r2=555187
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java Tue Jul 10
23:49:22 2007
@@ -1712,6 +1712,15 @@
   }
 
   /**
+   * Change the selected event on the log panel
+   *
+   * @param eventNumber
+   */
+  void setSelectedEvent(int eventNumber){
+      table.scrollToRow(eventNumber - 1, 0);
+  }
+
+  /**
    * Add a preference propertyChangeListener
    *
    * @param listener

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java?view=diff&rev=555187&r1=555186&r2=555187
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java Tue Jul 10 23:49:22
2007
@@ -678,11 +678,15 @@
       KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, Event.CTRL_MASK);
     KeyStroke ksLeft =
       KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.CTRL_MASK);
+    KeyStroke ksGotoLine =
+      KeyStroke.getKeyStroke(KeyEvent.VK_G,  Event.CTRL_MASK);
 
     getTabbedPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
       ksRight, "MoveRight");
     getTabbedPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
       ksLeft, "MoveLeft");
+    getTabbedPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+      ksGotoLine, "GotoLine");
 
     Action moveRight =
       new AbstractAction() {
@@ -708,8 +712,25 @@
         }
       };
 
+    Action gotoLine =
+      new AbstractAction() {
+        public void actionPerformed(ActionEvent e) {
+          String inputLine = JOptionPane.showInputDialog(LogUI.this, "Enter the line number
to go:", "Goto Line", -1);
+          int lineNumber = Integer.parseInt(inputLine);
+          List eventList = getCurrentLogPanel().getFilteredEvents();
+
+          if (lineNumber > 0 && lineNumber <= eventList.size()) {
+              getCurrentLogPanel().setSelectedEvent(lineNumber);
+          } else {
+              JOptionPane.showMessageDialog(LogUI.this, "You have entered an invalid line
number", "Error", 0);
+          }
+        }
+      };
+
+
     getTabbedPane().getActionMap().put("MoveRight", moveRight);
     getTabbedPane().getActionMap().put("MoveLeft", moveLeft);
+    getTabbedPane().getActionMap().put("GotoLine", gotoLine);
 
     /**
          * We listen for double clicks, and auto-undock currently selected Tab if



Mime
View raw message