[SRADA-1010] Add marker when GLAPI table double clicked
authorjaeyong lee <jae-yong.lee@samsung.com>
Thu, 11 Aug 2016 08:38:18 +0000 (17:38 +0900)
committergihun chang <gihun.chang@samsung.com>
Fri, 12 Aug 2016 01:46:30 +0000 (10:46 +0900)
Change-Id: Ibc6d1ee6db8fec8d54c00e90b7bf5297834a147c

org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/table/api/GLAPITable.java

index 019cb0e..4818ed7 100644 (file)
@@ -32,24 +32,41 @@ import java.util.List;
 import org.eclipse.nebula.widgets.grid.Grid;
 import org.eclipse.nebula.widgets.grid.GridColumn;
 import org.eclipse.nebula.widgets.grid.GridItem;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.widgets.Composite;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.model.FilterProperty;
 import org.tizen.dynamicanalyzer.model.TableInput;
+import org.tizen.dynamicanalyzer.ui.file.FileChartView;
+import org.tizen.dynamicanalyzer.ui.file.FilePage;
+import org.tizen.dynamicanalyzer.ui.memory.MemoryChartView;
+import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;
+import org.tizen.dynamicanalyzer.ui.network.NetworkChartView;
+import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
 import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
+import org.tizen.dynamicanalyzer.ui.opengl.chart.GLChartView;
 import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataManager;
 import org.tizen.dynamicanalyzer.ui.opengl.data.DB.GLAPIDBTableManager;
 import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLAPIData;
 import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLConstantDefine;
 import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLES20ErrorDefine;
 import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLSelectionData;
+import org.tizen.dynamicanalyzer.ui.page.BaseView;
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
+import org.tizen.dynamicanalyzer.ui.thread.chart.ThreadChartView;
+import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.utils.Formatter;
 
 public class GLAPITable extends DATableComposite {
@@ -85,6 +102,66 @@ public class GLAPITable extends DATableComposite {
                        public void widgetDefaultSelected(SelectionEvent e) {
                        }
                });
+               
+               table.addMouseListener(new MouseListener() {
+                       
+                       @Override
+                       public void mouseUp(MouseEvent e) {
+                               // TODO Auto-generated method stub
+                               
+                       }
+                       
+                       @Override
+                       public void mouseDown(MouseEvent e) {
+                               // TODO Auto-generated method stub
+                               
+                       }
+                       
+                       @Override
+                       public void mouseDoubleClick(MouseEvent e) {
+                               GridItem[] ti = ((Grid) e.widget).getSelection();
+                               if (null == ti || ti.length == 0) {
+                                       return;
+                               }
+                               DATableDataFormat dataFormat = (DATableDataFormat) ti[0].getData();
+                               addMarker(((GLAPIData)(dataFormat.getLogData())).getTime());
+                       }
+               });
+       }
+       
+       private void addMarker(long markerTime) {
+               double startMarkerTime = markerTime / (TimelineConstants.MEGA_DOUBLE);
+               
+               TimelineChartView TLchartView = (TimelineChartView) AnalyzerUtil.getView(TimelinePage.pageID, TimelineChartView.class.getName());
+               NetworkChartView NETchartView = (NetworkChartView) AnalyzerUtil.getView(NetworkPage.pageID, NetworkChartView.class.getName());
+               ThreadChartView THRchartView = (ThreadChartView) AnalyzerUtil.getView(ThreadPage.pageID, ThreadChartView.class.getName());
+               FileChartView FLchartView = (FileChartView) AnalyzerUtil.getView(FilePage.pageID, FileChartView.class.getName());
+               GLChartView GLchartview = (GLChartView) AnalyzerUtil.getView(GLPage.pageID, GLChartView.class.getName());
+               MemoryChartView MMchartView = (MemoryChartView) AnalyzerUtil.getView(MemoryPage.pageID, MemoryChartView.class.getName());
+               
+               //1. add marker to rangedatamanager
+               RangeDataManager.getInstance().addMarkerTime(markerTime);
+               
+               //2. add marker to toolbar
+               Toolbar.INSTANCE.addMarkerTime(startMarkerTime);
+               
+               if(TLchartView != null)
+                       TLchartView.updateView();
+               if(NETchartView != null)
+                       NETchartView.updateView();
+               if(THRchartView != null)
+                       THRchartView.updateView();
+               if(FLchartView != null)
+                       FLchartView.updateView();
+               if(GLchartview != null)
+                       GLchartview.updateView();
+               if(MMchartView != null)
+                       MMchartView.updateView();
+               
+               AnalyzerUtil.getMainTab().getTopComposite().updateView();
+               /// draw marker clearly
+               BaseView baseView = (BaseView) WorkbenchUtil.getViewPart(BaseView.ID);
+               baseView.getTopComposite().updateView();
        }
 
        protected List<TableInput> makeTableInput() {