SRADA-966 MemoryCallStackView tab added to MemoryPage.
authorp.privalov <p.privalov@partner.samsung.com>
Tue, 2 Aug 2016 08:28:05 +0000 (11:28 +0300)
committerp.privalov <p.privalov@partner.samsung.com>
Thu, 15 Sep 2016 08:31:50 +0000 (11:31 +0300)
 * Right bottom view of MemoryPage is a DATabComposite now.
 * It contains CallStackView and MemoryMapView.

MemoryCallStackView redesigned.

 * Implemented MemoryCallStackView.updateView(DAViewData).
 * CallStackTable.updateCallStackTable(DASelectionData): added clause
   to work with MemoryAllocationTraceTable's items.
 * MemoryPage: added parameter allocationtraceViewID, required for
   DASelectionData specification.
 * MemoryPage: CallstackView replaced with MemoryCallStackView to specify
   behavior.
 * MemoryAllocationTraceTable: selectionListener's method
   widgetSelected(SelectionEvent) implemented analogous to those of
   CallTraceTable.
 * MemoryAllocationTraceTable: in makeTableInput() methods added type
   information to TableItems.

Conflicts:
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/table/MemoryAllocationTraceTable.java

Change-Id: Iacf8d141741fbbb50c5b2b417e52f22881964734

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallstackTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryCallStackView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryPage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/table/MemoryAllocationTraceTable.java

index 04a9726..8cd58f7 100644 (file)
@@ -34,13 +34,11 @@ import org.eclipse.nebula.widgets.grid.GridItem;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.widgets.Composite;
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.DASelectionData;
 import org.tizen.dynamicanalyzer.common.Global;
-import org.tizen.dynamicanalyzer.model.FilterProperty;
 import org.tizen.dynamicanalyzer.model.TableInput;
 import org.tizen.dynamicanalyzer.project.callstack.RuntimeCallstackManager;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
@@ -128,7 +126,11 @@ public class CallstackTable extends DATableComposite {
                                seqNum = (Long) calltraceData.get(FunctionEntryDBTable.COLUMN.SEQUENCE_NUMBER.index);
                                pid = (Integer) calltraceData.get(FunctionEntryDBTable.COLUMN.PID.index);
                                time = (Long) calltraceData.get(FunctionEntryDBTable.COLUMN.START_TIME.index);
-                       } else if (tableData.getType() == AnalyzerConstants.TYPE_TABLE_INTERACTIVE) {
+                       } else if (tableData.getType() == AnalyzerConstants.TYPE_TABLE_MEM_ALLOCATEDTRACE) {
+                               GridItem gridItem = new GridItem(table, SWT.NONE);
+                               gridItem.setText(0, "Stub for callstack");
+                               return;
+                       }else if (tableData.getType() == AnalyzerConstants.TYPE_TABLE_INTERACTIVE) {
                                return; // TODO
                        } else { // in case table has LogData
                                LogData logData = tableData.getLogData();
index a427259..26b20d7 100644 (file)
@@ -27,18 +27,16 @@ package org.tizen.dynamicanalyzer.ui.memory;
 import org.eclipse.nebula.widgets.grid.GridItem;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
 import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
 import org.tizen.dynamicanalyzer.nl.MemoryPageLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackInserter;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackTable;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
+import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
 import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
 import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
 
@@ -46,73 +44,62 @@ public class MemoryCallStackView extends DAViewComposite {
        
        public static final String ID = MemoryCallStackView.class.getName();
        
-       private Composite contents = null;
-       private Text detailText = null;
-       private Label labelMessage = null;
-       
-       private void init() {
-               detailText.setText(CommonConstants.EMPTY);
-       }
+       private DATableComposite callstackTableComp = null;
+       private String[] columnNames = { InformationViewLabels.CALLSTACK_VIEW_FUNCTION,
+                       InformationViewLabels.CALLSTACK_VIEW_ADDRESS,
+                       InformationViewLabels.CALLSTACK_VIEW_BINARY_PATH };
+       private int[] columnSizes = { 120, 70, 400 };
+       private boolean[] columnVisibility = { true, true, true };
+       Composite contents = null;
+
+       // this definition should be here for creation of instance (register db table)
+       @SuppressWarnings("unused")
+       private static CallStackInserter inserter = CallStackInserter.getInstance();
 
        public MemoryCallStackView(Composite parent, int style) {
                super(parent, style, false);
                this.setLayout(new FillLayout());
-               
                setTitle(MemoryPageLabels.MEMORY_CALLSTACK_VIEW_TITLE);
-               
-               Composite detailCom = getContentArea();
-               detailCom.setBackground(ColorResources.VIEW_BG_COLOR);
-               detailCom.setLayout(new FormLayout());
-               FormData labelData = new FormData();
-               labelData.top = new FormAttachment(0, 0);
-               labelData.left = new FormAttachment(0, 0);
-               labelData.right = new FormAttachment(100, 0);
-               labelData.bottom = new FormAttachment(100, 0);
-               detailCom.setLayoutData(labelData);
-               
-               Composite contents = detailCom;
-               contents.setBackground(ColorResources.VIEW_BG_COLOR);
-               contents.setLayout(new FormLayout());
-               
-               detailText = new Text(contents, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
-               detailText.setBackground(ColorResources.VIEW_BG_COLOR);
-               detailText.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
-               detailText.setFont(FontResources.DETAIL_INFO_FONT);
-               
-               FormData buttonData = new FormData();
-               buttonData.top = new FormAttachment(labelMessage, 0);
-               buttonData.left = new FormAttachment(0, 0);
-               buttonData.right = new FormAttachment(100, 0);
-               buttonData.bottom = new FormAttachment(100, 0);
-               detailText.setLayoutData(buttonData);
+
+               contents = getContentArea();
+               contents.setBackground(ColorResources.WINDOW_BG_COLOR);
+               contents.setLayout(new FillLayout());
+
+               callstackTableComp = new CallstackTable(contents, SWT.NONE, SWT.SINGLE | SWT.BORDER
+                               | SWT.H_SCROLL | SWT.V_SCROLL);
+               callstackTableComp.setTableName("Callstack"); //$NON-NLS-1$
+               callstackTableComp.setColumns(columnNames);
+               callstackTableComp.setColumnSize(columnSizes);
+               callstackTableComp.setColumnVisibility(columnVisibility);
+
+               contents.addControlListener(new TableColumnSizePackListener(callstackTableComp, columnSizes));
        }
-       
+
        @Override
        public void updateView() {
-               
        }
-       
+
        @Override
        public void updateView(DAViewData data) {
-               if (data instanceof DASelectionData == false) {
+               if (!(data instanceof DASelectionData))
                        return;
-               }
+
                DASelectionData seldata = (DASelectionData) data;
+
                if (seldata.getData() instanceof GridItem[]) {
-                       
+                       ((CallstackTable) callstackTableComp).updateCallstackTable(seldata);
                } else {
-                       
+                       updateView();
                }
        }
-       
-       @Override
-       public Control getControl() {
-               return contents;
-       }
 
        @Override
        public void clear() {
-               init();
+               callstackTableComp.clear();
        }
 
+       @Override
+       public Control getControl() {
+               return callstackTableComp;
+       }
 }
index c0f5e98..f2ab2ff 100644 (file)
@@ -38,7 +38,6 @@ import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.setting.SettingDataManager;
 import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
-import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry;
 import org.tizen.dynamicanalyzer.ui.memory.data.HeapDataManager;
 import org.tizen.dynamicanalyzer.ui.memory.data.MemoryDataManager;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
@@ -56,6 +55,8 @@ public class MemoryPage extends DAPageComposite {
        public static final String chartViewID = MemoryChartView.class.getName();
        public static final String detailsViewID = MemoryDetailsTableView.class.getName();
        public static final String mapViewID = MemoryMapView.class.getName();
+       public static final String allocationtraceViewID = MemoryAllocationTraceTableView.class.getName();
+
        
        SashForm baseForm;              
        SashForm topForm;
@@ -121,17 +122,18 @@ public class MemoryPage extends DAPageComposite {
                }
                addView(memoryTabView);
 
-               DATabComposite memoryMapCallStackView = new DATabComposite(bottomRightForm, SWT.NONE, false, true);
+               DATabComposite memoryRightTabView = new DATabComposite(bottomRightForm, SWT.NONE, false, true);
                {
-                       memoryMapView = new MemoryMapView(memoryMapCallStackView.getContentComposite(), SWT.NONE);
+                       memoryCallStackView = new MemoryCallStackView(memoryRightTabView.getContentComposite(), SWT.NONE);
+                       memoryRightTabView.addView(memoryCallStackView, false);
+                       addView(memoryCallStackView);
+
+                       memoryMapView = new MemoryMapView(memoryRightTabView.getContentComposite(), SWT.NONE);
+                       memoryRightTabView.addView(memoryMapView, false);
                        addView(memoryMapView);
-                       memoryMapCallStackView.addView(memoryMapView, false);
-                       // It make ui hang issue. But this tab must be included.
-                       //memoryCallStackView = new MemoryCallStackView(memoryMapCallStackView.getContentComposite(), SWT.NONE);
-                       //addView(memoryCallStackView);
-                       //memoryMapCallStackView.addView(memoryCallStackView, false);
                }
-               addView(memoryMapCallStackView);
+               addView(memoryRightTabView);
+
                
                baseForm.setSashWidth(AnalyzerConstants.SASH_WIDTH);
                bottomForm.setSashWidth(AnalyzerConstants.SASH_WIDTH);
index a2576d1..f5e3688 100644 (file)
@@ -36,12 +36,14 @@ import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;\r
 import org.eclipse.swt.widgets.Composite;\r
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;\r
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;\r
+import org.tizen.dynamicanalyzer.common.DASelectionData;\r
 import org.tizen.dynamicanalyzer.common.DAState;\r
 import org.tizen.dynamicanalyzer.common.Global;\r
 import org.tizen.dynamicanalyzer.model.TableInput;\r
 import org.tizen.dynamicanalyzer.nl.MemoryPageLabels;\r
+import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;\r
 import org.tizen.dynamicanalyzer.ui.memory.data.HeapDataManager;\r
-import org.tizen.dynamicanalyzer.ui.timeline.calltrace.FunctionEntryDBTable;\r
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;\r
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;\r
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;\r
@@ -96,11 +98,21 @@ public class MemoryAllocationTraceTable extends DATableComposite {
 \r
                        @Override\r
                        public void widgetSelected(SelectionEvent e) {\r
-\r
-                               GridItem[] items = table.getSelection();\r
-                               if (null == items) {\r
+                               GridItem[] items = ((Grid) e.widget).getSelection();\r
+                               if (null == items|| items.length == 0) {\r
                                        return;\r
                                }\r
+                               int size = items.length;\r
+                               List<Object> startData = ((DATableDataFormat) items[0].getData()).getData();\r
+                               List<Object> endData = ((DATableDataFormat) items[size - 1].getData()).getData();\r
+                               long startTime = (Long) startData.get(1);//1 is an index of timestamp column in table.\r
+                               long endTime = (Long) endData.get(1);\r
+                               Toolbar.INSTANCE.setChartDragStartTime(startTime);\r
+                               Toolbar.INSTANCE.setChartDragEndTime(endTime);\r
+                               Toolbar.INSTANCE.setDlogSelection(false);\r
+                               DASelectionData data = new DASelectionData(MemoryPage.allocationtraceViewID, startTime,\r
+                                               endTime, items, table);\r
+                               AnalyzerManager.getCurrentPage().updateView(data);\r
                        }\r
 \r
                        @Override\r
@@ -169,8 +181,8 @@ public class MemoryAllocationTraceTable extends DATableComposite {
                        List<Object> iAllocData = allocDataList.get(j);\r
 \r
                        TableInput alloInput = HeapDataManager.getInstance().makeTreeInputForLeakData(iAllocData, index++);\r
-                       \r
                        if (alloInput != null){\r
+                               ((DATableDataFormat)alloInput.getData()).setType(AnalyzerConstants.TYPE_TABLE_MEM_ALLOCATEDTRACE);\r
                                output.add(alloInput);\r
                        }\r
                }\r