checkstyle partial pass.
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java b/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java
index eebd4b6..99a69b4 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/AbstractTreeLogger.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.log;
import com.google.gwt.core.ext.TreeLogger;
@@ -14,14 +28,14 @@
private static class UncommittedBranchData {
public UncommittedBranchData(Type type, String message, Throwable exception) {
- fCaught = exception;
- fMessage = message;
- fType = type;
+ caught = exception;
+ this.message = message;
+ this.type = type;
}
- public final Throwable fCaught;
- public final String fMessage;
- public final TreeLogger.Type fType;
+ public final Throwable caught;
+ public final String message;
+ public final TreeLogger.Type type;
}
public static String getStackTraceAsString(Throwable e) {
@@ -104,21 +118,21 @@
AbstractTreeLogger childLogger = doBranch();
// Set up the child logger.
- childLogger.fLogLevel = fLogLevel;
+ childLogger.logLevel = logLevel;
// Take a snapshot of the index that the branched child should have.
//
- childLogger.fIndexWithinMyParent = childIndex;
+ childLogger.indexWithinMyParent = childIndex;
// Have the child hang onto this (its parent logger).
//
- childLogger.fParent = this;
+ childLogger.parent = this;
// We can avoid committing this branch entry until and unless a some
// child (or grandchild) tries to log something that is loggable,
// in which case there will be cascading commits of the parent branches.
//
- childLogger.fUncommitted = new UncommittedBranchData(type, msg, caught);
+ childLogger.uncommitted = new UncommittedBranchData(type, msg, caught);
// Decide whether we want to log the branch message eagerly or lazily.
//
@@ -139,30 +153,30 @@
private synchronized void commitMyBranchEntryInMyParentLogger() {
// (Only the root logger doesn't have a parent.)
//
- if (fParent != null) {
- if (fUncommitted != null) {
+ if (parent != null) {
+ if (uncommitted != null) {
// Commit the parent first.
//
- fParent.commitMyBranchEntryInMyParentLogger();
+ parent.commitMyBranchEntryInMyParentLogger();
// Let the subclass do its thing to commit this branch.
//
- fParent.doCommitBranch(this, fUncommitted.fType, fUncommitted.fMessage,
- fUncommitted.fCaught);
+ parent.doCommitBranch(this, uncommitted.type, uncommitted.message,
+ uncommitted.caught);
// Release the uncommitted state.
//
- fUncommitted = null;
+ uncommitted = null;
}
}
}
public final AbstractTreeLogger getParentLogger() {
- return fParent;
+ return parent;
}
public final synchronized boolean isLoggable(TreeLogger.Type type) {
- TreeLogger.Type maxLevel = fLogLevel;
+ TreeLogger.Type maxLevel = logLevel;
while (maxLevel != null && maxLevel != type) {
maxLevel = maxLevel.getParent();
}
@@ -197,7 +211,7 @@
if (type == null) {
type = TreeLogger.INFO;
}
- fLogLevel = type;
+ logLevel = type;
}
public String toString() {
@@ -226,13 +240,13 @@
TreeLogger.Type type, String msg, Throwable caught);
private String getLoggerId() {
- if (fParent != null) {
- if (fParent.fParent == null) {
+ if (parent != null) {
+ if (parent.parent == null) {
// Top-level
- return fParent.getLoggerId() + getBranchedIndex();
+ return parent.getLoggerId() + getBranchedIndex();
} else {
// Nested
- return fParent.getLoggerId() + "." + getBranchedIndex();
+ return parent.getLoggerId() + "." + getBranchedIndex();
}
} else {
// The root
@@ -241,20 +255,20 @@
}
private int allocateNextChildIndex() {
- synchronized (fNextChildIndexLock) {
+ synchronized (nextChildIndexLock) {
// postincrement because we want indices to start at 0
- return fNextChildIndex++;
+ return nextChildIndex++;
}
}
public final int getBranchedIndex() {
- return fIndexWithinMyParent;
+ return indexWithinMyParent;
}
- private UncommittedBranchData fUncommitted;
- private TreeLogger.Type fLogLevel = TreeLogger.ALL;
- public int fIndexWithinMyParent;
- private int fNextChildIndex;
- private final Object fNextChildIndexLock = new Object();
- private AbstractTreeLogger fParent;
+ private UncommittedBranchData uncommitted;
+ private TreeLogger.Type logLevel = TreeLogger.ALL;
+ public int indexWithinMyParent;
+ private int nextChildIndex;
+ private final Object nextChildIndexLock = new Object();
+ private AbstractTreeLogger parent;
}
diff --git a/dev/core/src/com/google/gwt/dev/util/log/Loggers.java b/dev/core/src/com/google/gwt/dev/util/log/Loggers.java
index 3d0c5b1..edd0003 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/Loggers.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/Loggers.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.log;
import com.google.gwt.core.ext.TreeLogger;
diff --git a/dev/core/src/com/google/gwt/dev/util/log/PrintWriterTreeLogger.java b/dev/core/src/com/google/gwt/dev/util/log/PrintWriterTreeLogger.java
index e8fa4ce..be6b353 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/PrintWriterTreeLogger.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/PrintWriterTreeLogger.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.log;
import java.io.PrintWriter;
diff --git a/dev/core/src/com/google/gwt/dev/util/log/ServletContextTreeLogger.java b/dev/core/src/com/google/gwt/dev/util/log/ServletContextTreeLogger.java
index 3c6d43a..72a3bfb 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/ServletContextTreeLogger.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/ServletContextTreeLogger.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.log;
import javax.servlet.ServletContext;
diff --git a/dev/core/src/com/google/gwt/dev/util/log/ThreadLocalTreeLoggerProxy.java b/dev/core/src/com/google/gwt/dev/util/log/ThreadLocalTreeLoggerProxy.java
index 6a074d2..016e897 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/ThreadLocalTreeLoggerProxy.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/ThreadLocalTreeLoggerProxy.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.log;
import com.google.gwt.core.ext.TreeLogger;
diff --git a/dev/core/src/com/google/gwt/dev/util/log/TreeItemLogger.java b/dev/core/src/com/google/gwt/dev/util/log/TreeItemLogger.java
index a6f0ac3..e581226 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/TreeItemLogger.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/TreeItemLogger.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.log;
import com.google.gwt.core.ext.TreeLogger;
@@ -76,16 +90,16 @@
// the Tree.
//
TreeItemLogger parentLogger = (TreeItemLogger) logger.getParentLogger();
- if (parentLogger.fLazyTreeItem == null) {
+ if (parentLogger.lazyTreeItem == null) {
// Is top level.
//
treeItem = new TreeItem(tree, SWT.NONE);
- logger.fLazyTreeItem = treeItem;
- } else if (!parentLogger.fLazyTreeItem.isDisposed()) {
+ logger.lazyTreeItem = treeItem;
+ } else if (!parentLogger.lazyTreeItem.isDisposed()) {
// Is not top level, but still valid to write to.
//
- treeItem = new TreeItem(parentLogger.fLazyTreeItem, SWT.NONE);
- logger.fLazyTreeItem = treeItem;
+ treeItem = new TreeItem(parentLogger.lazyTreeItem, SWT.NONE);
+ logger.lazyTreeItem = treeItem;
} else {
// The tree item associated with this logger's parent has been
// disposed, so we simply ignore all pending updates related to it.
@@ -101,14 +115,14 @@
// case we create TreeItems underneath the branched logger's TreeItem
// (which cannot be null because of the careful ordering of log events).
//
- if (logger.fLazyTreeItem == null) {
+ if (logger.lazyTreeItem == null) {
// Is top level.
//
treeItem = new TreeItem(tree, SWT.NONE);
- } else if (!logger.fLazyTreeItem.isDisposed()) {
+ } else if (!logger.lazyTreeItem.isDisposed()) {
// Is not top level, but still valid to write to.
//
- treeItem = new TreeItem(logger.fLazyTreeItem, SWT.NONE);
+ treeItem = new TreeItem(logger.lazyTreeItem, SWT.NONE);
} else {
// The tree item associated with this logger's parent has been
// disposed, so we simply ignore all pending updates related to it.
@@ -126,8 +140,9 @@
if (caught != null) {
label = caught.getMessage();
- if (label == null || label.trim().length() == 0)
+ if (label == null || label.trim().length() == 0) {
label = caught.toString();
+ }
}
}
treeItem.setText(label);
@@ -248,12 +263,12 @@
// These don't get disposed, but they do last for the entire process, so
// not a big deal.
//
- private final static Image imageDebug = tryLoadImage("log-item-debug.gif");
- private final static Image imageError = tryLoadImage("log-item-error.gif");
- private final static Image imageInfo = tryLoadImage("log-item-info.gif");
- private final static Image imageSpam = tryLoadImage("log-item-spam.gif");
- private final static Image imageTrace = tryLoadImage("log-item-trace.gif");
- private final static Image imageWarning = tryLoadImage("log-item-warning.gif");
+ private static final Image imageDebug = tryLoadImage("log-item-debug.gif");
+ private static final Image imageError = tryLoadImage("log-item-error.gif");
+ private static final Image imageInfo = tryLoadImage("log-item-info.gif");
+ private static final Image imageSpam = tryLoadImage("log-item-spam.gif");
+ private static final Image imageTrace = tryLoadImage("log-item-trace.gif");
+ private static final Image imageWarning = tryLoadImage("log-item-warning.gif");
private static Image tryLoadImage(String simpleName) {
InputStream is = TreeItemLogger.class.getResourceAsStream(simpleName);
@@ -278,7 +293,7 @@
* Constructs the top-level TreeItemLogger.
*/
public TreeItemLogger() {
- fSharedPendingUpdates = new PendingUpdates();
+ sharedPendingUpdates = new PendingUpdates();
}
/**
@@ -286,14 +301,14 @@
*/
private TreeItemLogger(PendingUpdates sharedPendingUpdates) {
// Inherit the one and only update list from my parent.
- fSharedPendingUpdates = sharedPendingUpdates;
+ this.sharedPendingUpdates = sharedPendingUpdates;
}
public void markLoggerDead() {
// Cannot kill the root logger, even if attempted.
//
if (getParentLogger() != null) {
- fDead = true;
+ dead = true;
}
}
@@ -303,11 +318,11 @@
* @return <code>true</code> if any new entries were written
*/
public boolean uiFlush(Tree tree) {
- return fSharedPendingUpdates.uiFlush(tree);
+ return sharedPendingUpdates.uiFlush(tree);
}
protected AbstractTreeLogger doBranch() {
- return new TreeItemLogger(fSharedPendingUpdates);
+ return new TreeItemLogger(sharedPendingUpdates);
}
protected void doCommitBranch(AbstractTreeLogger childBeingCommitted,
@@ -317,16 +332,17 @@
}
TreeItemLogger commitChild = (TreeItemLogger) childBeingCommitted;
- fSharedPendingUpdates.add(new LogEvent(commitChild, true, commitChild
+ sharedPendingUpdates.add(new LogEvent(commitChild, true, commitChild
.getBranchedIndex(), type, msg, caught));
}
protected void doLog(int index, TreeLogger.Type type, String msg,
Throwable caught) {
- if (isLoggerDead())
+ if (isLoggerDead()) {
return;
+ }
- fSharedPendingUpdates.add(new LogEvent(this, false, index, type, msg,
+ sharedPendingUpdates.add(new LogEvent(this, false, index, type, msg,
caught));
}
@@ -337,8 +353,9 @@
private boolean isLoggerDead() {
// Deadness was cached.
//
- if (fDead)
+ if (dead) {
return true;
+ }
// Check upward in the parent chain for any dead parent.
//
@@ -363,7 +380,7 @@
return false;
}
- private boolean fDead;
- private TreeItem fLazyTreeItem;
- private final PendingUpdates fSharedPendingUpdates;
+ private boolean dead;
+ private TreeItem lazyTreeItem;
+ private final PendingUpdates sharedPendingUpdates;
}
diff --git a/dev/core/src/com/google/gwt/dev/util/log/TreeLoggerWidget.java b/dev/core/src/com/google/gwt/dev/util/log/TreeLoggerWidget.java
index facadb3..89c9825 100644
--- a/dev/core/src/com/google/gwt/dev/util/log/TreeLoggerWidget.java
+++ b/dev/core/src/com/google/gwt/dev/util/log/TreeLoggerWidget.java
@@ -1,4 +1,18 @@
-// Copyright 2006 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2006 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
package com.google.gwt.dev.util.log;
import com.google.gwt.core.ext.UnableToCompleteException;
@@ -38,7 +52,7 @@
* Useful for debugging, this method creates a standalone window in a background thread and
* returns a logger you can use to write to it.
*/
- public synchronized static AbstractTreeLogger getAsDetachedWindow(final String caption,
+ public static synchronized AbstractTreeLogger getAsDetachedWindow(final String caption,
final int width, final int height, final boolean autoScroll) {
if (singletonWindowLogger != null) {
@@ -118,27 +132,27 @@
// The tree.
//
- fTree = new Tree(sash, SWT.BORDER | SWT.SHADOW_IN);
- fTree.setLinesVisible(false);
- fTree.addSelectionListener(this);
- fTree.setFocus();
- fTree.addKeyListener(new KeyAdapter() {
+ tree = new Tree(sash, SWT.BORDER | SWT.SHADOW_IN);
+ tree.setLinesVisible(false);
+ tree.addSelectionListener(this);
+ tree.setFocus();
+ tree.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.keyCode == 'c' && e.stateMask == SWT.CTRL) {
// Copy subtree to clipboard.
//
- copyTreeSelectionToClipboard(fTree);
+ copyTreeSelectionToClipboard(tree);
}
}
});
- fLogger = new TreeItemLogger();
+ logger = new TreeItemLogger();
// The detail
- fDetails = new Text(sash, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL);
+ details = new Text(sash, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL);
final Color detailsBgColor = new Color(null, 255, 255, 255);
- fDetails.setBackground(detailsBgColor);
- fDetails.addDisposeListener(new DisposeListener() {
+ details.setBackground(detailsBgColor);
+ details.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent arg0) {
detailsBgColor.dispose();
}
@@ -150,13 +164,14 @@
}
public void collapseAll() {
- TreeItem[] items = fTree.getItems();
+ TreeItem[] items = tree.getItems();
for (int i = 0, n = items.length; i < n; ++i) {
TreeItem item = items[i];
collapseAll(item);
}
- if (items.length > 0)
- fTree.setSelection(new TreeItem[]{items[0]});
+ if (items.length > 0) {
+ tree.setSelection(new TreeItem[]{items[0]});
+ }
}
public void collapseAll(TreeItem from) {
@@ -169,13 +184,14 @@
}
public void expandAll() {
- TreeItem[] items = fTree.getItems();
+ TreeItem[] items = tree.getItems();
for (int i = 0, n = items.length; i < n; ++i) {
TreeItem item = items[i];
expandAll(item);
}
- if (items.length > 0)
- fTree.setSelection(new TreeItem[]{items[0]});
+ if (items.length > 0) {
+ tree.setSelection(new TreeItem[]{items[0]});
+ }
}
public void expandAll(TreeItem from) {
@@ -188,12 +204,12 @@
}
public AbstractTreeLogger getLogger() {
- return fLogger;
+ return logger;
}
public void removeAll() {
- fTree.removeAll();
- fDetails.setText("");
+ tree.removeAll();
+ details.setText("");
}
public synchronized void treeCollapsed(TreeEvent treeEvent) {
@@ -214,8 +230,9 @@
//
TreeItemLogger.LogEvent logEvent = null;
Object testLogEvent = item.getData();
- if (testLogEvent instanceof TreeItemLogger.LogEvent)
+ if (testLogEvent instanceof TreeItemLogger.LogEvent) {
logEvent = (LogEvent) testLogEvent;
+ }
// Build a detail string.
//
@@ -243,7 +260,7 @@
}
}
- fDetails.setText(sb.toString());
+ details.setText(sb.toString());
}
protected void appendTreeItemText(PrintWriter result, TreeItem[] items, int depth) {
@@ -280,17 +297,18 @@
display.timerExec(flushDelay, new Runnable() {
public void run() {
- if (fTree.isDisposed())
+ if (tree.isDisposed()) {
return;
+ }
- if (fLogger.uiFlush(fTree)) {
+ if (logger.uiFlush(tree)) {
// Sync to the end of the tree.
//
if (autoScroll) {
- TreeItem lastItem = findLastVisibleItem(fTree);
+ TreeItem lastItem = findLastVisibleItem(tree);
if (lastItem != null) {
- fTree.setSelection(new TreeItem[]{lastItem});
- fTree.showItem(lastItem);
+ tree.setSelection(new TreeItem[]{lastItem});
+ tree.showItem(lastItem);
expandAllChildren(lastItem);
syncDetailsPane(lastItem);
}
@@ -343,7 +361,7 @@
}
private boolean autoScroll;
- private final Text fDetails;
- private final TreeItemLogger fLogger;
- private final Tree fTree;
+ private final Text details;
+ private final TreeItemLogger logger;
+ private final Tree tree;
}