aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEtienne Bergeron2013-11-15 00:56:20 (EST)
committerAlexandre Montplaisir2013-11-18 15:08:42 (EST)
commit00c62c3308c96ec2ae0d1480b86ef3890aebb861 (patch)
tree097dff265891d547a162e52641140b85ae9c176a
parent2409951cab3b99652b8c988b07f369e584195e34 (diff)
downloadorg.eclipse.linuxtools-00c62c3308c96ec2ae0d1480b86ef3890aebb861.zip
org.eclipse.linuxtools-00c62c3308c96ec2ae0d1480b86ef3890aebb861.tar.gz
org.eclipse.linuxtools-00c62c3308c96ec2ae0d1480b86ef3890aebb861.tar.bz2
Fix coding style in TmfVirtualTable.refs/changes/54/18454/4
Fixing some nits I've found while reading this file. Mostly no behavior changed, except shortcut a loop and removing a useless test. Change-Id: Iaa2db0f7fc6cf72a3b87b0f67763a4dbf073cf57 Signed-off-by: Etienne Bergeron <etienne.bergeron@gmail.com> Reviewed-on: https://git.eclipse.org/r/18454 Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java8
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/virtualtable/TmfVirtualTable.java45
2 files changed, 26 insertions, 27 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java
index f997190..105a466 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/viewers/events/TmfEventsTable.java
@@ -197,7 +197,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
/** Filter object */
String FILTER_OBJ = "$fltr_obj"; //$NON-NLS-1$
- /** Timestamp*/
+ /** Timestamp */
String TIMESTAMP = "$time"; //$NON-NLS-1$
/** Rank */
@@ -386,9 +386,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
}
} else {
broadcast(new TmfTimeSynchSignal(TmfEventsTable.this, ts, fSelectedBeginTimestamp));
- if (fStatusLineManager != null) {
- updateStatusLine(fSelectedBeginTimestamp.getDelta(ts));
- }
+ updateStatusLine(fSelectedBeginTimestamp.getDelta(ts));
}
}
} else {
@@ -612,7 +610,7 @@ public class TmfEventsTable extends TmfComponent implements IGotoMarker, IColorS
fRawViewer.setVisible(true);
fSashForm.layout();
final int index = fTable.getSelectionIndex();
- if (index >= +1) {
+ if (index >= 1) {
fRawViewer.selectAndReveal(index - 1);
}
}
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/virtualtable/TmfVirtualTable.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/virtualtable/TmfVirtualTable.java
index 1a04f2f..c73c07f 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/virtualtable/TmfVirtualTable.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/virtualtable/TmfVirtualTable.java
@@ -81,7 +81,7 @@ public class TmfVirtualTable extends Composite {
private int fSelectedBeginRank = -1; // Global rank of the selected begin event
private boolean fPendingSelection = false; // Pending selection update
- private int fTableItemCount = 0;
+ private int fTableItemCount = 0;
// The slider
private Slider fSlider;
@@ -173,25 +173,25 @@ public class TmfVirtualTable extends Composite {
// Implement a "fake" tooltip
final String TOOLTIP_DATA_KEY = "_TABLEITEM"; //$NON-NLS-1$
- final Listener labelListener = new Listener () {
+ final Listener labelListener = new Listener() {
@Override
public void handleEvent (Event event) {
- Label label = (Label)event.widget;
- Shell shell = label.getShell ();
+ Label label = (Label) event.widget;
+ Shell shell = label.getShell();
switch (event.type) {
case SWT.MouseDown:
- Event e = new Event ();
- e.item = (TableItem) label.getData (TOOLTIP_DATA_KEY);
+ Event e = new Event();
+ e.item = (TableItem) label.getData(TOOLTIP_DATA_KEY);
// Assuming table is single select, set the selection as if
// the mouse down event went through to the table
- fTable.setSelection (new TableItem [] {(TableItem) e.item});
- fTable.notifyListeners (SWT.Selection, e);
- shell.dispose ();
+ fTable.setSelection(new TableItem [] {(TableItem) e.item});
+ fTable.notifyListeners(SWT.Selection, e);
+ shell.dispose();
fTable.setFocus();
break;
case SWT.MouseExit:
case SWT.MouseWheel:
- shell.dispose ();
+ shell.dispose();
break;
default:
break;
@@ -199,11 +199,11 @@ public class TmfVirtualTable extends Composite {
}
};
- Listener tableListener = new Listener () {
+ Listener tableListener = new Listener() {
Shell tip = null;
Label label = null;
@Override
- public void handleEvent (Event event) {
+ public void handleEvent(Event event) {
switch (event.type) {
case SWT.Dispose:
case SWT.KeyDown:
@@ -211,17 +211,17 @@ public class TmfVirtualTable extends Composite {
if (tip == null) {
break;
}
- tip.dispose ();
+ tip.dispose();
tip = null;
label = null;
break;
}
case SWT.MouseHover: {
- TableItem item = fTable.getItem (new Point(event.x, event.y));
+ TableItem item = fTable.getItem(new Point(event.x, event.y));
if (item != null) {
- for (int i=0; i < fTable.getColumnCount(); i++) {
+ for (int i = 0; i < fTable.getColumnCount(); i++) {
Rectangle bounds = item.getBounds(i);
- if (bounds.contains(event.x,event.y)){
+ if (bounds.contains(event.x, event.y)) {
if (tip != null && !tip.isDisposed()) {
tip.dispose();
}
@@ -250,6 +250,9 @@ public class TmfVirtualTable extends Composite {
Point pt = fTable.toDisplay(bounds.x, bounds.y);
tip.setBounds(pt.x, pt.y, size.x, size.y);
tip.setVisible(true);
+
+ // Item found, leave loop.
+ break;
}
}
}
@@ -318,11 +321,11 @@ public class TmfVirtualTable extends Composite {
@Override
public void handleEvent(Event event) {
if (doubleClickListener != null) {
- TableItem item = fTable.getItem (new Point (event.x, event.y));
+ TableItem item = fTable.getItem(new Point (event.x, event.y));
if (item != null) {
- for(int i=0;i<fTable.getColumnCount();i++){
+ for (int i = 0; i < fTable.getColumnCount(); i++){
Rectangle bounds = item.getBounds(i);
- if (bounds.contains(event.x,event.y)){
+ if (bounds.contains(event.x, event.y)){
doubleClickListener.handleDoubleClick(TmfVirtualTable.this, item, i);
break;
}
@@ -652,7 +655,6 @@ public class TmfVirtualTable extends Composite {
fTable.addKeyListener(listener);
}
-
/**
* Method addMouseListener.
* @param listener MouseListener
@@ -858,7 +860,7 @@ public class TmfVirtualTable extends Composite {
if (!done) {
return;
}
- if (fPendingSelection && done) {
+ if (fPendingSelection) {
fPendingSelection = false;
TableItem item = null;
if (fSelectedEventRank >= 0 && fSelectedEventRank < fFrozenRowCount) {
@@ -1002,7 +1004,6 @@ public class TmfVirtualTable extends Composite {
}
refreshTable();
-
}
}