[SRADA-686] Sync processCombo between pages
authorjaeyong lee <jae-yong.lee@samsung.com>
Thu, 26 May 2016 08:02:38 +0000 (17:02 +0900)
committerdongkyu6 lee <dongkyu6.lee@samsung.com>
Fri, 27 May 2016 05:17:43 +0000 (14:17 +0900)
Change-Id: I28406de61c4cbac0555a125e0b262db7df851e2b

org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomCombo.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/chart/GLChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/ThreadChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartView.java

index 494d920..078f923 100755 (executable)
@@ -143,6 +143,10 @@ public class DACustomCombo extends Canvas {
        public void setFontPoint(Point fontPoint) {
                attr.setFontPoint(fontPoint);
        }
+       
+       public int getSelectionIndex() {
+               return selection;
+       }
 
        public String getText() {
                if (selection < 0) {
index 91deb55..356c249 100644 (file)
@@ -241,9 +241,51 @@ public class FileChartView extends DAViewComposite {
                        }
                });
        }
+       
+       private void updateProcessCombo() {
+               int index = Toolbar.INSTANCE.getProcessCombo().getSelectionIndex();
+               if(index+1 > processCombo.getItems().size()) {
+                       addProcessListToProcessCombo();
+               }
+               processCombo.select(index);
+       }
+       
+       private void addProcessListToProcessCombo() {
+               Project project = Global.getProject();
+               if (null == project) {
+                       return;
+               }
+
+               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() {
+               updateProcessCombo();
                fileChartBoard.updateChart();
 
                /*
@@ -278,6 +320,7 @@ public class FileChartView extends DAViewComposite {
 
        @Override
        public void updateView(DAViewData data) {
+               updateProcessCombo();
                fileChartBoard.updateChart();
                if (data instanceof DASelectionData) {
                        DASelectionData selData = (DASelectionData) data;
index ab90e19..70dae5b 100644 (file)
@@ -128,6 +128,47 @@ public class MemoryChartView extends DAViewComposite {
                initProcessCombo();
        }
        
+       public void updateProcessCombo() {
+               int index = Toolbar.INSTANCE.getProcessCombo().getSelectionIndex();
+               if(index+1 > processCombo.getItems().size()) {
+                       addProcessListToProcessCombo();
+               }
+               processCombo.select(index);
+       }
+       
+       private void addProcessListToProcessCombo() {
+               Project project = Global.getProject();
+               if (null == project) {
+                       return;
+               }
+               
+               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());
+               }
+       }
+       
        private void initializeChart() {
                memoryChartBoard.initalizeChart();
        }
@@ -196,7 +237,6 @@ public class MemoryChartView extends DAViewComposite {
 
                        @Override
                        public void handleEvent(Event event) {
-
                                Project project = Global.getProject();
                                if (null == project) {
                                        return;
@@ -237,6 +277,7 @@ public class MemoryChartView extends DAViewComposite {
        
        @Override
        public void updateView() {
+               updateProcessCombo();
                /*
                 * In case of Latest status, update visibleStartTime of chartBoard.
                 * Because Chart should be refreshed automatically even Page change.
@@ -271,7 +312,6 @@ public class MemoryChartView extends DAViewComposite {
                                UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
                                rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE,
                                rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE);
-
        }
 
        @Override
index 6dcb34c..db79054 100644 (file)
@@ -154,6 +154,47 @@ public class NetworkChartView extends DAViewComposite {
                initProcessCombo();
        }
        
+       private void updateProcessCombo() {
+               int index = Toolbar.INSTANCE.getProcessCombo().getSelectionIndex();
+               if(index+1 > processCombo.getItems().size()) {
+                       addProcessListToProcessCombo();
+               }
+               processCombo.select(index);
+       }
+       
+       private void addProcessListToProcessCombo() {
+               Project project = Global.getProject();
+               if (null == project) {
+                       return;
+               }
+
+               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());
+               }
+       }
+       
        private DAToolBarCustomCombo makeDACustomCombo(Composite parent) {
                int PROCESS_COMBO = 2;
                DAToolBarCustomCombo returnCombo = new DAToolBarCustomCombo(parent, SWT.NONE);
@@ -259,6 +300,7 @@ public class NetworkChartView extends DAViewComposite {
 
        @Override
        public void updateView() {
+               updateProcessCombo();
                networkChartBoard.updateChart();
 
                /*
@@ -296,6 +338,7 @@ public class NetworkChartView extends DAViewComposite {
 
        @Override
        public void updateView(DAViewData data) {
+               updateProcessCombo();
                networkChartBoard.updateChart();
                if (data instanceof DASelectionData == false) {
                        return;
index 061350f..2693483 100644 (file)
@@ -369,9 +369,51 @@ public class GLChartView extends DAViewComposite {
                frameTimeChartBoard.setItemsHeightMode(frameRateChartBoard.isItemMinimized());
                updateView();
        }
+       
+       private void updateProcessCombo() {
+               int index = Toolbar.INSTANCE.getProcessCombo().getSelectionIndex();
+               if(index+1 > processCombo.getItems().size()) {
+                       addProcessListToProcessCombo();
+               }
+               processCombo.select(index);
+       }
+       
+       private void addProcessListToProcessCombo() {
+               Project project = Global.getProject();
+               if (null == project) {
+                       return;
+               }
+
+               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() {
+               updateProcessCombo();
                if (stackLayout.topControl == frameTimeChartBoard) {
                        frameTimeChartBoard.updateView();
                } else {
@@ -381,6 +423,7 @@ public class GLChartView extends DAViewComposite {
 
        @Override
        public void updateView(DAViewData vdata) {
+               updateProcessCombo();
                if (vdata instanceof GLSelectionData) {
                        updateViewFromHistory((GLSelectionData) vdata);
                } else if (vdata instanceof DASelectionData) {
index 54648dd..17afc9d 100644 (file)
@@ -383,9 +383,51 @@ public class ThreadChartView extends DAViewComposite {
                contents.layout();
                updateView();
        }
+       
+       private void updateProcessCombo() {
+               int index = Toolbar.INSTANCE.getProcessCombo().getSelectionIndex();
+               if(index+1 > processCombo.getItems().size()) {
+                       addProcessListToProcessCombo();
+               }
+               processCombo.select(index);
+       }
+       
+       private void addProcessListToProcessCombo() {
+               Project project = Global.getProject();
+               if (null == project) {
+                       return;
+               }
+
+               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() {
+               updateProcessCombo();
                if (stackLayout.topControl == syncChartBoard) {
                        updateTimeLine(syncChartBoard);
                        updateRange(syncChartBoard);
@@ -433,6 +475,7 @@ public class ThreadChartView extends DAViewComposite {
 
        @Override
        public void updateView(DAViewData data) {
+               updateProcessCombo();
                if (data instanceof DASelectionData == false) {
                        return;
                }
index de5b102..a4f7b70 100644 (file)
@@ -212,7 +212,6 @@ public class TimelineChartView extends DAViewComposite {
 
                        @Override
                        public void handleEvent(Event event) {
-
                                Project project = Global.getProject();
                                if (null == project) {
                                        return;
@@ -251,6 +250,47 @@ public class TimelineChartView extends DAViewComposite {
                });
        }
        
+       private void addProcessListToProcessCombo() {
+               Project project = Global.getProject();
+               if (null == project) {
+                       return;
+               }
+
+               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());
+               }
+       }
+       
+       private void updateProcessCombo() {
+               int index = Toolbar.INSTANCE.getProcessCombo().getSelectionIndex();
+               if(index+1 > processCombo.getItems().size()) {
+                       addProcessListToProcessCombo();
+               }
+               processCombo.select(index);
+       }
+       
        public void ScaleChanged(boolean zoom){
                chartBoard.getScale().changeScale(zoom);
        }
@@ -270,6 +310,7 @@ public class TimelineChartView extends DAViewComposite {
 
        @Override
        public void updateView(DAViewData data) {
+               updateProcessCombo();
                if (data instanceof DASelectionData) {
                        DASelectionData selData = (DASelectionData) data;
 
@@ -295,6 +336,7 @@ public class TimelineChartView extends DAViewComposite {
 
        @Override
        public void updateView() {
+               updateProcessCombo();
                timelineChartManager.makeChartSeries(AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleStartTime()), 
                                AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleEndTime()));