Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Wagiaalla2013-04-02 14:36:46 +0000
committerCamilo Bernal2013-04-02 17:51:40 +0000
commitc310b2b0b819c7f7fe65c6771d4d108dd37d5d67 (patch)
treec6a1bba22d612c091993be0fa19571d62c4a1ba5
parent37ca01a9b23af767ab41082a7525fc111f4a2c50 (diff)
downloadorg.eclipse.linuxtools-c310b2b0b819c7f7fe65c6771d4d108dd37d5d67.tar.gz
org.eclipse.linuxtools-c310b2b0b819c7f7fe65c6771d4d108dd37d5d67.tar.xz
org.eclipse.linuxtools-c310b2b0b819c7f7fe65c6771d4d108dd37d5d67.zip
Add braces around if statements
Change-Id: Ide699a5c1480d350472dbee5a3e8ab4dfd7dc18d Reviewed-on: https://git.eclipse.org/r/11609 Tested-by: Hudson CI Reviewed-by: Camilo Bernal <cabernal@redhat.com> IP-Clean: Camilo Bernal <cabernal@redhat.com> Tested-by: Camilo Bernal <cabernal@redhat.com>
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java60
-rw-r--r--systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/StapGraph.java213
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/internal/systemtap/ui/graphing/actions/OpenScriptOutputAction.java7
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/DataSetFactory.java40
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/DataSetWizard.java15
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/ParsingWizardPage.java30
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/SelectDataSetWizardPage.java15
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/SelectTableParsingWizardPage.java15
8 files changed, 254 insertions, 141 deletions
diff --git a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java
index d25d31b979..02974c28d5 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/SystemTapLaunchShortcut.java
@@ -196,8 +196,9 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
ILaunchConfiguration second) {
try {
- if (first.getAttributes().equals(second.getAttributes()))
+ if (first.getAttributes().equals(second.getAttributes())) {
return true;
+ }
} catch (CoreException e) {
e.printStackTrace();
}
@@ -220,15 +221,17 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
* @throws IOException
*/
protected void finishLaunch(String name, String mode, ILaunchConfigurationWorkingCopy wc) throws IOException {
- if (!finishLaunchHelper())
+ if (!finishLaunchHelper()) {
return;
+ }
if (wc != null) {
wc.setAttribute(LaunchConfigurationConstants.SCRIPT_PATH,scriptPath);
- if (!invalid(binaryPath))
+ if (!invalid(binaryPath)) {
wc.setAttribute(LaunchConfigurationConstants.BINARY_PATH,binaryPath);
+ }
outputPath = escapeSpecialCharacters(outputPath);
wc.setAttribute(LaunchConfigurationConstants.OUTPUT_PATH,outputPath);
@@ -253,8 +256,9 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
e.printStackTrace();
}*/
- if (!testMode)
+ if (!testMode) {
DebugUITools.launch(wc, mode);
+ }
}
}
@@ -275,8 +279,9 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
*
*/
private boolean finishLaunchHelper() throws IOException {
- if (invalid(scriptPath))
+ if (invalid(scriptPath)) {
scriptPath = setScriptPath();
+ }
if (invalid(scriptPath)) {
// Setting the variable didn't work, do not launch.
@@ -289,8 +294,9 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
return false;
}
- if (invalid(parserID))
+ if (invalid(parserID)) {
parserID = setParserID();
+ }
if (invalid(parserID)) {
SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
Messages.getString("SystemTapLaunchShortcut.InvalidParser1"), //$NON-NLS-1$
@@ -299,8 +305,9 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
return false;
}
- if (invalid(viewID))
+ if (invalid(viewID)) {
viewID = setViewID();
+ }
if (invalid(viewID)) {
// Setting the variable didn't work, do not launch.
SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
@@ -311,8 +318,9 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
}
if (needToGenerate) {
- if (invalid(generatedScript))
+ if (invalid(generatedScript)) {
generatedScript = generateScript();
+ }
if (invalid(generatedScript)) {
// Setting the variable didn't work, do not launch.
SystemTapUIErrorMessages mess = new SystemTapUIErrorMessages(
@@ -495,8 +503,9 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
*/
protected String getFunctionsFromBinary(IBinary bin, String targetResource) {
String funcs = ""; //$NON-NLS-1$
- if (bin == null)
+ if (bin == null) {
return funcs;
+ }
try {
ArrayList<ICContainer> list = new ArrayList<ICContainer>();
TranslationUnitVisitor v = new TranslationUnitVisitor();
@@ -512,8 +521,9 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
funcs += v.getFunctions();
return funcs;
} else {
- if (!list.contains(c))
+ if (!list.contains(c)) {
list.add(c);
+ }
}
}
@@ -531,8 +541,9 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
funcs += (v.getFunctions());
return funcs;
} else {
- if (!list.contains(c))
+ if (!list.contains(c)) {
list.add(c);
+ }
}
}
}
@@ -623,10 +634,12 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
if (obj instanceof ICContainer) {
ICElement[] array = ((ICContainer) obj).getChildren();
for (ICElement c : array) {
- if (!(validElement(c)))
+ if (!(validElement(c))) {
continue;
- if (c.getElementName().contains("main") && !output.contains(c)) //$NON-NLS-1$
+ }
+ if (c.getElementName().contains("main") && !output.contains(c)) {
output.add(c);
+ }
}
}
}
@@ -641,13 +654,15 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
result = output.toArray();
} else {
- if (dialog.open() == Window.CANCEL)
+ if (dialog.open() == Window.CANCEL) {
return null;
+ }
result = dialog.getResult();
}
- if (result == null)
+ if (result == null) {
return null;
+ }
ArrayList<Object> output = new ArrayList<Object>();
try {
@@ -655,10 +670,12 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
if (obj instanceof ICContainer) {
ICElement[] array = ((ICContainer) obj).getChildren();
for (ICElement c : array) {
- if (!(validElement(c)))
+ if (!(validElement(c))) {
continue;
- if (!output.contains(c))
+ }
+ if (!output.contains(c)) {
output.add(c);
+ }
}
} else if ((obj instanceof ICElement)
&& validElement((ICElement) obj)
@@ -769,10 +786,12 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
* @return number if number is in [low,high], low, or high.
*/
private int cap(int number, int low, int high) {
- if (number > high)
+ if (number > high) {
return high;
- if (number < low)
+ }
+ if (number < low) {
return low;
+ }
return number;
}
@@ -804,8 +823,9 @@ public abstract class SystemTapLaunchShortcut extends ProfileLaunchShortcut {
IIndex index = null;
IProgressMonitor m = monitor;
- if (m == null)
+ if (m == null) {
m = new NullProgressMonitor();
+ }
m.worked(1);
try {
diff --git a/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/StapGraph.java b/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/StapGraph.java
index a46ab710e3..b8cf28d099 100644
--- a/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/StapGraph.java
+++ b/systemtap/org.eclipse.linuxtools.callgraph/src/org/eclipse/linuxtools/internal/callgraph/StapGraph.java
@@ -226,8 +226,9 @@ public class StapGraph extends Graph {
((StapTreeContentProvider) treeViewer.getContentProvider()).setGraph(this);
- if (treeViewer.getLabelProvider() != null)
+ if (treeViewer.getLabelProvider() != null){
treeViewer.getLabelProvider().dispose();
+ }
StapTreeLabelProvider prov = new StapTreeLabelProvider();
treeViewer.setLabelProvider(prov);
@@ -279,14 +280,17 @@ public class StapGraph extends Graph {
nodeDataMap.put(id, n);
// Make no assumptions about the order that data is input
- if (id > idOfLastNode)
+ if (id > idOfLastNode) {
idOfLastNode = id;
+ }
return id;
}
public void insertMessage(int id, String message) {
StapData temp = nodeDataMap.get(id);
- if (temp == null) return;
+ if (temp == null) {
+ return;
+ }
temp.insertMessage(message);
nodeDataMap.put(id, temp);
}
@@ -329,8 +333,9 @@ public class StapGraph extends Graph {
int y = this.getBounds().height / 2;
n.setLocation(x, y);
- if (getNodeData(centerNode).isMarked())
+ if (getNodeData(centerNode).isMarked()) {
nodeMap.get(centerNode).setBackgroundColor(CONSTANT_MARKED);
+ }
radialHelper(centerNode, x, y, radius, 0);
}
@@ -379,8 +384,9 @@ public class StapGraph extends Graph {
getNode(id).makeConnection(SWT.NONE, getNode(callerID), getNodeData(id).timesCalled);
}
- if (getNodeData(callerID).isMarked())
+ if (getNodeData(callerID).isMarked()) {
nodeMap.get(callerID).setBackgroundColor(CONSTANT_MARKED);
+ }
}
@@ -397,16 +403,17 @@ public class StapGraph extends Graph {
if (nodeList.size() >= CONSTANT_MAX_NUMBER_OF_RADIAL_SIBLINGS ) {
numberOfNodes = CONSTANT_MAX_NUMBER_OF_RADIAL_SIBLINGS;
- }
- else
+ } else {
numberOfNodes = nodeList.size();
+ }
double angle;
- if (numberOfNodes > 5)
+ if (numberOfNodes > 5) {
angle = 2 * Math.PI / numberOfNodes;
- else
+ } else {
angle = 2 * Math.PI / CONSTANT_MAX_NUMBER_OF_RADIAL_SIBLINGS;
+ }
int i = 0;
@@ -427,8 +434,9 @@ public class StapGraph extends Graph {
xOffset = (int) (radius * Math.sin((float) angle * i)) - subN.getSize().width/2 + getNode(id).getSize().width/2;
}
- if (hasChildren(subID))
+ if (hasChildren(subID)) {
subN.setBackgroundColor(CONSTANT_HAS_CHILDREN);
+ }
subN.setLocation(x + xOffset, y + yOffset);
if (subN.connection == null) {
subN.makeConnection(SWT.NONE, nodeMap.get(id), nodeDataMap
@@ -436,8 +444,9 @@ public class StapGraph extends Graph {
}
StapData d = getNodeData(subID);
- if (d.isMarked())
+ if (d.isMarked()) {
subN.setBackgroundColor(CONSTANT_MARKED);
+ }
}
}
@@ -486,8 +495,9 @@ public class StapGraph extends Graph {
long time = aggregateTime.get(key);
//This is a stupid way to get the times right, but it is almost always guaranteed to work.
- while (time < 0)
+ while (time < 0) {
time += endTime;
+ }
tempMap.put(key, time);
}
@@ -557,11 +567,13 @@ public class StapGraph extends Graph {
//This is the lowest level of nodes to draw, and it still has kids
if (getLevelOfNode(id) == bottomLevelToDraw &&
- getNodeData(id).children.size() > 0)
+ getNodeData(id).children.size() > 0) {
n.setBackgroundColor(CONSTANT_HAS_CHILDREN);
+ }
- if (getNodeData(id).isMarked())
+ if (getNodeData(id).isMarked()) {
n.setBackgroundColor(CONSTANT_MARKED);
+ }
//-------------Get appropriate list of children
@@ -569,12 +581,14 @@ public class StapGraph extends Graph {
int usefulSize = 0;
// Determine which list of callees to use
- if (!collapse_mode)
+ if (!collapse_mode) {
callees = getNodeData(id).children;
- else
+ } else {
callees = getNodeData(id).collapsedChildren;
- if (callees == null)
+ }
+ if (callees == null) {
return;
+ }
int cLevel = getLevelOfNode(id) + 1;
@@ -584,9 +598,10 @@ public class StapGraph extends Graph {
}
}
else {
- if (collapsedLevelSize.get(cLevel) != null)
+ if (collapsedLevelSize.get(cLevel) != null) {
usefulSize = collapsedLevelSize.get(cLevel);
}
+ }
//-------------Draw all children
for (int i = 0; i < callees.size(); i++) {
//Find the number of nodes on this level for spacing purposes
@@ -612,8 +627,9 @@ public class StapGraph extends Graph {
+ getNode(childID).getSize().width;
//Leave a small blank space between nodes for aesthetic purposes
- if (i == callees.size() - 1)
+ if (i == callees.size() - 1) {
newSize += CONSTANT_HORIZONTAL_SPACING/3;
+ }
currentPositionInLevel.put(getLevelOfNode(childID), newSize);
}
@@ -624,8 +640,9 @@ public class StapGraph extends Graph {
* Extend the tree downwards
*/
public void extendTree() {
- if (bottomLevelToDraw >= lowestLevelOfNodesAdded)
+ if (bottomLevelToDraw >= lowestLevelOfNodesAdded) {
return;
+ }
StapData data = getNodeData(rootVisibleNodeNumber);
@@ -634,8 +651,9 @@ public class StapGraph extends Graph {
}
List<Integer> list = data.children;
- if (isCollapseMode())
+ if (isCollapseMode()) {
list = data.collapsedChildren;
+ }
if (list.size() == 1) {
//Special case - only one child of the root node
@@ -665,8 +683,9 @@ public class StapGraph extends Graph {
* Removes nodes from the bottom of the tree
*/
public void shrinkTree() {
- if (treeLevelFromRoot < 1)
+ if (treeLevelFromRoot < 1) {
return;
+ }
bottomLevelToDraw--;
@@ -688,10 +707,11 @@ public class StapGraph extends Graph {
setCollapseMode(false);
}
int toDraw = getNextCalledNode(getRootVisibleNodeNumber());
- if (toDraw != -1)
+ if (toDraw != -1) {
draw(toDraw);
- else
+ } else {
proj.pause();
+ }
}
@@ -731,8 +751,9 @@ public class StapGraph extends Graph {
if (collapse_mode && data.isPartOfCollapsedNode()) {
continue;
}
- if (!collapse_mode && data.isCollapsed)
+ if (!collapse_mode && data.isCollapsed) {
continue;
+ }
}
currPixelWidth += data.name.length() * 10 + StapGraph.CONSTANT_HORIZONTAL_SPACING_FOR_LEVEL;
@@ -748,15 +769,17 @@ public class StapGraph extends Graph {
MaxLevelPixelWidth = (int)(MaxLevelPixelWidth/scale);
counter = 0;
- if (id == getFirstUsefulNode())
+ if (id == getFirstUsefulNode()) {
nodeMap.get(id).setLocation(150 + (MaxLevelPixelWidth/2),y);
+ }
drawFromBottomToTop(bottomLevelToDraw, y
+ ((bottomLevelToDraw - topLevelToDraw ) * 3 * (int)(CONSTANT_VERTICAL_INCREMENT/scale)),
MaxLevelPixelWidth);
- if (id == getFirstUsefulNode())
+ if (id == getFirstUsefulNode()) {
nodeMap.get(id).setLocation(150 + (MaxLevelPixelWidth/2),y);
+ }
}
@@ -781,8 +804,9 @@ public class StapGraph extends Graph {
if (collapse_mode && data.isPartOfCollapsedNode() ) {
continue;
}
- if (!collapse_mode && nodeDataMap.get(id).isCollapsed)
+ if (!collapse_mode && nodeDataMap.get(id).isCollapsed) {
continue;
+ }
}
if (nodeMap.get(id) == null) {
@@ -796,8 +820,9 @@ public class StapGraph extends Graph {
//Placement algorithm
if (getAnimationMode() == CONSTANT_ANIMATION_SLOW){
- if (counter <= ANIMATION_TIME)
+ if (counter <= ANIMATION_TIME) {
Animation.markBegin();
+ }
n.setLocation(150 + (nodeMap.get(getRootVisibleNodeNumber()).getLocation().x),nodeMap.get(getRootVisibleNodeNumber()).getLocation().y);
n.setLocation(150 + (MaxLevelPixelWidth / (total + 1) * count),height);
@@ -817,21 +842,24 @@ public class StapGraph extends Graph {
- if (getNodeData(n.id).isMarked())
+ if (getNodeData(n.id).isMarked()) {
n.setBackgroundColor(CONSTANT_MARKED);
+ }
// FIND ALL THE NODES THAT THIS NODE CALLS AND MAKE CONNECTIONS
List<Integer> setOfCallees = null;
- if (collapse_mode)
+ if (collapse_mode) {
setOfCallees = nodeDataMap.get(id).collapsedChildren;
- else
+ } else {
setOfCallees = nodeDataMap.get(id).children;
+ }
for (int val : setOfCallees) {
- if (nodeMap.get(val) != null)
+ if (nodeMap.get(val) != null) {
nodeMap.get(val).makeConnection(SWT.NONE, n,
nodeDataMap.get(val).timesCalled);
+ }
}
count++;
@@ -873,8 +901,9 @@ public class StapGraph extends Graph {
//-------------Delete all nodes
for (int i : nodeMap.keySet()) {
StapNode node = nodeMap.get(i);
- if (node == null)
+ if (node == null) {
continue;
+ }
node.unhighlight();
node.dispose();
@@ -897,14 +926,16 @@ public class StapGraph extends Graph {
*/
private void deleteLevelsFromTop(int numberOfLevelsToDelete) {
- if (numberOfLevelsToDelete <= 0)
+ if (numberOfLevelsToDelete <= 0) {
return;
+ }
for (int i = 0; i < numberOfLevelsToDelete; i++) {
List<Integer> level = levels.get(topLevelToDraw);
for (int j = 0; j < level.size(); j++) {
- if (nodeMap.get(level.get(j)) != null)
+ if (nodeMap.get(level.get(j)) != null) {
nodeMap.remove(level.get(j)).dispose();
+ }
}
topLevelToDraw++;
}
@@ -917,15 +948,17 @@ public class StapGraph extends Graph {
*/
private void deleteLevelsFromBottom(int numberOfLevelsToDelete) {
- if (numberOfLevelsToDelete <= 0)
+ if (numberOfLevelsToDelete <= 0) {
return;
+ }
for (int i = 0; i < numberOfLevelsToDelete; i++) {
List<Integer> level = levels.get(getBottomLevelToDraw());
for (int j = 0; j < level.size(); j++) {
- if (nodeMap.get(level.get(j)) != null)
+ if (nodeMap.get(level.get(j)) != null) {
nodeMap.remove(level.get(j)).dispose();
+ }
}
bottomLevelToDraw--;
}
@@ -956,8 +989,9 @@ public class StapGraph extends Graph {
changeLevelLimits(new_topLevelToDraw);
int new_bottomLevelToDraw = new_topLevelToDraw + levelBuffer;
- if (new_bottomLevelToDraw > lowestLevelOfNodesAdded)
+ if (new_bottomLevelToDraw > lowestLevelOfNodesAdded) {
new_bottomLevelToDraw = lowestLevelOfNodesAdded;
+ }
deleteLevelsFromTop(new_topLevelToDraw - topLevelToDraw);
deleteLevelsFromBottom(getBottomLevelToDraw() - new_bottomLevelToDraw);
@@ -975,10 +1009,11 @@ public class StapGraph extends Graph {
for (int level = lvl; level < maxLevel; level++) {
for (int id : levels.get(level)) {
- if (isCollapseMode())
+ if (isCollapseMode()) {
list = getNodeData(id).collapsedChildren;
- else
+ } else {
list = getNodeData(id).children;
+ }
numberOfNodes += list.size();
@@ -1029,8 +1064,9 @@ public class StapGraph extends Graph {
public void draw(int drawMode, int animationMode, int id) {
setDrawMode(drawMode);
setAnimationMode(animationMode);
- if (nodeDataMap.get(id) == null)
+ if (nodeDataMap.get(id) == null) {
return;
+ }
this.clearSelection();
treeLevelFromRoot = 0;
currentPositionInLevel.clear();
@@ -1095,8 +1131,9 @@ public class StapGraph extends Graph {
//-------------Draw tree
if (draw_mode == CONSTANT_DRAWMODE_TREE) {
if (animation_mode == CONSTANT_ANIMATION_SLOW) {
- if (nodeMap.get(id) == null)
+ if (nodeMap.get(id) == null) {
nodeMap.put(id, getNodeData(id).makeNode(this));
+ }
int tempX = nodeMap.get(id).getLocation().x;
int tempY = nodeMap.get(id).getLocation().y;
Animation.markBegin();
@@ -1155,8 +1192,9 @@ public class StapGraph extends Graph {
else if (draw_mode == CONSTANT_DRAWMODE_LEVEL) {
rootVisibleNodeNumber = id;
if (animation_mode == CONSTANT_ANIMATION_SLOW) {
- if (nodeMap.get(id) == null)
+ if (nodeMap.get(id) == null) {
nodeMap.put(id, getNodeData(id).makeNode(this));
+ }
Animation.markBegin();
moveAllNodesTo(nodeMap.get(id).getLocation().x, nodeMap.get(id).getLocation().y);
@@ -1167,8 +1205,9 @@ public class StapGraph extends Graph {
drawBox(id, 0, 0);
} else {
- if (nodeMap.get(id) == null)
+ if (nodeMap.get(id) == null) {
nodeMap.put(id, getNodeData(id).makeNode(this));
+ }
deleteAll(id);
drawBox(id, 0, 0);
@@ -1183,8 +1222,9 @@ public class StapGraph extends Graph {
drawAggregateView();
}
- if (getNode(id) != null)
+ if (getNode(id) != null) {
getNode(id).unhighlight();
+ }
clearSelection();
//AFTER FIRST LOADING LET THE GRAPH EXPAND TO FILL THE VIEW
@@ -1200,7 +1240,9 @@ public class StapGraph extends Graph {
List<GraphNode> list = this.getSelection();
for (GraphNode n : list) {
- if (n != null) n.unhighlight();
+ if (n != null) {
+ n.unhighlight();
+ }
}
this.setSelection(null);
@@ -1228,15 +1270,17 @@ public class StapGraph extends Graph {
nodeMap.get(id).setLocation(x + xTarget, y + yTarget);
}
//If a node is null, then its children must be null
- else
+ else {
return;
+ }
List<Integer> list = null;
- if (collapse_mode)
+ if (collapse_mode) {
list = nodeDataMap.get(id).collapsedChildren;
- else
+ } else {
list = nodeDataMap.get(id).children;
+ }
for (int i = 0; i < list.size(); i++) {
moveRecursive(list.get(i), xTarget, yTarget);
}
@@ -1250,7 +1294,9 @@ public class StapGraph extends Graph {
*/
public void moveAllNodesBy(int xDiff, int yDiff) {
for (int id : nodeMap.keySet()) {
- if (nodeMap.get(id) == null) continue;
+ if (nodeMap.get(id) == null) {
+ continue;
+ }
int x = nodeMap.get(id).getLocation().x;
int y = nodeMap.get(id).getLocation().y;
@@ -1277,8 +1323,9 @@ public class StapGraph extends Graph {
//If all nodes have been collapsed, don't do anything
setCollapseMode(true);
- if (nodeDataMap.get(id).children.size() == 0)
+ if (nodeDataMap.get(id).children.size() == 0) {
return true;
+ }
nodeDataMap.get(id).hasCollapsedChildren = true;
@@ -1299,11 +1346,13 @@ public class StapGraph extends Graph {
for (int i = 0; i < size; i++) {
int childID = nodeDataMap.get(id).children.get(i);
- if (getNodeData(childID).isPartOfCollapsedNode())
+ if (getNodeData(childID).isPartOfCollapsedNode()) {
continue;
+ }
int childLevel = getLevelOfNode(childID);
- if (collapsedLevelSize.get(childLevel) == null)
+ if (collapsedLevelSize.get(childLevel) == null) {
collapsedLevelSize.put(childLevel, 0);
+ }
String nodeName = nodeDataMap.get(childID).name;
/*
@@ -1346,10 +1395,11 @@ public class StapGraph extends Graph {
nodeDataMap.get(otherChildID).setPartOfCollapsedNode(aggregateID);
nodeDataMap.get(aggregateID).uncollapsedPiece = otherChildID;
- } else
+ } else {
//-------------Aggregate - third and additional nodes
aggregateData(nodeDataMap.get(aggregateID), nodeDataMap
.get(childID));
+ }
//-------------Complete aggregation
@@ -1392,8 +1442,9 @@ public class StapGraph extends Graph {
//This node is technically a part of itself
nodeDataMap.get(childID).setPartOfCollapsedNode(childID);
- if (getNodeData(childID).isMarked())
+ if (getNodeData(childID).isMarked()) {
markedCollapsedNodes.add(childID);
+ }
}
@@ -1456,8 +1507,9 @@ public class StapGraph extends Graph {
* @return First node that is not the dummy first node
*/
public int getFirstUsefulNode() {
- if (threaded)
+ if (threaded) {
return 0;
+ }
int id = 0;
if (nodeDataMap.get(id).name == CONSTANT_TOP_NODE_NAME) {
@@ -1495,8 +1547,9 @@ public class StapGraph extends Graph {
* @return
*/
public boolean hasChildren(int nodeID) {
- if (nodeDataMap.get(nodeID).children.size() > 0)
+ if (nodeDataMap.get(nodeID).children.size() > 0) {
return true;
+ }
return false;
}
@@ -1528,9 +1581,9 @@ public class StapGraph extends Graph {
public void setCollapseMode(boolean value) {
if (collapse_mode == value ||
- draw_mode == StapGraph.CONSTANT_DRAWMODE_AGGREGATE)
+ draw_mode == StapGraph.CONSTANT_DRAWMODE_AGGREGATE) {
return;
-
+ }
if (draw_mode != StapGraph.CONSTANT_DRAWMODE_LEVEL) {
if (collapse_mode) {
//Collapsed to noncollapsed
@@ -1584,8 +1637,9 @@ public class StapGraph extends Graph {
* @return Time in milliseconds
*/
public long getTotalTime() {
- if (totalTime == 0 || totalTime > 1200000000000000000l)
+ if (totalTime == 0 || totalTime > 1200000000000000000l) {
return endTime - startTime;
+ }
return totalTime;
}
@@ -1728,8 +1782,9 @@ public class StapGraph extends Graph {
for (int count = callOrderList.indexOf(id) + 1;
count < callOrderList.size(); count++) {
int next = callOrderList.get(count);
- if (getNodeData(id) == null)
+ if (getNodeData(id) == null) {
continue;
+ }
if (!getNodeData(next).isCollapsed || getNodeData(next).isOnlyChildWithThisName()) {
return next;
}
@@ -1750,8 +1805,9 @@ public class StapGraph extends Graph {
for (int count = callOrderList.indexOf(id) - 1;
count > -1; count--) {
- if (getNodeData(id) == null)
+ if (getNodeData(id) == null) {
continue;
+ }
if (!getNodeData(id).isCollapsed || getNodeData(id).isOnlyChildWithThisName()) {
returnID = callOrderList.get(count);
return returnID;
@@ -1772,17 +1828,17 @@ public class StapGraph extends Graph {
*/
public int getNextMarkedNode() {
List<Integer> list = markedNodes;
- if (collapse_mode)
+ if (collapse_mode) {
list = markedCollapsedNodes;
-
- if (list.size() == 0)
+ }
+ if (list.size() == 0) {
return -1;
-
+ }
nextMarkedNode++;
- if (nextMarkedNode >= list.size())
+ if (nextMarkedNode >= list.size()) {
nextMarkedNode = 0;
-
+ }
return list.get(nextMarkedNode);
}
@@ -1796,16 +1852,17 @@ public class StapGraph extends Graph {
*/
public int getPreviousMarkedNode() {
List<Integer> list = markedNodes;
- if (collapse_mode)
+ if (collapse_mode) {
list = markedCollapsedNodes;
-
- if (list.size() == 0)
+ }
+ if (list.size() == 0){
return -1;
+ }
nextMarkedNode--;
- if (nextMarkedNode < 0)
+ if (nextMarkedNode < 0) {
nextMarkedNode = list.size() - 1;
-
+ }
return list.get(nextMarkedNode);
}
@@ -1878,12 +1935,16 @@ public class StapGraph extends Graph {
}
public int min(int a, int b) {
- if (a < b) return a;
+ if (a < b) {
+ return a;
+ }
return b;
}
public int max(int a, int b) {
- if (a > b) return a;
+ if (a > b) {
+ return a;
+ }
return b;
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/internal/systemtap/ui/graphing/actions/OpenScriptOutputAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/internal/systemtap/ui/graphing/actions/OpenScriptOutputAction.java
index b214150e50..3e77f9d544 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/internal/systemtap/ui/graphing/actions/OpenScriptOutputAction.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphing/src/org/eclipse/linuxtools/internal/systemtap/ui/graphing/actions/OpenScriptOutputAction.java
@@ -66,8 +66,11 @@ public class OpenScriptOutputAction extends Action implements IWorkbenchWindowAc
public void run(IAction act) {
File f = queryFile();
- if(null == f) {
- } else if(!f.exists()) {
+ if (f == null){
+ return;
+ }
+
+ if(!f.exists()) {
displayError(Localization.getString("OpenScriptOutputAction.SelectedFileDNE")); //$NON-NLS-1$
} else if(!f.canRead()) {
displayError(Localization.getString("OpenScriptOutputAction.SelectedFileCanNotRead")); //$NON-NLS-1$
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/DataSetFactory.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/DataSetFactory.java
index 1ac2fd19ef..7963817f42 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/DataSetFactory.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/DataSetFactory.java
@@ -29,26 +29,29 @@ import org.eclipse.ui.IMemento;
public final class DataSetFactory {
public static IDataSet createDataSet(String id, String[] labels) {
- if(id.equals(RowDataSet.ID))
+ if(id.equals(RowDataSet.ID)) {
return new RowDataSet(labels);
- else if(id.equals(TableDataSet.ID))
+ } else if(id.equals(TableDataSet.ID)) {
return new TableDataSet(labels);
+ }
return null;
}
public static IFilteredDataSet createFilteredDataSet(String id, String[] labels) {
- if(id.equals(RowDataSet.ID))
+ if(id.equals(RowDataSet.ID)) {
return new FilteredRowDataSet(labels);
- else if(id.equals(TableDataSet.ID))
+ } else if(id.equals(TableDataSet.ID)) {
return new FilteredTableDataSet(labels);
+ }
return new FilteredRowDataSet(labels);
}
public static IFilteredDataSet createFilteredDataSet(IDataSet set) {
- if(set instanceof RowDataSet)
+ if(set instanceof RowDataSet) {
return new FilteredRowDataSet((RowDataSet)set);
- else if(set instanceof TableDataSet)
+ } else if(set instanceof TableDataSet) {
return new FilteredTableDataSet((TableDataSet)set);
+ }
return null;
}
@@ -58,15 +61,17 @@ public final class DataSetFactory {
public static String getName(String id) {
int index = getIndex(id);
- if(index >= 0)
+ if(index >= 0) {
return names[index];
+ }
return null;
}
public static String getDescription(String id) {
int index = getIndex(id);
- if(index >= 0)
+ if(index >= 0) {
return descriptions[index];
+ }
return null;
}
@@ -74,34 +79,39 @@ public final class DataSetFactory {
ParsingWizardPage page = null;
int index = getIndex(id);
- if(index >=0 && index < dataSetWizards.length)
+ if(index >=0 && index < dataSetWizards.length) {
return dataSetWizards[index];
+ }
return page;
}
public static IDataSetParser createParserXML(String id, IMemento source) {
- if(id.equals(ids[0]))
+ if(id.equals(ids[0])) {
return new RowParser(source);
- else if(id.equals(ids[1]))
+ } else if(id.equals(ids[1])) {
return new TableParser(source);
+ }
return null;
}
public static DataGrid getDataGrid(Composite composite, IDataSet set) {
- if(set instanceof RowDataSet)
+ if(set instanceof RowDataSet) {
return new DataGrid(composite, set, DataGrid.NONE);
- else if(set instanceof TableDataSet)
+ } else if(set instanceof TableDataSet) {
return new DataGrid(composite, set, DataGrid.FULL_UPDATE);
+ }
return null;
}
private static int getIndex(String id) {
- for(int i=0; i<ids.length; i++)
- if(id.equals(ids[i]))
+ for(int i=0; i<ids.length; i++) {
+ if(id.equals(ids[i])) {
return i;
+ }
+ }
return -1;
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/DataSetWizard.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/DataSetWizard.java
index ac9ee09575..f81b2cdc88 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/DataSetWizard.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/DataSetWizard.java
@@ -60,8 +60,9 @@ public class DataSetWizard extends Wizard implements INewWizard {
@Override
public boolean canFinish() {
IWizardPage page = this.getContainer().getCurrentPage();
- if((null != dataSet) && (null != parser) && (page instanceof ParsingWizardPage))
+ if((null != dataSet) && (null != parser) && (page instanceof ParsingWizardPage)) {
return true;
+ }
return false;
}
@@ -88,8 +89,9 @@ public class DataSetWizard extends Wizard implements INewWizard {
private boolean writeParsingExpression() {
XMLMemento data = copyExisting();
- if(null == data)
+ if(null == data) {
data = XMLMemento.createWriteRoot(IDataSetParser.XMLDataSetSettings);
+ }
try {
IMemento child = data.createChild(IDataSetParser.XMLFile, scriptFile);
@@ -152,8 +154,9 @@ public class DataSetWizard extends Wizard implements INewWizard {
protected boolean openFile() {
try {
- if (!metaFile.exists())
+ if (!metaFile.exists()) {
metaFile.createNewFile();
+ }
} catch(IOException ioe) {
return false;
}
@@ -163,10 +166,12 @@ public class DataSetWizard extends Wizard implements INewWizard {
@Override
public void dispose() {
- if(null != getContainer())
+ if(null != getContainer()) {
((WizardDialog)getContainer()).removePageChangedListener(pageListener);
- if(null != dataSetPage)
+ }
+ if(null != dataSetPage) {
dataSetPage.dispose();
+ }
if(null != parsingPages) {
for(int i=0; i<parsingPages.length; i++) {
if(null != parsingPages[i]) {
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/ParsingWizardPage.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/ParsingWizardPage.java
index 9ab484f14a..f5494ca8e2 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/ParsingWizardPage.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/ParsingWizardPage.java
@@ -57,8 +57,9 @@ public abstract class ParsingWizardPage extends WizardPage {
txtSeries.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) {
- if(('0' > e.character || '9' < e.character) && 31 < e.character && 127 > e.character)
+ if(('0' > e.character || '9' < e.character) && 31 < e.character && 127 > e.character) {
e.doit = false;
+ }
}
@Override
@@ -94,20 +95,23 @@ public abstract class ParsingWizardPage extends WizardPage {
txtRegExpr[i] = new Text(cmpTextFields, SWT.BORDER);
txtRegExpr[i].setBounds(150*(i%COLUMNS), 30*(i/COLUMNS), 140, 25);
- if(2 == i%COLUMNS)
+ if(2 == i%COLUMNS) {
txtRegExpr[i].setText("\\D+"); //$NON-NLS-1$
- else if(1 == i%COLUMNS)
+ } else if(1 == i%COLUMNS)
+ {
txtRegExpr[i].setText("\\d+"); //$NON-NLS-1$
+ }
}
readParsingExpression();
//Do this after readingParsingExpressions so events arn't fired
for(int i=0; i<txtRegExpr.length; i++) {
- if(0 != i%COLUMNS)
+ if(0 != i%COLUMNS) {
txtRegExpr[i].addModifyListener(regExListener);
- else
+ } else {
txtRegExpr[i].addModifyListener(textListener);
+ }
}
displayTextBoxes();
@@ -124,10 +128,11 @@ public abstract class ParsingWizardPage extends WizardPage {
series *= COLUMNS;
for(int i=0; i<txtRegExpr.length; i++) {
- if(i < series)
+ if(i < series) {
txtRegExpr[i].setVisible(true);
- else
+ } else {
txtRegExpr[i].setVisible(false);
+ }
}
}
@@ -135,9 +140,11 @@ public abstract class ParsingWizardPage extends WizardPage {
int series = Integer.parseInt(txtSeries.getText());
series *= COLUMNS;
StringBuilder s = new StringBuilder();
- for(int i=0; i<series; i++)
- if(0 != i%COLUMNS)
+ for(int i=0; i<series; i++) {
+ if(0 != i%COLUMNS) {
s.append(txtRegExpr[i].getText());
+ }
+ }
lblRegEx.setText(s.toString());
}
@@ -151,10 +158,11 @@ public abstract class ParsingWizardPage extends WizardPage {
if(null != txtRegExpr) {
for(int i=0; i<txtRegExpr.length; i++) {
if(null != txtRegExpr[i]) {
- if(0 != i%COLUMNS)
+ if(0 != i%COLUMNS) {
txtRegExpr[i].removeModifyListener(regExListener);
- else
+ } else {
txtRegExpr[i].removeModifyListener(textListener);
+ }
txtRegExpr[i].dispose();
}
txtRegExpr[i] = null;
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/SelectDataSetWizardPage.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/SelectDataSetWizardPage.java
index 3cfdf6746c..17668cbb69 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/SelectDataSetWizardPage.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/SelectDataSetWizardPage.java
@@ -33,11 +33,11 @@ public class SelectDataSetWizardPage extends WizardPage {
dataSetID = ""; //$NON-NLS-1$
btnDataSets = null;
}
-
+
@Override
public void createControl(Composite parent) {
wizard = (DataSetWizard)super.getWizard();
-
+
Composite comp = new Composite(parent, SWT.NULL);
GridData layoutData = new GridData(GridData.FILL_BOTH);
layoutData.grabExcessHorizontalSpace = true;
@@ -60,15 +60,15 @@ public class SelectDataSetWizardPage extends WizardPage {
separatorData.horizontalSpan=2;
separator.setLayoutData(separatorData);
}
-
+
setControl(comp);
}
-
+
@Override
public boolean canFlipToNextPage() {
return !dataSetID.isEmpty();
}
-
+
@Override
public IWizardPage getNextPage() {
return DataSetFactory.getParsingWizardPage(dataSetID);
@@ -77,12 +77,13 @@ public class SelectDataSetWizardPage extends WizardPage {
@Override
public void dispose() {
super.dispose();
- if(null != btnDataSets)
+ if(null != btnDataSets) {
for(int i=0; i<btnDataSets.length; i++) {
btnDataSets[i].removeSelectionListener(buttonListener);
btnDataSets[i].dispose();
btnDataSets[i] = null;
}
+ }
btnDataSets = null;
}
@@ -101,7 +102,7 @@ public class SelectDataSetWizardPage extends WizardPage {
}
}
};
-
+
private Button[] btnDataSets;
private String dataSetID;
private DataSetWizard wizard;
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/SelectTableParsingWizardPage.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/SelectTableParsingWizardPage.java
index 3b8effc8ac..d2570447f8 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/SelectTableParsingWizardPage.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/ui/graphingapi/ui/wizards/dataset/SelectTableParsingWizardPage.java
@@ -56,8 +56,9 @@ public class SelectTableParsingWizardPage extends ParsingWizardPage {
@Override
protected boolean readParsingExpression() {
- if(null == wizard.metaFile && !wizard.openFile())
+ if(null == wizard.metaFile && !wizard.openFile()) {
return false;
+ }
try {
FileReader reader = new FileReader(wizard.metaFile);
@@ -72,20 +73,24 @@ public class SelectTableParsingWizardPage extends ParsingWizardPage {
IMemento[] children = data.getChildren(IDataSetParser.XMLFile);
int i;
for(i=0; i<children.length; i++) {
- if(children[i].getID().equals(wizard.scriptFile))
+ if(children[i].getID().equals(wizard.scriptFile)) {
break;
+ }
}
- if(i>=children.length) //Didn't find file
+ if(i>=children.length) {
return false;
+ }
- if(0 != children[i].getString(IDataSetParser.XMLdataset).compareTo(TableDataSet.ID))
+ if(0 != children[i].getString(IDataSetParser.XMLdataset).compareTo(TableDataSet.ID)) {
return false;
+ }
IMemento[] children2 = children[i].getChildren(IDataSetParser.XMLColumn);
txtSeries.setText("" + children2.length); //$NON-NLS-1$
- for(int j=0; j<children2.length; j++)
+ for(int j=0; j<children2.length; j++) {
txtRegExpr[j*COLUMNS].setText(children2[j].getString(IDataSetParser.XMLname));
+ }
children2 = children[i].getChildren(IDataSetParser.XMLSeries);
txtSeries.setText("" + children2.length); //$NON-NLS-1$

Back to the top