|
Lines 14-23
Link Here
|
| 14 |
|
14 |
|
| 15 |
package org.eclipse.tptp.trace.jvmti.internal.client.views; |
15 |
package org.eclipse.tptp.trace.jvmti.internal.client.views; |
| 16 |
|
16 |
|
|
|
17 |
import org.eclipse.emf.common.util.EList; |
| 18 |
import org.eclipse.emf.ecore.EObject; |
| 17 |
import org.eclipse.hyades.models.trace.TRCClass; |
19 |
import org.eclipse.hyades.models.trace.TRCClass; |
|
|
20 |
import org.eclipse.hyades.models.trace.TRCObjectAllocationAnnotation; |
| 21 |
import org.eclipse.hyades.trace.ui.ITraceSelection; |
| 18 |
import org.eclipse.hyades.trace.ui.TraceViewerPage; |
22 |
import org.eclipse.hyades.trace.ui.TraceViewerPage; |
|
|
23 |
import org.eclipse.hyades.trace.ui.UIPlugin; |
| 24 |
import org.eclipse.hyades.trace.ui.ViewSelectionChangedEvent; |
| 25 |
import org.eclipse.hyades.trace.views.internal.view.columnlabels.ContextUpdaterHelper; |
| 19 |
import org.eclipse.hyades.trace.views.util.internal.ColumnData; |
26 |
import org.eclipse.hyades.trace.views.util.internal.ColumnData; |
| 20 |
import org.eclipse.hyades.trace.views.util.internal.StatisticTableColumnInfo; |
27 |
import org.eclipse.hyades.trace.views.util.internal.StatisticTableColumnInfo; |
|
|
28 |
import org.eclipse.hyades.ui.provisional.context.ContextManager; |
| 21 |
import org.eclipse.jface.viewers.Viewer; |
29 |
import org.eclipse.jface.viewers.Viewer; |
| 22 |
import org.eclipse.swt.graphics.Image; |
30 |
import org.eclipse.swt.graphics.Image; |
| 23 |
import org.eclipse.swt.widgets.Composite; |
31 |
import org.eclipse.swt.widgets.Composite; |
|
Lines 25-36
Link Here
|
| 25 |
|
33 |
|
| 26 |
public class AllocationDetailsView extends BaseStatisticView { |
34 |
public class AllocationDetailsView extends BaseStatisticView { |
| 27 |
|
35 |
|
| 28 |
protected AllocationDetailsView(Composite parent, TraceViewerPage page) { |
36 |
TRCClass _class; |
|
|
37 |
BaseMemoryStatisticView _memView; |
| 38 |
static final Object _emptyArr[] = new Object[0]; |
| 39 |
|
| 40 |
protected AllocationDetailsView(Composite parent, TraceViewerPage page, |
| 41 |
BaseMemoryStatisticView memView) { |
| 29 |
super(parent, page); |
42 |
super(parent, page); |
|
|
43 |
_memView = memView; |
| 30 |
} |
44 |
} |
| 31 |
|
45 |
|
| 32 |
protected String getColumnsPreferencesKey() { |
46 |
protected String getColumnsPreferencesKey() { |
| 33 |
return "org.eclipse.hyades.trace.views.statistic.allocdetails02"; |
47 |
return "org.eclipse.hyades.trace.views.statistic.allocdetails03"; |
| 34 |
} |
48 |
} |
| 35 |
|
49 |
|
| 36 |
protected String getViewTypeStr() { |
50 |
protected String getViewTypeStr() { |
|
Lines 41-47
Link Here
|
| 41 |
return "" |
55 |
return "" |
| 42 |
+ TIContextAttributes.METHOD_NAME + ":" + 0 + ":" + String.valueOf(ColumnData.NONDELETABLE | ColumnData.IS_VISIBLE | ColumnData.NONMOVABLE) + ":left:150," |
56 |
+ TIContextAttributes.METHOD_NAME + ":" + 0 + ":" + String.valueOf(ColumnData.NONDELETABLE | ColumnData.IS_VISIBLE | ColumnData.NONMOVABLE) + ":left:150," |
| 43 |
+ TIContextAttributes.METHOD_LINE_NUMBER + ":" + 1 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":left:120," |
57 |
+ TIContextAttributes.METHOD_LINE_NUMBER + ":" + 1 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":left:120," |
| 44 |
+ TIContextAttributes.THREAD_CLASS_NAME + ":" + 2 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":left:150," |
58 |
+ TIContextAttributes.CLASS_NAME + ":" + 2 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":left:150," |
| 45 |
+ TIContextAttributes.PACKAGE_NAME + ":" + 3 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":left:120," |
59 |
+ TIContextAttributes.PACKAGE_NAME + ":" + 3 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":left:120," |
| 46 |
+ TIContextAttributes.CLASS_LIVE_INST + ":" + 4 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," |
60 |
+ TIContextAttributes.CLASS_LIVE_INST + ":" + 4 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," |
| 47 |
+ TIContextAttributes.CLASS_ACTIVE_SIZE + ":" + 5 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," |
61 |
+ TIContextAttributes.CLASS_ACTIVE_SIZE + ":" + 5 + ":" + String.valueOf(ColumnData.IS_VISIBLE) + ":right:80," |
|
Lines 55-75
Link Here
|
| 55 |
public String getColumnText(Object element, int columnIndex) { |
69 |
public String getColumnText(Object element, int columnIndex) { |
| 56 |
StatisticTableColumnInfo info = StatisticTableColumnInfo.getStatisticTableColumnInfo(getTree().getColumn(columnIndex)); |
70 |
StatisticTableColumnInfo info = StatisticTableColumnInfo.getStatisticTableColumnInfo(getTree().getColumn(columnIndex)); |
| 57 |
int pos = info.getColumnData().getInitalPos(); |
71 |
int pos = info.getColumnData().getInitalPos(); |
| 58 |
String label = "placeholder-" + pos; |
72 |
String label = ""; |
| 59 |
TRCClass cls = null; |
73 |
if (!(element instanceof TRCObjectAllocationAnnotation)) |
| 60 |
if (true) |
|
|
| 61 |
return label; |
74 |
return label; |
| 62 |
switch (pos) { |
75 |
switch (pos) { |
| 63 |
case 0: label = "method name"; break; |
76 |
case 0: label = "method name"; break; |
| 64 |
case 1: label = "line number"; break; |
77 |
case 1: label = "line number"; break; |
| 65 |
case 2: label = cls.getName(); break; |
78 |
case 2: break; |
| 66 |
case 3: label = cls.getPackage().getName(); break; |
79 |
case 3: break; |
| 67 |
case 4: label = "" + (cls.getTotalInstances() - cls.getCollectedInstances()); break; |
80 |
case 4: break; |
| 68 |
case 5: label = "" + (cls.getTotalSize() - cls.getCollectedSize()); break; |
|
|
| 69 |
case 6: label = "" + cls.getTotalInstances(); break; |
| 70 |
case 7: label = "" + cls.getTotalSize(); break; |
| 71 |
//case 8: label = "" + cls.getAvarageAge(); break; |
| 72 |
//case 9: label = "" + cls.getGenerations(); break; |
| 73 |
} |
81 |
} |
| 74 |
return label; |
82 |
return label; |
| 75 |
} |
83 |
} |
|
Lines 78-85
Link Here
|
| 78 |
return null; |
86 |
return null; |
| 79 |
} |
87 |
} |
| 80 |
|
88 |
|
|
|
89 |
TRCClass getSelectedClass() { |
| 90 |
return _class; |
| 91 |
/*if (null == _memView || _memView.getControl().isDisposed()) |
| 92 |
return null; |
| 93 |
IStructuredSelection selection = (IStructuredSelection) _memView.getTreeViewer().getSelection(); |
| 94 |
if (null == selection || selection.isEmpty()) |
| 95 |
return null; |
| 96 |
Object element = selection.getFirstElement(); |
| 97 |
if (!(element instanceof TRCClass)) |
| 98 |
return null; |
| 99 |
return (TRCClass) element;*/ |
| 100 |
} |
| 101 |
|
| 81 |
public Object[] getElements(Object inputElement) { |
102 |
public Object[] getElements(Object inputElement) { |
| 82 |
return new Object[] {""}; |
103 |
TRCClass cls = getSelectedClass(); |
|
|
104 |
if (null == cls) |
| 105 |
return _emptyArr; |
| 106 |
EList list = cls.getAnnotations(); |
| 107 |
if (null == list) |
| 108 |
return _emptyArr; |
| 109 |
return list.toArray(); |
| 83 |
} |
110 |
} |
| 84 |
|
111 |
|
| 85 |
public int compare(Viewer viewer, Object e1, Object e2, int pos) { |
112 |
public int compare(Viewer viewer, Object e1, Object e2, int pos) { |
|
Lines 96-102
Link Here
|
| 96 |
|
123 |
|
| 97 |
protected StatisticSorter getViewerSorterInstance() { |
124 |
protected StatisticSorter getViewerSorterInstance() { |
| 98 |
return new StatisticSorter() { |
125 |
return new StatisticSorter() { |
| 99 |
|
|
|
| 100 |
}; |
126 |
}; |
| 101 |
} |
127 |
} |
|
|
128 |
|
| 129 |
protected void populateData(Object obj) { |
| 130 |
if (obj instanceof TRCClass) { |
| 131 |
_class = (TRCClass) obj; |
| 132 |
refresh(); |
| 133 |
} |
| 134 |
} |
| 135 |
|
| 136 |
public void handleViewSelectionChangedEvent(ViewSelectionChangedEvent event) { |
| 137 |
Object source = event.getSource(); |
| 138 |
if (source != this) { |
| 139 |
ITraceSelection model = UIPlugin.getDefault().getSelectionModel(_page.getMOFObject()); |
| 140 |
if (model.size() > 0) { |
| 141 |
Object sel = model.getFirstElement(); |
| 142 |
if (sel != null) { |
| 143 |
populateData(sel); |
| 144 |
} |
| 145 |
} |
| 146 |
} |
| 147 |
} |
| 102 |
} |
148 |
} |