Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 61066 Details for
Bug 167995
Enhance Heap Statistics View
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Mar 16 patch - accumulated fixes in the heap view
org.eclipse.tptp.trace.jvmti.client_200703160000-patch (text/plain), 66.80 KB, created by
Ruslan Scherbakov
on 2007-03-16 04:44:49 EDT
(
hide
)
Description:
Mar 16 patch - accumulated fixes in the heap view
Filename:
MIME Type:
Creator:
Ruslan Scherbakov
Created:
2007-03-16 04:44:49 EDT
Size:
66.80 KB
patch
obsolete
>Index: plugin.properties >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/plugin.properties,v >retrieving revision 1.8 >diff -u -r1.8 plugin.properties >--- plugin.properties 27 Feb 2007 18:37:35 -0000 1.8 >+++ plugin.properties 16 Mar 2007 08:41:48 -0000 >@@ -17,7 +17,7 @@ > > JVMTI_ANALYSIS_TYPE_DESCRIPTION_EXEC = Execution Time Analysis (Java 5.0 +) > JVMTI_ANALYSIS_TYPE_DESCRIPTION_THRD = Thread Statistics >-JVMTI_ANALYSIS_TYPE_DESCRIPTION_HEAP = Memory Statistics >+JVMTI_ANALYSIS_TYPE_DESCRIPTION_HEAP = Memory Analysis > JVMTI_ANALYSIS_TYPE_VIEW_FLOW = Execution Flow > JVMTI_ANALYSIS_TYPE_VIEW_STATISTICS = Execution Statistics > JVMTI_ANALYSIS_TYPE_VIEW_UML_THREAD = UML2 Thread Interactions >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/plugin.xml,v >retrieving revision 1.10 >diff -u -r1.10 plugin.xml >--- plugin.xml 12 Mar 2007 14:51:25 -0000 1.10 >+++ plugin.xml 16 Mar 2007 08:41:48 -0000 >@@ -12,14 +12,14 @@ > </typeDescription> > <typeDescription > extension="trace" >- icon="icons/full/obj16/exectimeantype_obj.gif" >- name="%JVMTI_ANALYSIS_TYPE_DESCRIPTION_HEAP" >- type="org.eclipse.tptp.analysisType.jvmti.heap"/> >+ icon="icons/full/obj16/thread.gif" >+ name="%JVMTI_ANALYSIS_TYPE_DESCRIPTION_THRD" >+ type="org.eclipse.tptp.analysisType.jvmti.thread"/> > <typeDescription > extension="trace" >- icon="icons/full/obj16/exectimeantype_obj.gif" >- name="%JVMTI_ANALYSIS_TYPE_DESCRIPTION_THRD" >- type="org.eclipse.tptp.analysisType.jvmti.thread"/> >+ icon="icons/full/obj16/memleakantype_obj.gif" >+ name="%JVMTI_ANALYSIS_TYPE_DESCRIPTION_HEAP" >+ type="org.eclipse.tptp.analysisType.jvmti.heap"/> > </extension> > > <!-- Contribute a view to the TI analysis types --> >@@ -77,13 +77,6 @@ > extension="trace"> > </analyzerExtension> > <analyzerExtension >- class="org.eclipse.hyades.trace.views.actions.internal.OpenMemoryStatisticViewAction" >- extension="trace" >- icon="icons/full/obj16/memleakantype_obj.gif" >- id="org.eclipse.tptp.platform.jvmti.client.ClassInteractions" >- name="%JVMTI_ANALYSIS_TYPE_VIEW_HEAP" >- type="org.eclipse.tptp.analysisType.jvmti.heap"/> >- <analyzerExtension > class="org.eclipse.tptp.trace.jvmti.internal.client.views.OpenThreadStatisticViewAction" > extension="trace" > icon="icons/full/obj16/thread.gif" >@@ -99,11 +92,12 @@ > type="org.eclipse.tptp.analysisType.jvmti.thread"> > </analyzerExtension> > <analyzerExtension >- class="org.eclipse.tptp.trace.jvmti.internal.client.views.MemoryAnalysisViewer" >- extension="org.eclipse.tptp.trace.jvmti.client.analyzerExtension2" >+ class="org.eclipse.tptp.trace.jvmti.internal.client.views.OpenMemoryAnalysisViewAction" >+ extension="trace" > icon="icons/full/obj16/memleakantype_obj.gif" >- id="org.eclipse.tptp.trace.jvmti.internal.client.views.MemoryAnalysisViewer" >- name="%JVMTI_ANALYSIS_TYPE_VIEW_HEAP_ANALYSIS"> >+ id="org.eclipse.tptp.trace.jvmti.internal.client.views.OpenMemoryAnalysisViewAction" >+ name="%JVMTI_ANALYSIS_TYPE_VIEW_HEAP_ANALYSIS" >+ type="org.eclipse.tptp.analysisType.jvmti.heap"> > </analyzerExtension> > </extension> > >@@ -176,22 +170,6 @@ > visible="false" > id="org.eclipse.tptp.trace.jvmti.threadActionSet"> > <action >- label="%JVMTI_ANALYSIS_TYPE_VIEW_THRD" >- icon="icons/full/obj16/thread.gif" >- tooltip="%JVMTI_ANALYSIS_TYPE_TOOLTIP_THRD" >- class="org.eclipse.tptp.trace.jvmti.internal.client.views.OpenThreadStatisticViewAction" >- toolbarPath="trace/group.statistic" >- id="org.eclipse.tptp.trace.jvmti.internal.client.views.OpenThreadStatisticViewAction"> >- </action> >- <action >- class="org.eclipse.tptp.trace.jvmti.internal.client.views.OpenThreadStatesViewAction" >- icon="icons/full/cview16/thread_states_view.gif" >- id="org.eclipse.tptp.trace.jvmti.internal.client.views.OpenThreadStatesViewAction" >- label="%JVMTI_ANALYSIS_TYPE_VIEW_THRD_STATES" >- style="push" >- toolbarPath="trace/group.statistic" >- tooltip="%JVMTI_ANALYSIS_TYPE_TOOLTIP_THRD_STATES"/> >- <action > class="org.eclipse.tptp.trace.jvmti.internal.client.views.OpenCallStackViewAction" > icon="icons/full/cview16/call_stack_view.gif" > id="org.eclipse.tptp.trace.jvmti.internal.client.views.OpenCallStackViewAction" >@@ -209,6 +187,22 @@ > toolbarPath="trace/group.statistic" > tooltip="%JVMTI_ANALYSIS_TYPE_TOOLTIP_HEAP_ANALYSIS"> > </action> >+ <action >+ class="org.eclipse.tptp.trace.jvmti.internal.client.views.OpenThreadStatesViewAction" >+ icon="icons/full/cview16/thread_states_view.gif" >+ id="org.eclipse.tptp.trace.jvmti.internal.client.views.OpenThreadStatesViewAction" >+ label="%JVMTI_ANALYSIS_TYPE_VIEW_THRD_STATES" >+ style="push" >+ toolbarPath="trace/group.statistic" >+ tooltip="%JVMTI_ANALYSIS_TYPE_TOOLTIP_THRD_STATES"/> >+ <action >+ label="%JVMTI_ANALYSIS_TYPE_VIEW_THRD" >+ icon="icons/full/obj16/thread.gif" >+ tooltip="%JVMTI_ANALYSIS_TYPE_TOOLTIP_THRD" >+ class="org.eclipse.tptp.trace.jvmti.internal.client.views.OpenThreadStatisticViewAction" >+ toolbarPath="trace/group.statistic" >+ id="org.eclipse.tptp.trace.jvmti.internal.client.views.OpenThreadStatisticViewAction"> >+ </action> > </actionSet> > </extension> > <extension >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/AllocationSite.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/AllocationSite.java,v >retrieving revision 1.1 >diff -u -r1.1 AllocationSite.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/AllocationSite.java 12 Mar 2007 14:51:25 -0000 1.1 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/AllocationSite.java 16 Mar 2007 08:41:48 -0000 >@@ -33,4 +33,47 @@ > _method = method; > _lineNo = lineNo; > } >+ >+ public String getPackageName() { >+ String name = null; >+ if (_method != null && _method.getDefiningClass() != null >+ && _method.getDefiningClass().getPackage() != null) { >+ name = _method.getDefiningClass().getPackage().getName(); >+ } >+ return name; >+ } >+ >+ public String getClassName() { >+ String name = null; >+ if (_method != null && _method.getDefiningClass() != null) { >+ name = _method.getDefiningClass().getName(); >+ } >+ return name; >+ } >+ >+ public String getMethodName() { >+ String name = null; >+ if (_method != null) { >+ name = _method.getName(); >+ } >+ return name; >+ } >+ >+ public void clear() { >+ _lineNo = 0; >+ _total = 0; >+ _sumAges = 0; >+ _collected = 0; >+ _totalSize = 0; >+ _collectedSize = 0; >+ _method = null; >+ } >+ >+ public void sumOf(final AllocationSite a) { >+ _total += a._total; >+ _sumAges += a._sumAges; >+ _collected += a._collected; >+ _totalSize += a._totalSize; >+ _collectedSize += a._collectedSize; >+ } > } >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisPage.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisPage.java,v >retrieving revision 1.3 >diff -u -r1.3 MemoryAnalysisPage.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisPage.java 12 Mar 2007 14:51:25 -0000 1.3 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisPage.java 16 Mar 2007 08:41:48 -0000 >@@ -20,7 +20,7 @@ > import org.eclipse.hyades.trace.ui.TraceViewer; > import org.eclipse.hyades.trace.ui.TraceViewerPage; > import org.eclipse.hyades.trace.ui.UIPlugin; >-import org.eclipse.hyades.trace.views.internal.StatisticView; >+import org.eclipse.hyades.trace.ui.internal.util.PerftraceUtil; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.CTabFolder; > import org.eclipse.swt.custom.CTabItem; >@@ -36,14 +36,14 @@ > static public final int TAB_ALLOC_DETAILS = 1; > > CTabFolder _tabFolder; >- StatisticView _views[]; >+ BaseStatisticView _views[]; > > public MemoryAnalysisPage(EObject mofObject, TraceViewer viewer) { > super(mofObject, viewer); > } > > public void refreshPage() { >- StatisticView view = _views[_tabFolder.getSelectionIndex()]; >+ BaseStatisticView view = _views[_tabFolder.getSelectionIndex()]; > view.refresh(); > updateButtons(); > } >@@ -53,7 +53,7 @@ > > public void update(boolean newPage) { > if (newPage) { >- StatisticView view = _views[_tabFolder.getSelectionIndex()]; >+ BaseStatisticView view = _views[_tabFolder.getSelectionIndex()]; > view.updateUI(view.getColumnDataList()); > updateButtons(); > } >@@ -74,13 +74,13 @@ > } > public void widgetSelected(SelectionEvent e) { > updateAllocDetails(); >- StatisticView view = _views[_tabFolder.getSelectionIndex()]; >+ BaseStatisticView view = _views[_tabFolder.getSelectionIndex()]; > view.updateUI(view.getColumnDataList()); > updateButtons(); > } > }); > >- _views = new StatisticView[2]; >+ _views = new BaseStatisticView[2]; > CTabItem tabItem; > > tabItem = new CTabItem(_tabFolder, SWT.NONE); >@@ -117,7 +117,7 @@ > > public int getViewTabViewMode() { > int viewMode = -1; >- StatisticView view = _views[_tabFolder.getSelectionIndex()]; >+ BaseStatisticView view = _views[_tabFolder.getSelectionIndex()]; > if (view instanceof BaseMemoryStatisticView) { > BaseMemoryStatisticView view0 = (BaseMemoryStatisticView) view; > viewMode = view0.getViewMode(); >@@ -129,7 +129,7 @@ > if (TAB_MEMORY_STATS != tab && TAB_ALLOC_DETAILS != tab) > return; > _tabFolder.setSelection(tab); >- StatisticView view = _views[_tabFolder.getSelectionIndex()]; >+ BaseStatisticView view = _views[_tabFolder.getSelectionIndex()]; > if (view instanceof BaseMemoryStatisticView) { > BaseMemoryStatisticView view0 = (BaseMemoryStatisticView) view; > view0.setViewMode(viewMode); >@@ -147,18 +147,18 @@ > ((MemoryAnalysisViewer) _viewer).updateFilterAppliedDescription(); > } > >- public StatisticView getCurrentView() { >- StatisticView view = _views[_tabFolder.getSelectionIndex()]; >+ public BaseStatisticView getCurrentView() { >+ BaseStatisticView view = _views[_tabFolder.getSelectionIndex()]; > return view; > } > > public boolean isShowDelta() { >- StatisticView view = _views[_tabFolder.getSelectionIndex()]; >+ BaseStatisticView view = _views[_tabFolder.getSelectionIndex()]; > return view.showingDeltaColumns(); > } > > public boolean isShowPercent() { >- StatisticView view = _views[_tabFolder.getSelectionIndex()]; >+ BaseStatisticView view = _views[_tabFolder.getSelectionIndex()]; > return view.isShowPercent(); > } > >@@ -168,7 +168,7 @@ > } > > void updateAllocDetails() { >- StatisticView view = _views[_tabFolder.getSelectionIndex()]; >+ BaseStatisticView view = _views[_tabFolder.getSelectionIndex()]; > if (view instanceof AllocationDetailsView) { > ITraceSelection model = UIPlugin.getDefault().getSelectionModel(getMOFObject()); > if (model.size() > 0) { >@@ -178,4 +178,8 @@ > ((AllocationDetailsView) view).showAllocDetails(null); > } > } >+ >+ public boolean isEmpty() { >+ return PerftraceUtil.getTotalSize(getMOFObject()) <= 0; >+ } > } >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/views/UIMessages.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/views/UIMessages.java,v >retrieving revision 1.6 >diff -u -r1.6 UIMessages.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/views/UIMessages.java 1 Mar 2007 17:53:15 -0000 1.6 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/views/UIMessages.java 16 Mar 2007 08:41:48 -0000 >@@ -36,6 +36,7 @@ > public static String _Stopped; > public static String _Unknown; > >+ // state strings lower case > public static String _not_started; > public static String _running; > public static String _sleeping; >@@ -65,7 +66,6 @@ > public static String _THREAD_GROUP_NAME; > public static String _THREAD_START_TIME; > public static String _THREAD_STOP_TIME; >- public static String _DURATION; > public static String _THREAD_STATE; > public static String _THREAD_RUNNING_TIME; > public static String _THREAD_SLEEPING_TIME; >@@ -74,11 +74,16 @@ > public static String _THREAD_DEADLOCKED_TIME; > public static String _THREAD_BLOCK_COUNT; > public static String _THREAD_DEADLOCK_COUNT; >- > public static String _THREAD_MONITOR; >+ >+ // misc >+ public static String _Delta; >+ public static String _ShowAsPercentage; >+ public static String _ShowDeltaColumns; > public static String _MONITOR_OWNER; > public static String _TIMEOUT; > public static String _OBJECT_WAITING_FOR; >+ public static String _DURATION; > > private UIMessages() { > // Do not instantiate >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisViewer.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisViewer.java,v >retrieving revision 1.2 >diff -u -r1.2 MemoryAnalysisViewer.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisViewer.java 12 Mar 2007 14:51:25 -0000 1.2 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/views/MemoryAnalysisViewer.java 16 Mar 2007 08:41:48 -0000 >@@ -127,10 +127,11 @@ > if (getCurrentPage() instanceof MemoryAnalysisPage) > page = (MemoryAnalysisPage) getCurrentPage(); > boolean memStatsTab = null != page && page.getViewTab() == MemoryAnalysisPage.TAB_MEMORY_STATS; >+ boolean memAllocTab = null != page && page.getViewTab() == MemoryAnalysisPage.TAB_ALLOC_DETAILS; > boolean classMode = memStatsTab && page.getViewTabViewMode() == BaseMemoryStatisticView.CLASS_MODE; > boolean packageMode = memStatsTab && page.getViewTabViewMode() == BaseMemoryStatisticView.PACKAGE_MODE; > boolean isDelta = memStatsTab && page.isShowDelta(); >- boolean isPercent = memStatsTab && page.isShowPercent(); >+ boolean isPercent = null != page && page.isShowPercent(); > _viewClass.setEnabled(memStatsTab); > _viewClass.setChecked(classMode); > _viewPackage.setEnabled(memStatsTab); >@@ -138,9 +139,10 @@ > boolean canSrc = null != page && Utils.canOpenSourceOnThisObject(page.getMOFObject()); > _openSource.setEnabled(canSrc); > _deltaColumns.setEnabled(memStatsTab); >- _percentMode.setEnabled(memStatsTab); >+ _percentMode.setEnabled(memAllocTab || memStatsTab); > _deltaColumns.setChecked(isDelta); > _percentMode.setChecked(isPercent); >+ setFilterActionEnabled(memStatsTab); > } > > void createActions() { >@@ -216,4 +218,9 @@ > manager.add(_percentMode); > manager.add(_deltaColumns); > } >+ >+ public void setFocus() { >+ if (getCurrentPage() != null) >+ getCurrentPage().setFocus(); >+ } > } >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/views/BaseMemoryStatisticView.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/views/BaseMemoryStatisticView.java,v >retrieving revision 1.3 >diff -u -r1.3 BaseMemoryStatisticView.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/views/BaseMemoryStatisticView.java 12 Mar 2007 14:51:25 -0000 1.3 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/views/BaseMemoryStatisticView.java 16 Mar 2007 08:41:48 -0000 >@@ -33,14 +33,11 @@ > import org.eclipse.hyades.trace.views.internal.view.columnlabels.ColumnDisplayInfo; > import org.eclipse.hyades.trace.views.internal.view.columnlabels.ColumnLabelAdapter; > import org.eclipse.hyades.trace.views.util.internal.ColumnData; >-import org.eclipse.hyades.trace.views.util.internal.StatisticTableColumnInfo; >-import org.eclipse.jface.viewers.StructuredViewer; >-import org.eclipse.jface.viewers.TreeViewer; >+import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.Viewer; > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.widgets.Composite; >-import org.eclipse.swt.widgets.Tree; > import org.eclipse.tptp.trace.jvmti.internal.client.context.TIContextAttributes; > import org.eclipse.tptp.trace.jvmti.internal.client.context.TIContextUpdaterHelper; > import org.eclipse.tptp.trace.jvmti.internal.client.views.columnlabels.LiveSizeLabelAdapter; >@@ -177,7 +174,6 @@ > _collectedInst = PerftraceUtil.getTotalCollectedInstances(_page.getMOFObject()); > if (_collectedInst < 1) > _collectedInst = 1; >- //TODO _totalAge = get total age > if (_totalAge < 1) > _totalAge = 1; > } >@@ -202,7 +198,7 @@ > } > > public String getColumnText(Object element, int columnIndex) { >- StatisticTableColumnInfo info = StatisticTableColumnInfo.getStatisticTableColumnInfo(getTree().getColumn(columnIndex)); >+ StatisticViewColumnInfo info = StatisticViewColumnInfo.getStatisticTableColumnInfo(getTree().getColumn(columnIndex)); > int pos = info.getColumnData().getInitalPos(); > String label = "placeholder(view)"; > ColumnLabelAdapter columnAdapter = getColumnsLabelProvider(pos); >@@ -212,7 +208,7 @@ > } > > public Image getColumnImage(Object element, int columnIndex) { >- StatisticTableColumnInfo info = StatisticTableColumnInfo.getStatisticTableColumnInfo(getTree().getColumn(columnIndex)); >+ StatisticViewColumnInfo info = StatisticViewColumnInfo.getStatisticTableColumnInfo(getTree().getColumn(columnIndex)); > int pos = info.getColumnData().getInitalPos(); > Image image = null; > ColumnLabelAdapter columnAdapter = getColumnsLabelProvider(pos); >@@ -293,13 +289,19 @@ > > void updateAgeInfo(Object arr[]) { > _ageMap.clear(); >+ _totalAge = 1; >+ EList listGC = null; > for (int i = 0; i < arr.length; i++) { > if (arr[i] instanceof TRCClass) { > TRCClass cls = (TRCClass) arr[i]; >+ if (cls.getTotalInstances() == 0) >+ continue; > AgeInfo ageInfo = new AgeInfo(); >- EList listGC = cls.getPackage().getProcess().getGcEvents(); >+ if (listGC == null) >+ listGC = cls.getPackage().getProcess().getGcEvents(); > if (null == listGC || listGC.size() == 0) > return; >+ _totalAge = listGC.size(); > EList list = cls.getObjects(); > int len = list.size(); > for (int j = 0; j < len; j++) { >@@ -320,13 +322,24 @@ > public int objCount; > } > >- protected StructuredViewer createTreeViewer(Composite tree) { >- TreeViewer tv = getTreeViewer((Tree) tree); >- return tv; >+ public void update() { >+ super.update(); >+ if (_page instanceof MemoryAnalysisPage) >+ ((MemoryAnalysisPage) _page).updateFilterAppliedDescription(); >+ } >+ >+ protected void defaultActionForSelection(ISelection selection) { >+ // none > } > > public void widgetDefaultSelected(SelectionEvent event) { > if (_page instanceof MemoryAnalysisPage) > ((MemoryAnalysisPage)_page).showAllocDetails(); > } >+ >+ protected SimpleSearchQuery getCurrentFilter() { >+ if (_page instanceof MemoryAnalysisPage) >+ return ((MemoryAnalysisPage) _page).getCurrentFilter(); >+ return null; >+ } > } >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/views/BaseStatisticView.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/views/BaseStatisticView.java,v >retrieving revision 1.2 >diff -u -r1.2 BaseStatisticView.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/views/BaseStatisticView.java 1 Mar 2007 17:53:15 -0000 1.2 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/views/BaseStatisticView.java 16 Mar 2007 08:41:48 -0000 >@@ -1,5 +1,5 @@ > /***************************************************************************** >- * Copyright (c) 2007, Intel Corporation. >+ * Copyright (c) 2007, IBM Corporation, Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -16,71 +16,304 @@ > > import java.util.ArrayList; > >-import org.eclipse.emf.ecore.EObject; >-import org.eclipse.hyades.models.hierarchy.extensions.SimpleSearchQuery; >-import org.eclipse.hyades.trace.ui.ITraceSelection; >+import org.eclipse.hyades.trace.internal.ui.PDPluginImages; >+import org.eclipse.hyades.trace.ui.IViewSelectionChangedListener; >+import org.eclipse.hyades.trace.ui.ProfileEvent; >+import org.eclipse.hyades.trace.ui.TraceViewer; > import org.eclipse.hyades.trace.ui.TraceViewerPage; > import org.eclipse.hyades.trace.ui.UIPlugin; > import org.eclipse.hyades.trace.ui.ViewSelectionChangedEvent; >+import org.eclipse.hyades.trace.views.actions.internal.OpenSourceAction; > import org.eclipse.hyades.trace.views.adapter.internal.IContextViewer; >-import org.eclipse.hyades.trace.views.internal.ContextInfoContainer; >-import org.eclipse.hyades.trace.views.internal.IContextInfoContainerListener; >-import org.eclipse.hyades.trace.views.internal.StatisticView; >+import org.eclipse.hyades.trace.views.adapter.internal.TraceConstants; >+import org.eclipse.hyades.trace.views.internal.TraceUIPlugin; >+import org.eclipse.hyades.trace.views.internal.view.columnlabels.ColumnDisplayInfo; >+import org.eclipse.hyades.trace.views.internal.view.columnlabels.ColumnLabelAdapter; >+import org.eclipse.hyades.trace.views.internal.view.columnlabels.ColumnLabelComparator; > import org.eclipse.hyades.trace.views.internal.view.columnlabels.ContextUpdaterHelper; > import org.eclipse.hyades.trace.views.util.internal.ColumnData; >-import org.eclipse.hyades.ui.provisional.context.ContextManager; >-import org.eclipse.hyades.ui.provisional.context.IContextLanguage; >+import org.eclipse.hyades.ui.util.GridUtil; >+import org.eclipse.hyades.ui.util.HyadesFormToolkit; >+import org.eclipse.jface.action.Action; >+import org.eclipse.jface.action.IMenuManager; >+import org.eclipse.jface.viewers.DoubleClickEvent; > import org.eclipse.jface.viewers.IContentProvider; >+import org.eclipse.jface.viewers.IDoubleClickListener; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.IStructuredSelection; > import org.eclipse.jface.viewers.ITableLabelProvider; > import org.eclipse.jface.viewers.ITreeContentProvider; > import org.eclipse.jface.viewers.LabelProvider; >+import org.eclipse.jface.viewers.StructuredViewer; > import org.eclipse.jface.viewers.TreeViewer; > import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.jface.viewers.ViewerSorter; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.custom.ViewForm; >+import org.eclipse.swt.events.ControlEvent; >+import org.eclipse.swt.events.ControlListener; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; > import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.graphics.Rectangle; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.swt.widgets.TableColumn; > import org.eclipse.swt.widgets.Tree; >+import org.eclipse.swt.widgets.TreeColumn; > import org.eclipse.swt.widgets.TreeItem; >+import org.eclipse.tptp.trace.jvmti.internal.client.widgets.Utils; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.forms.widgets.ColumnLayout; >+ >+/** >+ * This class was ported from StatisticView from hyades project for JVMTI trace client. >+ * >+ * @see org.eclipse.hyades.trace.views.internal.StatisticView >+ * >+ */ >+public abstract class BaseStatisticView implements IViewSelectionChangedListener, SelectionListener, ControlListener { > >-public abstract class BaseStatisticView extends StatisticView { >- >- static public String PREFERENCE_KEY_PREFIX = "org.eclipse.tptp.trace.jvmti.internal.client.views.basememstats."; >+ static public String PREFERENCE_KEY_PREFIX = "org.eclipse.tptp.trace.jvmti.internal.client.views.stats."; > static public Object _empty[] = new Object[0]; > >- protected ContextInfoContainer _contextInfo; >- >- BaseStatisticView(Composite parent, TraceViewerPage page) { >- super(parent, page); >- } >- >- protected Composite createTree(Composite parent, int options) { >- final Tree tree = _toolkit.createTree(parent, options); >- return tree; >- } >- >- protected Composite createControl(Composite parent, ArrayList cols) { >- final Composite vc = super.createControl(parent, cols); >- _contextInfo = new ContextInfoContainer(); >- _contextInfo.setViewer((IContextViewer) _page.getTraceViewer()); >- _contextInfo.createControl(vc); >- _contextInfo.addContextInfoContainerListener(new IContextInfoContainerListener() { >- public void visibilityChanged(boolean isVisible) { >- vc.layout(true, true); >- } >- }); >- return vc; >- } >+ protected StructuredViewer _viewer; >+ protected Composite _viewContainer; >+ protected Composite _filterContainer; >+ protected ViewForm _dataPane; >+ protected Composite _viewComp; >+ protected TraceViewerPage _page; >+ protected StatisticSorter _viewerSorter; >+ protected ArrayList _currentColumns = null; >+ protected Action _updateAction; >+ protected Action _showPercent; >+ protected Action _deltaColumnsAction; >+ protected boolean _newSelection = false; >+ protected boolean _isShowPercent = false; >+ protected boolean _deltaColumns = false; >+ protected boolean _refresh = false; >+ protected boolean _firstTime = true; >+ protected double _maxTime; >+ protected int _totalInst; >+ protected int _totalCalls; >+ protected int _activeInst; >+ protected long _totalSize; >+ protected long _activeSize; >+ protected int _collectedInst; >+ protected HyadesFormToolkit _toolkit; > > protected abstract String getColumnsPreferencesKey(); >- protected abstract String getViewTypeStr(); > protected abstract String getDefaultColumnsTemplate(); >+ protected abstract String getViewTypeStr(); >+ protected abstract StatisticSorter getViewerSorterInstance(); > protected abstract String getColumnText(Object element, int columnIndex); > protected abstract Image getColumnImage(Object element, int columnIndex); > protected abstract Object[] getElements(Object inputElement); > protected abstract boolean hasChildren(Object element); > protected abstract Object[] getChildren(Object parentElement); >- protected abstract StatisticSorter getViewerSorterInstance(); >+ >+ public class BaseStatisticContentProvider implements ITreeContentProvider { >+ >+ public Object[] getChildren(Object parentElement) { >+ return BaseStatisticView.this.getChildren(parentElement); >+ } >+ >+ public Object getParent(Object element) { >+ return null; >+ } >+ >+ public boolean hasChildren(Object element) { >+ return BaseStatisticView.this.hasChildren(element); >+ } >+ >+ public Object[] getElements(Object inputElement) { >+ return BaseStatisticView.this.getElements(inputElement); >+ } >+ >+ public void dispose() { >+ } >+ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ } >+ } >+ >+ class StatisticTreeViewer extends TreeViewer { >+ >+ public StatisticTreeViewer(Tree tree) { >+ super(tree); >+ } >+ >+ public void expandItem(TreeItem item) { >+ item.setExpanded(true); >+ createChildren(item); >+ } >+ >+ public ISelection getSelection() { >+ ISelection sel = super.getSelection(); >+ if (sel != null && !sel.isEmpty()) { >+ } >+ return sel; >+ } >+ } >+ >+ public abstract class StatisticSorter extends ViewerSorter { >+ protected TreeColumn _sortColumn; >+ protected int _sortSequence = -1; >+ protected StatisticViewColumnInfo _info; >+ protected int _pos = 0; >+ >+ public StatisticSorter() { >+ super(); >+ } >+ >+ public void setSortedColumn(TreeColumn newSortColumn) { >+ // Get the currently designated sort column and turn remove its sorted indicator >+ TreeColumn currentColumn = getCurrentSortColumn(newSortColumn .getParent()); >+ if (currentColumn != null) { >+ if (currentColumn == newSortColumn) { >+ _sortSequence = -_sortSequence; >+ } else { >+ _sortSequence = -1; >+ } >+ } else { >+ _sortSequence = 1; >+ } >+ >+ setSortedColumn(_sortSequence, newSortColumn); >+ } >+ >+ public void setSortedColumn(int sortSequence, TreeColumn newSortColumn) { >+ _sortSequence = sortSequence; >+ _sortColumn = newSortColumn; >+ >+ // Get the currently designated sort column and turn remove its sorted indicator >+ TreeColumn currentColumn = getCurrentSortColumn(newSortColumn.getParent()); >+ if (currentColumn != null) { >+ String text = currentColumn.getText(); >+ if (text.startsWith(">") || text.startsWith("<")) >+ text = text.substring(1); >+ currentColumn.setText(text); >+ StatisticViewColumnInfo.getStatisticTableColumnInfo( >+ currentColumn).setSortColumn(false); >+ } >+ >+ // Add the sorted indicator to the newly sorted column >+ String text = newSortColumn.getText(); >+ _info = StatisticViewColumnInfo.getStatisticTableColumnInfo(newSortColumn); >+ _pos = _info.getColumnData().getInitalPos(); >+ newSortColumn.setText(((_sortSequence > 0) ? ">" : "<") + text); >+ StatisticViewColumnInfo.getStatisticTableColumnInfo(newSortColumn).setSortColumn(true); >+ } >+ >+ public int getSortSequence() { >+ return _sortSequence; >+ } >+ >+ public void setSortSequence(int sortSequence) { >+ _sortSequence = sortSequence; >+ } >+ >+ public TreeColumn getCurrentSortColumn(Tree tree) { >+ for (int idx = 0; idx < tree.getColumnCount(); idx++) { >+ if (StatisticViewColumnInfo.getStatisticTableColumnInfo( >+ tree.getColumn(idx)).isSortColumn()) { >+ return tree.getColumn(idx); >+ } >+ } >+ return null; >+ } >+ >+ public TreeColumn resetSortColumn(Tree tree) { >+ _sortColumn = getCurrentSortColumn(tree); >+ return _sortColumn; >+ } >+ } >+ >+ /** Update action */ >+ class UpdateAction extends Action { >+ public UpdateAction(String name) { >+ super(name); >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(UpdateAction.this, TraceUIPlugin.getPluginId() + ".uvew0000"); >+ PDPluginImages.setImageDescriptors(this, PDPluginImages.T_LCL, PDPluginImages.IMG_UPDATEVIEWS); >+ } >+ >+ public void run() { >+ ProfileEvent event = UIPlugin.getDefault().getRefreshViewEvent(_page.getMOFObject()); >+ UIPlugin.getDefault().notifyProfileEventListener(event); >+ } >+ } >+ >+ /** Show as percent action */ >+ class ShowPercentAction extends Action { >+ public ShowPercentAction(String name) { >+ super(name); >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(ShowPercentAction.this, TraceUIPlugin.getPluginId() + ".clst0003"); >+ } >+ >+ public void run() { >+ handlePercentChanged(); >+ } >+ } >+ >+ /** Show delta columns action */ >+ class DeltaColumnsAction extends Action { >+ public DeltaColumnsAction(String name) { >+ super(name); >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(DeltaColumnsAction.this, TraceUIPlugin.getPluginId() + ".ccol0000"); >+ } >+ >+ public void setChecked(boolean value) { >+ super.setChecked(value); >+ } >+ >+ public void run() { >+ handleDeltaChanged(); >+ } >+ } >+ >+ protected BaseStatisticView(Composite parent, TraceViewerPage page) { >+ this(parent, page, true); >+ } >+ >+ protected BaseStatisticView(Composite parent, TraceViewerPage page, boolean initializeContent) { >+ _page = page; >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, getContextHelpId()); >+ if (initializeContent) >+ createContent(parent); >+ } >+ >+ public void createContent(Composite parent) { >+ _toolkit = new HyadesFormToolkit(parent.getDisplay()); >+ _currentColumns = ColumnData.createColumnData(getColumnsPreferencesKey(), getDefaultColumnsTemplate()); >+ _isShowPercent = Utils.loadIntOption(getPreferenceString(TraceConstants.PERCENTAGE)) == 1; >+ _deltaColumns = Utils.loadIntOption(getPreferenceString(TraceConstants.DELTA)) == 1; >+ createControl(parent, _currentColumns); >+ } >+ >+ /* >+ * @see SelectionListener#widgetSelected(SelectionEvent) >+ */ >+ public void widgetSelected(SelectionEvent arg0) { >+ if (arg0.widget instanceof TreeColumn) { >+ _viewerSorter.setSortedColumn((TreeColumn) arg0.widget); >+ _viewer.setSorter(_viewerSorter); >+ _viewer.refresh(); >+ } else if (arg0.widget instanceof Table || arg0.widget instanceof Tree) { >+ updateModelSelection(); >+ } >+ updateButtons(); >+ } >+ >+ public Tree getTree() { >+ return (Tree) getTreeViewer().getControl(); >+ } >+ >+ protected TreeViewer getTreeViewer(Tree tree) { >+ return new StatisticTreeViewer(tree); >+ } > > protected IContentProvider getContentProvider() { > return new BaseStatisticContentProvider(); >@@ -98,77 +331,151 @@ > return new StatisticLabelProvider(); > } > >- protected void updateButtons() { >- if (_page instanceof MemoryAnalysisPage) { >- ((MemoryAnalysisPage)_page).updateButtons(); >- } >+ protected void defaultActionForSelection(ISelection selection) { >+ OpenSourceAction action = new OpenSourceAction(); >+ action.selectionChanged(action, selection); >+ action.run(); >+ } >+ >+ protected StructuredViewer createTreeViewer(Composite tree) { >+ TreeViewer tv = getTreeViewer((Tree) tree); >+ tv.addDoubleClickListener(new IDoubleClickListener() { >+ public void doubleClick(DoubleClickEvent event) { >+ ISelection selection = event.getSelection(); >+ if (selection != null && !selection.isEmpty()) { >+ TreeViewer tv = (TreeViewer) getTreeViewer(); >+ Object node = ((IStructuredSelection) selection).getFirstElement(); >+ if (tv.isExpandable(node)) { >+ tv.setExpandedState(node, !tv.getExpandedState(node)); >+ } else { >+ defaultActionForSelection(selection); >+ } >+ } >+ } >+ }); >+ return (StructuredViewer) tv; > } > >- public void update() { >- if (_page instanceof MemoryAnalysisPage && _contextInfo != null) >- _contextInfo.setMOFObject(_page.getMOFObject()); >- super.update(); >- if (_page instanceof MemoryAnalysisPage) >- ((MemoryAnalysisPage) _page).updateFilterAppliedDescription(); >+ protected Composite getViewComponent() { >+ return _viewComp; > } > >- protected void updateStatusContext(IContextLanguage language) { >- if (_contextInfo != null) >- _contextInfo.updateStatusContext(language); >+ protected TraceViewerPage getTraceViewerPage() { >+ return _page; > } > >- public Tree getTree() { >- return (Tree) getTreeViewer().getControl(); >+ protected ViewForm getDataPane() { >+ return _dataPane; > } > >- protected TreeViewer getTreeViewer(Tree tree) { >- return new StatisticTreeViewer(tree); >+ public void showNewSelection() { >+ if (_newSelection) { >+ getTree().showSelection(); >+ _newSelection = false; >+ } > } > >- protected void handleSelectionEvent() { >- ITraceSelection model = UIPlugin.getDefault().getSelectionModel(_page.getMOFObject()); >- if (model.size() > 0) { >- Object sel = model.getFirstElement(); >- if (sel != null) { >- select(sel); >- if (sel instanceof EObject) >- updateStatusContext(ContextManager.getContextLanguage(ContextUpdaterHelper.getContext((EObject)sel))); >- } >+ public boolean showingDeltaColumns() { >+ return _deltaColumns; >+ } >+ >+ protected void setNewSelection() { >+ _newSelection = true; >+ } >+ >+ public Action getUpdateAction() { >+ if (_updateAction == null) { >+ _updateAction = new UpdateAction(UIPlugin.getResourceString("REFRESH_VIEWS")); > } >+ return _updateAction; > } > >- protected void select(Object obj) { >+ public Action getDeltaColumnsAction() { >+ if (_deltaColumnsAction == null) { >+ _deltaColumnsAction = new DeltaColumnsAction(UIMessages._ShowDeltaColumns); >+ } >+ return _deltaColumnsAction; > } > >- public void updateModelSelection() { >- ISelection selection = getTreeViewer().getSelection(); >- if (selection != null && !selection.isEmpty()) { >- Object sel = ((IStructuredSelection) selection).getFirstElement(); >- notifyViewSelectionChanged(this, sel); >+ public Action getShowPercentAction() { >+ if (_showPercent == null) { >+ _showPercent = new ShowPercentAction(UIMessages._ShowAsPercentage); > } >+ return _showPercent; > } > >- public void handleViewSelectionChangedEvent(ViewSelectionChangedEvent event) { >- Object source = event.getSource(); >- if (source != this) { >- handleSelectionEvent(); >- } else { >- ITraceSelection model = UIPlugin.getDefault().getSelectionModel(_page.getMOFObject()); >- if (model.size() > 0) { >- Object sel = model.getFirstElement(); >- if (sel != null && sel instanceof EObject) >- updateStatusContext(ContextManager.getContextLanguage(ContextUpdaterHelper.getContext((EObject)sel))); >- } >- updateButtons(); >+ public boolean isShowPercent() { >+ return _isShowPercent; >+ } >+ >+ public Control getControl() { >+ return _viewContainer; >+ } >+ >+ public ArrayList getColumnDataList() { >+ return _currentColumns; >+ } >+ >+ public StructuredViewer getTreeViewer() { >+ return _viewer; >+ } >+ >+ public StatisticSorter getViewerSorter() { >+ return _viewerSorter; >+ } >+ >+ public void widgetDefaultSelected(SelectionEvent arg0) { >+ } >+ >+ public void controlMoved(ControlEvent arg0) { >+ } >+ >+ public void controlResized(ControlEvent arg0) { >+ // Get the client area for the shell >+ Rectangle dataBounds = getViewComponent().getClientArea(); >+ getDataPane().setBounds(dataBounds.x, dataBounds.y, dataBounds.width, dataBounds.height); >+ // If the table column was resized, update the ColumnData array with the >+ // new size and save the new column definitions to the preferences. >+ if (arg0.getSource() instanceof TableColumn) { >+ ColumnData.setColumns(getColumnDataList(), getColumnsPreferencesKey()); > } > } >- >+ >+ public void menuAboutToShow(IMenuManager arg0) { >+ } >+ >+ protected void setRedrawTable(boolean redraw) { >+ _viewer.getControl().setRedraw(redraw); >+ } >+ >+ public void refresh() { >+ if (!getTreeViewer().getControl().isDisposed()) >+ update(); >+ } >+ >+ public void selectionChanged() { >+ handleSelectionEvent(); >+ } >+ >+ public void updateUI(ArrayList cols) { >+ update(); >+ updateButtons(); >+ } >+ >+ protected void showPercentUpdate() { >+ } >+ > protected void firstTimeUpdate() { >- super.firstTimeUpdate(); >+ _firstTime = false; >+ Tree tree = getTree(); >+ TreeColumn firstColumn = tree.getColumn(0); >+ _viewerSorter = getViewerSorterInstance(); >+ _viewerSorter.setSortedColumn(firstColumn); >+ _viewer.setSorter(_viewerSorter); > redrawTable(); > } > >- public void redrawTable() { >+ protected void redrawTable() { > getTree().setRedraw(false); > _currentColumns = ColumnData.createColumnData(getColumnsPreferencesKey(), getDefaultColumnsTemplate()); > _currentColumns = TIColumnData.convertColumnData(_currentColumns); >@@ -177,60 +484,277 @@ > refresh(); > } > >- public class BaseStatisticContentProvider implements ITreeContentProvider { >+ protected void postUpdateEvents() { >+ handleSelectionEvent(); >+ } > >- public Object[] getChildren(Object parentElement) { >- return BaseStatisticView.this.getChildren(parentElement); >- } >+ protected void expandFirstElement() { >+ } > >- public Object getParent(Object element) { >- return null; >+ protected String getContext() { >+ IContextViewer viewer = getContextViewer(); >+ return viewer != null ? viewer.getSelectedContext() : null; >+ } >+ >+ protected boolean contextChanged() { >+ IContextViewer viewer = getContextViewer(); >+ if (viewer != null) { >+ if (viewer.contextChanged()) { >+ return true; >+ } else { >+ viewer.setSelectedContext(ContextUpdaterHelper.getCurrentContext(ContextUpdaterHelper.getContexts(_page.getMOFObject()), viewer), false); >+ return viewer.contextChanged(); >+ } >+ } else >+ return false; >+ } >+ >+ protected void updateContext() { >+ resetColumns(_currentColumns); >+ IContextViewer viewer = getContextViewer(); >+ if (viewer != null) >+ viewer.updateContext(); >+ } >+ >+ private IContextViewer getContextViewer() { >+ if (_page != null) { >+ TraceViewer traceViewer = _page.getTraceViewer(); >+ if (traceViewer != null && traceViewer instanceof IContextViewer) >+ return (IContextViewer) traceViewer; > } >+ return null; >+ } > >- public boolean hasChildren(Object element) { >- return BaseStatisticView.this.hasChildren(element); >+ public void update() { >+ if (_firstTime) >+ firstTimeUpdate(); >+ // context changes or context handler selection changes >+ if (contextChanged() || _page.getTraceViewer().contextHandlerSelectionChanged()) { >+ updateContext(); >+ } >+ IContextViewer viewer = getContextViewer(); >+ if (viewer != null) { >+ viewer.getContextSelectionMenuListener().setMOFObject(_page.getMOFObject()); >+ } >+ // set the input of the viewer >+ showPercentUpdate(); >+ setRedrawTable(false); >+ getTreeViewer().setInput(_page.getMOFObject()); >+ // _viewer.refresh(); >+ expandFirstElement(); >+ setRedrawTable(true); >+ postUpdateEvents(); >+ } >+ >+ /** >+ * This method is called as a result of changing the selected columns. It >+ * takes the new column definition list and adjusts the columns of the table >+ * to match this list. >+ */ >+ protected void resetColumns(ArrayList list) { >+ String sortedColumnKey = ""; // store sorted column >+ boolean isDeltaColumn = false; >+ int sortSequence = _viewerSorter.getSortSequence(); // store sorted sequence >+ >+ Tree tree = getTree(); >+ setRedrawTable(false); >+ >+ // Dispose all the existing columns >+ for (int idx = tree.getColumnCount(); idx > 0; idx--) { >+ TreeColumn col = tree.getColumn(tree.getColumnCount() - 1); >+ StatisticViewColumnInfo staticTblColInfo = (StatisticViewColumnInfo) (col.getData()); >+ if (staticTblColInfo.isSortColumn()) { >+ sortedColumnKey = staticTblColInfo.getColumnData().key(); >+ isDeltaColumn = staticTblColInfo.isDeltaColumn(); >+ } >+ col.dispose(); > } > >- public Object[] getElements(Object inputElement) { >- return BaseStatisticView.this.getElements(inputElement); >+ for (int idx = 0; idx < list.size(); idx++) { >+ ColumnData data = (ColumnData) list.get(idx); >+ data.setContext(getContext()); >+ if (data.visible()) { >+ new StatisticViewColumnInfo(this, data, _deltaColumns); >+ } > } > >- public void dispose() { >+ tree = getTree(); >+ for (int idx = 0; idx < tree.getColumnCount(); idx++) { >+ StatisticViewColumnInfo treeColumnInfo = getColumnInfo(tree.getColumn(idx)); >+ if (treeColumnInfo != null >+ && sortedColumnKey.equals(treeColumnInfo.getColumnData().key()) >+ && isDeltaColumn == treeColumnInfo.isDeltaColumn()) { >+ treeColumnInfo.setSortColumn(true); >+ break; >+ } > } > >- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ if (_viewerSorter.resetSortColumn(getTree()) == null) { >+ _viewer.setSorter(null); >+ } else { >+ _viewerSorter.setSortSequence(sortSequence * -1); >+ _viewerSorter.setSortedColumn(_viewerSorter.resetSortColumn(getTree())); >+ _viewer.setSorter(_viewerSorter); > } >+ >+ setRedrawTable(true); > } > >- class StatisticTreeViewer extends TreeViewer { >+ protected Composite createControl(Composite parent, ArrayList cols) { >+ GridLayout layout; >+ _viewContainer = _toolkit.createComposite(parent, SWT.FLAT); >+ layout = new GridLayout(); >+ layout.numColumns = 1; >+ _viewContainer.setLayout(layout); >+ _viewContainer.setLayoutData(GridUtil.createFill()); >+ createLabel(_viewContainer); >+ _viewComp = _toolkit.createComposite(_viewContainer, SWT.FLAT); >+ layout = new GridLayout(); >+ layout.numColumns = 1; >+ layout.marginWidth = 0; >+ layout.marginHeight = 0; >+ _viewComp.setLayout(layout); >+ _viewComp.setLayoutData(GridUtil.createFill()); >+ _dataPane = _toolkit.createViewForm(_viewComp); >+ Control table = createTableViewer(_dataPane, cols); >+ _dataPane.setContent(table); >+ _dataPane.setLayoutData(GridUtil.createFill()); >+ _viewContainer.addControlListener(this); >+ return _viewContainer; >+ } >+ >+ protected void createLabel(Composite viewContainer) { >+ } >+ >+ protected Tree createTree(Composite parent, int options) { >+ Tree tree = _toolkit.createTree(parent, options); >+ tree.setLinesVisible(true); >+ tree.setHeaderVisible(true); >+ ColumnLayout layout = new ColumnLayout(); >+ layout.maxNumColumns = 100; >+ tree.setLayout(layout); >+ tree.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ tree.addSelectionListener(this); >+ return tree; >+ } > >- public StatisticTreeViewer(Tree tree) { >- super(tree); >+ private Control createTableViewer(Composite parent, ArrayList cols) { >+ Tree tree = createTree(parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.FLAT); >+ _viewer = createTreeViewer(tree); >+ for (int idx = 0; idx < cols.size(); idx++) { >+ ColumnData data = (ColumnData) cols.get(idx); >+ data.setContext(getContext()); >+ if (data.visible()) { >+ new StatisticViewColumnInfo(this, data, _deltaColumns); >+ } > } >+ _viewer.setContentProvider(getContentProvider()); >+ _viewer.setLabelProvider(getTableLabelProvider()); >+ UIPlugin.getDefault().addViewSelectionChangedListener(this); >+ return _viewer.getControl(); >+ } > >- public void expandItem(TreeItem item) { >- item.setExpanded(true); >- createChildren(item); >- } >+ public void dispose() { >+ UIPlugin.getDefault().removeViewSelectionChangedListener(this); >+ _page = null; >+ } > >- public ISelection getSelection() { >- ISelection sel = super.getSelection(); >- if (sel != null && !sel.isEmpty()) { >- } >- return sel; >- } >+ public void handlePercentChanged() { >+ _isShowPercent = !_isShowPercent; >+ Utils.saveIntOption(getPreferenceString(TraceConstants.PERCENTAGE), (_isShowPercent ? 1 : 0)); >+ refresh(); >+ updateButtons(); > } > >- public class BaseStatisticFilter extends StatisticFilter { >+ public void handleDeltaChanged() { >+ _deltaColumns = !_deltaColumns; >+ Utils.saveIntOption(getPreferenceString(TraceConstants.DELTA), (_deltaColumns ? 1 : 0)); >+ resetColumns(_currentColumns); >+ refresh(); >+ } > >- public boolean select(Viewer viewer, Object parent, Object element) { >- return false; >+ protected String getPreferenceString(String str) { >+ return getViewTypeStr() + "." + str; >+ } >+ >+ public void updateModelSelection() { >+ ISelection selection = getTreeViewer().getSelection(); >+ if (selection != null && !selection.isEmpty()) { >+ Object sel = ((IStructuredSelection) selection).getFirstElement(); >+ notifyViewSelectionChanged(this, sel); > } > } > >- protected SimpleSearchQuery getCurrentFilter() { >- if (_page instanceof MemoryAnalysisPage) >- return ((MemoryAnalysisPage) _page).getCurrentFilter(); >+ public void notifyViewSelectionChanged(Object source, Object selection) { >+ UIPlugin.getDefault().getSelectionModel(_page.getMOFObject()).add(selection); >+ ViewSelectionChangedEvent event = UIPlugin.getDefault().getViewSelectionChangedEvent(); >+ event.setSource(source); >+ UIPlugin.getDefault().notifyViewSelectionChangedListener(event); >+ } >+ >+ public HyadesFormToolkit getToolkit() { >+ return _toolkit; >+ } >+ >+ protected StatisticViewColumnInfo getColumnInfo(TreeColumn treeColumn) { >+ if (treeColumn.getData() != null && treeColumn.getData() instanceof StatisticViewColumnInfo) >+ return (StatisticViewColumnInfo) treeColumn.getData(); > return null; > } >+ >+ protected int compareElements(Object obj1, Object obj2, ColumnLabelAdapter col, boolean isDeltaColumn) { >+ ColumnDisplayInfo info = getColumnDisplayInfo(col, isDeltaColumn); >+ return ColumnLabelComparator.compare(obj1, obj2, col, info); >+ } >+ >+ protected String getElementColumnText(Object obj, ColumnLabelAdapter col, boolean isDeltaColumn) { >+ ColumnDisplayInfo info = getColumnDisplayInfo(col, isDeltaColumn); >+ return col.getDisplayString(obj, info); >+ } >+ >+ protected Image getElementColumnImage(Object obj, ColumnLabelAdapter col, boolean isDeltaColumn) { >+ ColumnDisplayInfo info = getColumnDisplayInfo(col, isDeltaColumn); >+ return col.getDisplayImage(obj, info); >+ } >+ >+ protected ColumnDisplayInfo getColumnDisplayInfo(ColumnLabelAdapter col, boolean isDeltaColumn) { >+ return col.getColumnDisplayInfo(); >+ } >+ >+ protected String getContextHelpId() { >+ return null; >+ } >+ >+ protected void updateButtons() { >+ if (_page instanceof MemoryAnalysisPage) { >+ ((MemoryAnalysisPage)_page).updateButtons(); >+ } >+ } >+ >+ protected void handleSelectionEvent() { >+ /*ITraceSelection model = UIPlugin.getDefault().getSelectionModel(_page.getMOFObject()); >+ if (model.size() > 0) { >+ Object sel = model.getFirstElement(); >+ if (sel != null) { >+ //select(sel); >+ //if (sel instanceof EObject) >+ // updateStatusContext(ContextManager.getContextLanguage(ContextUpdaterHelper.getContext((EObject)sel))); >+ } >+ }*/ >+ } >+ >+ public void handleViewSelectionChangedEvent(ViewSelectionChangedEvent event) { >+ Object source = event.getSource(); >+ if (source != this) { >+ handleSelectionEvent(); >+ } else { >+ /*ITraceSelection model = UIPlugin.getDefault().getSelectionModel(_page.getMOFObject()); >+ if (model.size() > 0) { >+ //Object sel = model.getFirstElement(); >+ //if (sel != null && sel instanceof EObject) >+ // updateStatusContext(ContextManager.getContextLanguage(ContextUpdaterHelper.getContext((EObject)sel))); >+ }*/ >+ updateButtons(); >+ } >+ } > } >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/views/messages.properties >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/views/messages.properties,v >retrieving revision 1.6 >diff -u -r1.6 messages.properties >--- src/org/eclipse/tptp/trace/jvmti/internal/client/views/messages.properties 1 Mar 2007 17:53:15 -0000 1.6 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/views/messages.properties 16 Mar 2007 08:41:48 -0000 >@@ -69,6 +69,10 @@ > _THREAD_BLOCK_COUNT = Block Count > _THREAD_DEADLOCK_COUNT = Deadlock Count > >+#misc >+_Delta = Delta >+_ShowAsPercentage = Show as Percentage >+_ShowDeltaColumns = Show Delta Columns > _THREAD_MONITOR = Monitor > _MONITOR_OWNER = Monitor Owner > _TIMEOUT = Timeout >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/views/AllocationDetailsView.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/views/AllocationDetailsView.java,v >retrieving revision 1.3 >diff -u -r1.3 AllocationDetailsView.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/views/AllocationDetailsView.java 12 Mar 2007 14:51:25 -0000 1.3 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/views/AllocationDetailsView.java 16 Mar 2007 08:41:48 -0000 >@@ -14,7 +14,6 @@ > > package org.eclipse.tptp.trace.jvmti.internal.client.views; > >-import java.util.ArrayList; > import java.util.HashMap; > import java.util.Map; > >@@ -23,10 +22,9 @@ > import org.eclipse.hyades.models.trace.TRCFullTraceObject; > import org.eclipse.hyades.models.trace.TRCMethod; > import org.eclipse.hyades.models.trace.TRCObjectAllocationAnnotation; >-import org.eclipse.hyades.models.trace.TRCPackage; > import org.eclipse.hyades.trace.ui.TraceViewerPage; >+import org.eclipse.hyades.trace.ui.internal.util.TString; > import org.eclipse.hyades.trace.views.util.internal.ColumnData; >-import org.eclipse.hyades.trace.views.util.internal.StatisticTableColumnInfo; > import org.eclipse.hyades.ui.provisional.context.IContextLabelFormatProvider; > import org.eclipse.hyades.ui.util.GridUtil; > import org.eclipse.jface.viewers.Viewer; >@@ -58,6 +56,7 @@ > private TRCClass _class; > private int _nextIndex; > private Label _label; >+ AllocationSite _allocAll = new AllocationSite(); > static final Object _emptyArr[] = new Object[0]; > > protected AllocationDetailsView(Composite parent, TraceViewerPage page) { >@@ -72,17 +71,15 @@ > return "viewoption.allocdetails"; > } > >- protected Composite createControl(Composite parent, ArrayList cols) { >- Composite comp = super.createControl(parent, cols); >- _label = _toolkit.createLabel(comp, null); >+ protected void createLabel(Composite viewContainer) { >+ _label = _toolkit.createLabel(viewContainer, null); > Font font = _label.getFont(); > FontData fd = font.getFontData()[0]; > font = new Font(null, new FontData(fd.getName(), fd.getHeight() * 3 / 2, fd.getStyle())); > _label.setFont(font); >- _label.setBackground(comp.getBackground()); >+ _label.setBackground(viewContainer.getBackground()); > _label.setForeground(new Color(null, 0, 0, 200)); > _label.setLayoutData(GridUtil.createHorizontalFill()); >- return comp; > } > > protected String getDefaultColumnsTemplate() { >@@ -100,87 +97,107 @@ > ; > } > >+ String formatPercent(int val, int max) { >+ String s = max > 0 && max >= val ? >+ TString.formatAsPercentage((double)val / (double)max) : ""; >+ return s; >+ } >+ > public String getColumnText(Object element, int columnIndex) { >- StatisticTableColumnInfo info = StatisticTableColumnInfo >+ StatisticViewColumnInfo info = StatisticViewColumnInfo > .getStatisticTableColumnInfo(getTree().getColumn(columnIndex)); > int pos = info.getColumnData().getInitalPos(); > String label = ""; > if (!(element instanceof AllocationSite)) > return label; >+ boolean noperc = !isShowPercent(); > AllocationSite allocSite = (AllocationSite) element; > switch (pos) { > case AD_COL_METHOD_NAME: >- if (allocSite._method != null) >- label = allocSite._method.getName(); >+ label = allocSite.getMethodName(); > break; > case AD_COL_CLASS_NAME: >- if (allocSite._method != null && >- allocSite._method.getDefiningClass() != null) >- label = allocSite._method.getDefiningClass().getName(); >+ label = allocSite.getClassName(); > break; > case AD_COL_PACKAGE_NAME: >- if (allocSite._method != null && >- allocSite._method.getDefiningClass() != null && >- allocSite._method.getDefiningClass().getPackage() != null) >- label = allocSite._method.getDefiningClass().getPackage().getName(); >+ label = allocSite.getPackageName(); > break; > case AD_COL_LINE_NO: >- label = "" + allocSite._lineNo; >+ label = String.valueOf(allocSite._lineNo); > break; > case AD_COL_TOTAL_INST: >- label = "" + allocSite._total; >+ if (noperc) >+ label = String.valueOf(allocSite._total); >+ else >+ label = formatPercent(allocSite._total, _allocAll._total); > break; > case AD_COL_TOTAL_SIZE: >- label = "" + allocSite._totalSize; >+ if (noperc) >+ label = String.valueOf(allocSite._totalSize); >+ else >+ label = formatPercent(allocSite._totalSize, _allocAll._totalSize); > break; > case AD_COL_LIVE_INST: >- label = "" + (allocSite._total - allocSite._collected); >+ if (noperc) >+ label = String.valueOf(allocSite._total - allocSite._collected); >+ else >+ label = formatPercent(allocSite._total - allocSite._collected, >+ _allocAll._total - _allocAll._collected); > break; > case AD_COL_LIVE_SIZE: >- label = "" + (allocSite._totalSize - allocSite._collectedSize); >+ if (noperc) >+ label = String.valueOf(allocSite._totalSize - allocSite._collectedSize); >+ else >+ label = formatPercent(allocSite._totalSize - allocSite._collectedSize, >+ _allocAll._totalSize - _allocAll._collectedSize); > break; > case AD_COL_AVG_AGE: >- double age = 0; >- if (allocSite._total > 0) { >- age = (double) allocSite._sumAges / allocSite._total; >- label = "" + age; >+ if (noperc) { >+ double age = 0; >+ if (allocSite._total > 0) { >+ age = (double) allocSite._sumAges / allocSite._total; >+ label = String.valueOf(age); >+ } >+ IContextLabelFormatProvider formatter = TIContextProvider.instance().getContextLabelFormatProvider(TIContextAttributes.CALL_SITE_AVG_AGE); >+ label = formatter.getDisplayStringFromElement(new Double(age), null, IContextLabelFormatProvider.MODE_COLUMN_CONTENT); >+ } else { >+ label = formatPercent(allocSite._sumAges, _allocAll._sumAges); > } >- IContextLabelFormatProvider formatter = TIContextProvider.instance().getContextLabelFormatProvider(TIContextAttributes.CALL_SITE_AVG_AGE); >- label = formatter.getDisplayStringFromElement(new Double(age), null, IContextLabelFormatProvider.MODE_COLUMN_CONTENT); > break; > } >+ if (null == label) >+ label = ""; > return label; > } > > public Image getColumnImage(Object element, int columnIndex) { >- StatisticTableColumnInfo info = StatisticTableColumnInfo.getStatisticTableColumnInfo(getTree().getColumn(columnIndex)); >+ StatisticViewColumnInfo info = StatisticViewColumnInfo.getStatisticTableColumnInfo(getTree().getColumn(columnIndex)); > int pos = info.getColumnData().getInitalPos(); > Image image = null; > if (!(element instanceof AllocationSite)) > return image; > AllocationSite allocSite = (AllocationSite) element; >+ String name = null; > switch (pos) { > case AD_COL_METHOD_NAME: >- if (allocSite._method != null) { >+ name = allocSite.getMethodName(); >+ if (name != null) { > IContextLabelFormatProvider formatter = TIContextProvider.instance().getContextLabelFormatProvider(TIContextAttributes.METHOD_NAME); >- image = formatter.getDisplayImageByElement(allocSite._method.getName(), allocSite._method, IContextLabelFormatProvider.MODE_COLUMN_CONTENT); >+ image = formatter.getDisplayImageByElement(name, null, IContextLabelFormatProvider.MODE_COLUMN_CONTENT); > } > break; > case AD_COL_CLASS_NAME: >- if (allocSite._method != null && >- allocSite._method.getDefiningClass() != null) { >- TRCClass cls = allocSite._method.getDefiningClass(); >+ name = allocSite.getClassName(); >+ if (name != null) { > IContextLabelFormatProvider formatter = TIContextProvider.instance().getContextLabelFormatProvider(TIContextAttributes.CLASS_NAME); >- image = formatter.getDisplayImageByElement(cls.getName(), cls, IContextLabelFormatProvider.MODE_COLUMN_CONTENT); >+ image = formatter.getDisplayImageByElement(name, null, IContextLabelFormatProvider.MODE_COLUMN_CONTENT); > } > break; > case AD_COL_PACKAGE_NAME: >- if (allocSite._method != null && >- allocSite._method.getDefiningClass() != null && >- allocSite._method.getDefiningClass().getPackage() != null) { >- TRCPackage pkg = allocSite._method.getDefiningClass().getPackage(); >+ name = allocSite.getPackageName(); >+ if (name != null) { > IContextLabelFormatProvider formatter = TIContextProvider.instance().getContextLabelFormatProvider(TIContextAttributes.PACKAGE_NAME); >- image = formatter.getDisplayImageByElement(pkg.getName(), pkg, IContextLabelFormatProvider.MODE_COLUMN_CONTENT); >+ image = formatter.getDisplayImageByElement(name, null, IContextLabelFormatProvider.MODE_COLUMN_CONTENT); > } > break; > } >@@ -194,30 +211,25 @@ > AllocationSite a1 = (AllocationSite) e1; > AllocationSite a2 = (AllocationSite) e2; > switch (pos) { >- case AD_COL_METHOD_NAME: >- ret = Utils.compare(a1._method != null ? a1._method.getName() : null >- , a2._method != null ? a2._method.getName() : null); >- break; >- case AD_COL_CLASS_NAME: >- ret = Utils.compare(a1._method != null && >- a1._method.getDefiningClass() != null ? >- a1._method.getDefiningClass().getName() : null >- , a2._method != null && >- a2._method.getDefiningClass() != null ? >- a2._method.getDefiningClass().getName() : null); >- break; > case AD_COL_PACKAGE_NAME: >- ret = Utils.compare(a1._method != null && >- a1._method.getDefiningClass() != null && >- a1._method.getDefiningClass().getPackage() != null ? >- a1._method.getDefiningClass().getPackage().getName() : null >- , a2._method != null && >- a2._method.getDefiningClass() != null && >- a2._method.getDefiningClass().getPackage() != null ? >- a2._method.getDefiningClass().getPackage().getName() : null); >- break; >+ if (0 == ret) { >+ ret = Utils.compare(a1.getPackageName(), a2.getPackageName()); >+ } >+ //break; >+ case AD_COL_CLASS_NAME: >+ if (0 == ret) { >+ ret = Utils.compare(a1.getClassName(), a2.getClassName()); >+ } >+ //break; >+ case AD_COL_METHOD_NAME: >+ if (0 == ret) { >+ ret = Utils.compare(a1.getMethodName(), a2.getMethodName()); >+ } >+ //break; > case AD_COL_LINE_NO: >- ret = a1._lineNo - a2._lineNo; >+ if (0 == ret) { >+ ret = a1._lineNo - a2._lineNo; >+ } > break; > case AD_COL_TOTAL_INST: > ret = a1._total - a2._total; >@@ -232,9 +244,7 @@ > ret = (a1._totalSize - a1._collectedSize) - (a2._totalSize - a2._collectedSize); > break; > case AD_COL_AVG_AGE: >- double age1 = a1._total > 0 ? a1._sumAges / a1._total : 0; >- double age2 = a2._total > 0 ? a2._sumAges / a2._total : 0; >- ret = Utils.compare(age1, age2); >+ ret = a1._sumAges - a2._sumAges; > break; > } > return ret; >@@ -266,16 +276,19 @@ > _class = (TRCClass) obj; > _nextIndex = 0; > _allocSites.clear(); >+ _allocAll.clear(); > String text = Utils.getPackageClassName(_class); > if (text.length() > 0) > text = "Allocation details for '" + text + "'"; > _label.setText(text); >- //_label.getParent().layout(); > } > refresh(); > } > > void updateData() { >+ _nextIndex = 0; >+ _allocSites.clear(); >+ _allocAll.clear(); > if (null == _class) > return; > TRCObjectAllocationAnnotation aa = Utils.getAllocationAnnotation(_class); >@@ -309,14 +322,20 @@ > int j = i + i + 1; > if (j < objectsLen && objects.get(j) instanceof TRCFullTraceObject) { > TRCFullTraceObject trObj = (TRCFullTraceObject) objects.get(j); >+ int objSize = trObj.getSize(); > if (trObj.getCollectTime() > 0) { > allocSite._collected++; >- allocSite._collectedSize += trObj.getSize(); >+ allocSite._collectedSize += objSize; >+ _allocAll._collected++; >+ _allocAll._collectedSize += objSize; > } >- allocSite._totalSize += trObj.getSize(); > int age = Utils.getObjAge(trObj, listGC); >+ allocSite._totalSize += objSize; > allocSite._sumAges += age; > allocSite._total++; >+ _allocAll._totalSize += objSize; >+ _allocAll._sumAges += age; >+ _allocAll._total++; > } > } > _nextIndex = lineNoLen; >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/widgets/Utils.java >=================================================================== >RCS file: /cvsroot/tptp/trace/org.eclipse.tptp.trace.jvmti.client/src/org/eclipse/tptp/trace/jvmti/internal/client/widgets/Utils.java,v >retrieving revision 1.5 >diff -u -r1.5 Utils.java >--- src/org/eclipse/tptp/trace/jvmti/internal/client/widgets/Utils.java 12 Mar 2007 14:51:25 -0000 1.5 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/widgets/Utils.java 16 Mar 2007 08:41:48 -0000 >@@ -514,6 +514,11 @@ > return val; > } > >+ static public int loadIntOption(String opt) { >+ int val = TraceUIPlugin.getDefault().getPreferenceStore().getInt(opt); >+ return val; >+ } >+ > static public void saveIntOption(String opt, int val) { > TraceUIPlugin.getDefault().getPreferenceStore().setValue(opt, val); > } >Index: src/org/eclipse/tptp/trace/jvmti/internal/client/views/StatisticViewColumnInfo.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/jvmti/internal/client/views/StatisticViewColumnInfo.java >diff -N src/org/eclipse/tptp/trace/jvmti/internal/client/views/StatisticViewColumnInfo.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/jvmti/internal/client/views/StatisticViewColumnInfo.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,83 @@ >+/********************************************************************** >+ * Copyright (c) 2005 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * $Id: StatisticTableColumnInfo.java,v 1.4 2005/08/10 02:37:48 popescu Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.tptp.trace.jvmti.internal.client.views; >+ >+import org.eclipse.hyades.trace.views.util.internal.ColumnData; >+import org.eclipse.swt.*; >+import org.eclipse.swt.widgets.*; >+ >+/** >+ * This class was ported from hyades project for JVMTI trace client. >+ */ >+public class StatisticViewColumnInfo { >+ >+ private boolean _isSortColumn = false; >+ private boolean _isDeltaColumn = false; >+ private ColumnData _columnData; >+ >+ public ColumnData getColumnData() { >+ return _columnData; >+ } >+ >+ public boolean isSortColumn() { >+ return _isSortColumn; >+ } >+ >+ public boolean isDeltaColumn() { >+ return _isDeltaColumn; >+ } >+ >+ public void setSortColumn(boolean flag) { >+ _isSortColumn = flag; >+ } >+ >+ public void setDeltaColumn(boolean flag) { >+ _isDeltaColumn = flag; >+ } >+ >+ static public StatisticViewColumnInfo getStatisticTableColumnInfo(TreeColumn col) { >+ if (col.getData() != null && col.getData() instanceof StatisticViewColumnInfo) { >+ return (StatisticViewColumnInfo) (col.getData()); >+ } else { >+ return null; >+ } >+ } >+ >+ private StatisticViewColumnInfo(BaseStatisticView statisticView, ColumnData data) { >+ TreeColumn treeColumn = new TreeColumn(statisticView.getTree(), SWT.NULL | SWT.NO_BACKGROUND | data.getAlignment()); >+ treeColumn.setData(this); >+ initializeTreeColumn(statisticView, treeColumn, data, true); >+ } >+ >+ public StatisticViewColumnInfo(BaseStatisticView statisticView, ColumnData data, boolean deltaColumnsEnabled) { >+ TreeColumn treeColumn = new TreeColumn(statisticView.getTree(), SWT.NULL | SWT.NO_BACKGROUND | data.getAlignment()); >+ treeColumn.setData(this); >+ initializeTreeColumn(statisticView, treeColumn, data, false); >+ if (deltaColumnsEnabled && data.supportsDelta()) { >+ new StatisticViewColumnInfo(statisticView, data); >+ } >+ } >+ >+ private void initializeTreeColumn(BaseStatisticView statisticView, TreeColumn treeColumn, ColumnData data, boolean isDeltaColumn) { >+ _columnData = data; >+ _isDeltaColumn = isDeltaColumn; >+ treeColumn.setResizable(data.isResizable()); >+ if (isDeltaColumn) { >+ treeColumn.setText(UIMessages._Delta + ":" + data.name()); >+ } else { >+ treeColumn.setText(data.name()); >+ } >+ treeColumn.setWidth(data.width()); >+ treeColumn.addSelectionListener(statisticView); >+ treeColumn.addControlListener(statisticView); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 167995
:
59470
|
60265
| 61066 |
61814
|
61815