Author: sdeboy
Date: Wed Mar 24 06:41:46 2010
New Revision: 926952
URL: http://svn.apache.org/viewvc?rev=926952&view=rev
Log:
New feature: search/refine focus from a selection in the details panel
- Details panel entry no longer refreshes even when selection hasn't changed
(the contents of the detail pane were being updated, preventing text selection)
- Event details context menu (right click) now has 'set refine focus' and
'find next' menu items that will update the refine focus/find next fields with
the selected text (building a 'msg ~= SELECTEDTEXT' expression)
Modified:
logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
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?rev=926952&r1=926951&r2=926952&view=diff
==============================================================================
---
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
Wed Mar 24 06:41:46 2010
@@ -858,7 +858,7 @@ public class LogPanel extends DockablePa
detailArea.setText(buf.toString());
} else {
- detailArea.setText((o == null) ? "" : o.toString());
+ detailArea.setText(o.toString());
}
detailDialog.setLocation(lowerPanel.getLocationOnScreen());
@@ -1039,6 +1039,7 @@ public class LogPanel extends DockablePa
detailPaneUpdater = new DetailPaneUpdater();
+ //if the panel gets focus, update the detail pane
addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
@@ -1123,6 +1124,29 @@ public class LogPanel extends DockablePa
}
});
+ Action copyToRefineFocusAction = new AbstractAction("Set 'refine focus'
field") {
+ public void actionPerformed(ActionEvent e) {
+ String selectedText = detail.getSelectedText();
+ if (selectedText == null || selectedText.equals("")) {
+ //no-op empty searches
+ return;
+ }
+ filterText.setText("msg ~= '" + selectedText + "'");
+ }
+ };
+
+ Action copyToSearchAction = new AbstractAction("Find next") {
+ public void actionPerformed(ActionEvent e) {
+ String selectedText = detail.getSelectedText();
+ if (selectedText == null || selectedText.equals("")) {
+ //no-op empty searches
+ return;
+ }
+ findField.setText("msg ~= '" + selectedText + "'");
+ findNext();
+ }
+ };
+
Action editDetailAction =
new AbstractAction(
"Edit...", new ImageIcon(ChainsawIcons.ICON_EDIT_RECEIVER)) {
@@ -1170,6 +1194,11 @@ public class LogPanel extends DockablePa
detailPanel.add(detailToolbar, BorderLayout.NORTH);
JPopupMenu editDetailPopupMenu = new JPopupMenu();
+
+ editDetailPopupMenu.add(copyToRefineFocusAction);
+ editDetailPopupMenu.add(copyToSearchAction);
+ editDetailPopupMenu.addSeparator();
+
editDetailPopupMenu.add(editDetailAction);
editDetailPopupMenu.addSeparator();
@@ -2854,7 +2883,7 @@ public class LogPanel extends DockablePa
*/
private class DetailPaneUpdater implements PropertyChangeListener {
private int selectedRow = -1;
-
+ int lastRow = -1;
private DetailPaneUpdater() {
}
@@ -2882,7 +2911,7 @@ public class LogPanel extends DockablePa
}
LoggingEvent event = null;
- if (selectedRow != -1) {
+ if (selectedRow != -1 && (lastRow != selectedRow)) {
event = tableModel.getRow(selectedRow);
if (event != null) {
@@ -2898,6 +2927,7 @@ public class LogPanel extends DockablePa
public void run() {
detail.setDocument(doc);
detail.setCaretPosition(0);
+ lastRow = selectedRow;
}
});
} catch (Exception e) {}
@@ -2905,7 +2935,7 @@ public class LogPanel extends DockablePa
}
}
- if (event == null) {
+ if (event == null && (lastRow != selectedRow)) {
try {
final Document doc =
detail.getEditorKit().createDefaultDocument();
detail.getEditorKit().read(new
StringReader("<html>Nothing selected</html>"), doc, 0);
@@ -2913,6 +2943,7 @@ public class LogPanel extends DockablePa
public void run() {
detail.setDocument(doc);
detail.setCaretPosition(0);
+ lastRow = selectedRow;
}
});
} catch (Exception e) {}
Modified:
logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
URL:
http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html?rev=926952&r1=926951&r2=926952&view=diff
==============================================================================
---
logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
(original)
+++
logging/chainsaw/trunk/src/main/resources/org/apache/log4j/chainsaw/help/release-notes.html
Wed Mar 24 06:41:46 2010
@@ -15,6 +15,12 @@
<li>
'Refine focus' field now supports auto-filtering: entering text in the refine
focus field now causes the popup to display matching entries (reminder: you can
press enter to add entries to this box, and those entries are persisted)
</li>
+<li>
+Event details context menu (right click) now has 'set refine focus' and 'find
next' menu items that will update the refine focus/find next fields with the
selected text (building a 'msg ~= SELECTEDTEXT' expression)
+</li>
+<li>
+Details panel entry no longer refreshes even when selection hasn't changed
(the contents of the detail pane were being updated, preventing text selection)
+</li>
</ul>
<h2>20 Mar 2010</h2>
<ul>