[SRADA-610] Fixed Memory page
authordongkyu6 lee <dongkyu6.lee@samsung.com>
Thu, 19 May 2016 07:42:01 +0000 (16:42 +0900)
committerdongkyu6 lee <dongkyu6.lee@samsung.com>
Thu, 19 May 2016 08:13:19 +0000 (17:13 +0900)
Change-Id: I35381406859e57626b87abb421c562b43e35b8f8

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryPage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/BaseView.java

index b67d0c7..880233e 100644 (file)
 
 package org.tizen.dynamicanalyzer.ui.memory;
 
+import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StackLayout;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.ScrollBar;
 import org.tizen.dynamicanalyzer.common.Global;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.nl.MemoryPageLabels;
+import org.tizen.dynamicanalyzer.project.ProcessInformation;
+import org.tizen.dynamicanalyzer.project.ProcessMemoryMap;
+import org.tizen.dynamicanalyzer.project.Project;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
 import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
 import org.tizen.dynamicanalyzer.ui.memory.chart.MemoryChartBoard;
+import org.tizen.dynamicanalyzer.ui.page.BaseView;
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
+import org.tizen.dynamicanalyzer.ui.toolbar.DAToolBarCustomCombo;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolBarComboListener;
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
+import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
@@ -54,6 +70,8 @@ public class MemoryChartView extends DAViewComposite {
        private final StackLayout stackLayout;
        private Boolean isLatestTraceMode = true;
        
+       private DAToolBarCustomCombo processCombo;
+       
        private final RangeDataManager rangeDataManager = RangeDataManager.getInstance();
        
        public MemoryChartView(Composite parent, int style) {
@@ -86,12 +104,7 @@ public class MemoryChartView extends DAViewComposite {
                
                initializeChart();
                stackLayout.topControl = memoryChartBoard;
-               
-               memoryChartBoard.makeDefaultTitleComposite(MemoryPageLabels.MEMORY_CHART_TITLE,
-                               FontResources.ADDITEM_BUTTON_FONT, ColorResources.ADD_CHART_FONT_COLOR,
-                               ColorResources.ADD_CHART_NORMAL_START, ColorResources.ADD_CHART_NORMAL_END,
-                               ColorResources.ADD_CHART_NORMAL_STROKE);
-
+       
                DATimeline timeline = memoryChartBoard.getTimeline();
 
                timeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
@@ -102,12 +115,125 @@ public class MemoryChartView extends DAViewComposite {
 
                timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(rangeDataManager,
                                memoryChartBoard, timeline));
+               
+               processCombo = makeDACustomCombo(memoryChartBoard.getTitleComp());
+               FormData data = new FormData();
+               data.top = new FormAttachment(0, 0);
+               data.left = new FormAttachment(0, 0);
+               data.width = 190;
+               data.height = 20;
+               processCombo.setLayoutData(data);
+               
+               initProcessCombo();
        }
        
        private void initializeChart() {
                memoryChartBoard.initalizeChart();
        }
        
+       private DAToolBarCustomCombo makeDACustomCombo(Composite parent) {
+               int PROCESS_COMBO = 2;
+               DAToolBarCustomCombo returnCombo = new DAToolBarCustomCombo(parent, SWT.NONE);
+               returnCombo.setComboGradation(ColorResources.WHITE,
+                               ColorResources.WHITE, ColorResources.WHITE,
+                               ColorResources.WHITE, ColorResources.WHITE,
+                               ColorResources.WHITE, ColorResources.WHITE,
+                               ColorResources.WHITE);
+               returnCombo.setOutlineColors(ColorResources.GRAY_130,
+                               ColorResources.WHITE,
+                               ColorResources.GRAY_130,
+                               ColorResources.GRAY_130);
+               returnCombo.setComboImages(ImageResources.TOOLBAR_COMBO_BUTTON_NORMAL,
+                               ImageResources.TOOLBAR_COMBO_BUTTON_NORMAL,
+                               ImageResources.TOOLBAR_COMBO_BUTTON_NORMAL,
+                               ImageResources.TOOLBAR_COMBO_BUTTON_DISABLE);
+               returnCombo.setComboImagePoint(new Point(160, 9));
+               returnCombo.setComboButtonColor(ColorResources.WHITE,
+                               ColorResources.WHITE,
+                               ColorResources.WHITE,
+                               ColorResources.WHITE);
+               returnCombo.setArrowOutlineColors(ColorResources.GRAY_220,
+                               ColorResources.GRAY_220,
+                               ColorResources.GRAY_220,
+                               ColorResources.GRAY_220);
+               returnCombo.setButtonImages(ImageResources.COMBO_DROPDOWN_UP,
+                               ImageResources.COMBO_DROPDOWN_DOWN);
+               returnCombo.setFontPoint(new Point(5, 5));
+               returnCombo.setEnabled(true);
+               returnCombo.setComboFont(FontResources.COMBO);
+               returnCombo.setItemFont(FontResources.DROPDOWN);
+               returnCombo.setFontColors(ColorResources.BLACK,
+                               ColorResources.BLACK,
+                               ColorResources.BLACK,
+                               ColorResources.GRAY_170);
+               returnCombo.setButtonRenderer(new DACustomButtonRenderer());
+               returnCombo.setDeviceCombo(PROCESS_COMBO);
+               return returnCombo;
+       }
+       
+       public void initProcessCombo() {
+               processCombo.initCombo();
+               processCombo.add(Toolbar.ALL_PROCESS);
+               processCombo.select(0);
+               
+               processCombo.addSelectionListener(new ToolBarComboListener() {
+                       
+                       @Override
+                       public void selectionEvent(DAToolBarCustomCombo combo) {
+                               for(int i = 0; i < Toolbar.INSTANCE.getProcessCombo().getItems().size(); i++) {
+                                       if(combo.getText().equals(Toolbar.INSTANCE.getProcessCombo().getItem(i))) {
+                                               Toolbar.INSTANCE.getProcessCombo().select(i);
+                                       }
+                               }
+                               BaseView baseView = (BaseView) WorkbenchUtil.getViewPart(BaseView.ID);
+                               baseView.getTopComposite().updateView();
+                               
+                       }
+               });
+               
+               processCombo.addListener(SWT.MouseDown, new Listener() {
+
+                       @Override
+                       public void handleEvent(Event event) {
+
+                               Project project = Global.getProject();
+                               if (null == project) {
+                                       return;
+                               }
+                               processCombo.initCombo();
+                               processCombo.add(Toolbar.ALL_PROCESS);
+                               Toolbar.INSTANCE.getProcessCombo().initCombo();
+                               Toolbar.INSTANCE.getProcessCombo().add(Toolbar.ALL_PROCESS);
+
+                               int[] pids = project.getProcessIDs();
+                               int pcount = pids.length;
+
+                               for (int i = 0; i < pcount; i++) {
+                                       ProcessInformation process = project.getProcessInformation(pids[i]);
+                                       String binName = process.getProcessName();
+                                       if (binName == null || binName.isEmpty()) {
+                                               ProcessMemoryMap map = process.getLastProcessMemoryMap();
+                                               if (map != null) {
+                                                       int bid = map.getMainbinary().getBinaryID();
+                                                       String binPath = project.getDeviceStatusInfo().getBinaryInfo(bid)
+                                                                       .getTargetBinaryPath();
+                                                       if (null != binPath && !binPath.isEmpty()) {
+                                                               int index = binPath.lastIndexOf(CommonConstants.SLASH);
+                                                               binName = binPath.substring(index + 1, binPath.length());
+                                                       }
+                                               }
+                                       }
+
+                                       StringBuffer buffer = new StringBuffer();
+                                       buffer.append(process.getPid()).append(Toolbar.PROCESS_SPLITER);
+                                       buffer.append(binName);
+                                       processCombo.add(buffer.toString());
+                                       Toolbar.INSTANCE.getProcessCombo().add(buffer.toString());
+                               }
+                       }
+               });
+       }
+       
        @Override
        public void updateView() {
                /*
index 047a10b..3748f15 100644 (file)
@@ -82,7 +82,7 @@ public class MemoryPage extends DAPageComposite {
                bottomRightForm.setLayout(new FillLayout());
                
                DATabComposite memoryTabView = new DATabComposite(bottomLeftForm, SWT.NONE, false);
-               memoryTabView.setTabWidth(130);
+               memoryTabView.enableImageTab(true);
                {
                        memoryDetailsTableView = new MemoryDetailsTableView(memoryTabView.getContentComposite(), SWT.NONE);
                        memoryTabView.addView(memoryDetailsTableView, false);
@@ -99,7 +99,7 @@ public class MemoryPage extends DAPageComposite {
                addView(memoryTabView);
 
                DATabComposite memoryMapCallStackView = new DATabComposite(bottomRightForm, SWT.NONE, false);
-               memoryMapCallStackView.setTabWidth(100);
+               memoryMapCallStackView.enableImageTab(true);
                {
                        memoryMapView = new MemoryMapView(memoryMapCallStackView.getContentComposite(), SWT.NONE);
                        addView(memoryMapView);
@@ -112,7 +112,7 @@ public class MemoryPage extends DAPageComposite {
                addView(memoryMapCallStackView);
                
                baseForm.setWeights(new int[] { 60, 40 });
-               bottomForm.setWeights(new int[] { 75, 25 });
+               bottomForm.setWeights(new int[] { 60, 40 });
                
                baseForm.setSashWidth(AnalyzerConstants.SASH_WIDTH);
                bottomForm.setSashWidth(AnalyzerConstants.SASH_WIDTH);
index eaad5cc..7bef693 100644 (file)
@@ -55,6 +55,7 @@ import org.tizen.dynamicanalyzer.ui.hierarchy.HierarchyPage;
 import org.tizen.dynamicanalyzer.ui.interactive.InteractivePage;
 import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveDataManager;
 import org.tizen.dynamicanalyzer.ui.kernel.KernelPage;
+import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;
 import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
 import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
 import org.tizen.dynamicanalyzer.ui.summary.SummaryPage;
@@ -241,9 +242,9 @@ public class BaseView extends ViewPart {
                                        newPage = new InteractivePage(tabView.getContentComposite(), SWT.NONE);
                                } else if (SettingConstants.PAGE_NAME_HIERARCHY.equals(pageName)) {
                                        newPage = new HierarchyPage(tabView.getContentComposite(), SWT.NONE);
-                               } //else if (SettingConstants.PAGE_NAME_MEMORY.equals(pageName)) {
-                               //      newPage = new MemoryPage(tabView.getContentComposite(), SWT.NONE);
-                               //}
+                               } else if (SettingConstants.PAGE_NAME_MEMORY.equals(pageName)) {
+                                       newPage = new MemoryPage(tabView.getContentComposite(), SWT.NONE);
+                               }
 
                                // add tab view
                                if (null != newPage) {