Author: sdeboy
Date: Sun Jun 20 07:29:56 2010
New Revision: 956321
URL: http://svn.apache.org/viewvc?rev=956321&view=rev
Log:
Changed 'Ignore all loggers' in logger tree context menu (only hides all
loggers below the root node) to 'Ignore loggers below selection', hiding all
loggers below the selected logger (which still may behave the same as 'ignore
all loggers' if the action is performed on the root logger.
Modified:
logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.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/LoggerNameTreePanel.java
URL:
http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java?rev=956321&r1=956320&r2=956321&view=diff
==============================================================================
---
logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java
(original)
+++
logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java
Sun Jun 20 07:29:56 2010
@@ -131,7 +131,7 @@ final class LoggerNameTreePanel extends
new SmallToggleButton();
private final Set hiddenSet = new HashSet();
private final Action hideAction;
- private final Action hideAllAction;
+ private final Action hideSubLoggersAction;
private final LogPanelPreferenceModel preferenceModel;
private final JList ignoreList = new JList();
@@ -296,7 +296,7 @@ final class LoggerNameTreePanel extends
collapseAction = createCollapseAction();
focusOnAction = createFocusOnAction();
hideAction = createIgnoreAction();
- hideAllAction = createIgnoreAllAction();
+ hideSubLoggersAction = createIgnoreAllAction();
clearIgnoreListAction = createClearIgnoreListAction();
popupMenu = new LoggerTreePopupMenu();
@@ -1031,18 +1031,37 @@ final class LoggerNameTreePanel extends
{
Action action =
new AbstractAction(
- "Ignore all loggers", new ImageIcon(ChainsawIcons.ICON_COLLAPSE))
+ "Ignore loggers below selection")
{
public void actionPerformed(ActionEvent e)
{
//add all top level loggers as hidden loggers
- final DefaultMutableTreeNode root =
- (DefaultMutableTreeNode) logTreeModel.getRoot();
+ TreePath[] paths = logTree.getSelectionPaths();
+
+ String parentPathString = "";
+ DefaultMutableTreeNode root;
+ if ((paths == null) || (paths.length == 0))
+ {
+ root = (DefaultMutableTreeNode) logTreeModel.getRoot();
+ } else {
+ root = (DefaultMutableTreeNode)
logTree.getSelectionPath().getLastPathComponent();
+ TreeNode[] path = root.getPath();
+ //don't add 'root logger' to path string
+ for (int i=1;i<path.length;i++) {
+ if (i > 1) {
+ parentPathString = parentPathString + ".";
+ }
+ parentPathString = parentPathString + path[i].toString();
+ }
+ if (!(parentPathString.equals(""))) {
+ parentPathString = parentPathString + ".";
+ }
+ }
Enumeration topLevelLoggersEnumeration = root.children();
Set topLevelLoggersSet = new HashSet();
while (topLevelLoggersEnumeration.hasMoreElements()) {
String thisLogger =
topLevelLoggersEnumeration.nextElement().toString();
- topLevelLoggersSet.add(thisLogger);
+ topLevelLoggersSet.add(parentPathString + thisLogger);
}
if (topLevelLoggersSet.size() > 0) {
ignore(topLevelLoggersSet);
@@ -1261,7 +1280,7 @@ final class LoggerNameTreePanel extends
}
// need to ensure the button doens't update itself with the text, looks
stupid otherwise
- hideAllAction.putValue(Action.NAME, "Ignore all loggers");
+ hideSubLoggersAction.putValue(Action.NAME, "Ignore loggers below
selection");
focusOnLoggerButton.setText(null);
ignoreLoggerButton.setText(null);
}
@@ -1296,9 +1315,6 @@ final class LoggerNameTreePanel extends
&& !hiddenSet.contains(logger));
hideAction.setEnabled(
(path != null) && (node != null) && (node.getParent() != null));
- //only enable on root node
- hideAllAction.setEnabled(node != null && (node.getParent() == null));
-
if (!focusOnAction.isEnabled())
{
setFocusOnSelected(false);
@@ -1623,9 +1639,8 @@ final class LoggerNameTreePanel extends
add(defineColorRuleForLoggerAction);
addSeparator();
+ add(hideSubLoggersAction);
add(clearIgnoreListAction);
- addSeparator();
- add(hideAllAction);
}
}
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=956321&r1=956320&r2=956321&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
Sun Jun 20 07:29:56 2010
@@ -27,6 +27,10 @@
<b>NOTE:</b> The mechanism and format used to persist settings in Chainsaw is
subject to change. If you are experiencing problems displaying events in
Chainsaw, please delete everything in the $user.dir/.chainsaw directory and
restart Chainsaw.
<br>
<h1>2.1</h1>
+<h2>20 Jun 2010</h2>
+<ul>
+<li>Added new 'ignore loggers below selection' context menu item to logger
tree context menu (makes it easy to quickly display specific loggers without
building expressions - hide all loggers below the selection and then enable
individual sub-loggers).</li>
+</ul>
<h2>15 Jun 2010</h2>
<ul>
<li>Added 'copy value under pointer to clipboard' log panel context menu
item.</li>
@@ -50,10 +54,6 @@
<ul>
<li>Loggers can now be ignored from the logger tree even while focus-on is
enabled.</li>
</ul>
-<h2>5 Jun 2010</h2>
-<ul>
-<li>Added new 'ignore all loggers' context menu item to logger tree context
menu (makes it easy to quickly display specific loggers without building
expressions - hide all loggers and then enable individual loggers).</li>
-</ul>
<h2>20 May 2010</h2>
<ul>
<li>For users who would like to specify the Chainsaw configuration file from
the command line, specify the URL to a configuration file as the first argument
to Chainsaw (will bypass the the initial use of the automatic configuration URL
mechanism). Example: java -classpath {classpath here}
org.apache.log4j.chainsaw.LogUI
file:///c:/downloads/tools/log4j/config/log4j.xml</li>