summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorCamilo Bernal2012-05-22 13:43:57 (EDT)
committer Roland Grunberg2012-05-23 15:52:36 (EDT)
commit36c6dc340a8fccfbd0e18e83abc9e468938256b7 (patch)
tree8dfbc15f098fe0400d21d4371b607b56bbc7e86e
parent6ffd4d608495cbbd5748abc41b1def233146c81e (diff)
downloadorg.eclipse.linuxtools-36c6dc340a8fccfbd0e18e83abc9e468938256b7.zip
org.eclipse.linuxtools-36c6dc340a8fccfbd0e18e83abc9e468938256b7.tar.gz
org.eclipse.linuxtools-36c6dc340a8fccfbd0e18e83abc9e468938256b7.tar.bz2
Implemented compare method for NameSorter class in PerfProfileView.java.
Adding sorting functionality in PerfViewContentProvider.java does not have any effect on sorting. Implementing the compare method for NameSorter correctly sorts the tree elements by percentage.
-rw-r--r--perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/PerfProfileView.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/PerfProfileView.java b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/PerfProfileView.java
index 85fa7e8..7b24fd5 100644
--- a/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/PerfProfileView.java
+++ b/perf/org.eclipse.linuxtools.perf/src/org/eclipse/linuxtools/internal/perf/ui/PerfProfileView.java
@@ -20,8 +20,10 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.linuxtools.internal.perf.PerfPlugin;
+import org.eclipse.linuxtools.internal.perf.model.TreeParent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
@@ -44,6 +46,10 @@ public class PerfProfileView extends ViewPart {
private Action doubleClickAction;
class NameSorter extends ViewerSorter {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ return (((TreeParent) e1).getPercent() <= ((TreeParent) e2)
+ .getPercent()) ? -1 : 1;
+ }
}
/**