|
Lines 1-5
Link Here
|
| 1 |
/***************************************************************************** |
1 |
/***************************************************************************** |
| 2 |
* Copyright (c) 2007, Intel Corporation. |
2 |
* Copyright (c) 2007, 2008 Intel Corporation. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 26-31
Link Here
|
| 26 |
import org.eclipse.hyades.models.trace.impl.TRCPackageImpl; |
26 |
import org.eclipse.hyades.models.trace.impl.TRCPackageImpl; |
| 27 |
import org.eclipse.hyades.models.trace.impl.TRCClassImpl.TRCClassSnapshot; |
27 |
import org.eclipse.hyades.models.trace.impl.TRCClassImpl.TRCClassSnapshot; |
| 28 |
import org.eclipse.hyades.models.trace.impl.TRCPackageImpl.TRCPackageSnapshot; |
28 |
import org.eclipse.hyades.models.trace.impl.TRCPackageImpl.TRCPackageSnapshot; |
|
|
29 |
import org.eclipse.hyades.trace.ui.FilterTraceViewer; |
| 30 |
import org.eclipse.hyades.trace.ui.TraceViewer; |
| 29 |
import org.eclipse.hyades.trace.ui.TraceViewerPage; |
31 |
import org.eclipse.hyades.trace.ui.TraceViewerPage; |
| 30 |
import org.eclipse.hyades.trace.ui.internal.util.PerftraceUtil; |
32 |
import org.eclipse.hyades.trace.ui.internal.util.PerftraceUtil; |
| 31 |
import org.eclipse.hyades.trace.views.adapter.internal.DynamicFilter; |
33 |
import org.eclipse.hyades.trace.views.adapter.internal.DynamicFilter; |
|
Lines 33-43
Link Here
|
| 33 |
import org.eclipse.hyades.trace.views.internal.view.columnlabels.ColumnDisplayInfo; |
35 |
import org.eclipse.hyades.trace.views.internal.view.columnlabels.ColumnDisplayInfo; |
| 34 |
import org.eclipse.hyades.trace.views.internal.view.columnlabels.ColumnLabelAdapter; |
36 |
import org.eclipse.hyades.trace.views.internal.view.columnlabels.ColumnLabelAdapter; |
| 35 |
import org.eclipse.hyades.trace.views.util.internal.ColumnData; |
37 |
import org.eclipse.hyades.trace.views.util.internal.ColumnData; |
|
|
38 |
import org.eclipse.hyades.ui.filters.internal.actions.FiltersEditorAction; |
| 39 |
import org.eclipse.hyades.ui.filters.internal.util.FilterInformationManager; |
| 40 |
import org.eclipse.hyades.ui.util.GridUtil; |
| 36 |
import org.eclipse.jface.viewers.ISelection; |
41 |
import org.eclipse.jface.viewers.ISelection; |
| 37 |
import org.eclipse.jface.viewers.Viewer; |
42 |
import org.eclipse.jface.viewers.Viewer; |
|
|
43 |
import org.eclipse.osgi.util.NLS; |
| 44 |
import org.eclipse.swt.SWT; |
| 38 |
import org.eclipse.swt.events.SelectionEvent; |
45 |
import org.eclipse.swt.events.SelectionEvent; |
|
|
46 |
import org.eclipse.swt.events.SelectionListener; |
| 47 |
import org.eclipse.swt.graphics.Font; |
| 48 |
import org.eclipse.swt.graphics.FontData; |
| 39 |
import org.eclipse.swt.graphics.Image; |
49 |
import org.eclipse.swt.graphics.Image; |
| 40 |
import org.eclipse.swt.widgets.Composite; |
50 |
import org.eclipse.swt.widgets.Composite; |
|
|
51 |
import org.eclipse.swt.widgets.Label; |
| 52 |
import org.eclipse.swt.widgets.Link; |
| 53 |
import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceMessages; |
| 41 |
import org.eclipse.tptp.trace.jvmti.internal.client.context.TIContextAttributes; |
54 |
import org.eclipse.tptp.trace.jvmti.internal.client.context.TIContextAttributes; |
| 42 |
import org.eclipse.tptp.trace.jvmti.internal.client.context.TIContextUpdaterHelper; |
55 |
import org.eclipse.tptp.trace.jvmti.internal.client.context.TIContextUpdaterHelper; |
| 43 |
import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.LiveSizeLabelAdapter; |
56 |
import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.LiveSizeLabelAdapter; |
|
Lines 48-56
Link Here
|
| 48 |
import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.TotalInstancesLabelAdapter; |
61 |
import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.TotalInstancesLabelAdapter; |
| 49 |
import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.TotalSizeLabelAdapter; |
62 |
import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.TotalSizeLabelAdapter; |
| 50 |
import org.eclipse.tptp.trace.jvmti.internal.client.widgets.Utils; |
63 |
import org.eclipse.tptp.trace.jvmti.internal.client.widgets.Utils; |
|
|
64 |
import org.eclipse.ui.forms.IFormColors; |
| 51 |
|
65 |
|
| 52 |
public class BaseMemoryStatisticView extends BaseStatisticView { |
66 |
public class BaseMemoryStatisticView extends BaseStatisticView { |
| 53 |
|
|
|
| 54 |
static public final int CLASS_MODE = 0; // CM |
67 |
static public final int CLASS_MODE = 0; // CM |
| 55 |
static public final int PACKAGE_MODE = 1;// PM |
68 |
static public final int PACKAGE_MODE = 1;// PM |
| 56 |
// class mode |
69 |
// class mode |
|
Lines 86-91
Link Here
|
| 86 |
private ColumnLabelAdapter _packageModeCols[] = new ColumnLabelAdapter[PM_COL_NUM]; |
99 |
private ColumnLabelAdapter _packageModeCols[] = new ColumnLabelAdapter[PM_COL_NUM]; |
| 87 |
private ColumnLabelAdapter _classModeCols[] = new ColumnLabelAdapter[CM_COL_NUM]; |
100 |
private ColumnLabelAdapter _classModeCols[] = new ColumnLabelAdapter[CM_COL_NUM]; |
| 88 |
private Map _ageMap = new Hashtable(); |
101 |
private Map _ageMap = new Hashtable(); |
|
|
102 |
private Link setFilter; |
| 89 |
|
103 |
|
| 90 |
public BaseMemoryStatisticView(Composite parent, TraceViewerPage page) { |
104 |
public BaseMemoryStatisticView(Composite parent, TraceViewerPage page) { |
| 91 |
super(parent, page); |
105 |
super(parent, page); |
|
Lines 325-336
Link Here
|
| 325 |
|
339 |
|
| 326 |
public void update() { |
340 |
public void update() { |
| 327 |
super.update(); |
341 |
super.update(); |
| 328 |
if (_page instanceof MemoryAnalysisPage) |
342 |
if (_page instanceof MemoryAnalysisPage) { |
| 329 |
((MemoryAnalysisPage) _page).updateFilterAppliedDescription(); |
343 |
((MemoryAnalysisPage) _page).updateFilterAppliedDescription(); |
|
|
344 |
setFilter.setText(NLS.bind(CommonUITraceMessages.CHOOSE_FILTER_MSG, getCurrentFilterName())); |
| 345 |
} |
| 330 |
} |
346 |
} |
| 331 |
|
347 |
|
| 332 |
protected void defaultActionForSelection(ISelection selection) { |
348 |
protected void defaultActionForSelection(ISelection selection) { |
| 333 |
// none |
|
|
| 334 |
} |
349 |
} |
| 335 |
|
350 |
|
| 336 |
public void widgetDefaultSelected(SelectionEvent event) { |
351 |
public void widgetDefaultSelected(SelectionEvent event) { |
|
Lines 343-346
Link Here
|
| 343 |
return ((MemoryAnalysisPage) _page).getCurrentFilter(); |
358 |
return ((MemoryAnalysisPage) _page).getCurrentFilter(); |
| 344 |
return null; |
359 |
return null; |
| 345 |
} |
360 |
} |
|
|
361 |
|
| 362 |
protected void createLabel(Composite viewContainer) { |
| 363 |
Label _label = _toolkit.createLabel(viewContainer, null); |
| 364 |
|
| 365 |
_label.setBackground(viewContainer.getBackground()); |
| 366 |
_label.setForeground(_toolkit.getColors().getColor(IFormColors.TITLE)); |
| 367 |
|
| 368 |
Font font = _label.getFont(); |
| 369 |
FontData fd = font.getFontData()[0]; |
| 370 |
font = new Font(null, new FontData(fd.getName(), fd.getHeight()*3/2, fd.getStyle() | SWT.BOLD)); |
| 371 |
_label.setFont(font); |
| 372 |
|
| 373 |
_label.setLayoutData(GridUtil.createHorizontalFill()); |
| 374 |
|
| 375 |
_label.setText(UIMessages.MEM_STATISTICS_TITLE); |
| 376 |
|
| 377 |
setFilter = new Link(viewContainer, SWT.WRAP | _toolkit.getOrientation()); |
| 378 |
setFilter.setBackground(_toolkit.getColors().getBackground()); |
| 379 |
setFilter.setForeground(_toolkit.getColors().getColor(IFormColors.TITLE)); |
| 380 |
font = setFilter.getFont(); |
| 381 |
fd = font.getFontData()[0]; |
| 382 |
font = new Font(null, new FontData(fd.getName(), fd.getHeight(), fd.getStyle() | SWT.BOLD)); |
| 383 |
setFilter.setFont(font); |
| 384 |
setFilter.addSelectionListener(new SelectionListener() { |
| 385 |
public void widgetDefaultSelected(SelectionEvent e) {} |
| 386 |
|
| 387 |
public void widgetSelected(SelectionEvent e) { |
| 388 |
if (_page != null && _page instanceof MemoryAnalysisPage) { |
| 389 |
TraceViewer viewer = ((MemoryAnalysisPage) _page).getTraceViewer(); |
| 390 |
if (viewer != null && viewer instanceof FilterTraceViewer) { |
| 391 |
FilterInformationManager fim = ((FilterTraceViewer) viewer).getFilterInformationManager(); |
| 392 |
FiltersEditorAction feAction = new FiltersEditorAction(fim, true); |
| 393 |
feAction.run(); |
| 394 |
} |
| 395 |
} |
| 396 |
} |
| 397 |
}); |
| 398 |
|
| 399 |
setFilter.setLayoutData(GridUtil.createHorizontalFill()); |
| 400 |
setFilter.setText(NLS.bind(CommonUITraceMessages.CHOOSE_FILTER_MSG, getCurrentFilterName())); |
| 401 |
} |
| 402 |
|
| 403 |
public String getCurrentFilterName() { |
| 404 |
String filterAppliedName; |
| 405 |
|
| 406 |
SimpleSearchQuery cf = getCurrentFilter(); |
| 407 |
if (cf != null) |
| 408 |
filterAppliedName = cf.getName(); |
| 409 |
else |
| 410 |
filterAppliedName = CommonUITraceMessages.ST_FLTAPN; |
| 411 |
|
| 412 |
return filterAppliedName; |
| 413 |
} |
| 346 |
} |
414 |
} |