[Interactive] first version development 64/30664/23
authorjungwook.ryu <jungwook.ryu@samsung.com>
Sat, 22 Nov 2014 12:22:50 +0000 (21:22 +0900)
committerjungwook.ryu <jungwook.ryu@samsung.com>
Mon, 19 Jan 2015 11:25:53 +0000 (20:25 +0900)
show Profiling result to Chart, Table on Interactive Page.
You can get information about this commit from document.(Interactive profiling_Analysis_Design.pptx)

Change-Id: I010b6853da5d5bc63ba0e1118c63e36d3bbbfc30
Signed-off-by: jungwook.ryu <jungwook.ryu@samsung.com>
68 files changed:
org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/resources/ColorResources.java
org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/theme/DAThemeWhite.java
org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/util/ByteUtil.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoardManager.java
org.tizen.dynamicanalyzer/.classpath
org.tizen.dynamicanalyzer/META-INF/MANIFEST.MF
org.tizen.dynamicanalyzer/build.properties
org.tizen.dynamicanalyzer/lib/org.eclipse.cdt.debug.edc_1.0.0.201501071837.jar [moved from org.tizen.dynamicanalyzer/lib/org.eclipse.cdt.debug.edc_1.0.0.201409200430.jar with 50% similarity]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/IDECommunicator.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBColumn.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/DBConstants.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/database/SqlConnectionManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/InteractivePageLabels.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/InteractivePageLabels.properties [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/FunctionBodyInstrument.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/FunctionBodyInstrumentStep.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/FunctionBodyInstrumentVariable.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/FunctionInst.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/data/DataChannelConstants.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/MessageParser.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/SWAPLogParser.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/FunctionBodyInstrumentData.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/LogDataFactory.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/TimelineChartMouseEventListener.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallstackTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/screenshot/ScreenshotView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/InteractivePage.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveChart.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveChartMouseEventListener.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveChartRenderer.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveChartView.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveEditItemsDialog.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/data/InteractiveDataManager.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/data/InteractiveUIData.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/data/InteractiveValueDBTable.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/data/InteractiveVariableDBTable.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/FBIManager.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/InteractiveIDGenerator.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/InteractiveInfo.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/InteractiveParser.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/VAR_TYPE.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/table/InteractiveTable.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/table/InteractiveTableView.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/chart/GLFrameRateChartBoard.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/BaseView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/TimelinePage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUCoreChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/CPUFrequencyChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DeviceChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/DiskIOChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/EnergyChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/HeapChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/NetworkIOChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessMemoryChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ScreenshotChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/SystemMemoryChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/UIEventChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/AddChartMenuComposite.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineEditItemsDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogManager.java

index 4029264..f1b0b58 100755 (executable)
@@ -472,6 +472,8 @@ public class ColorResources {
        public static Color SERIES_COLOR_UI_EVENT_ORIENTATION = getColor("seriesColorUIEventOrientation");//$NON-NLS-1$\r
        public static Color SERIES_COLOR_UI_EVENT_FRAMEWORK = getColor("seriesColorUIEventFramework");//$NON-NLS-1$\r
 \r
+       public static Color SERIES_COLOR_INTERACTIVE = getColor("seriesColorInteractive");//$NON-NLS-1$\r
+       \r
        public static Color SELECTION_RANGE = getColor("selectionRange"); //$NON-NLS-1$\r
        public static Color SELECTION_LINE = getColor("selectionLine"); //$NON-NLS-1$\r
 \r
index 3759fb8..86abe82 100644 (file)
@@ -479,6 +479,8 @@ public class DAThemeWhite extends DATheme {
                setColor("seriesColorUIEventOrientation", new RGB(177, 202, 229)); //$NON-NLS-1$
                setColor("seriesColorUIEventFramework", new RGB(216, 160, 76)); //$NON-NLS-1$
 
+               setColor("seriesColorInteractive", new RGB(129, 172, 50)); //$NON-NLS-1$
+               
                setColor("selectionRange", new RGB(43, 80, 201)); //$NON-NLS-1$
                setColor("selectionLine", new RGB(43, 80, 201)); //$NON-NLS-1$
 
index 265c179..2d8eecc 100755 (executable)
@@ -209,6 +209,13 @@ public class ByteUtil {
                return ByteBuffer.allocate(size).putDouble(input).array();
        }
 
+       // TODO : make unittest
+       public static byte[] toBytesN(byte[] src, int start, int length) {
+               byte[] temp = new byte[length];
+               System.arraycopy(src, start, temp, 0, length);
+               return temp;
+       }
+       
        // remove EOS
        public static String getString(byte[] data, int start) {
                int length = getStringLength(data, start)-1;
index b1c9ece..ea57161 100644 (file)
@@ -185,6 +185,9 @@ public class DAChartBoardManager {
        }
 
        public void timelineWidthChanged(int width) {
+               if (width == 0) {
+                       return;
+               }
                chartWidth = width;
                thumb = computeThumb(chartWidth, scaleValues[currentScaleValueIndex]);
                board.setScrollThumb((int) (thumb * 1000));
index 848093b..eb263bf 100644 (file)
@@ -4,12 +4,12 @@
        <classpathentry exported="true" kind="lib" path="lib/org.eclipse.cdt.core_5.3.1.201109151620.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/org.eclipse.cdt.dsf_2.2.0.201109151620.jar"/>
        <classpathentry kind="lib" path="lib/hsqldb.jar"/>
+       <classpathentry kind="lib" path="lib/org.eclipse.cdt.debug.edc_1.0.0.201501071837.jar"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
        <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="src" path="test/src"/>
        <classpathentry kind="lib" path="lib/json-simple-1.1.1.jar"/>
        <classpathentry kind="lib" path="lib/protobuf.jar"/>
-       <classpathentry kind="lib" path="lib/org.eclipse.cdt.debug.edc_1.0.0.201409200430.jar"/>
        <classpathentry kind="output" path="bin"/>
 </classpath>
index 1aab4a0..013e9f1 100644 (file)
@@ -22,7 +22,7 @@ Bundle-ClassPath: .,
  lib/hsqldb.jar,
  lib/json-simple-1.1.1.jar,
  lib/protobuf.jar,
- lib/org.eclipse.cdt.debug.edc_1.0.0.201409200430.jar
+ lib/org.eclipse.cdt.debug.edc_1.0.0.201501071837.jar
 Import-Package: junit.framework;version="4.8.2",
  org.junit,
  org.tizen.sdblib,
index 9d1e53e..1bbe0f3 100644 (file)
@@ -12,5 +12,5 @@ bin.includes = .,\
                .project,\\r
                .classpath,\\r
                lib/,\\r
-               lib/org.eclipse.cdt.debug.edc_1.0.0.201409200430.jar\r
+               lib/org.eclipse.cdt.debug.edc_1.0.0.201501071837.jar\r
 
similarity index 50%
rename from org.tizen.dynamicanalyzer/lib/org.eclipse.cdt.debug.edc_1.0.0.201409200430.jar
rename to org.tizen.dynamicanalyzer/lib/org.eclipse.cdt.debug.edc_1.0.0.201501071837.jar
index dd3f9b2..112f98d 100644 (file)
Binary files a/org.tizen.dynamicanalyzer/lib/org.eclipse.cdt.debug.edc_1.0.0.201409200430.jar and b/org.tizen.dynamicanalyzer/lib/org.eclipse.cdt.debug.edc_1.0.0.201501071837.jar differ
index 9bd2df5..e4eea73 100644 (file)
@@ -137,6 +137,7 @@ public class AnalyzerConstants {
        public static final int PAGE_KERNEL = 6;
        public static final int PAGE_SUMMARY = 7;
        public static final int PAGE_RANGE = 8;
+       public static final int PAGE_INTERACTIVE = 9;
        
        /* general value */
        public static final int INVALID_INDEX = -1;
@@ -355,6 +356,7 @@ public class AnalyzerConstants {
        public final static int TYPE_TABLE_CALLTRACE = 0x0020;
        public final static int TYPE_TABLE_CONTEXTSWITCH = 0x0040;
        public final static int TYPE_TABLE_FUNCTIONFRAGMENT = 0x0080;
+       public final static int TYPE_TABLE_INTERACTIVE = 0x0100;
 
        public final static int CONTEXT_TABLE_RANGE = 0x0001;
        public final static int CONTEXT_TABLE_SOURCE = 0x0002;
index 663bb5d..c14448c 100644 (file)
@@ -58,12 +58,18 @@ import org.tizen.dynamicanalyzer.nl.UserErrorWarningLabels;
 import org.tizen.dynamicanalyzer.project.AppInfo;
 import org.tizen.dynamicanalyzer.project.PackageInfo;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.swap.channel.control.FunctionBodyInstrument;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
+import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveDataManager;
+import org.tizen.dynamicanalyzer.ui.interactive.model.FBIManager;
+import org.tizen.dynamicanalyzer.ui.interactive.model.InteractiveInfo;
+import org.tizen.dynamicanalyzer.ui.interactive.model.InteractiveParser;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
 import org.tizen.dynamicanalyzer.util.CommonUtil;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.utils.RpmUtil;
 import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
 import org.tizen.dynamicanalyzer.workbench.SingletonFocusManager;
@@ -83,6 +89,8 @@ public class IDECommunicator implements Runnable {
        private static final int MSG_INDEX_BINARY_OF_TARGET = 3;
        private static final int MSG_INDEX_EXECUTABLE_PATH = 4;
        private static final int MSG_INDEX_LOCAL_PACKAGE_PATH = 5;
+       private static final int MSG_INDEX_INTERACTIVE_INFO = 6; // This is not
+                                                                                                                               // default
        private static final int MSG_DEFAULT_LENGTH = 5;
 
        // project type string
@@ -143,16 +151,17 @@ public class IDECommunicator implements Runnable {
                                                Socket clientSocket = lastCommunicationIdeSocket;
                                                while (true) {
                                                        try {
+                                                               for (int i = 0; i < receiveBuffer.length; i++) {        // clear buffer
+                                                                       receiveBuffer[i] = 0;
+                                                               }
                                                                in = clientSocket.getInputStream();
-                                                               Logger.debug("IDE recvMessage Wait : "
-                                                                               + ideClientSocketArray.size());
+                                                               Logger.debug("IDE recvMessage Wait : " + ideClientSocketArray.size());
                                                                readSize = in.read(receiveBuffer);
                                                                if (readSize > 0) {
                                                                        lastCommunicationIdeSocket = clientSocket;
                                                                        parsingReceiveMessage(new String(receiveBuffer));
                                                                } else {
-                                                                       Logger.debug("Disconnected IDE : "
-                                                                                       + ideClientSocketArray.size());
+                                                                       Logger.debug("Disconnected IDE : " + ideClientSocketArray.size());
                                                                        clientSocket.close();
                                                                        ideClientSocketArray.remove(clientSocket);
                                                                        break;
@@ -169,15 +178,14 @@ public class IDECommunicator implements Runnable {
                        }
                }
        }
-
+       
        private void errorMessageBox() {
                popupMessage(AnalyzerLabels.IDE_DA_COMMUNICATION_ERROR_MESSAGE);
        }
 
        public synchronized static void startIDECommunicatorThread() {
                if (null == instance || !instance.isAlive()) {
-                       instance = new Thread(null, new IDECommunicator(),
-                                       AnalyzerConstants.IDE_COMMUNICATOR_THREAD);
+                       instance = new Thread(null, new IDECommunicator(), AnalyzerConstants.IDE_COMMUNICATOR_THREAD);
                        instance.start();
                }
        }
@@ -203,8 +211,7 @@ public class IDECommunicator implements Runnable {
        public static boolean sendMessageToIDE(final String message) {
                try {
                        if (lastCommunicationIdeSocket != null) {
-                               writer = new BufferedWriter(new OutputStreamWriter(
-                                               lastCommunicationIdeSocket.getOutputStream()));
+                               writer = new BufferedWriter(new OutputStreamWriter(lastCommunicationIdeSocket.getOutputStream()));
                                writer.write(message);
                                writer.flush();
                        }
@@ -232,18 +239,18 @@ public class IDECommunicator implements Runnable {
        // Receive Message DA Status , Send DA Status
        private void sendDAStatus() {
                if (isDAReadyStatus()) {
-                       sendMessageToIDE(sendMessageString(IDE_DA_COMMUNICATION_TYPE_1,
-                                       IDE_DA_COMMUNICATION_TYPE_1_STOP, CommonConstants.EMPTY));
+                       sendMessageToIDE(sendMessageString(IDE_DA_COMMUNICATION_TYPE_1, IDE_DA_COMMUNICATION_TYPE_1_STOP,
+                                       CommonConstants.EMPTY));
                } else {
-                       sendMessageToIDE(sendMessageString(IDE_DA_COMMUNICATION_TYPE_1,
-                                       IDE_DA_COMMUNICATION_TYPE_1_RECORD, CommonConstants.EMPTY));
+                       sendMessageToIDE(sendMessageString(IDE_DA_COMMUNICATION_TYPE_1, IDE_DA_COMMUNICATION_TYPE_1_RECORD,
+                                       CommonConstants.EMPTY));
                }
        }
 
        private boolean isDAReadyStatus() {
                if (AnalyzerManager.isRunning()) {
-                       sendMessageToIDE(sendMessageString(IDE_DA_COMMUNICATION_TYPE_1,
-                                       IDE_DA_COMMUNICATION_TYPE_1_RECORD, CommonConstants.EMPTY));
+                       sendMessageToIDE(sendMessageString(IDE_DA_COMMUNICATION_TYPE_1, IDE_DA_COMMUNICATION_TYPE_1_RECORD,
+                                       CommonConstants.EMPTY));
                        SingletonFocusManager.setFocusToDA();
                        popupMessage(AnalyzerLabels.RE_TRACE_FORM_IDE);
                        return false;
@@ -327,6 +334,7 @@ public class IDECommunicator implements Runnable {
                        Logger.debug("wrong message format!!");
                        return;
                }
+               
                ToolbarArea.getInstance().setToolbarStartStopState(false);
 
                final String deviceName = new String(strMsg[MSG_INDEX_DEVICE].trim());
@@ -334,9 +342,18 @@ public class IDECommunicator implements Runnable {
                final String binaryOfTarget = new String(strMsg[MSG_INDEX_BINARY_OF_TARGET].trim());
                final String executablePath = new String(strMsg[MSG_INDEX_EXECUTABLE_PATH].trim());
                List<String> localPackagePathList = new ArrayList<String>();
+               int msg_index_interactive = MSG_INDEX_INTERACTIVE_INFO;
                for (int i = MSG_INDEX_LOCAL_PACKAGE_PATH; i < strMsg.length; i++) {
+                       msg_index_interactive = i;
+                       if (AnalyzerUtil.isInteger(strMsg[i].trim())) {
+                               break;
+                       }
                        localPackagePathList.add(new String(strMsg[i].trim()));
                }
+               /*
+                * make interactiveInfo, FunctionBodyInstrument
+                */
+               parseCheckpoints(strMsg, msg_index_interactive);
 
                if (isOpenWelcomeDlg()) {
                        Logger.debug("Start -AutoRun Waiting...");
@@ -426,8 +443,7 @@ public class IDECommunicator implements Runnable {
                                } else {
                                        // there is no appid
                                        Logger.error("there is no appid for library tracing");
-                                       popupMessage(UserErrorWarningLabels.ERROR_LIBTRACE_START
-                                                       + CommonConstants.NEW_LINE
+                                       popupMessage(UserErrorWarningLabels.ERROR_LIBTRACE_START + CommonConstants.NEW_LINE
                                                        + UserErrorWarningLabels.ERROR_NO_APPID_FOR_LAUNCHPAD);
                                        ToolbarArea.getInstance().setToolbarStartStopState(true);
                                        return;
@@ -460,6 +476,36 @@ public class IDECommunicator implements Runnable {
                }
        }
 
+       private void parseCheckpoints(String[] strMsg, int msg_index_interactive) {
+               InteractiveDataManager.getInstance().getVariableInfoList().clear();
+               FBIManager.getInstance().clear();
+               List<String> interactiveInfoList = new ArrayList<String>();
+               for (int i = msg_index_interactive; i < strMsg.length; i++) {
+                       interactiveInfoList.add(new String(strMsg[i].trim()));
+               }
+               if (interactiveInfoList.isEmpty() == false) {
+                       int msg_index = 0;
+                       int variableCount = Integer.parseInt(interactiveInfoList.get(msg_index++));
+                       String debugBinaryPath = interactiveInfoList.get(msg_index++);
+                       for (int i = 0; i < variableCount; i++) {
+                               String sourcePath = interactiveInfoList.get(msg_index++);
+                               String variableName = interactiveInfoList.get(msg_index++);
+                               int lineNum = Integer.parseInt(interactiveInfoList.get(msg_index++));
+                               int arrayCount = Integer.parseInt(interactiveInfoList.get(msg_index++));
+                               InteractiveInfo interactiveInfo = InteractiveParser.getInteractiveInfo(debugBinaryPath, sourcePath,
+                                               lineNum, variableName, arrayCount);
+                               if (interactiveInfo == null) {
+                                       Logger.warning("Invalid Interactive Info : " + sourcePath + ", " + lineNum + ", " + variableName + ", "
+                                                       + arrayCount);
+                                       continue;
+                               }
+                               InteractiveDataManager.getInstance().addVariableInfo(interactiveInfo);
+                               FunctionBodyInstrument fbi = FBIManager.makeSWAPProtocolMessage(interactiveInfo);
+                               FBIManager.getInstance().addFbi(fbi);
+                       }
+               }
+       }
+       
        private void popupMessageUnsupportedApp(final String appName) {
                Display.getDefault().syncExec(new Runnable() {
                        public void run() {
index 27c598b..525e6e4 100644 (file)
@@ -75,7 +75,7 @@ public class DBColumn {
        }       
 
        public String getColumnString() {
-               if (DBConstants.VARCHAR.equals(type)) {
+               if (DBConstants.VARCHAR.equals(type) || DBConstants.VARBINARY.equals(type)) {
                        return name + CommonConstants.SPACE + type + "(" + string_size + ")" + CommonConstants.SPACE + option;
                } else if (DBConstants.VARCHAR_ARRAY.equals(type)) {
                        return name + CommonConstants.SPACE + "VARCHAR(" + string_size + ") ARRAY"
index 26d49c1..33cc596 100644 (file)
@@ -97,6 +97,7 @@ public class DBConstants {
        public static final String INTEGER = "INTEGER";//$NON-NLS-1$
        public static final String LONG = "BIGINT";//$NON-NLS-1$
        public static final String FLOAT = "DOUBLE";
+       public static final String VARBINARY = "VARBINARY";
 
        // common column name
        public static final String COMMON_COLUMN_RID = "RID";//$NON-NLS-1$
index e0ac52c..3301f4e 100644 (file)
@@ -351,7 +351,15 @@ public class SqlConnectionManager {
                                                                        } else {
                                                                                prep.setFloat(i + 1, (Float) col);
                                                                        }
-                                                               } else {
+                                                               } else if (columnType.get(i).equals(DBConstants.VARBINARY)) {
+                                                                       if (col == null) {
+                                                                               Logger.error("VARBINARY column data is null !!");
+                                                                               isPrepared = false;
+                                                                               break;
+                                                                       } else {
+                                                                               prep.setBytes(i + 1, (byte[]) col);
+                                                                       }
+                                                               }else {
                                                                        Logger.error("not supported DB column type!!");
                                                                        isPrepared = false;
                                                                        break;
@@ -578,6 +586,9 @@ public class SqlConnectionManager {
                                                        } else if (rsMetaData.getColumnTypeName(i).contains(
                                                                        DBConstants.DBTYPE_INT1)) {
                                                                rowData.add(Byte.valueOf(rs.getByte(i)));
+                                                       } else if (rsMetaData.getColumnTypeName(i)
+                                                                       .contains(DBConstants.VARBINARY)) {
+                                                               rowData.add(rs.getBytes(i));
                                                        } else {
                                                                Logger.error("undefined type : " + rsMetaData.getColumnTypeName(i));
                                                        }
index 06bf931..00f4594 100755 (executable)
@@ -116,6 +116,7 @@ public class AnalyzerLabels extends NLS {
        public static String COOLBAR_AREA_NETWORK;
        public static String COOLBAR_AREA_KERNEL;
        public static String COOLBAR_AREA_OPENGLES;
+       public static String COOLBAR_AREA_INTERACTIVE;
 
        public static String COOLBAR_AREA_FILE_TOOLTIP;
        public static String COOLBAR_AREA_SUMMARY_TOOLTIP;
index 0b27886..8c16c19 100755 (executable)
@@ -81,6 +81,7 @@ COOLBAR_AREA_RANGE=Range
 COOLBAR_AREA_NETWORK=Network
 COOLBAR_AREA_KERNEL=Kernel
 COOLBAR_AREA_OPENGLES=OpenGL ES
+COOLBAR_AREA_INTERACTIVE=Interactive
 
 COOLBAR_AREA_TIMELINE_TOOLTIP=Timeline [Ctrl + 1]
 COOLBAR_AREA_FILE_TOOLTIP=File [Ctrl + 4]
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/InteractivePageLabels.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/InteractivePageLabels.java
new file mode 100644 (file)
index 0000000..d2aa802
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.nl;
+
+import org.eclipse.osgi.util.NLS;
+
+public class InteractivePageLabels extends NLS {
+       private static final String BUNDLE_NAME = "org.tizen.dynamicanalyzer.nl.InteractivePageLabels"; //$NON-NLS-1$
+
+       public static String INTERACTIVE_CHART;
+       public static String INTERACTIVE_CHART_VALUE;
+       public static String CHART_TITLE;
+       
+       public static String INTERACTIVE_TABLE_VIEW_TITLE;
+       public static String INTERACTIVE_TABLE_TIME;
+       public static String INTERACTIVE_TABLE_TYPE;
+       public static String INTERACTIVE_TABLE_VALUE;
+       
+       static {
+               // initialize resource bundle
+               NLS.initializeMessages(BUNDLE_NAME, InteractivePageLabels.class);
+       }
+
+       private InteractivePageLabels() {
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/InteractivePageLabels.properties b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/InteractivePageLabels.properties
new file mode 100644 (file)
index 0000000..49e2088
--- /dev/null
@@ -0,0 +1,8 @@
+INTERACTIVE_CHART=Interactive
+INTERACTIVE_CHART_VALUE=Value
+CHART_TITLE=Variable
+
+INTERACTIVE_TABLE_VIEW_TITLE=Interactive Profiling
+INTERACTIVE_TABLE_TIME=Time / name
+INTERACTIVE_TABLE_TYPE=Type
+INTERACTIVE_TABLE_VALUE=Value
\ No newline at end of file
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/FunctionBodyInstrument.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/FunctionBodyInstrument.java
new file mode 100644 (file)
index 0000000..19ee470
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.swap.channel.control;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.model.Streamable;
+import org.tizen.dynamicanalyzer.util.ByteUtil;
+
+public class FunctionBodyInstrument implements Streamable {
+       public final static int MAX_VARIABLE_COUNT = 255;       // TODO add checking routine in Ide-eplugin
+       
+       private long address;
+       private byte[] variableCount = new byte[1];     // TODO use byte not byte[]
+       private List<FunctionBodyInstrumentVariable> variables = new ArrayList<FunctionBodyInstrumentVariable>();
+       
+       public FunctionBodyInstrument(long address) {
+               this.address = address;
+       }
+       
+       public long getAddress() {
+               return address;
+       }
+       
+       public void addVariable(FunctionBodyInstrumentVariable variable) {
+               if (variables.size() == MAX_VARIABLE_COUNT) {
+                       return;
+               }
+               variables.add(variable);
+       }
+
+       @Override
+       public byte[] toByteStream() {
+               variableCount[0] = (byte)variables.size();
+               byte[] payLoad = ByteUtil.getByte(variableCount);
+               for (int i = 0; i < variables.size(); i++) {
+                       payLoad = ByteUtil.getByte(payLoad, variables.get(i).toByteStream());
+               }
+               return payLoad;
+       }
+
+       @Override
+       public void fromByteStream(byte[] input) {
+               // TODO Auto-generated method stub
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/FunctionBodyInstrumentStep.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/FunctionBodyInstrumentStep.java
new file mode 100644 (file)
index 0000000..782f669
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.swap.channel.control;
+
+import org.tizen.dynamicanalyzer.model.Streamable;
+import org.tizen.dynamicanalyzer.util.ByteUtil;
+
+public class FunctionBodyInstrumentStep implements Streamable {
+       private byte[] pointerOrder = new byte[1];
+       private long memoryOffset = 0;
+
+       public FunctionBodyInstrumentStep(byte pointerOrder, long memoryOffset) {
+               this.pointerOrder[0] = pointerOrder;
+               this.memoryOffset = memoryOffset; 
+       }
+
+       public byte[] getPointerOrder() {
+               return pointerOrder;
+       }
+
+       public void setPointerOrder(byte[] pointerOrder) {
+               this.pointerOrder = pointerOrder;
+       }
+
+       
+       public long getMemoryOffset() {
+               return memoryOffset;
+       }
+
+       public void setMemoryOffset(long memoryOffset) {
+               this.memoryOffset = memoryOffset;
+       }
+
+       @Override
+       public byte[] toByteStream() {
+               return ByteUtil.getByte(pointerOrder, memoryOffset);
+       }
+
+       @Override
+       public void fromByteStream(byte[] input) {
+               // TODO Auto-generated method stub
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/FunctionBodyInstrumentVariable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/channel/control/FunctionBodyInstrumentVariable.java
new file mode 100644 (file)
index 0000000..3a43180
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.swap.channel.control;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.model.Streamable;
+import org.tizen.dynamicanalyzer.util.ByteUtil;
+
+public class FunctionBodyInstrumentVariable implements Streamable {
+       private long variableID;
+       private long registerOffset;
+       private byte[] registerNum = new byte[1];
+       private int dataSize;
+       private byte[] stepsCount = new byte[1];
+       private List<FunctionBodyInstrumentStep> steps;
+
+       public FunctionBodyInstrumentVariable(long variableID, long registerOffset, byte registerNum, int dataSize,
+                       List<FunctionBodyInstrumentStep> steps) {
+               this.variableID = variableID;
+               this.registerOffset = registerOffset;
+               this.registerNum[0] = registerNum;
+               this.dataSize = dataSize;
+               this.steps = steps;
+       }
+
+       public long getRegisterOffset() {
+               return registerOffset;
+       }
+
+       public void setRegisterOffset(long registerOffset) {
+               this.registerOffset = registerOffset;
+       }
+
+       public byte[] getRegisterNum() {
+               return registerNum;
+       }
+
+       public void setRegisterNum(byte[] registerNum) {
+               this.registerNum = registerNum;
+       }
+
+       public int getDataSize() {
+               return dataSize;
+       }
+
+       public void setDataSize(int dataSize) {
+               this.dataSize = dataSize;
+       }
+
+       public void setVariableID(long variableID) {
+               this.variableID = variableID;
+       }
+
+       public long getVariableID() {
+               return variableID;
+       }
+
+       @Override
+       public byte[] toByteStream() {
+               stepsCount[0] = (byte)(steps.size());
+               byte[] payLoad = ByteUtil.getByte(variableID, registerOffset, registerNum, dataSize, stepsCount);
+               for (int i = 0; i < steps.size(); i++) {
+                       payLoad = ByteUtil.getByte(payLoad, steps.get(i).toByteStream());
+               }
+               return payLoad;
+       }
+
+       @Override
+       public void fromByteStream(byte[] input) {
+               // TODO Auto-generated method stub
+       }
+
+       @Override
+       public boolean equals(Object o) {
+               if (o instanceof FunctionBodyInstrumentVariable) {
+                       return (variableID == ((FunctionBodyInstrumentVariable) o).variableID);
+               }
+               return false;
+       }
+}
index 5406bd9..e43f933 100755 (executable)
@@ -30,8 +30,13 @@ import org.tizen.dynamicanalyzer.model.Streamable;
 import org.tizen.dynamicanalyzer.util.ByteUtil;
 
 public class FunctionInst implements Streamable {
+       public static byte PROBE_TYPE_COMMON = 0;
+       public static byte PROBE_TYPE_FBI = 1;
+       
        private long addr = 0;
+       private byte probeType = PROBE_TYPE_COMMON;
        private byte[] args = null;
+       private FunctionBodyInstrument fbi = null; 
 
        public long getAddr() {
                return addr;
@@ -41,6 +46,14 @@ public class FunctionInst implements Streamable {
                this.addr = addr;
        }
 
+       public byte getProbeType() {
+               return probeType;
+       }
+       
+       public void setProbeType(byte probeType) {
+               this.probeType = probeType;
+       }
+       
        public byte[] getArgs() {
                return args;
        }
@@ -49,15 +62,22 @@ public class FunctionInst implements Streamable {
                this.args = args;
        }
 
+       public void setFBI(FunctionBodyInstrument fbi) {
+               this.fbi = fbi;
+       }
+       
        @Override
        public byte[] toByteStream() {
-               return ByteUtil.getByte(addr, args);
+               if (probeType == PROBE_TYPE_FBI) {      // Function body instrumentation probe
+                       return ByteUtil.getByte(addr, new byte[]{ probeType }, fbi.toByteStream());
+               } else {        // Common probe
+                       return ByteUtil.getByte(addr, new byte[]{ probeType }, args);
+               }
        }
 
        @Override
        public void fromByteStream(byte[] input) {
                // TODO Auto-generated method stub
-
        }
 
        // FIXME: black list hard coded.
index 85d9c5e..d2cc62d 100644 (file)
@@ -43,6 +43,7 @@ public class DataChannelConstants {
        public final static int MSG_PROCESS_MAP = 0x0012;
        public final static int MSG_PROCESS_UNMAP = 0x0013;
        public final static int MSG_PROCESS_COMM = 0x0014;
+       public final static int MSG_FUNCTION_BODY = 0x000A;
        
        /* Custom Message Type */
        public final static int MSG_FUCNTION_ENTRY_EXIT = 0x0900;
index 04c88dd..ea148d9 100755 (executable)
@@ -29,11 +29,11 @@ package org.tizen.dynamicanalyzer.swap.communicator;
 
 import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_BINARY_INFO_ACK;
 import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_CONFIG_ACK;
+import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_GET_PROCESS_ADD_INFO_ACK;
 import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_KEEP_ALIVE_ACK;
 import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_START_ACK;
 import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_STOP_ACK;
 import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_TARGET_INFO_ACK;
-import static org.tizen.dynamicanalyzer.common.AnalyzerConstants.MSG_GET_PROCESS_ADD_INFO_ACK;
 import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
 import static org.tizen.dynamicanalyzer.constant.CommonConstants.LONG_SIZE;
 
@@ -81,6 +81,7 @@ import org.tizen.dynamicanalyzer.project.DeviceStatusInfo;
 import org.tizen.dynamicanalyzer.project.PackageInfo;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.channel.control.ApplicationInst;
+import org.tizen.dynamicanalyzer.swap.channel.control.FunctionBodyInstrument;
 import org.tizen.dynamicanalyzer.swap.channel.control.FunctionInst;
 import org.tizen.dynamicanalyzer.swap.channel.control.RunTimeConfiguration;
 import org.tizen.dynamicanalyzer.swap.channel.control.UserSpaceInst;
@@ -91,6 +92,7 @@ import org.tizen.dynamicanalyzer.swap.model.data.LogDataUtils;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
 import org.tizen.dynamicanalyzer.ui.info.screenshot.EmulatorScreenshot;
 import org.tizen.dynamicanalyzer.ui.info.screenshot.SocketClient;
+import org.tizen.dynamicanalyzer.ui.interactive.model.FBIManager;
 import org.tizen.dynamicanalyzer.ui.page.UpdateViewTimer;
 import org.tizen.dynamicanalyzer.ui.toolbar.StartProcessManager;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
@@ -215,7 +217,6 @@ public class Communicator30 extends BaseCommunicator {
                int length = rear.length;
 
                byte[] ret = ByteUtil.getByte(AnalyzerConstants.MSG_START_SWAP, length, rear);
-
                Logger.debug("print start message");
                // ByteUtils.printByteArrayForStart(ret);
 
@@ -338,7 +339,17 @@ public class Communicator30 extends BaseCommunicator {
                                        // this means there is no function inst.
                                        continue;
                                }
-
+                               
+                               List<FunctionBodyInstrument> fbiList = FBIManager.getInstance().getFbiList();
+                               Logger.debug("fbiList.size() : " + fbiList.size());
+                               for (int i = 0; i < fbiList.size(); i++) {
+                                       FunctionInst functionInst = new FunctionInst();
+                                       functionInst.setAddr(fbiList.get(i).getAddress());
+                                       functionInst.setProbeType(FunctionInst.PROBE_TYPE_FBI);
+                                       functionInst.setFBI(fbiList.get(i));
+                                       functionInstList.add(functionInst);
+                               }
+                               
                                ApplicationInst appInst = new ApplicationInst();
 
                                // TODO : make sure that first app of package is main app
index 5c62ccd..1a1ff40 100755 (executable)
@@ -524,6 +524,7 @@ public class MessageParser {
                case DataChannelConstants.MSG_CONTEXT_SWITCH_ENTRY:
                case DataChannelConstants.MSG_CONTEXT_SWITCH_EXIT:
                case DataChannelConstants.MSG_DATA_RECORD:
+               case DataChannelConstants.MSG_FUNCTION_BODY:
                        if (AnalyzerManager.isProcessInfoArrived()) {
                                // make log
                                log = LogDataFactory.createInstance(data);
index b72ae97..ba97e0b 100755 (executable)
@@ -42,6 +42,7 @@ import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
 import org.tizen.dynamicanalyzer.swap.model.data.ContextSwitchData;
+import org.tizen.dynamicanalyzer.swap.model.data.FunctionBodyInstrumentData;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
 import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
 import org.tizen.dynamicanalyzer.swap.model.data.ReplayData;
@@ -216,6 +217,8 @@ public class SWAPLogParser implements Runnable {
                                pushLog(log, logPack);
                        } else if (log instanceof ContextSwitchData) {
                                pushLog(log, logPack);
+                       } else if (log instanceof FunctionBodyInstrumentData) {
+                               pushLog(log, logPack);
                        } else {
                                if (log instanceof ScreenShotData) {
                                        // get image file from target or ecs
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/FunctionBodyInstrumentData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/FunctionBodyInstrumentData.java
new file mode 100644 (file)
index 0000000..9e0ff11
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.swap.model.data;
+
+import static org.tizen.dynamicanalyzer.constant.CommonConstants.INT_SIZE;
+
+import org.tizen.dynamicanalyzer.util.ByteUtil;
+import org.tizen.dynamicanalyzer.util.UnsignedInt;
+
+public class FunctionBodyInstrumentData extends LogData {
+       UnsignedInt variableID;
+       UnsignedInt size;
+       byte[] data;
+
+       public FunctionBodyInstrumentData() {
+       }
+
+       public boolean makeData(byte[] data) {
+               super.makeData(data);
+
+               this.variableID = ByteUtil.toUnsignedInt(data, index);
+               index += INT_SIZE;
+               this.size = ByteUtil.toUnsignedInt(data, index);
+               index += INT_SIZE;
+               this.data = ByteUtil.toBytesN(data, index, (int) (size.getValue()));
+               index += (int) (size.getValue());
+
+               return true;
+       }
+
+       public UnsignedInt getVariableID() {
+               return variableID;
+       }
+
+       public void setVariableID(UnsignedInt variableID) {
+               this.variableID = variableID;
+       }
+
+       public UnsignedInt getSize() {
+               return size;
+       }
+
+       public void setSize(UnsignedInt size) {
+               this.size = size;
+       }
+
+       public byte[] getData() {
+               return data;
+       }
+
+       public void setData(byte[] data) {
+               this.data = data;
+       }
+
+       @Override
+       public int getPid() {
+               return 0;
+       }
+}
index 41c74aa..449b7ee 100644 (file)
@@ -34,6 +34,7 @@ import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.M
 import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_DATA_SYSTEM;
 import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_FUNCTION_ENTRY;
 import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_FUNCTION_EXIT;
+import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_FUNCTION_BODY;
 import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_PROBE_CUSTOM;
 import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_PROBE_FILE;
 import static org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants.MSG_PROBE_GLES20;
@@ -87,6 +88,7 @@ public class LogDataFactory {
                logIDList.add(MSG_DATA_SAMPLE);
                logIDList.add(MSG_CONTEXT_SWITCH_ENTRY);
                logIDList.add(MSG_CONTEXT_SWITCH_EXIT);
+               logIDList.add(MSG_FUNCTION_BODY);
        }
 
        public static LogData createInstance(byte[] data) {
@@ -158,6 +160,9 @@ public class LogDataFactory {
                case MSG_CONTEXT_SWITCH_EXIT:
                        output = new ContextSwitchData();
                        break;
+               case MSG_FUNCTION_BODY:
+                       output = new FunctionBodyInstrumentData();
+                       break;
                default:
                        return null;
                }
index 9666225..13b20d4 100644 (file)
@@ -42,6 +42,7 @@ import org.tizen.dynamicanalyzer.ui.page.ScreenshotTabComposite;
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
 import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.ScreenshotChart;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
 import org.tizen.dynamicanalyzer.util.Logger;
@@ -61,8 +62,7 @@ import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
 import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
 
-public class TimelineChartMouseEventListener extends MouseAdapter implements
-               MouseMoveListener {
+public class TimelineChartMouseEventListener extends MouseAdapter implements MouseMoveListener {
        private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
        private DAPopupMenu menu;
        private DATimeline timeline;
@@ -79,8 +79,7 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
        public void mouseDown(MouseEvent e) {
                DAChart chart = (DAChart) e.widget;
                DAChartPlot plot = chart.getPlot();
-               DAChartPlotMarker marker = plot.getMarkers()
-                               .get(SELECTION_MARKER_INDEX);
+               DAChartPlotMarker marker = plot.getMarkers().get(SELECTION_MARKER_INDEX);
                if (!(marker instanceof DAChartPlotIntervalMarker)) {
                        return;
                }
@@ -101,8 +100,7 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
                                return;
                        }
 
-                       if (eventTime * TimelineConstants.MEGA_DOUBLE <= ToolbarArea
-                                       .getInstance().getTime()) {
+                       if (eventTime * TimelineConstants.MEGA_DOUBLE <= ToolbarArea.getInstance().getTime()) {
                                startItem.setEnabled(true);
                                endItem.setEnabled(true);
                                analysisItem.setEnabled(rangeDataManager.isAnalyzable());
@@ -128,22 +126,16 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
                                List<Integer> endIndexList = new ArrayList<Integer>();
 
                                for (DAChartSeries chartSeries : chart.getSeriesList()) {
-                                       int startIndex = chartSeries
-                                                       .getNextIndexByXvalue(intervalMarker.getStartVal());
-                                       int endIndex = chartSeries
-                                                       .getPrevIndexByXvalue(intervalMarker.getEndVal());
+                                       int startIndex = chartSeries.getNextIndexByXvalue(intervalMarker.getStartVal());
+                                       int endIndex = chartSeries.getPrevIndexByXvalue(intervalMarker.getEndVal());
 
                                        startIndexList.add(startIndex);
                                        endIndexList.add(endIndex + 1);
                                }
-                               DAPopupMenuItem eventListItem = menu.getItems().get(
-                                               menu.getItems().size() - 1);
-                               ((UIEventChartContextMenuItem) eventListItem)
-                                               .setChartSeriesList(chart.getSeriesList());
-                               ((UIEventChartContextMenuItem) eventListItem)
-                                               .setStartIndexList(startIndexList);
-                               ((UIEventChartContextMenuItem) eventListItem)
-                                               .setEndIndexList(endIndexList);
+                               DAPopupMenuItem eventListItem = menu.getItems().get(menu.getItems().size() - 1);
+                               ((UIEventChartContextMenuItem) eventListItem).setChartSeriesList(chart.getSeriesList());
+                               ((UIEventChartContextMenuItem) eventListItem).setStartIndexList(startIndexList);
+                               ((UIEventChartContextMenuItem) eventListItem).setEndIndexList(endIndexList);
 
                                eventListItem.setEnabled(true);
                        }
@@ -151,8 +143,8 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
                        return;
                }
 
-               DATabComposite timelineTabComp = (DATabComposite) AnalyzerUtil.getView(
-                               TimelinePage.pageID, ScreenshotTabComposite.tabID);
+               DATabComposite timelineTabComp = (DATabComposite) AnalyzerUtil.getView(TimelinePage.pageID,
+                               ScreenshotTabComposite.tabID);
                ScreenshotView screenshotView = (ScreenshotView) timelineTabComp
                                .getView(ScreenshotTabComposite.screenshotViewID);
                screenshotView.setLatestButtonEnable(true);
@@ -167,17 +159,13 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
                        if (series != null) {
                                int index = series.getPrevIndexByXvalue(eventTime);
                                if (index >= 0 && index < series.getSeriesItemList().size()) {
-                                       DAChartSeriesItem item = series.getSeriesItemList().get(
-                                                       index);
+                                       DAChartSeriesItem item = series.getSeriesItemList().get(index);
                                        double itemTime = item.getX();
                                        int imageWidth = item.getImage().getBounds().width;
-                                       double imageRightTime = itemTime
-                                                       + plot.getXFromXPixcel(imageWidth)
-                                                       - plot.getVisibleStartX();
+                                       double imageRightTime = itemTime + plot.getXFromXPixcel(imageWidth) - plot.getVisibleStartX();
 
                                        if (eventTime > itemTime && eventTime < imageRightTime) {
-                                               if (bShift == true
-                                                               && intervalMarker.getStartVal() != -1) {
+                                               if (bShift == true && intervalMarker.getStartVal() != -1) {
                                                        if (baseTime > eventTime) {
                                                                intervalMarker.setInterval(eventTime, baseTime);
                                                        } else {
@@ -188,8 +176,7 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
                                                        baseTime = itemTime;
                                                }
                                        } else {
-                                               if (bShift == true
-                                                               && intervalMarker.getStartVal() != -1) {
+                                               if (bShift == true && intervalMarker.getStartVal() != -1) {
                                                        if (baseTime > eventTime) {
                                                                intervalMarker.setInterval(eventTime, baseTime);
                                                        } else {
@@ -213,11 +200,12 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
                                        }
                                }
                        }
-                       DAChart chartWidget = ScreenshotChart.getInstance().getChart();
-                       DAScreenshotChartPlot screenshotChartPlot = (DAScreenshotChartPlot) chartWidget
-                                       .getPlot();
-                       screenshotChartPlot.setSelectedImageIndex(getHighlightedImageIndex(
-                                       screenshotChartPlot, chartWidget.getSeriesList(), e.x));
+
+                       DAChart chartWidget = ((ScreenshotChart) TimelineChartManager.getInstance().getChartInstance(
+                                       TimelineConstants.CHART_TYPE_SCREENSHOT)).getChart();
+                       DAScreenshotChartPlot screenshotChartPlot = (DAScreenshotChartPlot) chartWidget.getPlot();
+                       screenshotChartPlot.setSelectedImageIndex(getHighlightedImageIndex(screenshotChartPlot,
+                                       chartWidget.getSeriesList(), e.x));
                } else {
                        if (bShift == true && intervalMarker.getStartVal() != -1) {
                                if (baseTime > eventTime) {
@@ -242,8 +230,7 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
 
                DAChart chart = (DAChart) e.widget;
                DAChartPlot plot = chart.getPlot();
-               DAChartPlotMarker marker = plot.getMarkers()
-                               .get(SELECTION_MARKER_INDEX);
+               DAChartPlotMarker marker = plot.getMarkers().get(SELECTION_MARKER_INDEX);
                if (!(marker instanceof DAChartPlotIntervalMarker)) {
                        return;
                }
@@ -261,8 +248,7 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
                        markerEndTime = eventTime;
                }
 
-               double toolbarTime = ToolbarArea.getInstance().getTime()
-                               / TimelineConstants.MEGA_DOUBLE;
+               double toolbarTime = ToolbarArea.getInstance().getTime() / TimelineConstants.MEGA_DOUBLE;
 
                if (markerStartTime < 0) {
                        markerStartTime = 0;
@@ -279,36 +265,27 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
                if (plot instanceof DAScreenshotChartPlot) {
                        DAChartSeries series = chart.getSeries(0);
                        if (series != null) {
-                               int index = series.getPrevIndexByXvalue(plot
-                                               .getXFromXPixcel(e.x));
+                               int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(e.x));
                                if (index >= 0 && index < series.getSeriesItemList().size()) {
-                                       DAChartSeriesItem item = series.getSeriesItemList().get(
-                                                       index);
+                                       DAChartSeriesItem item = series.getSeriesItemList().get(index);
                                        double itemTime = item.getX();
                                        int imageWidth = item.getImage().getBounds().width;
-                                       double imageRightTime = itemTime
-                                                       + plot.getXFromXPixcel(imageWidth)
-                                                       - plot.getVisibleStartX();
+                                       double imageRightTime = itemTime + plot.getXFromXPixcel(imageWidth) - plot.getVisibleStartX();
 
-                                       if (markerEndTime > itemTime
-                                                       && markerEndTime < imageRightTime) {
+                                       if (markerEndTime > itemTime && markerEndTime < imageRightTime) {
                                                intervalMarker.setInterval(markerStartTime, itemTime);
                                        } else {
                                                if (markerEndTime <= plot.getVisibleEndX()) {
-                                                       intervalMarker.setInterval(markerStartTime,
-                                                                       markerEndTime);
+                                                       intervalMarker.setInterval(markerStartTime, markerEndTime);
                                                } else {
-                                                       intervalMarker.setInterval(markerStartTime,
-                                                                       plot.getVisibleEndX());
+                                                       intervalMarker.setInterval(markerStartTime, plot.getVisibleEndX());
                                                }
                                        }
                                } else {
                                        if (markerEndTime <= plot.getVisibleEndX()) {
-                                               intervalMarker.setInterval(markerStartTime,
-                                                               markerEndTime);
+                                               intervalMarker.setInterval(markerStartTime, markerEndTime);
                                        } else {
-                                               intervalMarker.setInterval(markerStartTime,
-                                                               plot.getVisibleEndX());
+                                               intervalMarker.setInterval(markerStartTime, plot.getVisibleEndX());
                                        }
                                }
                        }
@@ -316,21 +293,18 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
                        if (markerEndTime <= plot.getVisibleEndX()) {
                                intervalMarker.setInterval(markerStartTime, markerEndTime);
                        } else {
-                               intervalMarker.setInterval(markerStartTime,
-                                               plot.getVisibleEndX());
+                               intervalMarker.setInterval(markerStartTime, plot.getVisibleEndX());
                        }
                }
 
-               sendSelectionTimes(intervalMarker.getStartVal(),
-                               intervalMarker.getEndVal());
+               sendSelectionTimes(intervalMarker.getStartVal(), intervalMarker.getEndVal());
        }
 
        @Override
        public void mouseMove(MouseEvent e) {
                DAChart chart = (DAChart) e.widget;
                DAChartPlot plot = chart.getPlot();
-               DAChartPlotMarker marker = plot.getMarkers()
-                               .get(SELECTION_MARKER_INDEX);
+               DAChartPlotMarker marker = plot.getMarkers().get(SELECTION_MARKER_INDEX);
                if (!(marker instanceof DAChartPlotIntervalMarker)) {
                        Logger.debug("mouseMove !IntervalMarker");
                        return;
@@ -366,24 +340,20 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
                }
 
                double oldStartVal = tooltip.getStartVal();
-               double newStartVal = getTooltipStartX(plot, chart.getSeriesList(), e.x,
-                               newYPosRatio);
+               double newStartVal = getTooltipStartX(plot, chart.getSeriesList(), e.x, newYPosRatio);
 
                if (oldStartVal != newStartVal) {
                        tooltip.setStartVal(newStartVal);
                }
 
                if (plot instanceof DAScreenshotChartPlot) {
-                       ((DAScreenshotChartPlot) plot)
-                                       .setHighlightedImageIndex(getHighlightedImageIndex(e));
+                       ((DAScreenshotChartPlot) plot).setHighlightedImageIndex(getHighlightedImageIndex(e));
                        chart.redraw();
                } else if (plot instanceof DAUIEventChartPlot) {
                        DAUIEventChartPlot uiEventChartPlot = (DAUIEventChartPlot) plot;
-                       int seriesIndex = (int) (newYPosRatio * chart.getSeriesList()
-                                       .size());
+                       int seriesIndex = (int) (newYPosRatio * chart.getSeriesList().size());
 
-                       uiEventChartPlot.setHighlightedEventIndexX(chart.getSeriesList()
-                                       .get(seriesIndex)
+                       uiEventChartPlot.setHighlightedEventIndexX(chart.getSeriesList().get(seriesIndex)
                                        .getPrevIndexByXvalue(plot.getXFromXPixcel(e.x)));
                        uiEventChartPlot.setHighlightedEventIndexY(seriesIndex);
                        chart.redraw();
@@ -407,12 +377,10 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
                        startTime = 0;
                }
                AnalyzerManager.getCurrentPage().updateView(
-                               new DASelectionData(TimelinePage.timelineViewID, startTime,
-                                               endTime, null, null));
+                               new DASelectionData(TimelinePage.timelineViewID, startTime, endTime, null, null));
        }
 
-       private int getHighlightedImageIndex(DAChartPlot plot,
-                       List<DAChartSeries> seriesList, int x) {
+       private int getHighlightedImageIndex(DAChartPlot plot, List<DAChartSeries> seriesList, int x) {
                if (plot instanceof DAScreenshotChartPlot) {
                        DAChartSeries series = seriesList.get(0);
 
@@ -422,8 +390,7 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
                }
        }
 
-       private double getTooltipStartX(DAChartPlot plot,
-                       List<DAChartSeries> seriesList, int x, double yPosRatio) {
+       private double getTooltipStartX(DAChartPlot plot, List<DAChartSeries> seriesList, int x, double yPosRatio) {
                double ret = -1;
                for (int i = 0; i < seriesList.size(); i++) {
                        if (plot instanceof DAUIEventChartPlot) {
@@ -465,8 +432,7 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements
                        screenshotWidth /= 2;
                }
 
-               if (e.x < plot.getXPixcelFromX(item.getX()) + screenshotWidth
-                               && e.x >= plot.getXPixcelFromX(item.getX())) {
+               if (e.x < plot.getXPixcelFromX(item.getX()) + screenshotWidth && e.x >= plot.getXPixcelFromX(item.getX())) {
                        return index;
                } else {
                        return -1;
index d7e9b89..ac2830b 100644 (file)
@@ -128,6 +128,8 @@ public class CallstackTable extends DATableComposite {
                                seqNum = (Long) calltraceData.get(FunctionEntryDBTable.COLUMN.SEQ.index);
                                pid = (Integer) calltraceData.get(FunctionEntryDBTable.COLUMN.PID.index);
                                time = (Long) calltraceData.get(FunctionEntryDBTable.COLUMN.STARTTIME.index);
+                       } else if (tableData.getType() == AnalyzerConstants.TYPE_TABLE_INTERACTIVE) {
+                               return; // TODO
                        } else { // in case table has LogData
                                LogData logData = tableData.getLogData();
                                seqNum = logData.getSeq();
index 4b8fb73..f4ab8a1 100644 (file)
@@ -397,11 +397,13 @@ public class ScreenshotView extends DAViewComposite {
                        if (table.getSelectionCount() > 0) {
                                GridItem[] selection = table.getSelection();
                                LogData startData = ((DATableDataFormat) selection[0].getData()).getLogData();
-                               long time = startData.getTime();
-                               if (isStartTime) {
-                                       setStartTime(time);
-                               } else {
-                                       setSelectTime(time);
+                               if (startData != null) {                // TODO Interactive page is null
+                                       long time = startData.getTime();
+                                       if (isStartTime) {
+                                               setStartTime(time);
+                                       } else {
+                                               setSelectTime(time);
+                                       }
                                }
                        }
                }
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/InteractivePage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/InteractivePage.java
new file mode 100644 (file)
index 0000000..5beea1c
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry;
+import org.tizen.dynamicanalyzer.ui.interactive.chart.InteractiveChartView;
+import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveDataManager;
+import org.tizen.dynamicanalyzer.ui.interactive.table.InteractiveTableView;
+import org.tizen.dynamicanalyzer.ui.page.ScreenshotTabComposite;
+import org.tizen.dynamicanalyzer.ui.timeline.calltrace.CallTraceView;
+import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
+
+public class InteractivePage extends DAPageComposite {
+       public static final String pageID = InteractivePage.class.getName();
+       public static final String chartViewID = InteractiveChartView.class.getName();
+       public static final String listViewID = InteractiveTableView.class.getName();
+
+       SashForm baseForm;
+       SashForm leftForm;
+       SashForm rightForm;
+
+       public InteractivePage(Composite parent, int style) {
+               super(parent, style);
+               setTitle(AnalyzerLabels.COOLBAR_AREA_INTERACTIVE);
+               this.setLayout(new FillLayout());
+
+               baseForm = new SashForm(this, SWT.HORIZONTAL);
+               baseForm.setLayout(new FillLayout());
+
+               leftForm = new SashForm(baseForm, SWT.VERTICAL);
+               InteractiveChartView chartView = new InteractiveChartView(leftForm, SWT.NONE);
+               addView(chartView);
+               InteractiveTableView tableView = new InteractiveTableView(leftForm, SWT.NONE);
+               addView(tableView);
+
+               leftForm.setWeights(new int[] { 60, 40 });
+
+               rightForm = new SashForm(baseForm, SWT.VERTICAL);
+               ScreenshotTabComposite tabView = new ScreenshotTabComposite(rightForm,
+                               SWT.NONE, InteractivePage.pageID);
+               tabView.setObservingViews(ScreenshotTabComposite.screenshotViewID,
+                               new String[] { InteractivePage.chartViewID });
+               tabView.setObservingViews(ScreenshotTabComposite.screenshotViewID,
+                               new String[] { InteractivePage.listViewID });
+               addView(tabView);
+
+               CallTraceView apiListView = new CallTraceView(rightForm, SWT.NONE);
+               addView(apiListView);
+
+               rightForm.setWeights(new int[] { 50, 50 });
+               baseForm.setWeights(new int[] { 75, 25 });
+
+               baseForm.setSashWidth(AnalyzerConstants.SASH_WIDTH);
+               leftForm.setSashWidth(AnalyzerConstants.SASH_WIDTH);
+               rightForm.setSashWidth(AnalyzerConstants.SASH_WIDTH);
+               
+               DataManagerRegistry.registerPageDataManager(InteractiveDataManager.getInstance());
+       }
+
+       @Override
+       protected void onResized(int width, int height) {
+               int wrate = (int) (ScreenshotTabComposite.DEFAULT_WIDTH * 100 / width);
+               int hrate = (int) (ScreenshotTabComposite.DEFAULT_HEIGHT * 100 / height);
+               wrate = (wrate > 100) ? 100 : wrate;
+               hrate = (hrate > 100) ? 100 : hrate;
+
+               if ((wrate > (100 - 37)) || hrate > 100) {
+                       return;
+               }
+
+               baseForm.setWeights(new int[] { 100 - wrate, wrate });
+               rightForm.setWeights(new int[] { hrate, 100 - hrate });
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveChart.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveChart.java
new file mode 100644 (file)
index 0000000..60f331a
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.chart;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.nl.InteractivePageLabels;
+import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.ui.common.PopupAnalysisMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.PopupClearMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.PopupEndMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.PopupFromSelectionMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.PopupStartMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveUIData;
+import org.tizen.dynamicanalyzer.ui.interactive.model.InteractiveInfo;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot.AutoRangeType;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
+
+public class InteractiveChart {
+       private InteractiveInfo interactiveInfo;
+       private DAChart chartWidget;
+       private DAPopupMenu popupMenu;
+       DAChartSeries chartSeries;
+
+       public InteractiveChart(InteractiveInfo interactiveInfo) {
+               this.interactiveInfo = interactiveInfo;
+               chartSeries = new DAChartSeries(InteractivePageLabels.INTERACTIVE_CHART_VALUE, DAChartSeries.SERIES_STYLE_BAR,
+                               ColorResources.SERIES_COLOR_INTERACTIVE);
+       }
+
+       public DAChartBoardItem createBoardItem(final DAChartBoard chartBoard) {
+               DAChartBoardItem item = new DAChartBoardItem(chartBoard, InteractivePageLabels.CHART_TITLE);
+               item.setData(interactiveInfo);
+               chartWidget = item.getChart();
+
+               setChartStyle();
+               popupMenu = new DAPopupMenu(chartWidget);
+               initPopupMenu(chartBoard, popupMenu);
+
+               chartWidget.addSeries(chartSeries);
+               return item;
+       }
+
+       public InteractiveInfo getInteractiveInfo() {
+               return interactiveInfo;
+       }
+
+       public DAChart getChartWidget() {
+               return chartWidget;
+       }
+
+       public DAChartSeries getChartSeries() {
+               return this.chartSeries;
+       }
+
+       private void initPopupMenu(DAChartBoard chartBoard, DAPopupMenu popupMenu) {
+               popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
+               DAPopupMenuItem startItem = new DAPopupMenuItem(popupMenu);
+               startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);
+               startItem.addListener(new PopupStartMenuItemClickListener(startItem, chartBoard));
+
+               DAPopupMenuItem endItem = new DAPopupMenuItem(popupMenu);
+               endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END);
+               endItem.addListener(new PopupEndMenuItemClickListener(endItem, chartBoard));
+
+               DAPopupMenuItem fromSelectionItem = new DAPopupMenuItem(popupMenu);
+               fromSelectionItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+               fromSelectionItem.addListener(new PopupFromSelectionMenuItemClickListener(fromSelectionItem, chartBoard));
+
+               DAPopupMenuItem analysisItem = new DAPopupMenuItem(popupMenu);
+               analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
+               analysisItem.addListener(new PopupAnalysisMenuItemClickListener());
+
+               DAPopupMenuItem clearItem = new DAPopupMenuItem(popupMenu);
+               clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);
+               clearItem.addListener(new PopupClearMenuItemClickListener());
+       }
+
+       private void setChartStyle() {
+               DAChartPlot plot = chartWidget.getPlot();
+               if (null == plot) {
+                       return;
+               }
+               plot.setBackgroundImage(ImageResources.BG_GRADIENT);
+               plot.setAutoHeightRange(AutoRangeType.SEMI_AUTO);
+               DAChartPlotTooltip tooltip = new DAChartPlotTooltip(-1);
+               tooltip.setFont(FontResources.CHART_TOOLTIP_FONT);
+               plot.setTooltip(tooltip);
+               plot.setAxisFont(FontResources.CHART_AXIS_FONT);
+       }
+
+       public DAPopupMenu getPopupMenu() {
+               return popupMenu;
+       }
+
+       public void clear() {
+               List<DAChartSeries> seriesList = chartWidget.getSeriesList();
+               for (DAChartSeries series : seriesList) {
+                       series.clear();
+               }
+       }
+       
+       public void inputChartSeries(List<InteractiveUIData> parsedDataList) {
+               for (int i = 0; i < parsedDataList.size(); i++) {
+                       InteractiveUIData valueData = parsedDataList.get(i);
+                       double chartTime = valueData.getTime() / TimelineConstants.MEGA_DOUBLE;
+                       String tooltipText = valueData.getChartTooltipString();
+                       chartSeries.addSeriesItem(new DAChartSeriesItem(chartTime, 0, tooltipText));
+               }
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveChartMouseEventListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveChartMouseEventListener.java
new file mode 100644 (file)
index 0000000..4b5ce9d
--- /dev/null
@@ -0,0 +1,280 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.chart;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.widgets.Canvas;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.DASelectionData;
+import org.tizen.dynamicanalyzer.ui.info.screenshot.ScreenshotView;
+import org.tizen.dynamicanalyzer.ui.interactive.InteractivePage;
+import org.tizen.dynamicanalyzer.ui.page.ScreenshotTabComposite;
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.util.Logger;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotMarker;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
+import org.tizen.dynamicanalyzer.widgets.da.view.DATabComposite;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
+import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
+
+public class InteractiveChartMouseEventListener extends MouseAdapter implements MouseMoveListener {
+       private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
+       private DAPopupMenu menu;
+       private DATimeline timeline;
+       private DAChartBoard chartBoard;
+       private double baseTime = TimelineConstants.NOT_INITED;
+
+       private static final int SELECTION_MARKER_INDEX = 0;
+
+       public InteractiveChartMouseEventListener(DAPopupMenu menu, DATimeline timeline, DAChartBoard chartBoard) {
+               this.menu = menu;
+               this.timeline = timeline;
+               this.chartBoard = chartBoard;
+       }
+
+       @Override
+       public void mouseDown(MouseEvent e) {
+               DAChart chart = (DAChart) e.widget;
+               DAChartPlot plot = chart.getPlot();
+               DAChartPlotMarker marker = plot.getMarkers().get(SELECTION_MARKER_INDEX);
+               if (!(marker instanceof DAChartPlotIntervalMarker)) {
+                       return;
+               }
+               DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker;
+
+               double eventTime = plot.getXFromXPixcel(e.x);
+
+               if (e.button == 3) {            // mouse right click
+                       List<DAPopupMenuItem> itemList = menu.getItems();
+                       DAPopupMenuItem startItem = itemList.get(0);
+                       DAPopupMenuItem endItem = itemList.get(1);
+                       DAPopupMenuItem fromSelectionItem = itemList.get(2);
+                       DAPopupMenuItem analysisItem = itemList.get(3);
+                       DAPopupMenuItem clearItem = itemList.get(4);
+
+                       if (ToolbarArea.getInstance() == null) {
+                               Logger.debug("toolbar area is null");//$NON-NLS-1$
+                               return;
+                       }
+
+                       if (eventTime * TimelineConstants.MEGA_DOUBLE <= ToolbarArea.getInstance().getTime()) {
+                               startItem.setEnabled(true);
+                               endItem.setEnabled(true);
+                               analysisItem.setEnabled(rangeDataManager.isAnalyzable());
+                               clearItem.setEnabled(rangeDataManager.isBeingAnalyzed());
+
+                               startItem.setDoubleData(eventTime);
+                               endItem.setDoubleData(eventTime);
+                       } else {
+                               startItem.setEnabled(false);
+                               endItem.setEnabled(false);
+                               analysisItem.setEnabled(rangeDataManager.isAnalyzable());
+                               clearItem.setEnabled(rangeDataManager.isBeingAnalyzed());
+                       }
+
+                       if (intervalMarker.getStartVal() != intervalMarker.getEndVal()) {
+                               fromSelectionItem.setEnabled(true);
+                       } else {
+                               fromSelectionItem.setEnabled(false);
+                       }
+                       return;
+               }
+
+               DATabComposite interactiveTabComp = (DATabComposite) AnalyzerUtil.getView(InteractivePage.pageID,
+                               ScreenshotTabComposite.tabID);
+               ScreenshotView screenshotView = (ScreenshotView) interactiveTabComp
+                               .getView(ScreenshotTabComposite.screenshotViewID);
+               screenshotView.setLatestButtonEnable(true);
+
+               boolean bShift = false;
+               if ((e.stateMask & SWT.SHIFT) != 0) {
+                       bShift = true;
+               }
+
+               if (bShift == true && intervalMarker.getStartVal() != -1) {
+                       if (baseTime > eventTime) {
+                               intervalMarker.setInterval(eventTime, baseTime);
+                       } else {
+                               intervalMarker.setInterval(baseTime, eventTime);
+                       }
+               } else {
+                       intervalMarker.setInterval(eventTime, eventTime);
+                       baseTime = eventTime;
+               }
+
+               chart.redraw();
+       }
+
+       @Override
+       public void mouseUp(MouseEvent e) {
+               if (e.button == 3) {            // mouse right click
+                       return;
+               }
+
+               DAChart chart = (DAChart) e.widget;
+               DAChartPlot plot = chart.getPlot();
+               DAChartPlotMarker marker = plot.getMarkers().get(SELECTION_MARKER_INDEX);
+               if (!(marker instanceof DAChartPlotIntervalMarker)) {
+                       return;
+               }
+               DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker;
+
+               double eventTime = plot.getXFromXPixcel(e.x);
+               double markerStartTime;
+               double markerEndTime;
+
+               if (intervalMarker.getStartVal() >= eventTime) {
+                       markerStartTime = eventTime;
+                       markerEndTime = intervalMarker.getEndVal();
+               } else {
+                       markerStartTime = intervalMarker.getStartVal();
+                       markerEndTime = eventTime;
+               }
+
+               double toolbarTime = ToolbarArea.getInstance().getTime() / TimelineConstants.MEGA_DOUBLE;
+
+               if (markerStartTime < 0) {
+                       markerStartTime = 0;
+               } else if (markerStartTime > toolbarTime) {
+                       markerStartTime = toolbarTime;
+               }
+
+               if (markerEndTime > toolbarTime) {
+                       markerEndTime = toolbarTime;
+               } else if (markerEndTime < 0) {
+                       markerEndTime = 0;
+               }
+
+               if (markerEndTime <= plot.getVisibleEndX()) {
+                       intervalMarker.setInterval(markerStartTime, markerEndTime);
+               } else {
+                       intervalMarker.setInterval(markerStartTime, plot.getVisibleEndX());
+               }
+
+               sendSelectionTimes(intervalMarker.getStartVal(), intervalMarker.getEndVal());
+       }
+
+       @Override
+       public void mouseMove(MouseEvent e) {
+               DAChart chart = (DAChart) e.widget;
+               DAChartPlot plot = chart.getPlot();
+               DAChartPlotMarker marker = plot.getMarkers().get(SELECTION_MARKER_INDEX);
+               if (!(marker instanceof DAChartPlotIntervalMarker)) {
+                       Logger.debug("mouseMove !IntervalMarker");
+                       return;
+               }
+               DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker;
+               DAChartPlotTooltip tooltip;
+
+               if ((e.stateMask & SWT.BUTTON1) != 0) {
+                       double eventTime = plot.getXFromXPixcel(e.x);
+
+                       if (baseTime > eventTime) {
+                               intervalMarker.setInterval(eventTime, baseTime);
+                       } else {
+                               intervalMarker.setInterval(baseTime, eventTime);
+                       }
+               }
+               tooltip = plot.getTooltip();
+               if (null == tooltip) {
+                       return;
+               }
+
+               double oldYPosRatio = tooltip.getYPosRatio();
+               double newYPosRatio = (double) e.y / ((Canvas) e.widget).getSize().y;
+
+               if (Double.compare(oldYPosRatio, newYPosRatio) != 0) {
+                       if (newYPosRatio < 0) {
+                               newYPosRatio = 0.01;
+                       } else if (newYPosRatio >= 1) {
+                               newYPosRatio = 0.99;
+                       }
+
+                       tooltip.setYPosRatio(newYPosRatio);
+               }
+
+               double oldStartVal = tooltip.getStartVal();
+               double newStartVal = getTooltipStartX(plot, chart.getSeriesList(), e.x, newYPosRatio);
+
+               if (oldStartVal != newStartVal) {
+                       tooltip.setStartVal(newStartVal);
+               }
+
+               timeline.setDetailTime(plot.getXFromXPixcel(e.x));
+               timeline.setDetailTimePosition(e.x);
+               timeline.setDrawDetailTime(true);
+               timeline.redraw();
+       }
+
+       private void sendSelectionTimes(double start, double end) {
+               long startTime = (long) (start * TimelineConstants.MEGA_DOUBLE);
+               long endTime = (long) (end * TimelineConstants.MEGA_DOUBLE);
+               if (endTime < startTime) {      // user mouse drag right->left on chart
+                       long temp = startTime;
+                       startTime = endTime;
+                       endTime = temp;
+               }
+               if (startTime < 0) {
+                       startTime = 0;
+               }
+               DAChartBoardItem selectedItem = chartBoard.getSelectItem();
+               Object data = selectedItem.getData();
+               AnalyzerManager.getCurrentPage().updateView(
+                               new DASelectionData(InteractivePage.chartViewID, startTime, endTime, data, null));
+       }
+
+       private double getTooltipStartX(DAChartPlot plot, List<DAChartSeries> seriesList, int x, double yPosRatio) {
+               double ret = -1;
+               for (int i = 0; i < seriesList.size(); i++) {
+                       DAChartSeries series = seriesList.get(i);
+                       int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(x));
+                       if (-1 == index) {
+                               continue;
+                       }
+                       double startVal = series.getSeriesItemList().get(index).getX();
+                       if (ret < startVal) {
+                               ret = startVal;
+                       }
+               }
+               return ret;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveChartRenderer.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveChartRenderer.java
new file mode 100644 (file)
index 0000000..f7290cf
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.chart;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartRenderer;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
+import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
+import org.tizen.dynamicanalyzer.widgets.helper.FontResources;
+import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
+
+public class InteractiveChartRenderer extends DAChartRenderer {
+       private static final int MARGIN = 4;
+       private static final int CHAR_MAX_WIDTH = 12;
+
+       @Override
+       protected void drawToGc(GC gc, DAChart chart) {
+               if (!preDraw(gc, chart)) {
+                       return;
+               }
+               for (int i = 0; i < seriesList.size(); i++) {
+                       drawSeries(gc, chart, seriesList.get(i));
+               }
+       }
+
+       private void drawSeries(GC gc, DAChart chart, DAChartSeries series) {
+               List<DAChartSeriesItem> seriesItems = series.getSeriesItemList();
+               if (seriesItems == null) {
+                       return;
+               }
+
+               int seriesItemSize = seriesItems.size();
+               int index = series.getPrevIndexByXvalue(plot.getVisibleStartX());
+               if (index < 0) {
+                       index = 0;
+               }
+               
+               gc.setLineStyle(SWT.LINE_SOLID);
+               gc.setAntialias(SWT.ON);
+
+               for (int i = index; i < seriesItemSize; i++) {
+                       DAChartSeriesItem seriesItem = seriesItems.get(i);
+
+                       double currentX = seriesItem.getX();
+                       int pixcelStartX = plot.getXPixcelFromX(currentX, r);
+                       int pixcelStartY = r.y + MARGIN;
+
+                       gc.setBackground(series.getColor());
+                       gc.fillRectangle(pixcelStartX, pixcelStartY, 2, r.height - MARGIN);
+                       if (currentX > plot.getVisibleEndX()) {
+                               break;
+                       }
+               }
+               
+               /*
+                * draw chart information
+                */
+               if (chart.getInformation() != null) {
+                       gc.setForeground(ColorResources.CHART_INFO);
+                       gc.setFont(FontResources.CHART_INFO_FONT);
+                       gc.drawImage(ImageResources.CHART_INFO, r.x + 5, (r.y + r.height) / 2 - 4);
+                       gc.drawText(chart.getInformation(), r.x + 18,
+                                       (r.y + r.height / 2 - gc.textExtent(chart.getInformation()).y / 2), true);
+               }
+       }
+
+       @Override
+       protected void drawTooltip(GC gc) {
+               DAChartPlotTooltip tooltip = plot.getTooltip();
+               if (tooltip == null || tooltip.shouldBeDrawn() == false || tooltip.getStartVal() == -1) {
+                       return;
+               }
+               gc.setFont(tooltip.getFont());
+               // make text,time & draw auxiliary line
+               double realXVal = tooltip.getStartVal();
+
+               if (seriesList.size() != 1) {
+                       return;
+               }
+               DAChartSeries series = seriesList.get(0);
+               
+               String time = "";
+               String message = "";
+               int textWidth = 0;
+               int textHeight = 0;
+               int index = series.getPrevIndexByXvalue(realXVal);
+               if (index >= 0) {
+                       /*
+                        * Get Tooltip text
+                        */
+                       time += toTimeFormat(series.getSeriesItemList().get(index).getX());
+                       textWidth = DAChartPlotTooltip.TOOLTIP_TIME_MARGIN + gc.textExtent(time).x;
+                       int possibleMaxTextWidth = r.width - DAChartPlotTooltip.TOOLTIP_MARGIN
+                                       - DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH - DAChartPlotTooltip.TOOLTIP_MARGIN - textWidth;                
+                       if (possibleMaxTextWidth < 0) {
+                               return;
+                       }
+                       message = series.getSeriesItemList().get(index).getTooltipText();
+                       int messageWidth = gc.textExtent(message).x;
+                       if (messageWidth > possibleMaxTextWidth) {
+                               int messageLength = possibleMaxTextWidth / CHAR_MAX_WIDTH;
+                               if (message.length() > messageLength) {
+                                       message = message.substring(0, messageLength) + " ...";
+                               }
+                       }
+                       textWidth += gc.textExtent(message).x;
+                       textHeight = gc.textExtent(message).y;
+               }
+               /*
+                * Draw tooltip box
+                */
+               int startX = getTooltipStartX(realXVal, textWidth, DAChartPlotTooltip.TOOLTIP_MARGIN);
+               int totalHeight = textHeight + DAChartPlotTooltip.TOOLTIP_MARGIN + DAChartPlotTooltip.TOOLTIP_MARGIN;
+               int startY = (r.y + r.height / 2) - (totalHeight / 2);
+
+               gc.setBackground(tooltip.getBackgroundColor());
+               gc.setForeground(tooltip.getForegroundColor());
+               gc.fillGradientRectangle(startX, startY, textWidth + DAChartPlotTooltip.TOOLTIP_MARGIN
+                               + DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH + DAChartPlotTooltip.TOOLTIP_MARGIN, totalHeight, true);
+               gc.setAlpha(255);
+               gc.setForeground(tooltip.getLineColor());
+               gc.drawRoundRectangle(startX, startY, textWidth + DAChartPlotTooltip.TOOLTIP_MARGIN
+                               + DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH + DAChartPlotTooltip.TOOLTIP_MARGIN, totalHeight, 5, 5);
+               gc.setFont(tooltip.getFont());
+
+               /*
+                * Draw tooltip contents
+                */
+               int yPosition = startY + DAChartPlotTooltip.TOOLTIP_MARGIN;
+               gc.setBackground(series.getColor());
+               gc.fillRectangle(startX + DAChartPlotTooltip.TOOLTIP_MARGIN, yPosition + 1,
+                               DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH, DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH);
+
+               gc.setForeground(tooltip.getTextColor());
+               gc.drawText(message, startX + DAChartPlotTooltip.TOOLTIP_MARGIN
+                                       + DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH + DAChartPlotTooltip.TOOLTIP_MARGIN, yPosition,
+                                       SWT.DRAW_DELIMITER | SWT.DRAW_TRANSPARENT);
+               gc.setForeground(tooltip.getTimeColor());
+               gc.drawText(
+                               time,
+                               startX + DAChartPlotTooltip.TOOLTIP_MARGIN + DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH
+                                               + DAChartPlotTooltip.TOOLTIP_MARGIN + textWidth - DAChartPlotTooltip.TOOLTIP_MARGIN
+                                               - gc.textExtent(time).x, yPosition, SWT.DRAW_DELIMITER | SWT.DRAW_TRANSPARENT);
+       }
+       
+       @Override
+       protected int getTooltipStartX(double startVal, int width, int margin) {
+               int ret = plot.getXPixcelFromX(startVal);
+               if (ret + width > r.x + r.width) {
+                       ret = ret - width - margin;
+                       if (ret < 0) {
+                               ret = 50;
+                       }
+               } else if (ret < r.x) {
+                       ret = r.x + margin;
+               } else {
+                       ret += margin;
+               }
+
+               return ret;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveChartView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveChartView.java
new file mode 100644 (file)
index 0000000..2f11f0d
--- /dev/null
@@ -0,0 +1,410 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.chart;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.ScrollBar;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.DASelectionData;
+import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
+import org.tizen.dynamicanalyzer.nl.InteractivePageLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
+import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
+import org.tizen.dynamicanalyzer.ui.info.screenshot.ScreenshotView;
+import org.tizen.dynamicanalyzer.ui.interactive.InteractivePage;
+import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveDataManager;
+import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveUIData;
+import org.tizen.dynamicanalyzer.ui.interactive.model.InteractiveInfo;
+import org.tizen.dynamicanalyzer.ui.interactive.model.InteractiveParser;
+import org.tizen.dynamicanalyzer.ui.page.ScreenshotTabComposite;
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart;
+import org.tizen.dynamicanalyzer.ui.timeline.common.AddChartMenuComposite;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.util.Logger;
+import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
+import org.tizen.dynamicanalyzer.widgets.da.view.DATabComposite;
+import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
+import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
+
+public class InteractiveChartView extends DAViewComposite {
+       private DAChartBoard chartBoard;
+
+       private final RangeDataManager rangeDataManager = RangeDataManager.getInstance();
+       private final LifecycleLogParser lifecycleLogParser = LifecycleLogParser.getInstance();
+       private List<InteractiveChart> chartList = new ArrayList<InteractiveChart>();
+
+       public InteractiveChartView(Composite parent, int style) {
+               super(parent, style, false);
+               this.setLayout(new FillLayout());
+
+               Composite contents = getContentArea();
+               contents.setBackground(ColorResources.WINDOW_BG_COLOR);
+
+               chartBoard = new DAChartBoard(contents, InteractivePageLabels.INTERACTIVE_CHART);
+               chartBoard.setItemHeight(65);
+               chartBoard.setNameFont(FontResources.CHART_NAME_FONT);
+
+               ScrollBar hScrollBar = chartBoard.getHScrollBar();
+               hScrollBar.addSelectionListener(new SelectionListener() {
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               DATabComposite interactiveTabComp = (DATabComposite) AnalyzerUtil.getView(InteractivePage.pageID,
+                                               ScreenshotTabComposite.tabID);
+                               ScreenshotView screenshotView = (ScreenshotView) interactiveTabComp
+                                               .getView(ScreenshotTabComposite.screenshotViewID);
+                               screenshotView.setLatestButtonEnable(true);
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                       }
+               });
+
+               StackLayout stackLayout = new StackLayout();
+               stackLayout.topControl = chartBoard;
+               contents.setLayout(stackLayout);
+
+               initializeCharts();
+
+               AddChartMenuComposite addChartComposite = new AddChartMenuComposite(chartBoard.getTitleComp());
+               addChartComposite.setAddItemListButtonListener(new DACustomButtonClickEventListener() {
+                       @Override
+                       public void handleClickEvent(DACustomButton button) {
+                               Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+                               InteractiveEditItemsDialog dialog = new InteractiveEditItemsDialog(shell, InteractiveChartView.this);
+                               if (dialog.isRunningDialog() == false) {
+                                       dialog.open();
+                               }
+                       }
+               });
+               addChartComposite.createAddMenuComp();
+
+               setBackground(ColorResources.VIEW_BG_COLOR);
+
+               final DATimeline timeline = chartBoard.getTimeline();
+
+               timeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
+               timeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
+
+               lifecycleLogParser.registerLifecycleBar(chartBoard.getLifecycleBar());
+               lifecycleLogParser.registerTimeline(timeline);
+
+               timeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
+               timeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
+               timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(rangeDataManager, chartBoard, timeline));
+
+               InteractiveDataManager.getInstance().setChartView(this);
+       }
+
+       private void initializeCharts() {
+               initIntervalMarkers(chartBoard);
+
+               List<TimelineChart> timelineChartList = InteractiveDataManager.getInstance().getTimelineChartList();
+               for (int i = 0; i < timelineChartList.size(); i++) {
+                       TimelineChart timelineChart = timelineChartList.get(i);
+
+                       DAChartBoardItem item = timelineChart.createBoardItem(chartBoard);
+                       item.setHeight(DAChartBoard.DEFAULT_ITEM_HEIGHT);
+                       DAChart chartWidget = item.getChart();
+
+                       chartWidget.getPlot().setAxisRangeX(chartBoard.getVisibleStartTime(), chartBoard.getVisibleEndTime());
+
+                       chartWidget.getPlot().setMarkers(chartBoard.getMarkers());
+                       InteractiveChartMouseEventListener chartMouseEventListener = new InteractiveChartMouseEventListener(
+                                       timelineChart.getPopupMenu(), chartBoard.getTimeline(), chartBoard);
+                       chartWidget.addMouseListener(chartMouseEventListener);
+                       chartWidget.addMouseMoveListener(chartMouseEventListener);
+                       chartWidget.addMouseTrackListener(new TimelineChartMouseTrackAdapter(chartBoard.getTimeline()));
+                       
+                       List<TimelineChart> showChartList = InteractiveDataManager.getInstance().getShowTimelineChartList();
+                       chartBoard.hideItem(i);
+                       for (int ii = 0; ii < showChartList.size(); ii++) {
+                               if (showChartList.get(ii).getChartType() == timelineChart.getChartType()) {
+                                       chartBoard.showItem(i);
+                               }
+                       }
+               }
+
+               /*
+                * Interactive Chart
+                */
+               List<InteractiveInfo> interactiveList = InteractiveDataManager.getInstance().getVariableInfoList();
+               for (int i = 0; i < interactiveList.size(); i++) {
+                       InteractiveChart chart = new InteractiveChart(interactiveList.get(i));
+                       chartList.add(chart);
+                       DAChartBoardItem boardItem = chart.createBoardItem(chartBoard);
+                       DAChart chartWidget = boardItem.getChart();
+                       chartWidget.setChartRenderer(new InteractiveChartRenderer());
+
+                       String chartInfo = interactiveList.get(i).getDescription();
+                       chartWidget.setInformation(chartInfo);
+
+                       chartWidget.getPlot().setMarkers(chartBoard.getMarkers());
+                       InteractiveChartMouseEventListener chartMouseEventListener = new InteractiveChartMouseEventListener(
+                                       chart.getPopupMenu(), chartBoard.getTimeline(), chartBoard);
+                       chartWidget.addMouseListener(chartMouseEventListener);
+                       chartWidget.addMouseMoveListener(chartMouseEventListener);
+                       chartWidget.addMouseTrackListener(new TimelineChartMouseTrackAdapter(chartBoard.getTimeline()));
+               }
+       }
+
+       private void initIntervalMarkers(DAChartBoard board) {
+               // selection marker
+               DAChartPlotIntervalMarker selectionMarker = new DAChartPlotIntervalMarker(-1, -1,
+                               DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
+               selectionMarker.setBackgroundColor(ColorResources.SELECTION_RANGE);
+               selectionMarker.setAlpha((int) (255 * 0.25));
+               board.addIntervalMarker(selectionMarker);
+
+               // range analysis marker
+               DAChartPlotIntervalMarker rangeAnalyzeMarker = new DAChartPlotIntervalMarker(-1, -1,
+                               DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
+               rangeAnalyzeMarker.setBackgroundColor(ColorResources.YELLOW);
+               rangeAnalyzeMarker.setAlpha((int) (255 * 0.25));
+               board.addIntervalMarker(rangeAnalyzeMarker);
+
+               // range marker
+               DAChartPlotIntervalMarker rangeMarker = new DAChartPlotIntervalMarker(-1, -1,
+                               DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE);
+               rangeMarker.setForegroundColor(ColorResources.SELECTION_LINE);
+               rangeMarker.setAlpha((int) (255 * 0.25));
+               board.addIntervalMarker(rangeMarker);
+       }
+
+       @Override
+       public void updateView() {
+               InteractiveDataManager.getInstance().makeChartSeries(
+                               AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleStartTime()),
+                               AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleEndTime()));
+
+               if (ToolbarArea.getInstance() == null) {
+                       Logger.debug("toolbar area is null");//$NON-NLS-1$
+                       return;
+               }
+
+               DATabComposite interactiveTabComp = (DATabComposite) AnalyzerUtil.getView(InteractivePage.pageID,
+                               ScreenshotTabComposite.tabID);
+               ScreenshotView screenshotView = (ScreenshotView) interactiveTabComp
+                               .getView(ScreenshotTabComposite.screenshotViewID);
+
+               long time = ToolbarArea.getInstance().getTime();
+               if (screenshotView != null && !screenshotView.isLatestButtonEnabled()) {
+                       DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+                                       UICommonConstants.SELECTION_MARKER_INDEX);
+                       intervalMarker.setInterval(time / TimelineConstants.MEGA_DOUBLE, time / TimelineConstants.MEGA_DOUBLE);
+               }
+
+               chartBoard.setTimelineMarkerStartTime(rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE);
+               chartBoard.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE);
+
+               if (RangeDataManager.getInstance().isBeingAnalyzed()) {
+                       ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+                                       .setInterval(rangeDataManager.getAnalysisStartTime() / TimelineConstants.MEGA_DOUBLE,
+                                                       rangeDataManager.getAnalysisEndTime() / TimelineConstants.MEGA_DOUBLE);
+               } else {
+                       ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+                                       .setInterval(-1, -1);
+               }
+
+               ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
+                               rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA_DOUBLE,
+                               rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA_DOUBLE);
+
+               chartBoard.setTotalEndTime(time);
+       }
+
+       @Override
+       public void updateView(DAViewData data) {
+               if (data instanceof DASelectionData) {
+                       DASelectionData selData = (DASelectionData) data;
+
+                       long start = selData.getStartTime();
+                       long end = selData.getEndTime();
+                       Double startTime = Formatter.longTimeToDoubleTime(start);
+                       Double endTime = Formatter.longTimeToDoubleTime(end);
+                       double middleTime = (startTime + endTime) / 2.0;
+                       if (startTime.equals(endTime)) {
+                               middleTime = startTime;
+                       }
+
+                       chartBoard.setVisibleMiddleTime(middleTime);
+                       DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+                                       UICommonConstants.SELECTION_MARKER_INDEX);
+                       intervalMarker.setInterval(startTime, endTime);
+
+                       InteractiveDataManager.getInstance().makeChartSeries(
+                                       AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleStartTime()),
+                                       AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleEndTime()));
+               }
+       }
+
+       @Override
+       public void clear() {
+               chartBoard.contentsClear();
+               chartBoard.clear();
+               chartList.clear();
+               for (TimelineChart timelineChart : InteractiveDataManager.getInstance().getTimelineChartList()) {
+                       timelineChart.clear();
+               }
+               initializeCharts();
+       }
+
+       @Override
+       public Control getControl() {
+               return chartBoard;
+       }
+
+       public void setRangeMarker(double starttime, double endtime) {
+               chartBoard.setTimelineMarkerStartTime(starttime);
+               chartBoard.setTimelineMarkerEndTime(endtime);
+
+               ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
+                               starttime, endtime);
+       }
+
+       public void inputChartSeries(ResultSet rs) {
+               if (rs == null) {
+                       return;
+               }
+               Map<Long, List<ValueInfo>> valueInfoMap = new HashMap<Long, List<ValueInfo>>(); // key : variableID
+               try {
+                       while (rs.next()) {
+                               long time = rs.getLong(1);
+                               long id = rs.getLong(2);
+                               byte[] value = rs.getBytes(4);
+                               List<ValueInfo> valueInfoList = valueInfoMap.get(id);
+                               if (valueInfoList == null) {
+                                       valueInfoList = new ArrayList<ValueInfo>();
+                                       valueInfoMap.put(id, valueInfoList);
+                               }
+                               valueInfoList.add(new ValueInfo(time, id, value));
+                       }
+               } catch (SQLException e) {
+                       e.printStackTrace();
+                       return;
+               } finally {
+                       SqlConnectionManager.releaseResultSet(rs);
+               }
+               if (valueInfoMap.isEmpty()) {
+                       return;
+               }
+               /*
+                * Make Chart series
+                */
+               for (int i = 0; i < chartList.size(); i++) {
+                       InteractiveInfo rootInteractiveInfo = chartList.get(i).getInteractiveInfo();
+                       List<ValueInfo> rootValueInfoList = valueInfoMap.get(rootInteractiveInfo.getVariableID());
+                       if (rootValueInfoList == null) {
+                               continue;
+                       }
+                       List<InteractiveUIData> parsedUIDataList = new ArrayList<InteractiveUIData>();
+                       List<List<ValueInfo>> childrenValueInfoList = new ArrayList<List<ValueInfo>>();
+                       Iterator<Long> variableIDIter = valueInfoMap.keySet().iterator();
+                       while (variableIDIter.hasNext()) {
+                               long variableID = variableIDIter.next();
+                               if (rootInteractiveInfo.hasChild(variableID)) {
+                                       childrenValueInfoList.add(valueInfoMap.get(variableID));
+                               }
+                       }
+                       for (int ii = 0; ii < rootValueInfoList.size(); ii++) {
+                               Map<Long, byte[]> valueMap = new HashMap<Long, byte[]>(); // Map<variableID, value>
+                               valueMap.put(rootInteractiveInfo.getVariableID(), rootValueInfoList.get(ii).value);
+                               for (int iii = 0; iii < childrenValueInfoList.size(); iii++) {
+                                       if (childrenValueInfoList.get(iii).size() > ii) {
+                                               ValueInfo valueInfo = childrenValueInfoList.get(iii).get(ii);
+                                               valueMap.put(valueInfo.variableID, valueInfo.value);
+                                       }
+                               }
+                               InteractiveUIData uiData = InteractiveParser.parseValue(rootInteractiveInfo, valueMap);
+                               uiData.setTime(rootValueInfoList.get(ii).time);
+                               parsedUIDataList.add(uiData);
+                       }
+                       chartList.get(i).inputChartSeries(parsedUIDataList);
+               }
+       }
+       
+       /*
+        *  User can add Timeline chart on Chart Edit dialog and rearrange added charts.
+        *  but only Timeline charts can be rearranged. Value charts is not rearranged.
+        */
+       public void reArrangeChart(List<Integer> order, List<Boolean> showInfo) {
+               if (order != null) {
+                       int lastIndex = order.size();
+                       for (int i = 0; i < chartList.size(); i++) {
+                               order.add(lastIndex++);
+                       }
+                       chartBoard.reArrangeItem(order.toArray(new Integer[order.size()]));
+               }
+               for (int i = 0; i < showInfo.size(); i++) {
+                       if (showInfo.get(i)) {
+                               chartBoard.showItem(i);
+                       } else {
+                               chartBoard.hideItem(i);
+                       }
+               }
+       }
+       
+       private static class ValueInfo {
+               long time;
+               long variableID;
+               byte[] value;
+               
+               ValueInfo(long time, long variableID, byte[] value) {
+                       this.time = time;
+                       this.variableID = variableID;
+                       this.value = value;
+               }
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveEditItemsDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveEditItemsDialog.java
new file mode 100644 (file)
index 0000000..f06085b
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.chart;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TableItem;
+import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineEditItemsDialog;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+
+public class InteractiveEditItemsDialog extends TimelineEditItemsDialog {
+       private InteractiveChartView chartView;
+
+       public InteractiveEditItemsDialog(Shell parent, InteractiveChartView chartView_) {
+               super(parent);
+               this.chartView = chartView_;
+               this.chartList = InteractiveDataManager.getInstance().getTimelineChartList();
+               this.selectedChartList = InteractiveDataManager.getInstance().getShowTimelineChartList();
+               setOkButtonListener(okButtonListener);
+       }
+
+       private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       TableItem[] tableitems = chartTableViewer.getTable().getItems();
+                       ArrayList<Integer> order = new ArrayList<Integer>();
+                       ArrayList<Boolean> showInfo = new ArrayList<Boolean>();
+
+                       selectedChartList.clear();
+
+                       List<TimelineChart> tempChartList = new ArrayList<TimelineChart>(chartList);
+                       chartList.clear();
+                       for (TableItem item : tableitems) {     // Rearrange chart order
+                               TableItemData itemData = (TableItemData) item.getData();
+                               TimelineChart chart = findChart(tempChartList, itemData.chartType);
+                               chartList.add(chart);
+
+                               if (itemData.isEnabled) {
+                                       selectedChartList.add(chart);
+                                       showInfo.add(true);
+                               } else {
+                                       showInfo.add(false);
+                               }
+
+                               order.add(itemData.index);
+                       }
+
+                       chartView.reArrangeChart(order, showInfo);
+                       shell.dispose();
+                       RunningDialog = false;
+               }
+       };
+       
+       private TimelineChart findChart(List<TimelineChart> chartList, int chartType) {
+               if (chartList != null) {
+                       for (int i = 0; i < chartList.size(); i++) {
+                               if (chartType == chartList.get(i).getChartType()) {
+                                       return chartList.get(i);
+                               }
+                       }
+               }
+               return null;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/data/InteractiveDataManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/data/InteractiveDataManager.java
new file mode 100644 (file)
index 0000000..bb9db95
--- /dev/null
@@ -0,0 +1,314 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.data;
+
+import java.sql.ResultSet;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.tizen.dynamicanalyzer.database.DBInsertManager;
+import org.tizen.dynamicanalyzer.database.DBInserter;
+import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
+import org.tizen.dynamicanalyzer.swap.channel.data.DataChannelConstants;
+import org.tizen.dynamicanalyzer.swap.logparser.LogPackage;
+import org.tizen.dynamicanalyzer.swap.logparser.Logs;
+import org.tizen.dynamicanalyzer.swap.logparser.PageDataManager;
+import org.tizen.dynamicanalyzer.swap.model.data.FunctionBodyInstrumentData;
+import org.tizen.dynamicanalyzer.swap.model.data.LogData;
+import org.tizen.dynamicanalyzer.ui.interactive.chart.InteractiveChartView;
+import org.tizen.dynamicanalyzer.ui.interactive.model.InteractiveInfo;
+import org.tizen.dynamicanalyzer.ui.interactive.model.VAR_TYPE;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUChart;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUCoreChart;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUFrequencyChart;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.DeviceChart;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.DiskIOChart;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.EnergyChart;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.HeapChart;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.NetworkIOChart;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.ProcessMemoryChart;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.ScreenshotChart;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.SystemMemoryChart;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.UIEventChart;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.IDAChartSeriesMaker;
+
+public class InteractiveDataManager extends PageDataManager implements IDAChartSeriesMaker {
+       private static InteractiveDataManager instance = null;
+
+       private InteractiveVariableDBTable variableDBTable = null;
+       private InteractiveValueDBTable valueDBTable = null;
+       private DBInserter valueDBInserter = null;
+       // Only contain target variables
+       private List<InteractiveInfo> variableInfoList = new ArrayList<InteractiveInfo>();
+       private InteractiveChartView chartView;
+       private List<TimelineChart> timelineChartList = new ArrayList<TimelineChart>();
+       private List<TimelineChart> showTimelineChartList = new ArrayList<TimelineChart>();
+
+       private InteractiveDataManager() {
+               variableDBTable = new InteractiveVariableDBTable();
+               valueDBTable = new InteractiveValueDBTable();
+               valueDBInserter = DBInsertManager.makeInserter(valueDBTable);
+
+               timelineChartList.add(new CPUChart());
+               timelineChartList.add(new CPUCoreChart());
+               timelineChartList.add(new CPUFrequencyChart());
+               timelineChartList.add(new HeapChart());
+               timelineChartList.add(new ProcessMemoryChart());
+               timelineChartList.add(new SystemMemoryChart());
+               timelineChartList.add(new ScreenshotChart());
+               timelineChartList.add(new UIEventChart());
+               timelineChartList.add(new DiskIOChart());
+               timelineChartList.add(new NetworkIOChart());
+               timelineChartList.add(new DeviceChart());
+               timelineChartList.add(new EnergyChart());
+       }
+
+       public synchronized static InteractiveDataManager getInstance() {
+               if (null == instance) {
+                       instance = new InteractiveDataManager();
+               }
+               return instance;
+       }
+
+       public List<InteractiveInfo> getVariableInfoList() {
+               return variableInfoList;
+       }
+
+       public void setChartView(InteractiveChartView chartView) {
+               this.chartView = chartView;
+       }
+
+       public List<TimelineChart> getTimelineChartList() {
+               return timelineChartList;
+       }
+
+       public List<TimelineChart> getShowTimelineChartList() {
+               return showTimelineChartList;
+       }
+
+       public void addVariableInfo(InteractiveInfo info) {
+               variableInfoList.add(info);
+       }
+
+       public static ResultSet getValueDataFromDB(long start, long end) {
+               String query = "SELECT SAMPLING_TIME, VARIABLE_ID, VALUE_SIZE, VALUE FROM INTERACTIVE_VALUE " +
+                               "WHERE SAMPLING_TIME BETWEEN " + start + " AND " + end + " ORDER BY SAMPLING_TIME";
+               ResultSet rs = SqlConnectionManager.executeQueryRS(query);
+               
+               return rs;
+       }
+
+       public ResultSet getValueDataFromDB(InteractiveInfo interactiveInfo) {
+               String query = "SELECT SAMPLING_TIME, VARIABLE_ID, VALUE_SIZE, VALUE FROM INTERACTIVE_VALUE " +
+                       "WHERE VARIABLE_ID IN (" + interactiveInfo.getVariableID();
+               List<Long> variableIDList = interactiveInfo.getAllChildrenIDs();
+               for (int i = 0; i < variableIDList.size(); i++) {
+                       query += "," + variableIDList.get(i);
+               }
+               query += ")";
+               
+               ResultSet rs = SqlConnectionManager.executeQueryRS(query);
+               return rs;
+       }
+
+       @Override
+       public void saveData(Map<String, String> dataMap) {
+               List<List<Object>> list = new ArrayList<List<Object>>();
+               insertVariableInfo(variableInfoList, list);
+               variableDBTable.insertData(list);
+       }
+
+       private void insertVariableInfo(List<InteractiveInfo> infoList, List<List<Object>> list) {
+               for (int i = 0; i < infoList.size(); i++) {
+                       ArrayList<Object> dbVariableData = new ArrayList<Object>();
+                       InteractiveInfo info = infoList.get(i);
+                       dbVariableData.add(info.getVariableID());
+                       dbVariableData.add(info.getType().ordinal());
+                       dbVariableData.add(info.getTypeName());
+                       dbVariableData.add(info.getVariableName());
+                       dbVariableData.add(info.getSourceLineNum());
+                       dbVariableData.add(info.getSourceFileName());
+                       dbVariableData.add(info.getPointerOrder());
+                       dbVariableData.add(info.getArrayCount());
+                       if (info.getParent() == null) {
+                               dbVariableData.add(0);
+                       } else {
+                               dbVariableData.add(info.getParent().getVariableID());
+                       }
+                       dbVariableData.add(info.getByteSize());
+                       dbVariableData.add(info.getOffset());
+                       dbVariableData.add(info.isTarget());
+                       dbVariableData.add(info.getChildrenIDs());
+                       list.add(dbVariableData);
+                       if (info.getChildren() != null) {
+                               insertVariableInfo(info.getChildren(), list);
+                       }
+               }
+       }
+
+       @Override
+       public void openData(Map<String, String> dataMap) {
+               variableInfoList.clear();
+               List<List<Object>> datas = variableDBTable.selectAllColumnData(null);
+               if (datas == null) {
+                       return;
+               }
+
+               Map<Long, List<Long>> relationMap = new HashMap<Long, List<Long>>();
+               List<InteractiveInfo> loadList = new ArrayList<InteractiveInfo>();
+               for (int i = 0; i < datas.size(); i++) {
+                       List<Object> row = datas.get(i);
+                       long variableID = ((Long) row.get(InteractiveVariableDBTable.COLUMN.VARIABLE_ID.ordinal())).longValue();
+                       VAR_TYPE variableType = VAR_TYPE.values()[((Integer) row
+                                       .get(InteractiveVariableDBTable.COLUMN.VARIABLE_TYPE.ordinal())).intValue()];
+                       String typeName = (String) row.get(InteractiveVariableDBTable.COLUMN.VARIABLE_TYPE_NAME.ordinal());
+                       String variableName = (String) row.get(InteractiveVariableDBTable.COLUMN.VARIABLE_NAME.ordinal());
+                       int sourceLineNum = ((Integer) row.get(InteractiveVariableDBTable.COLUMN.SOURCE_LINE_NUM.ordinal()))
+                                       .intValue();
+                       String sourceFileName = (String) row.get(InteractiveVariableDBTable.COLUMN.SOURCE_FILE_NAME.ordinal());
+                       int pointerOrder = ((Integer) row.get(InteractiveVariableDBTable.COLUMN.POINTER_ORDER.ordinal()))
+                                       .intValue();
+                       int arrayCount = ((Integer) row.get(InteractiveVariableDBTable.COLUMN.ARRAY_COUNT.ordinal())).intValue();
+                       int byteSize = ((Integer) row.get(InteractiveVariableDBTable.COLUMN.BYTE_SIZE.ordinal())).intValue();
+                       boolean isTarget = ((Boolean) row.get(InteractiveVariableDBTable.COLUMN.IS_TARGET.ordinal()))
+                                       .booleanValue();
+                       int offset = ((Integer) row.get(InteractiveVariableDBTable.COLUMN.OFFSET.ordinal())).intValue();
+                       @SuppressWarnings("unchecked")
+                       List<Long> childrenID = (List<Long>) row.get(InteractiveVariableDBTable.COLUMN.CHILDREN_VARIABLE_ID
+                                       .ordinal());
+                       relationMap.put(variableID, childrenID);
+
+                       InteractiveInfo valueInfo = new InteractiveInfo();
+                       valueInfo.setVariableID(variableID);
+                       valueInfo.setType(variableType);
+                       valueInfo.setTypeName(typeName);
+                       valueInfo.setVariableName(variableName);
+                       valueInfo.setSourceLineNum(sourceLineNum);
+                       valueInfo.setSourceFileName(sourceFileName);
+                       valueInfo.setPointerOrder(pointerOrder);
+                       valueInfo.setArrayCount(arrayCount);
+                       valueInfo.setByteSize(byteSize);
+                       valueInfo.setOffset(offset);
+                       valueInfo.setTarget(isTarget);
+                       if (isTarget) { // target variable, only this info show in chart.
+                               variableInfoList.add(valueInfo);
+                       }
+                       loadList.add(valueInfo);
+               }
+               makeRelation(loadList, relationMap);
+       }
+
+       private void makeRelation(List<InteractiveInfo> infoList, Map<Long, List<Long>> relationMap) {
+               for (int i = 0; i < infoList.size(); i++) {
+                       InteractiveInfo parent = infoList.get(i);
+                       List<Long> childrenIDs = relationMap.get(parent.getVariableID());
+                       if (childrenIDs != null) {
+                               List<InteractiveInfo> children = new ArrayList<InteractiveInfo>();
+                               for (int ii = 0; ii < childrenIDs.size(); ii++) {
+                                       InteractiveInfo child = findInfo(infoList, childrenIDs.get(ii));
+                                       child.setParent(parent);
+                                       children.add(child);
+                               }
+                               parent.setChildren(children);
+                       }
+               }
+       }
+
+       private InteractiveInfo findInfo(List<InteractiveInfo> infoList, long variableID) {
+               for (int i = 0; i < infoList.size(); i++) {
+                       if (infoList.get(i).getVariableID() == variableID) {
+                               return infoList.get(i);
+                       }
+               }
+               return null;
+       }
+
+       @Override
+       protected void makeData(LogPackage pack) {
+               Logs fbiLogs = pack.getLogs(DataChannelConstants.MSG_FUNCTION_BODY);
+               List<LogData> fbiLogList = fbiLogs == null ? null : fbiLogs.getRawLogs();
+
+               if (fbiLogList != null) {
+                       List<List<Object>> valueDataList = new ArrayList<List<Object>>();
+                       for (int i = 0; i < fbiLogList.size(); i++) {
+                               FunctionBodyInstrumentData log = (FunctionBodyInstrumentData) fbiLogList.get(i);
+                               long variableID = log.getVariableID().getValue();
+                               long size = log.getSize().getValue();
+                               byte[] data = log.getData();
+
+                               ArrayList<Object> dbValueData = new ArrayList<Object>();
+                               dbValueData.add(new Long(log.getTime()));
+                               dbValueData.add(new Long(variableID));
+                               dbValueData.add(new Long(size));
+                               dbValueData.add(data);
+
+                               valueDataList.add(dbValueData);
+                       }
+                       valueDBInserter.pushData(valueDataList);
+               }
+       }
+
+       @Override
+       public void makeChartSeries(long startTime, long endTime) {
+               chartView.inputChartSeries(getValueDataFromDB(startTime, endTime));
+               
+               List<List<Object>> systemDBData = TimelineChartManager.getInstance().getSystemDataFromDB(startTime, endTime);
+               List<List<Object>> uiEventDBData = TimelineChartManager.getInstance().getUIEventDataFromDB(startTime, endTime);
+               List<List<Object>> screenShotDBData = TimelineChartManager.getInstance().getScreenShotDataFromDB(startTime,
+                               endTime);
+               Map<Integer, List<List<Object>>> targetProcessDBData = TimelineChartManager.getInstance()
+                               .getTargetProcessDataFromDB(startTime, endTime);
+
+               /*
+                * 2. Make series of chart
+                */
+               for (TimelineChart chart : timelineChartList) {
+                       if (chart.getProbeType() == DataChannelConstants.MSG_DATA_SYSTEM) {
+                               List<Object> dataList = new ArrayList<Object>();
+                               dataList.add(systemDBData);
+                               dataList.add(targetProcessDBData);
+                               chart.inputChartSeries(dataList);
+                       } else if (chart.getProbeType() == DataChannelConstants.MSG_PROBE_UIEVENT) {
+                               List<Object> dataList = new ArrayList<Object>();
+                               dataList.add(uiEventDBData);
+                               chart.inputChartSeries(dataList);
+                       } else if (chart.getProbeType() == DataChannelConstants.MSG_PROBE_SCREENSHOT) {
+                               List<Object> dataList = new ArrayList<Object>();
+                               dataList.add(screenShotDBData);
+                               chart.inputChartSeries(dataList);
+                       }
+               }
+       }
+
+       public void clear() {
+               variableInfoList.clear();
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/data/InteractiveUIData.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/data/InteractiveUIData.java
new file mode 100644 (file)
index 0000000..07ea656
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.data;
+
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.ui.interactive.model.InteractiveInfo;
+
+public class InteractiveUIData implements Comparable {
+       private long tableRowID;                /* need for table row identity */
+       private long time;
+       private String type;
+       private String name;
+       private Object value;
+       private boolean array = false;
+       private InteractiveInfo interactiveInfo;
+       private List<InteractiveUIData> children;
+               
+       public InteractiveUIData(InteractiveInfo interactiveInfo) {
+               this.interactiveInfo = interactiveInfo;
+               this.type = interactiveInfo.getTypeNameWithPointer();
+               this.name = interactiveInfo.getVariableName();
+       }
+       
+       public long getTableRowID() {
+               return (long)(interactiveInfo.getVariableID() + "," + tableRowID).hashCode();
+       }
+       
+       public void setTableRowID(long tableRowID) {
+               this.tableRowID = tableRowID;
+       }
+       
+       public long getTime() {
+               return time;
+       }
+       
+       public void setTime(long time) {
+               this.time = time;
+       }
+       
+       public boolean isArray() {
+               return array;
+       }
+
+       public void setArray(boolean array) {
+               this.array = array;
+       }
+
+       public String getType() {
+               if (array) {
+                       type += " [" + children.size() + "]";
+               } 
+               return type;
+       }
+
+       public void setType(String type) {
+               this.type = type;
+       }
+
+       public String getName() {
+               return name;
+       }
+       
+       public void setName(String name) {
+               this.name = name;
+       }
+       
+       public Object getValue() {
+               if (array || children != null) {
+                       return getComplexValue();
+               }
+               return value;
+       }
+       
+       public void setValue(Object value) {
+               this.value = value;
+       }
+       
+       public List<InteractiveUIData> getChildren() {
+               return children;
+       }
+       
+       public void setChildren(List<InteractiveUIData> children) {
+               this.children = children;
+       }
+       
+       public InteractiveInfo getVariableInfo() {
+               return interactiveInfo;
+       }
+       
+       private String getComplexValue() {
+               String complexValue = "[";
+               for (int i = 0; i < children.size(); i++) {
+                       InteractiveUIData child = children.get(i);
+                       if (child.isArray() || child.getChildren() != null) {
+                               complexValue += child.getComplexValue();
+                       } else {
+                               complexValue += child.getValue();
+                       }
+                       if (i != children.size() - 1) { // is not last index
+                               complexValue += ", ";
+                       }
+               }
+               return complexValue + "]";
+       }
+       
+       public String getChartTooltipString() {
+               if (array || children != null) {
+                       return getComplexValue();
+               }
+               return getType() + " " + name + " : " + value;
+       }
+
+       @Override
+       public int compareTo(Object arg0) {
+               if (arg0 instanceof InteractiveUIData) {
+                       return (int)(time - ((InteractiveUIData)arg0).time);
+               }
+               return 0;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/data/InteractiveValueDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/data/InteractiveValueDBTable.java
new file mode 100644 (file)
index 0000000..7ce54b2
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.data;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.database.DBColumn;
+import org.tizen.dynamicanalyzer.database.DBConstants;
+import org.tizen.dynamicanalyzer.database.DBTable;
+
+public class InteractiveValueDBTable extends DBTable {
+       private static final String TABLENAME = "INTERACTIVE_VALUE";
+
+       private final static int MAX_BYTES_LEN = 1024;
+
+       public static enum COLUMN {
+               SAMPLING_TIME,
+               VARIABLE_ID,
+               VALUE_SIZE,
+               VALUE
+       }
+
+       public static final String SAMPLING_TIME = "SAMPLING_TIME";
+       public static final String VARIABLE_ID = "VARIABLE_ID";
+       public static final String VALUE_SIZE = "VALUE_SIZE";
+       public static final String VALUE = "VALUE";
+
+       @Override
+       public String getTableName() {
+               return TABLENAME;
+       }
+
+       public InteractiveValueDBTable() {
+               addColumn(new DBColumn(SAMPLING_TIME, DBConstants.NOT_NULL, DBConstants.LONG));
+               addColumn(new DBColumn(VARIABLE_ID, DBConstants.NOT_NULL, DBConstants.LONG));
+               addColumn(new DBColumn(VALUE_SIZE, DBConstants.NOT_NULL, DBConstants.LONG));
+               addColumn(new DBColumn(VALUE, DBConstants.NOT_NULL, DBConstants.VARBINARY, MAX_BYTES_LEN));
+               setIndexColumn(COLUMN.SAMPLING_TIME.ordinal());
+       }
+
+       @Override
+       public boolean prepare(PreparedStatement prep, List<Object> rowData) {
+               boolean isPrepared = true;
+
+               int columnsize = getColumnSize();
+               if (columnsize != rowData.size()) {
+                       isPrepared = false;
+               } else {
+                       try {
+                               int index = 1;
+                               prep.setLong(index++, (Long) (rowData.get(COLUMN.SAMPLING_TIME.ordinal())));
+                               prep.setLong(index++, (Long) (rowData.get(COLUMN.VARIABLE_ID.ordinal())));
+                               prep.setLong(index++, (Long) (rowData.get(COLUMN.VALUE_SIZE.ordinal())));
+                               prep.setBytes(index++, (byte[]) (rowData.get(COLUMN.VALUE.ordinal())));
+                       } catch (SQLException e) {
+                               e.printStackTrace();
+                               isPrepared = false;
+                       }
+               }
+
+               return isPrepared;
+       }
+
+       @Override
+       public List<Object> extractDataFromResultSet(ResultSet rs) {
+               List<Object> row = new ArrayList<Object>();
+               try {
+                       row.add(Long.valueOf(rs.getLong(1)));
+                       row.add(Long.valueOf(rs.getLong(2)));
+                       row.add(Long.valueOf(rs.getLong(3)));
+                       row.add(rs.getBytes(4));
+//                     row.add(getArrayFromResultSet(rs, 3, String.valueOf(0)));
+               } catch (SQLException e) {
+                       e.printStackTrace();
+                       return null;
+               }
+               return row;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/data/InteractiveVariableDBTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/data/InteractiveVariableDBTable.java
new file mode 100644 (file)
index 0000000..e185e2f
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.data;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.database.DBColumn;
+import org.tizen.dynamicanalyzer.database.DBConstants;
+import org.tizen.dynamicanalyzer.database.DBTable;
+import org.tizen.dynamicanalyzer.util.Logger;
+
+public class InteractiveVariableDBTable extends DBTable {
+       private static final String TABLENAME = "INTERACTIVE_VARIABLE";
+
+       private final static int MAX_NAME_LEN = 128;
+       private final static int MAX_TYPE_LEN = 64;
+
+       public static enum COLUMN {
+               VARIABLE_ID,
+               VARIABLE_TYPE,
+               VARIABLE_TYPE_NAME,
+               VARIABLE_NAME,
+               SOURCE_LINE_NUM,
+               SOURCE_FILE_NAME,
+               POINTER_ORDER,
+               ARRAY_COUNT,
+               PARENT_VARIABLE_ID,
+               BYTE_SIZE,
+               OFFSET,
+               IS_TARGET,
+               CHILDREN_VARIABLE_ID
+       }
+
+       public static final String VARIABLE_ID = "VARIABLE_ID";
+       public static final String VARIABLE_TYPE = "VARIABLE_TYPE";
+       public static final String VARIABLE_TYPE_NAME = "VARIABLE_TYPE_NAME";
+       public static final String VARIABLE_NAME = "VARIABLE_NAME";
+       public static final String SOURCE_LINE_NUM = "SOURCE_LINE_NUM";
+       public static final String SOURCE_FILE_NAME = "SOURCE_FILE_NAME";
+       public static final String POINTER_ORDER = "POINTER_ORDER";
+       public static final String ARRAY_COUNT = "ARRAY_COUNT";
+       public static final String PARENT_VARIABLE_ID = "PARENT_VARIABLE_ID";
+       public static final String BYTE_SIZE = "BYTE_SIZE";
+       public static final String OFFSET = "OFFSET";
+       public static final String IS_TARGET = "IS_TARGET";
+       public static final String CHILDREN_VARIABLE_ID = "CHILDREN_VARIABLE_ID";
+
+       @Override
+       public String getTableName() {
+               return TABLENAME;
+       }
+
+       public InteractiveVariableDBTable() {
+               addColumn(new DBColumn(VARIABLE_ID, DBConstants.PRIMARY_KEY, DBConstants.DBTYPE_LONG));
+               addColumn(new DBColumn(VARIABLE_TYPE, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4));
+               addColumn(new DBColumn(VARIABLE_TYPE_NAME, DBConstants.EMPTY, DBConstants.DBTYPE_VARCHAR, MAX_TYPE_LEN));
+               addColumn(new DBColumn(VARIABLE_NAME, DBConstants.NOT_NULL, DBConstants.DBTYPE_VARCHAR, MAX_NAME_LEN));
+               addColumn(new DBColumn(SOURCE_LINE_NUM, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4));
+               addColumn(new DBColumn(SOURCE_FILE_NAME, DBConstants.NOT_NULL, DBConstants.DBTYPE_VARCHAR, MAX_NAME_LEN));
+               addColumn(new DBColumn(POINTER_ORDER, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4));
+               addColumn(new DBColumn(ARRAY_COUNT, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4));
+               addColumn(new DBColumn(PARENT_VARIABLE_ID, DBConstants.NOT_NULL, DBConstants.DBTYPE_LONG));
+               addColumn(new DBColumn(BYTE_SIZE, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4));
+               addColumn(new DBColumn(OFFSET, DBConstants.NOT_NULL, DBConstants.DBTYPE_INT4));
+               addColumn(new DBColumn(IS_TARGET, DBConstants.NOT_NULL, DBConstants.DBTYPE_BOOLEAN));
+               addColumn(new DBColumn(CHILDREN_VARIABLE_ID, DBConstants.EMPTY, DBConstants.BIGINT_ARRAY));
+       }
+
+       @Override
+       public boolean prepare(PreparedStatement prep, List<Object> rowData) {
+               boolean isPrepared = true;
+
+               int columnsize = getColumnSize();
+               if (columnsize != rowData.size()) {
+                       isPrepared = false;
+               } else {
+                       try {
+                               int index = 1;
+                               prep.setLong(index++, (Long) (rowData.get(COLUMN.VARIABLE_ID.ordinal())));
+                               prep.setInt(index++, (Integer) (rowData.get(COLUMN.VARIABLE_TYPE.ordinal())));
+                               // Check string overflow
+                               String name = (String) (rowData.get(COLUMN.VARIABLE_TYPE_NAME.ordinal()));
+                               if (name != null && name.length() > MAX_TYPE_LEN) {
+                                       Logger.warning("Overflow occurs VARIABLE_TYPE_NAME in InteractiveVariableDBTable : " + name);
+                                       name = name.substring(0, MAX_NAME_LEN);
+                               }
+                               prep.setString(index++, name);
+                               // Check string overflow
+                               name = (String) (rowData.get(COLUMN.VARIABLE_NAME.ordinal()));
+                               if (name != null && name.length() > MAX_NAME_LEN) {
+                                       Logger.warning("Overflow occurs VARIABLE_NAME in InteractiveVariableDBTable : " + name);
+                                       name = name.substring(0, MAX_NAME_LEN);
+                               }
+                               prep.setString(index++, name);
+                               prep.setInt(index++, (Integer) (rowData.get(COLUMN.SOURCE_LINE_NUM.ordinal())));
+                               // Check string overflow
+                               name = (String) (rowData.get(COLUMN.SOURCE_FILE_NAME.ordinal()));
+                               if (name != null && name.length() > MAX_NAME_LEN) {
+                                       Logger.warning("Overflow occurs SOURCE_FILE_NAME in InteractiveVariableDBTable : " + name);
+                                       name = name.substring(0, MAX_NAME_LEN);
+                               }
+                               prep.setString(index++, name);
+                               prep.setInt(index++, (Integer) (rowData.get(COLUMN.POINTER_ORDER.ordinal())));
+                               prep.setInt(index++, (Integer) (rowData.get(COLUMN.ARRAY_COUNT.ordinal())));
+                               prep.setLong(index++, (Long) (rowData.get(COLUMN.PARENT_VARIABLE_ID.ordinal())));
+                               prep.setInt(index++, (Integer) (rowData.get(COLUMN.BYTE_SIZE.ordinal())));
+                               prep.setInt(index++, (Integer) (rowData.get(COLUMN.OFFSET.ordinal())));
+                               prep.setBoolean(index++, (Boolean) (rowData.get(COLUMN.IS_TARGET.ordinal())));
+                               setArrayToPreparedStatement(COLUMN.CHILDREN_VARIABLE_ID.ordinal(), DBConstants.LONG, prep, rowData);
+                       } catch (SQLException e) {
+                               e.printStackTrace();
+                               isPrepared = false;
+                       }
+               }
+
+               return isPrepared;
+       }
+
+       @Override
+       public List<Object> extractDataFromResultSet(ResultSet rs) {
+               List<Object> row = new ArrayList<Object>();
+               try {
+                       int index = 1;
+                       row.add(Long.valueOf(rs.getLong(index++)));
+                       row.add(Integer.valueOf(rs.getInt(index++)));
+                       row.add(rs.getString(index++));
+                       row.add(rs.getString(index++));
+                       row.add(Integer.valueOf(rs.getInt(index++)));
+                       row.add(rs.getString(index++));
+                       row.add(Integer.valueOf(rs.getInt(index++)));
+                       row.add(Integer.valueOf(rs.getInt(index++)));
+                       row.add(Long.valueOf(rs.getLong(index++)));
+                       row.add(Integer.valueOf(rs.getInt(index++)));
+                       row.add(Integer.valueOf(rs.getInt(index++)));
+                       row.add(Boolean.valueOf(rs.getBoolean(index++)));
+                       row.add(getArrayFromResultSet(rs, index++, Long.valueOf(0)));
+               } catch (SQLException e) {
+                       e.printStackTrace();
+                       return null;
+               }
+               return row;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/FBIManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/FBIManager.java
new file mode 100644 (file)
index 0000000..bcec040
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.swap.channel.control.FunctionBodyInstrument;
+import org.tizen.dynamicanalyzer.swap.channel.control.FunctionBodyInstrumentStep;
+import org.tizen.dynamicanalyzer.swap.channel.control.FunctionBodyInstrumentVariable;
+
+public class FBIManager {
+       private List<FunctionBodyInstrument> fbiList = new ArrayList<FunctionBodyInstrument>();
+       private static FBIManager instance = null;
+
+       public static FBIManager getInstance() {
+               if (instance == null) {
+                       instance = new FBIManager();
+               }
+               return instance;
+       }
+       
+       public void addFbi(FunctionBodyInstrument fbi) {
+               fbiList.add(fbi);
+       }
+       
+       public List<FunctionBodyInstrument> getFbiList() {
+               return fbiList;
+       }
+       
+       public void clear() {
+               fbiList.clear();
+       }
+       
+       public static FunctionBodyInstrument makeSWAPProtocolMessage(InteractiveInfo info) {
+               FunctionBodyInstrument fbi = new FunctionBodyInstrument(info.getSourceLineAddress());
+
+               long variableID = info.getVariableID();
+               long registerOffset = info.getRegisterOffset();
+               byte registerNum = (byte) info.getRegisterID();
+               int dataSize = info.getByteSize();
+               if (info.getArrayCount() > 0) {
+                       dataSize *= info.getArrayCount();
+               } else if (info.isString()) {
+                       dataSize = 0;
+               }
+               // make target variable
+               List<FunctionBodyInstrumentStep> steps = makeFBISteps(info);
+               FunctionBodyInstrumentVariable targetVariable = new FunctionBodyInstrumentVariable(variableID, registerOffset,
+                               registerNum, dataSize, steps);
+               fbi.addVariable(targetVariable);
+
+               // make child variable (char * member of struct)
+               if (info.getType() == VAR_TYPE.STRUCT) {
+                       List<InteractiveInfo> children = info.getChildren();
+                       for (int i = 0; i < children.size(); i++) {
+                               InteractiveInfo child = children.get(i);
+                               if (child.isString()) {
+                                       List<FunctionBodyInstrumentStep> memberSteps = new ArrayList<FunctionBodyInstrumentStep>();
+                                       memberSteps.add(new FunctionBodyInstrumentStep((byte) child.getPointerOrder(), child.getOffset()));
+                                       memberSteps.addAll(steps);
+                                       FunctionBodyInstrumentVariable childVariable = new FunctionBodyInstrumentVariable(child.getVariableID(),
+                                                       registerOffset, registerNum, 0, memberSteps);
+                                       fbi.addVariable(childVariable);
+                               }
+                       }
+               }
+               return fbi;
+       }
+       
+       private static List<FunctionBodyInstrumentStep> makeFBISteps(InteractiveInfo info) {
+               List<FunctionBodyInstrumentStep> steps = new ArrayList<FunctionBodyInstrumentStep>();
+               while (info != null) {
+                       FunctionBodyInstrumentStep step = new FunctionBodyInstrumentStep((byte)info.getPointerOrder(), (byte)info.getOffset());
+                       steps.add(step);
+                       info = info.getParent();
+               }
+               return steps;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/InteractiveIDGenerator.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/InteractiveIDGenerator.java
new file mode 100644 (file)
index 0000000..4772513
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.model;
+
+public class InteractiveIDGenerator {
+       private static int id = 0;
+       
+       public static synchronized int generateID() {
+               return ++id;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/InteractiveInfo.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/InteractiveInfo.java
new file mode 100644 (file)
index 0000000..d33c8f8
--- /dev/null
@@ -0,0 +1,262 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.model;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+
+public class InteractiveInfo {
+       public static int pointerSize = 4;      // TODO
+       private long variableID = 0;
+       private VAR_TYPE type;
+       private String typeName;
+       private String variableName = "";
+       private int sourceLineNum = 0;
+       private long sourceLineAddress = 0;
+       private String sourceFileName = "";
+       private int pointerOrder = 0;
+       private int arrayCount = 0;
+       private int byteSize = 0;
+       private int offset = 0;
+       private int registerID;
+       private long registerOffset;
+       private InteractiveInfo parent;
+       private List<InteractiveInfo> children;
+       private boolean isTarget = false;
+       
+       public boolean isTarget() {
+               return isTarget;
+       }
+
+       public void setTarget(boolean isTarget) {
+               this.isTarget = isTarget;
+       }
+
+       public void setTypeName(String typeName) {
+               this.typeName = typeName;
+       }
+
+       public void increasePointerOrder() {
+               pointerOrder++;
+       }
+       
+       public List<InteractiveInfo> getChildren() {
+               return children;
+       }
+
+       public void setChildren(List<InteractiveInfo> children) {
+               this.children = children;
+       }
+
+       public boolean isString() {
+               return type == VAR_TYPE.CHAR && pointerOrder > 0;
+       }
+       
+       public int getRegisterID() {
+               return registerID;
+       }
+
+       public void setRegisterID(int registerID) {
+               this.registerID = registerID;
+       }
+
+       public long getRegisterOffset() {
+               return registerOffset;
+       }
+
+       public void setRegisterOffset(long registerOffset) {
+               this.registerOffset = registerOffset;
+       }
+
+       public long getVariableID() {
+               return variableID;
+       }
+
+       public void setVariableID(long variableID) {
+               this.variableID = variableID;
+       }
+
+       public VAR_TYPE getType() {
+               return type;
+       }
+
+       public void setType(VAR_TYPE type) {
+               this.type = type;
+       }
+
+       public String getVariableName() {
+               return variableName;
+       }
+
+       public void setVariableName(String variableName) {
+               this.variableName = variableName;
+       }
+
+       public int getSourceLineNum() {
+               return sourceLineNum;
+       }
+
+       public void setSourceLineNum(int sourceLineNum) {
+               this.sourceLineNum = sourceLineNum;
+       }
+
+       public long getSourceLineAddress() {
+               return sourceLineAddress;
+       }
+
+       public void setSourceLineAddress(long sourceLineAddress) {
+               this.sourceLineAddress = sourceLineAddress;
+       }
+
+       public String getSourceFileName() {
+               return sourceFileName;
+       }
+
+       public void setSourceFileName(String sourceFileName) {
+               this.sourceFileName = sourceFileName;
+       }
+
+       public int getPointerOrder() {
+               return pointerOrder;
+       }
+
+       public void setPointerOrder(int pointerOrder) {
+               this.pointerOrder = pointerOrder;
+       }
+
+       public int getArrayCount() {
+               return arrayCount;
+       }
+
+       public void setArrayCount(int arrayCount) {
+               this.arrayCount = arrayCount;
+       }
+
+       public InteractiveInfo getParent() {
+               return parent;
+       }
+
+       public void setParent(InteractiveInfo parent) {
+               this.parent = parent;
+       }
+       
+       public int getByteSize() {
+               return byteSize;
+       }
+
+       public void setByteSize(int byteSize) {
+               this.byteSize = byteSize;
+       }
+
+       public int getOffset() {
+               return offset;
+       }
+
+       public void setOffset(int offset) {
+               this.offset = offset;
+       }
+
+       public String getTypeName() {
+               return typeName;
+       }
+       
+       public String getTypeNameWithPointer() {
+               String string = typeName; 
+               if (string == null) {
+                       string = type.getName();
+               }
+               for (int i = 0; i < pointerOrder; i++) {
+                       string += "*";
+               }                       
+               return string;
+       }
+       
+       /*
+        * type + variable name / source file name / line
+        * ex) int result / test.c / 231
+        */
+       public String getDescription() {
+               String[] splitedSourcePath = AnalyzerUtil.splitFilePath(sourceFileName, File.separator);
+               String fileName = splitedSourcePath[splitedSourcePath.length - 1];
+               if (arrayCount > 0) {
+                       return getTypeNameWithPointer() + " " + getVariableName() + " [" + arrayCount + "]  (" + fileName + " : " + sourceLineNum + ")";
+               } else {
+                       return getTypeNameWithPointer() + " " + getVariableName() + "  (" + fileName + " : " + sourceLineNum + ")";
+               }
+       }       
+       
+       public boolean isStructType() {
+               return (type == VAR_TYPE.STRUCT);
+       }
+       
+       public boolean isArray() {
+               return (arrayCount > 0);
+       }
+       
+       public boolean isPointerType() {
+               return (pointerOrder > 0);
+       }
+       
+       public List<Long> getAllChildrenIDs() {
+               List<Long> variableIDList = new ArrayList<Long>();
+               getChildrenIDs(variableIDList);
+               return variableIDList;
+       }
+       
+       public List<Long> getChildrenIDs() {
+               List<Long> variableIDList = new ArrayList<Long>();
+               if (children != null) {
+                       for (int i = 0; i < children.size(); i++) {
+                               variableIDList.add(children.get(i).getVariableID());
+                       }
+               }
+               return variableIDList;
+       }
+       
+       private void getChildrenIDs(List<Long> variableIDList) {
+               if (children != null) {
+                       for (int i = 0; i < children.size(); i++) {
+                               variableIDList.add(children.get(i).getVariableID());
+                               children.get(i).getChildrenIDs(variableIDList);
+                       }
+               }
+       }
+       
+       public boolean hasChild(long variableID) {
+               if (children != null) {
+                       for (int i = 0; i < children.size(); i++) {
+                               if (variableID == children.get(i).getVariableID()) {
+                                       return true;
+                               }
+                       }
+               }
+               return false;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/InteractiveParser.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/InteractiveParser.java
new file mode 100644 (file)
index 0000000..95a13b4
--- /dev/null
@@ -0,0 +1,522 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.model;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.debug.edc.internal.symbols.IArrayType;
+import org.eclipse.cdt.debug.edc.internal.symbols.IConstType;
+import org.eclipse.cdt.debug.edc.internal.symbols.IField;
+import org.eclipse.cdt.debug.edc.internal.symbols.ILexicalBlockScope;
+import org.eclipse.cdt.debug.edc.internal.symbols.IPointerType;
+import org.eclipse.cdt.debug.edc.internal.symbols.ITypedef;
+import org.eclipse.cdt.debug.edc.internal.symbols.LexicalBlockScope;
+import org.eclipse.cdt.debug.edc.internal.symbols.StructType;
+import org.eclipse.cdt.debug.edc.internal.symbols.dwarf.DwarfCompileUnit;
+import org.eclipse.cdt.debug.edc.internal.symbols.dwarf.DwarfDebugInfoProvider;
+import org.eclipse.cdt.debug.edc.internal.symbols.dwarf.DwarfInfoReader;
+import org.eclipse.cdt.debug.edc.internal.symbols.dwarf.LocationExpression;
+import org.eclipse.cdt.debug.edc.internal.symbols.files.ElfExecutableSymbolicsReaderFactory;
+import org.eclipse.cdt.debug.edc.symbols.ICompileUnitScope;
+import org.eclipse.cdt.debug.edc.symbols.IExecutableSymbolicsReader;
+import org.eclipse.cdt.debug.edc.symbols.IFunctionScope;
+import org.eclipse.cdt.debug.edc.symbols.ILineEntry;
+import org.eclipse.cdt.debug.edc.symbols.ILocationProvider;
+import org.eclipse.cdt.debug.edc.symbols.IScope;
+import org.eclipse.cdt.debug.edc.symbols.IType;
+import org.eclipse.cdt.debug.edc.symbols.IVariable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveUIData;
+import org.tizen.dynamicanalyzer.util.ByteUtil;
+import org.tizen.dynamicanalyzer.util.Logger;
+
+public class InteractiveParser {
+       private static int GLOBAL_VARIABLE_ID = 0xFF;           // If Global variable, Register ID will be 0xFF. It's Protocol with SWAP.
+       
+       public static InteractiveUIData parseValue(InteractiveInfo interactiveInfo, Map<Long, byte[]> valueMap) {
+               InteractiveUIData uiData = null;
+               byte[] value = valueMap.get(interactiveInfo.getVariableID());
+               if (value != null) {
+                       if (interactiveInfo.isStructType() == false && interactiveInfo.isArray() == false) {
+                               uiData = parseScalar(interactiveInfo, value);
+                       } else if (interactiveInfo.isArray()) {
+                               uiData = parseArray(interactiveInfo, value);
+                       } else if (interactiveInfo.isStructType()) {
+                               uiData = parseStruct(interactiveInfo, value, valueMap);
+                       } else {
+                               Logger.warning("value is not scalar, array, struct.");
+                       }
+               }
+               return uiData;
+       }
+
+       /*
+        * TODO Detail variable type parsing, because some C data type is not supported by Java's primitive.
+        */
+       private static InteractiveUIData parseScalar(InteractiveInfo info, byte[] data) {
+               InteractiveUIData uiData = new InteractiveUIData(info);
+               Object value = null;
+               switch (info.getType()) {
+               case CHAR:
+               case UNSIGNED_CHAR:
+               case SIGNED_CHAR: {
+                       if (info.getPointerOrder() > 0) {
+                               value = ByteUtil.getString(data, 0);
+                       } else {
+                               value = new Character((char) data[0]);
+                       }
+               }
+                       break;
+               case INT:
+                       value = ByteUtil.toInt(data);
+                       break;
+               case UNSIGNED_INT:
+                       value = ByteUtil.toUnsignedInt(data, 0);
+                       break;
+               case SHORT:
+               case UNSIGNED_SHORT:
+                       value = ByteUtil.toShort(data, 0);
+                       break;
+               case LONG:
+               case UNSIGNED_LONG:
+                       value = ByteUtil.toLong(data);
+                       break;
+               case FLOAT:
+                       value = ByteUtil.toFloat(data, 0);
+                       break;
+               case DOUBLE:
+               case LONG_DOUBLE:
+                       value = ByteUtil.toDouble(data, 0);
+                       break;
+               default:
+                       Logger.warning("undefined variable type!!");
+                       break;
+               }
+               uiData.setValue(value);
+               return uiData;
+       }
+       
+       private static InteractiveUIData parseStruct(InteractiveInfo info, byte[] data, Map<Long, byte[]> valueMap) {
+               InteractiveUIData uiData = new InteractiveUIData(info);
+               List<InteractiveUIData> children = new ArrayList<InteractiveUIData>();
+               if (info.getChildren() != null) {
+                       for (int i = 0; i < info.getChildren().size(); i++) {
+                               InteractiveInfo memberInfo = info.getChildren().get(i);
+                               int offset = memberInfo.getOffset();
+                               int byteSize = memberInfo.getByteSize();
+                               InteractiveUIData memberUiData = null;
+                               /*
+                                * Note : The sequence of "if/else if" is significant. Do not change sequence without consideration.
+                                * It's possible 8cases : (single, array) * (scalar, scalar+pointer, struct, struct+pointer)
+                                * "scalar" means "not Struct" like "int, double, ...".
+                                */
+                               /*
+                                * Case : member is scalar of value. 1case is covered.
+                                * (single) * (scalar)
+                                */
+                               if (memberInfo.isStructType() == false && memberInfo.isPointerType() == false 
+                                               && memberInfo.isArray() == false) {
+                                       memberUiData = parseScalar(memberInfo, Arrays.copyOfRange(data, offset, offset + byteSize));
+                               } 
+                               /*
+                                * Case : member is Array of value. 2cases is covered.
+                                * (array) * (scalar, struct) 
+                                */
+                               else if (memberInfo.isArray() && memberInfo.isPointerType() == false) {  
+                                       int lastIndex = offset + (memberInfo.getArrayCount() * byteSize);
+                                       memberUiData = parseArray(memberInfo, Arrays.copyOfRange(data, offset, lastIndex));
+                               }
+                               /*
+                                * Case : member is Array of pointer. 2cases is covered.
+                                * (array) * (scalar+pointer, struct+pointer)
+                                */
+                               else if (memberInfo.isArray() && memberInfo.isPointerType() == true) {
+                                       int lastIndex = offset + (memberInfo.getArrayCount() * InteractiveInfo.pointerSize);
+                                       memberUiData = parseArray(memberInfo, Arrays.copyOfRange(data, offset, lastIndex));
+                               }
+                               /*
+                                * Case : member is Pointer regardless of scalar, struct. 2cases is covered.
+                                * (single) * (scalar+pointer, struct+pointer)
+                                */
+                               else if (memberInfo.isPointerType()) {
+                                       memberUiData = new InteractiveUIData(memberInfo);
+                                       byte[] stream = valueMap.get(memberInfo.getVariableID());
+                                       if (stream != null) {
+                                               memberUiData = parseValue(memberInfo, valueMap);
+                                       } else {
+                                               byte[] address = ByteUtil.toBytesN(data, offset, InteractiveInfo.pointerSize);
+                                               if (InteractiveInfo.pointerSize == 4) { // 4byte
+                                                       memberUiData.setValue("0x" + Integer.toHexString(ByteUtil.toInt(address)));
+                                               } else if (InteractiveInfo.pointerSize == 8) {  // 8byte
+                                                       memberUiData.setValue("0x" + Long.toHexString(ByteUtil.toLong(address)));
+                                               }
+                                       }
+                               }
+                               /*
+                                * Case : member is Struct (not Pointer, Array). 1case is covered.
+                                * (single) * (struct)
+                                */
+                               else if (memberInfo.isStructType()) {
+                                       memberUiData = parseStruct(memberInfo, Arrays.copyOfRange(data, offset, offset + byteSize), valueMap);
+                               }
+                               /*
+                                * Error Case. This case is impossible.
+                                */
+                               else {
+                                       Logger.warning("Unhandled case!!");
+                               }
+                               children.add(memberUiData);
+                       }
+               }
+               uiData.setChildren(children);
+               return uiData;
+       }
+
+       private static InteractiveUIData parseArray(InteractiveInfo info, byte[] data) {
+               InteractiveUIData uiData = new InteractiveUIData(info);
+               uiData.setArray(true);
+               String arrayValue = "[ ";
+               List<InteractiveUIData> children = new ArrayList<InteractiveUIData>();
+               int index = 0;
+               int byteSize = (info.getPointerOrder() > 0) ? InteractiveInfo.pointerSize : info.getByteSize();
+               for (int i = 0; i < info.getArrayCount(); i++) {
+                       InteractiveUIData elementUiData = null;
+                       /*
+                        * Note : The sequence of "if/else if" is significant. Do not change sequence without consideration.
+                        * It's possible 4cases : (scalar, scalar+pointer, struct, struct+pointer)
+                        * "scalar" means "not Struct" like "int, double, ...".
+                        */
+                       /*
+                        * Case : Array of simple primitive type (not struct, not pointer). 1case is covered.
+                        * (scalar)
+                        */
+                       if (info.isStructType() == false && info.isPointerType() == false) {
+                               elementUiData = parseScalar(info, Arrays.copyOfRange(data, index, index + byteSize));
+                       } 
+                       /*
+                        * Case : Array of pointer (regardless of struct). 2case is covered.
+                        * (scalar+pointer, struct+pointer)
+                        */
+                       else if (info.isPointerType() == true) {
+                               byte[] address = ByteUtil.toBytesN(data, index, InteractiveInfo.pointerSize);
+                               elementUiData = new InteractiveUIData(info);
+                               if (InteractiveInfo.pointerSize == 4) { // 4byte
+                                       elementUiData.setValue("0x" + Integer.toHexString(ByteUtil.toInt(address)));
+                               } else if (InteractiveInfo.pointerSize == 8) { // 8byte
+                                       elementUiData.setValue("0x" + Long.toHexString(ByteUtil.toLong(address)));
+                               }
+                       } 
+                       /*
+                        * Case : Array of Struct (not pointer). 1case is covered.
+                        * (struct) 
+                        */
+                       else if (info.isStructType()) {
+                               elementUiData = parseStruct(info, Arrays.copyOfRange(data, index, index + byteSize), null);
+                       } 
+                       /*
+                        * Error Case. This case is impossible.
+                        */
+                       else {
+                               Logger.warning("Unhandled case!!");
+                       }
+                       index += byteSize;
+                       if (elementUiData != null) {
+                               children.add(elementUiData);
+                               arrayValue += elementUiData.getValue() + " , ";
+                       }
+               }
+               arrayValue += " ]";
+               uiData.setValue(arrayValue);
+               uiData.setChildren(children);
+               return uiData;
+       }
+
+       public static InteractiveInfo getInteractiveInfo(String binaryPath, String sourcePath, int lineNum, String varStr,
+                       int arrayCount) {
+               String[] parsedVar = parseVariableString(varStr);       // parse structure member (ex. structVal->mem1 => [structVal, mem1])
+               InteractiveInfo rootInteractiveInfo = parseDwarf(binaryPath, sourcePath, lineNum, parsedVar[0]);
+               if (rootInteractiveInfo != null) {
+                       InteractiveInfo targetInteractiveInfo = findTargetInteractiveInfo(rootInteractiveInfo, parsedVar);
+                       targetInteractiveInfo.setVariableName(varStr);
+                       targetInteractiveInfo.setSourceFileName(sourcePath);
+                       targetInteractiveInfo.setSourceLineNum(lineNum);
+                       targetInteractiveInfo.setSourceLineAddress(rootInteractiveInfo.getSourceLineAddress());
+                       targetInteractiveInfo.setArrayCount(arrayCount);
+                       return targetInteractiveInfo;
+               }
+               return rootInteractiveInfo;
+       }
+       
+       private static String[] parseVariableString(String varStr) {
+               String[] parsed = varStr.split("->|\\.");
+               return parsed;
+       }
+       
+       private static InteractiveInfo findTargetInteractiveInfo(InteractiveInfo rootInfo, String[] parsedVar) {
+               int depth = parsedVar.length;
+               InteractiveInfo cursorInfo = rootInfo;
+               for (int i = 1; i < depth; i++) {
+                       List<InteractiveInfo> children = rootInfo.getChildren();
+                       for (int ii = 0; ii < children.size(); ii++) {
+                               if (children.get(ii).getVariableName().equals(parsedVar[i])) {
+                                       cursorInfo = children.get(ii);
+                               }
+                       }
+               }
+               cursorInfo.setTarget(true);
+               cursorInfo.setRegisterID(rootInfo.getRegisterID());
+               cursorInfo.setRegisterOffset(rootInfo.getRegisterOffset());
+               return cursorInfo;
+       }
+       
+       private static InteractiveInfo parseDwarf(String binaryPath, String sourcePath, int lineNum, String varName) {
+               Path _binaryPath = new Path(binaryPath);
+               Path _sourcePath = new Path(sourcePath);
+               ElfExecutableSymbolicsReaderFactory fact = new ElfExecutableSymbolicsReaderFactory();
+               IExecutableSymbolicsReader exeReader = fact.createExecutableSymbolicsReader(_binaryPath);
+               if (exeReader == null) {
+                       return null;
+               }
+               DwarfDebugInfoProvider dip = new DwarfDebugInfoProvider(exeReader);
+               DwarfInfoReader dir = new DwarfInfoReader(dip);
+               dir.parseInitial();
+               dir.parseForAddresses(true);
+
+               List<ICompileUnitScope> cuList = dip.getModuleScope().getCompileUnitsForFile(_sourcePath);
+               ILineEntry sourceLine = null;
+               for (int i = 0; i < cuList.size(); i++) {
+                       ICompileUnitScope cu = cuList.get(i);
+                       if (!(cu instanceof DwarfCompileUnit)) {
+                               continue;
+                       }
+                       List<IPath> fileList = new ArrayList<IPath>();
+                       Collection<ILineEntry> lines = dir.parseLineTable(cu, ((DwarfCompileUnit) cu).getAttributeList(), fileList);
+                       Iterator<ILineEntry> iterLine = lines.iterator();
+                       while (iterLine.hasNext()) {
+                               ILineEntry line = iterLine.next();
+                               if (line.getLineNumber() == lineNum && line.getFilePath().equals(_sourcePath)) {
+                                       sourceLine = line;
+                                       Collection<IScope> cuChildren = cu.getChildren();
+                                       Iterator<IScope> iterScope = cuChildren.iterator();
+                                       while (iterScope.hasNext()) {
+                                               IScope cuChild = iterScope.next();
+                                               if (!(cuChild instanceof IFunctionScope)) {
+                                                       continue;
+                                               }
+                                               IFunctionScope funcScope = (IFunctionScope) cuChild;
+                                               /*
+                                                * DW_TAG_subprogram
+                                                */
+                                               if (line.getHighAddress().compareTo(cuChild.getHighAddress()) <= 0
+                                                               && line.getLowAddress().compareTo(cuChild.getLowAddress()) >= 0) {
+                                                       Collection<IScope> funcChildren = cuChild.getChildren();
+                                                       Iterator<IScope> iterFunc = funcChildren.iterator();
+                                                       /*
+                                                        * DW_TAG_lexical_block
+                                                        */
+                                                       while (iterFunc.hasNext()) {
+                                                               InteractiveInfo varInfo = checkLexicalBlock(iterFunc.next(), varName, line, funcScope);
+                                                               if (varInfo != null) {
+                                                                       return varInfo;
+                                                               }
+                                                       }
+                                                       /*
+                                                        * DW_TAG_formal_parameter
+                                                        */
+                                                       Collection<IVariable> params = ((IFunctionScope) cuChild).getParameters();
+                                                       InteractiveInfo varInfo = getVariableInfo(params, varName, line, funcScope);
+                                                       if (varInfo != null) {
+                                                               return varInfo;
+                                                       }
+                                                       /*
+                                                        * DW_TAG_variable
+                                                        */
+                                                       varInfo = getVariableInfo(cuChild.getVariables(), varName, line, funcScope);
+                                                       if (varInfo != null) {
+                                                               return varInfo;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+               if (sourceLine == null) {       // Invalid line of source code (for example.. space, comment)
+                       return null;
+               }
+               /*
+                * Check global variable
+                */
+               Collection<IVariable> variables = dip.getModuleScope().getVariablesByName(varName, true);
+               return getVariableInfo(variables, varName, sourceLine, null);
+       }
+
+       private static boolean setVariableLocationInfo(ILocationProvider locationProvider, InteractiveInfo variableInfo,
+                       IFunctionScope funcScope) {
+               if (!(locationProvider instanceof LocationExpression)) {
+                       return false;
+               }
+               /*
+                * Case : Local variable
+                */
+               if (funcScope != null) {
+                       int registerID = ((LocationExpression) funcScope.getFrameBaseLocation()).getRegisterID();
+                       variableInfo.setRegisterID(registerID);
+                       if (registerID > 0) {
+                               Object[] offset = new Object[1];
+                               if (((LocationExpression) locationProvider).getRegisterOffset(offset)) {
+                                       variableInfo.setRegisterOffset((Long) offset[0]);
+                                       return true;
+                               }
+                       }
+               }
+               /*
+                * Case : Global variable
+                */
+               else {
+                       variableInfo.setRegisterID(GLOBAL_VARIABLE_ID);
+                       Object[] address = new Object[1];
+                       if (true == ((LocationExpression) locationProvider).getGlobalVariableAddress(address)) {
+                               variableInfo.setRegisterOffset((Long) address[0]);
+                               return true;
+                       }
+               }
+               return false;
+       }
+
+       private static IType findTypeOfArray(IType type) {
+               if (!(type instanceof IArrayType) && !((type instanceof ITypedef || type instanceof IConstType))) {
+                       return type;
+               }
+               return findTypeOfArray(type.getType());
+       }
+
+       private static void getTypeInfo(IType type, InteractiveInfo valueInfo) {
+               valueInfo.setByteSize(type.getByteSize());
+               if (type instanceof IPointerType) {
+                       valueInfo.increasePointerOrder();
+                       getTypeInfo(type.getType(), valueInfo);
+               } else if (type instanceof ITypedef || type instanceof IConstType) {
+                       getTypeInfo(type.getType(), valueInfo);
+               } else if (type instanceof IArrayType) {
+                       getTypeInfo(type.getType(), valueInfo);
+               } else if (type instanceof StructType) {
+                       valueInfo.setType(VAR_TYPE.STRUCT);
+                       valueInfo.setTypeName(type.getName());
+                       List<InteractiveInfo> members = new ArrayList<InteractiveInfo>();
+                       valueInfo.setChildren(members);
+                       IField[] fields = ((StructType) type).getFields();
+                       for (int i = 0; i < fields.length; i++) {
+                               InteractiveInfo memberInfo = new InteractiveInfo();
+                               memberInfo.setVariableID(InteractiveIDGenerator.generateID());
+                               memberInfo.setVariableName(fields[i].getName());
+                               memberInfo.setOffset((int) fields[i].getFieldOffset());
+                               memberInfo.setParent(valueInfo);
+                               // calculate count of array
+                               int arrayCount = 0;
+                               if (fields[i].getType() instanceof IArrayType) {
+                                       IType arrayType = findTypeOfArray(fields[i].getType());
+                                       if (fields.length - 1 == i) { // if last member,
+                                               arrayCount = (type.getByteSize() - memberInfo.getOffset()) / arrayType.getByteSize();
+                                       } else {
+                                               arrayCount = ((int) fields[i + 1].getFieldOffset() - memberInfo.getOffset())
+                                                               / arrayType.getByteSize();
+                                       }
+                               }
+                               memberInfo.setArrayCount(arrayCount);
+                               getTypeInfo(fields[i].getType(), memberInfo);
+                               members.add(memberInfo);
+                       }
+               } else {
+                       if (VAR_TYPE.CHAR.getName().equals(type.getName())) {
+                               valueInfo.setType(VAR_TYPE.CHAR);
+                       } else if (VAR_TYPE.UNSIGNED_CHAR.getName().equals(type.getName())) {
+                               valueInfo.setType(VAR_TYPE.UNSIGNED_CHAR);
+                       } else if (VAR_TYPE.SIGNED_CHAR.getName().equals(type.getName())) {
+                               valueInfo.setType(VAR_TYPE.SIGNED_CHAR);
+                       } else if (VAR_TYPE.INT.getName().equals(type.getName())) {
+                               valueInfo.setType(VAR_TYPE.INT);
+                       } else if (VAR_TYPE.UNSIGNED_INT.getName().equals(type.getName())) {
+                               valueInfo.setType(VAR_TYPE.UNSIGNED_INT);
+                       } else if (VAR_TYPE.SHORT.getName().equals(type.getName())) {
+                               valueInfo.setType(VAR_TYPE.SHORT);
+                       } else if (VAR_TYPE.UNSIGNED_SHORT.getName().equals(type.getName())) {
+                               valueInfo.setType(VAR_TYPE.UNSIGNED_SHORT);
+                       } else if (VAR_TYPE.LONG.getName().equals(type.getName())) {
+                               valueInfo.setType(VAR_TYPE.LONG);
+                       } else if (VAR_TYPE.UNSIGNED_LONG.getName().equals(type.getName())) {
+                               valueInfo.setType(VAR_TYPE.UNSIGNED_LONG);
+                       } else if (VAR_TYPE.FLOAT.getName().equals(type.getName())) {
+                               valueInfo.setType(VAR_TYPE.FLOAT);
+                       } else if (VAR_TYPE.DOUBLE.getName().equals(type.getName())) {
+                               valueInfo.setType(VAR_TYPE.DOUBLE);
+                       } else if (VAR_TYPE.LONG_DOUBLE.getName().equals(type.getName())) {
+                               valueInfo.setType(VAR_TYPE.LONG_DOUBLE);
+                       } else {
+                               valueInfo.setType(VAR_TYPE.UNDEF);
+                       }
+               }
+       }
+
+       private static InteractiveInfo getVariableInfo(Collection<IVariable> variables, String varName, ILineEntry line,
+                       IFunctionScope funcScope) {
+               Iterator<IVariable> iterVar = variables.iterator();
+               while (iterVar.hasNext()) {
+                       IVariable var = iterVar.next();
+                       if (var.getName().equals(varName)) {
+                               InteractiveInfo variableInfo = new InteractiveInfo();
+                               variableInfo.setVariableID(InteractiveIDGenerator.generateID());
+                               variableInfo.setVariableName(var.getName());
+                               variableInfo.setSourceLineAddress(line.getHighAddress().getValue().longValue());
+                               getTypeInfo(var.getType(), variableInfo);
+                               if (setVariableLocationInfo(var.getLocationProvider(), variableInfo, funcScope)) {
+                                       return variableInfo;
+                               } else {
+                                       Logger.warning("Get Location error!!!");
+                               }
+                       }
+               }
+               return null;
+       }
+
+       private static InteractiveInfo checkLexicalBlock(IScope lexicalScope, String varName, ILineEntry line,
+                       IFunctionScope funcScope) {
+               if (lexicalScope instanceof LexicalBlockScope) {
+                       if (line.getLowAddress().compareTo(lexicalScope.getHighAddress()) < 0
+                                       && line.getLowAddress().compareTo(lexicalScope.getLowAddress()) > 0) {
+                               Collection<IVariable> variables = ((ILexicalBlockScope) lexicalScope).getVariablesInTree();
+                               return getVariableInfo(variables, varName, line, funcScope);
+                       }
+               }
+               return null;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/VAR_TYPE.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/model/VAR_TYPE.java
new file mode 100644 (file)
index 0000000..9844268
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.model;
+
+public enum VAR_TYPE {
+       UNDEF,
+       CHAR("char"),
+       UNSIGNED_CHAR("unsigned char"),
+       SIGNED_CHAR("signed char"),
+       INT("int"),
+       UNSIGNED_INT("unsigned int"),
+       SHORT("short"),
+       UNSIGNED_SHORT("unsigned short"),
+       LONG("long"),
+       UNSIGNED_LONG("unsigned long"),
+       FLOAT("float"),
+       DOUBLE("double"),
+       LONG_DOUBLE("long double"),
+       POINTER,
+       ARRAY,
+       STRUCT("struct");
+
+       final private String name;
+
+       private VAR_TYPE() {
+               this.name = "";
+       }
+
+       private VAR_TYPE(String name) {
+               this.name = name;
+       }
+
+       public String getName() {
+               return name;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/table/InteractiveTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/table/InteractiveTable.java
new file mode 100644 (file)
index 0000000..6ac98a8
--- /dev/null
@@ -0,0 +1,251 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.table;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.nebula.widgets.grid.Grid;
+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.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.DASelectionData;
+import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
+import org.tizen.dynamicanalyzer.model.TreeInput;
+import org.tizen.dynamicanalyzer.ui.interactive.InteractivePage;
+import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveDataManager;
+import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveUIData;
+import org.tizen.dynamicanalyzer.ui.interactive.model.InteractiveInfo;
+import org.tizen.dynamicanalyzer.ui.interactive.model.InteractiveParser;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATreeComposite;
+import org.tizen.dynamicanalyzer.utils.Formatter;
+
+public class InteractiveTable extends DATreeComposite {
+       private InteractiveInfo interactiveInfo;
+       private Map<Long, Boolean> beforeExpandMap; 
+       
+       public InteractiveTable(Composite parent, int compStyle, int tableStyle) {
+               super(parent, compStyle, tableStyle);
+
+               table.addListener(SWT.Expand, new Listener() {
+                       @Override
+                       public void handleEvent(Event event) {
+                               GridItem item = (GridItem) event.item;
+                               setExpand(item, true);
+                       }
+               });
+               table.addListener(SWT.Collapse, new Listener() {
+                       @Override
+                       public void handleEvent(Event event) {
+                               GridItem item = (GridItem) event.item;
+                               setExpand(item, false);
+                       }
+               });
+               
+               table.addSelectionListener(new SelectionListener() {
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               GridItem[] ti = ((Grid) e.widget).getSelection();
+                               if (null == ti || ti.length == 0) {
+                                       return;
+                               }
+                               int size = ti.length;
+                               List<Object> startData = ((DATableDataFormat) ti[0].getData()).getData();
+                               List<Object> endData = ((DATableDataFormat) ti[size - 1].getData()).getData();
+                               long startTime = (Long) startData.get(0);
+                               long endTime = (Long) endData.get(0);
+
+                               DASelectionData data = new DASelectionData(InteractivePage.listViewID, startTime, endTime, ti, table);
+                               AnalyzerManager.getCurrentPage().updateView(data);
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+                       }
+               });
+       }
+
+       public void setInteractiveInfo(InteractiveInfo interactiveInfo) {
+               this.interactiveInfo = interactiveInfo;
+       }
+       
+       public void updateTree(long startTime, long endTime) {
+               GridItem[] items = table.getItems();
+               if (items != null) {
+                       List<Integer> selectionList = new ArrayList<Integer>();
+                       for (int i = 0; i < items.length; i++) {
+                               GridItem item = items[i];
+                               long time = (Long)((DATableDataFormat)(item.getData())).getData().get(0);
+                               if (startTime <= time && time <= endTime) {
+                                       selectionList.add(i);
+                               }
+                       }
+                       int[] sels = new int[selectionList.size()];
+                       for (int i = 0; i < selectionList.size(); i++) {
+                               sels[i] = selectionList.get(i);
+                       }
+                       table.setSelection(sels);
+               }
+               updateTree();
+       }
+       
+       @Override
+       public void updateTree() {
+               beforeExpandMap = (Map<Long, Boolean>)getExpandMap().clone();
+               super.updateTree();
+       }
+       
+       @Override
+       public List<TreeInput> makeTreeInput() {
+               if (interactiveInfo == null) {
+                       return null;
+               }
+               ResultSet rs = InteractiveDataManager.getInstance().getValueDataFromDB(interactiveInfo);
+               if (rs == null) {
+                       return null;
+               }
+               List<InteractiveUIData> parsedDataList = new ArrayList<InteractiveUIData>();
+               long targetVariableID = interactiveInfo.getVariableID();
+               long tableID = 0;
+               try {
+                       Map<Long, byte[]> valueMap = new HashMap<Long, byte[]>();
+                       while (rs.next()) {
+                               long time = rs.getLong(1);
+                               long variableID = rs.getLong(2);
+                               byte[] value = rs.getBytes(4);
+                               valueMap.put(variableID, value);
+                               if (variableID == targetVariableID || rs.isLast()) {
+                                       InteractiveUIData uiData = InteractiveParser.parseValue(interactiveInfo, valueMap);
+                                       if (uiData != null) {
+                                               tableID = setUIDataID(uiData, tableID); // for Table row identity
+                                               uiData.setTime(time);
+                                               parsedDataList.add(uiData);
+                                       }
+                                       valueMap.clear();
+                               }
+                       }
+               } catch (SQLException e) {
+                       e.printStackTrace();
+               } finally {
+                       SqlConnectionManager.releaseResultSet(rs);
+               }
+               Collections.sort(parsedDataList);
+               List<TreeInput> output = new ArrayList<TreeInput>();
+               for (int i = 0; i < parsedDataList.size(); i++) {
+                       InteractiveUIData valueData = parsedDataList.get(i);
+                       TreeInput valueInput = makeInput(valueData, valueData.getTime(), false);
+                       makeChildTree(valueData, valueInput, valueData.getTime(), valueData.getName());
+                       output.add(valueInput);
+               }
+               return output;
+       }
+
+       @Override
+       protected GridItem checkExpand(GridItem gridItem, DATableDataFormat gridData) {
+               long seq = gridData.getSelectionKey();
+               Object expand = beforeExpandMap.get(seq);
+               if (null == expand) {
+                       if (gridItem.getParent() == null) {
+                               gridItem.setExpanded(true);
+                               getExpandMap().put(seq, true);
+                       } else {
+                               gridItem.setExpanded(false);
+                               getExpandMap().put(seq, false);
+                       }
+               } else {
+                       gridItem.setExpanded((Boolean) expand);
+               }
+               return gridItem;
+       }
+
+       private TreeInput makeInput(InteractiveUIData input, long time, boolean isChild) {
+               // table data
+               DATableDataFormat tableData = new DATableDataFormat(input.getTableRowID());
+
+               // make input data
+               if (isChild) {
+                       tableData.setObject(input.getName());
+               } else {
+                       String strTime = Formatter.toTimeFormat(input.getTime());
+                       tableData.setObject(strTime + " / " + input.getName());
+               }
+
+               List<String> text = new ArrayList<String>();
+
+               text.add(input.getName());
+               text.add(input.getType());
+               if (input.getValue() != null) {
+                       text.add(input.getValue().toString());
+               }
+
+               TreeInput output = new TreeInput();
+               output.setText(text);
+               tableData.getData().add(time);
+               tableData.setType(AnalyzerConstants.TYPE_TABLE_INTERACTIVE);
+               output.setData(tableData);
+               return output;
+       }
+
+       private void makeChildTree(InteractiveUIData parentData, TreeInput parentInput, long time, String parentName) {
+               List<InteractiveUIData> children = parentData.getChildren();
+               if (children == null) {
+                       return;
+               }
+               for (int i = 0; i < children.size(); i++) {
+                       InteractiveUIData data = children.get(i);
+                       if (parentData.isArray()) {
+                               data.setName("[" + i + "]");
+                       }
+                       TreeInput input = makeInput(data, time, true);
+                       makeChildTree(data, input, time, data.getName());
+                       parentInput.getChildren().add(input);
+                       input.setParent(parentName);
+               }
+       }
+       
+       private long setUIDataID(InteractiveUIData uiData, long tableRowID) {
+               uiData.setTableRowID(tableRowID++);
+               if (uiData.getChildren() != null) {
+                       for (int i = 0; i < uiData.getChildren().size(); i++) {
+                               tableRowID = setUIDataID(uiData.getChildren().get(i), tableRowID);
+                       }
+               }
+               return tableRowID;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/table/InteractiveTableView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/table/InteractiveTableView.java
new file mode 100644 (file)
index 0000000..435c478
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jungwook Ryu <jungwook.ryu@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.interactive.table;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.DASelectionData;
+import org.tizen.dynamicanalyzer.model.ColumnData;
+import org.tizen.dynamicanalyzer.nl.InteractivePageLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.ui.interactive.model.InteractiveInfo;
+import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
+import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
+import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
+
+public class InteractiveTableView extends DAViewComposite {
+       public static final String ID = InteractiveTableView.class.getName();
+       protected InteractiveTable treeComp = null;
+       protected List<ColumnData> columnData = null;
+
+       protected String[] columnNames = {
+                       InteractivePageLabels.INTERACTIVE_TABLE_TIME,
+                       InteractivePageLabels.INTERACTIVE_TABLE_TYPE,
+                       InteractivePageLabels.INTERACTIVE_TABLE_VALUE };
+       protected int[] columnSizes = { 200, 150, 0 };
+       private int[] columnAlignment = { SWT.LEFT, SWT.RIGHT, SWT.LEFT};
+       protected boolean[] columnVisibility = { true, true, true };
+       protected int[] sortTypes = { AnalyzerConstants.SORT_TYPE_GRID,
+                       AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NONE,
+                       AnalyzerConstants.SORT_TYPE_NONE };
+
+       public InteractiveTableView(Composite parent, int style) {
+               super(parent, style, true);
+               this.setLayout(new FillLayout());
+
+               setTitle(InteractivePageLabels.INTERACTIVE_TABLE_VIEW_TITLE);
+               
+               Composite contents = getContentArea();
+               contents.setBackground(ColorResources.WINDOW_BG_COLOR);
+               contents.setLayout(new FillLayout());
+               treeComp = new InteractiveTable(contents, SWT.NONE, SWT.MULTI
+                               | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+               /*** setTree set first!!! ***/
+               treeComp.setTree(true);
+               treeComp.setSortTypes(sortTypes);
+               treeComp.setColumnAlignment(columnAlignment);
+               treeComp.setColumns(columnNames);
+               treeComp.setColumnSize(columnSizes);
+               treeComp.setColumnVisibility(columnVisibility);
+               treeComp.setTableToolTipEnable(false);
+               contents.addControlListener(new TableColumnSizePackListener(treeComp,
+                               columnSizes));
+       }
+
+       @Override
+       public void updateView() {
+               treeComp.updateTree();
+       }
+       
+       @Override
+       public void updateView(DAViewData data) {
+               if (data instanceof DASelectionData) {
+                       DASelectionData selData = (DASelectionData) data;
+
+                       long start = selData.getStartTime();
+                       long end = selData.getEndTime();
+                       
+                       if (data.getData() instanceof InteractiveInfo) {
+                               treeComp.setInteractiveInfo((InteractiveInfo)data.getData());
+                               treeComp.updateTree(start, end);
+                       } else {
+                               treeComp.deselectAll();
+                       }
+               }
+       }
+
+       @Override
+       public void clear() {
+               treeComp.clear();
+       }
+
+       @Override
+       public Control getControl() {
+               return treeComp;
+       }
+}
index 9bbf358..0451b44 100644 (file)
@@ -34,6 +34,7 @@ import org.tizen.dynamicanalyzer.ui.opengl.chart.listener.GLFrameRateMouseListen
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUChart;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.ScreenshotChart;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
@@ -89,8 +90,10 @@ public class GLFrameRateChartBoard extends GLChartBoard {
                DAChartBoardItem frameRateChartItem = frameRateChart.createBoardItem(this, true);
                DAChart frameRateChartWidget = frameRateChartItem.getChart();
 
-               CPUChart.getInstance().createBoardItem(this);
-               ScreenshotChart.getInstance().createBoardItem(this);
+               TimelineChart cpuChart = new CPUChart();
+               cpuChart.createBoardItem(this);
+               TimelineChart screenShotChart = new ScreenshotChart();
+               screenShotChart.createBoardItem(this);
 
                GLFrameRateMouseListener glFrameRateMouseEventListener = new GLFrameRateMouseListener(
                                frameRateChart.getPopupMenu(), getTimeline());
index 3839744..6e5c04a 100755 (executable)
@@ -39,6 +39,8 @@ import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.ui.file.FilePage;
+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.network.NetworkPage;
 import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
@@ -118,6 +120,9 @@ public class BaseView extends ViewPart {
                        } // else nothing
                }
 
+               if (InteractiveDataManager.getInstance().getVariableInfoList().isEmpty() == false) {
+                       tabViewList.add(AnalyzerConstants.PAGE_INTERACTIVE);
+               }
                tabViewList.add(AnalyzerConstants.PAGE_SUMMARY); // default : summary tab
                addTabViewPage(tabViewList);
        }
@@ -166,6 +171,10 @@ public class BaseView extends ViewPart {
                                        newPage = new UIPage(tabView.getContentComposite(), SWT.NONE);
                                        tabView.addView(newPage, false);
                                        break;
+                               case AnalyzerConstants.PAGE_INTERACTIVE:
+                                       newPage = new InteractivePage(tabView.getContentComposite(), SWT.NONE);
+                                       tabView.addView(newPage, false);
+                                       break;
                                default:
                                        Logger.debug("No Selected View Pages");
                                        break;
@@ -218,6 +227,10 @@ public class BaseView extends ViewPart {
                                newPage = new UIPage(tabView.getContentComposite(), SWT.NONE);
                                tabView.addView(newPage, false);
                                break;
+                       case AnalyzerConstants.PAGE_INTERACTIVE:
+                               newPage = new InteractivePage(tabView.getContentComposite(), SWT.NONE);
+                               tabView.addView(newPage, false);
+                               break;
                        default:
                                Logger.debug("No Selected View Pages");
                                break;
index 4bdc317..b593021 100644 (file)
@@ -35,6 +35,7 @@ import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
 import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
 import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry;
+import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveDataManager;
 import org.tizen.dynamicanalyzer.ui.page.ScreenshotTabComposite;
 import org.tizen.dynamicanalyzer.ui.timeline.calltrace.CallTraceDataManager;
 import org.tizen.dynamicanalyzer.ui.timeline.calltrace.CallTraceView;
@@ -88,7 +89,7 @@ public class TimelinePage extends DAPageComposite {
                TimelineChartManager.getInstance().clear();
                DataManagerRegistry.registerPageDataManager(TimelineChartManager.getInstance());
                DataManagerRegistry.registerPageDataManager(ReplayDataManager.getInstance());
-               DataManagerRegistry.registerPageDataManager(CallTraceDataManager.getInstance());                
+               DataManagerRegistry.registerPageDataManager(CallTraceDataManager.getInstance());        
        }
 
        @Override
index 2c5ce20..388bd70 100644 (file)
@@ -60,8 +60,6 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
 
 public class CPUChart extends TimelineChart {
-       private static CPUChart instance = null;
-
        private DAChartSeries appLoadSeries;
        private DAChartSeries totalLoadSeries;
 
@@ -70,15 +68,7 @@ public class CPUChart extends TimelineChart {
        private DAChartBoardHeightChangeableItem processItem = null;
        private Map<Integer, DAChartSeries> childSeriesMap;
 
-       public static CPUChart getInstance() {
-               if (instance == null) {
-                       instance = new CPUChart();
-               }
-
-               return instance;
-       }
-
-       private CPUChart() {
+       public CPUChart() {
                chartType = TimelineConstants.CHART_TYPE_CPU;
                probeType = DataChannelConstants.MSG_DATA_SYSTEM;
                chartName = TimelineChartLabels.CPU_CHART_TITLE;
@@ -189,13 +179,13 @@ public class CPUChart extends TimelineChart {
                                totalLoadSeries.addSeriesItem(new DAChartSeriesItem(time, systemAvgLoad, Formatter
                                                .toPercentageFormat(systemAvgLoad)));
                                @SuppressWarnings("unchecked")
-                               List<Object> otherPidList = (List<Object>) row
+                               List<Object> otherPIDList = (List<Object>) row
                                                .get(SystemDataDBTable.COLUMN.PROCESS_PID_OTHER.ordinal());
                                @SuppressWarnings("unchecked")
                                List<Object> otherProcessCpuLoadList = (List<Object>) row
                                                .get(SystemDataDBTable.COLUMN.PROCESS_LOAD_OTHER.ordinal());
-                               for (int ii = 0; ii < otherPidList.size(); ii++) {
-                                       int pid = (Integer) otherPidList.get(ii);
+                               for (int ii = 0; ii < otherPIDList.size(); ii++) {
+                                       int pid = (Integer) otherPIDList.get(ii);
                                        double load = (Double) otherProcessCpuLoadList.get(ii) / coreSize;
                                        DAChartSeries series = childSeriesMap.get(pid);
                                        if (series == null) {
index 8fda361..e662af7 100644 (file)
@@ -46,8 +46,6 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
 
 public class CPUCoreChart extends TimelineChart {
-       private static CPUCoreChart instance = null;
-
        private int coreSize = TimelineConstants.NOT_INITED;
        private List<DAChartSeries> coreChartSeriesList = new ArrayList<DAChartSeries>();
        private Color[] coreChartSeriesColors = new Color[] {
@@ -56,13 +54,6 @@ public class CPUCoreChart extends TimelineChart {
                        ColorResources.SERIES_COLOR_CPUCORE_CORE4, ColorResources.SERIES_COLOR_CPUCORE_CORE5,
                        ColorResources.SERIES_COLOR_CPUCORE_CORE6, ColorResources.SERIES_COLOR_CPUCORE_CORE7 };
 
-       public static CPUCoreChart getInstance() {
-               if (null == instance) {
-                       instance = new CPUCoreChart();
-               }
-               return instance;
-       }
-
        public CPUCoreChart() {
                chartType = TimelineConstants.CHART_TYPE_CPU_CORE;
                probeType = DataChannelConstants.MSG_DATA_SYSTEM;
index b9bd85d..60ff3d4 100644 (file)
@@ -45,8 +45,6 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
 
 public class CPUFrequencyChart extends TimelineChart {
-       private static CPUFrequencyChart instance = null;
-
        private int coreSize = TimelineConstants.NOT_INITED;
        private List<DAChartSeries> coreFrequencyChartSeriesList = new ArrayList<DAChartSeries>();
        private Color[] coreChartSeriesColors = new Color[] {
@@ -55,15 +53,7 @@ public class CPUFrequencyChart extends TimelineChart {
                        ColorResources.SERIES_COLOR_CPUCORE_CORE4, ColorResources.SERIES_COLOR_CPUCORE_CORE5,
                        ColorResources.SERIES_COLOR_CPUCORE_CORE6, ColorResources.SERIES_COLOR_CPUCORE_CORE7 };
 
-       public static CPUFrequencyChart getInstance() {
-               if (instance == null) {
-                       instance = new CPUFrequencyChart();
-               }
-
-               return instance;
-       }
-
-       private CPUFrequencyChart() {
+       public CPUFrequencyChart() {
                chartType = TimelineConstants.CHART_TYPE_CPU_FREQUENCY;
                probeType = DataChannelConstants.MSG_DATA_SYSTEM;
                chartName = TimelineChartLabels.CPU_FREQUENCY_CHART_TITLE;
index 21e19a1..e26ffd0 100644 (file)
@@ -58,8 +58,6 @@ public class DeviceChart extends TimelineChart {
        private static final String RECORDING = "Recording"; //$NON-NLS-1$
        private static final String RECORDING_PAUSE = "Recording pause"; //$NON-NLS-1$
 
-       private static DeviceChart instance = null;
-
        private DAChartSeries wifiSeries;
        private DAChartSeries bluetoothSeries;
        private DAChartSeries gpsSeries;
@@ -75,15 +73,7 @@ public class DeviceChart extends TimelineChart {
        public static final String[] CAMERA_STATES = new String[] { OFF, OPEN, PREVIEW, RECORDING,
                        RECORDING_PAUSE };
 
-       public static DeviceChart getInstance() {
-               if (instance == null) {
-                       instance = new DeviceChart();
-               }
-
-               return instance;
-       }
-
-       private DeviceChart() {
+       public DeviceChart() {
                chartType = TimelineConstants.CHART_TYPE_DEVICE;
                probeType = DataChannelConstants.MSG_DATA_SYSTEM;
                chartName = TimelineChartLabels.DEVICE_CHART_TITLE;
index 88e2719..76e8100 100644 (file)
@@ -44,8 +44,6 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
 
 public class DiskIOChart extends TimelineChart {
-       private static volatile DiskIOChart instance = null;
-
        private DAChartSeries readOpCountSeries;
        private DAChartSeries writeOpCountSeries;
        private DAChartSeries readByteSizeSeries;
@@ -54,19 +52,7 @@ public class DiskIOChart extends TimelineChart {
        private long maxOpCount = 10;
        private long maxReadWriteSize = 100;
     
-       public static DiskIOChart getInstance() {
-               if (instance == null) {
-                       synchronized (DiskIOChart.class) {
-                               if (instance == null) {
-                                       instance = new DiskIOChart();
-                               }
-                       }
-               }
-
-               return instance;
-       }
-
-       private DiskIOChart() {
+       public DiskIOChart() {
                chartType = TimelineConstants.CHART_TYPE_DISK_IO;
                probeType = DataChannelConstants.MSG_DATA_SYSTEM;
                chartName = TimelineChartLabels.DISK_IO_CHART_TITLE;
index 1330e6d..46f39dd 100644 (file)
@@ -54,7 +54,6 @@ import org.tizen.dynamicanalyzer.widgets.helper.Formatter;
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
 
 public class EnergyChart extends TimelineChart {
-       private static EnergyChart instance = null;
        private static final String UNIT = "A";
 
        private DAChartSeries energyUsageSeries;
@@ -63,15 +62,7 @@ public class EnergyChart extends TimelineChart {
 
        private DAChartBoardItem appUsageItem;
 
-       public static EnergyChart getInstance() {
-               if (instance == null) {
-                       instance = new EnergyChart();
-               }
-
-               return instance;
-       }
-
-       private EnergyChart() {
+       public EnergyChart() {
                chartType = TimelineConstants.CHART_TYPE_ENERGY;
                probeType = DataChannelConstants.MSG_DATA_SYSTEM;
                chartName = TimelineChartLabels.ENERGY_CHART_TITLE;
index b00794f..ec352cf 100644 (file)
@@ -61,8 +61,6 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
 
 public class HeapChart extends TimelineChart {
-       private static HeapChart instance = null;
-
        private List<Integer> librarySequenceList = new ArrayList<Integer>();
        // Map<PID, Map<binaryID, DAChartSeries>>
        private Map<Integer, Map<Integer, DAChartSeries>> seriesPerProcessMap = 
@@ -73,13 +71,15 @@ public class HeapChart extends TimelineChart {
        private static final int totalAllocSeriesID = -100;
        private static final int appAllocSeriesID = -10;
        
-       public static HeapChart getInstance() {
-               if (instance == null) {
-                       instance = new HeapChart();
-               }
-               return instance;
+       public HeapChart() {
+               chartType = TimelineConstants.CHART_TYPE_HEAP;
+               probeType = DataChannelConstants.MSG_DATA_SYSTEM;
+               chartName = TimelineChartLabels.HEAP_CHART_TITLE;
+               chartDescriptor = TimelineChartLabels.HEAP_CHART_DESCRIPTOR;
+               chartIcon = ImageResources.CHART_HEAP;
+               addIcon = ImageResources.CHART_HEAP;
        }
-
+       
        private Map<Integer, DAChartSeries> createChartSeries(int pid) {
                Map<Integer, DAChartSeries> chartSeriesMap = new HashMap<Integer, DAChartSeries>();
                /*
@@ -120,15 +120,6 @@ public class HeapChart extends TimelineChart {
                return chartSeriesMap;
        }
 
-       private HeapChart() {
-               chartType = TimelineConstants.CHART_TYPE_HEAP;
-               probeType = DataChannelConstants.MSG_DATA_SYSTEM;
-               chartName = TimelineChartLabels.HEAP_CHART_TITLE;
-               chartDescriptor = TimelineChartLabels.HEAP_CHART_DESCRIPTOR;
-               chartIcon = ImageResources.CHART_HEAP;
-               addIcon = ImageResources.CHART_HEAP;
-       }
-
        @Override
        public DAChartBoardItem createBoardItem(DAChartBoard board) {
                parentBoardItem = super.createBoardItem(board);
index 07493c3..a57bb5c 100644 (file)
@@ -43,24 +43,10 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
 
 public class NetworkIOChart extends TimelineChart {
-       private static volatile NetworkIOChart instance = null;
-
        private DAChartSeries sendSeries;
        private DAChartSeries receiveSeries;
 
-       public static NetworkIOChart getInstance() {
-               if (instance == null) {
-                       synchronized (NetworkIOChart.class) {
-                               if (instance == null) {
-                                       instance = new NetworkIOChart();
-                               }
-                       }
-               }
-
-               return instance;
-       }
-
-       private NetworkIOChart() {
+       public NetworkIOChart() {
                chartType = TimelineConstants.CHART_TYPE_NETWORK_IO;
                probeType = DataChannelConstants.MSG_DATA_SYSTEM;
                chartName = TimelineChartLabels.NETWORK_IO_CHART_TITLE;
index 30b69f3..11f576f 100644 (file)
@@ -52,8 +52,6 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
 
 public class ProcessMemoryChart extends TimelineChart {
-       private static ProcessMemoryChart instance = null;
-
        private final int VSS = 0;
        private final int RSS = 1;
        private final int PSS = 2;
@@ -62,13 +60,15 @@ public class ProcessMemoryChart extends TimelineChart {
        private Map<Integer, String> processNameMap = new HashMap<Integer, String>();
        private DAChartBoardItem parentBoardItem;
 
-       public static ProcessMemoryChart getInstance() {
-               if (instance == null) {
-                       instance = new ProcessMemoryChart();
-               }
-               return instance;
+       public ProcessMemoryChart() {
+               chartType = TimelineConstants.CHART_TYPE_PROCESS_MEMORY;
+               probeType = DataChannelConstants.MSG_DATA_SYSTEM;
+               chartName = TimelineChartLabels.PROCESS_MEMORY_CHART_TITLE;
+               chartDescriptor = TimelineChartLabels.PROCESS_MEMORY_CHART_DESCRIPTOR;
+               chartIcon = ImageResources.CHART_PROCESS_MEMORY;
+               addIcon = ImageResources.CHART_PROCESS_MEMORY;
        }
-
+       
        private List<DAChartSeries> createChartSeries() {
                List<DAChartSeries> chartSeriesList = new ArrayList<DAChartSeries>();
 
@@ -91,15 +91,6 @@ public class ProcessMemoryChart extends TimelineChart {
                return chartSeriesList;
        }
 
-       private ProcessMemoryChart() {
-               chartType = TimelineConstants.CHART_TYPE_PROCESS_MEMORY;
-               probeType = DataChannelConstants.MSG_DATA_SYSTEM;
-               chartName = TimelineChartLabels.PROCESS_MEMORY_CHART_TITLE;
-               chartDescriptor = TimelineChartLabels.PROCESS_MEMORY_CHART_DESCRIPTOR;
-               chartIcon = ImageResources.CHART_PROCESS_MEMORY;
-               addIcon = ImageResources.CHART_PROCESS_MEMORY;
-       }
-
        @Override
        public DAChartBoardItem createBoardItem(DAChartBoard board) {
                parentBoardItem = super.createBoardItem(board);
index db9851c..2ee4973 100644 (file)
@@ -54,15 +54,7 @@ public class ScreenshotChart extends TimelineChart {
        private DAChartSeries screenshotSeries;
        private Map<String, Image> imageMap = new ConcurrentHashMap<String, Image>();
        
-       public static ScreenshotChart getInstance() {
-               if (instance == null) {
-                       instance = new ScreenshotChart();
-               }
-
-               return instance;
-       }
-
-       private ScreenshotChart() {
+       public ScreenshotChart() {
                chartType = TimelineConstants.CHART_TYPE_SCREENSHOT;
                chartStyle = DAChart.CHART_STYLE_SCREENSHOT;
                probeType = DataChannelConstants.MSG_PROBE_SCREENSHOT;
index de0f63b..36a2bb4 100644 (file)
@@ -50,21 +50,11 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
 
 public class SystemMemoryChart extends TimelineChart {
-       private static SystemMemoryChart instance = null;
-
        private DAChartSeries processSeries;
        private DAChartSeries systemSeries;
        private DAChartSeries totalSeries;
 
-       public static SystemMemoryChart getInstance() {
-               if (instance == null) {
-                       instance = new SystemMemoryChart();
-               }
-
-               return instance;
-       }
-
-       private SystemMemoryChart() {
+       public SystemMemoryChart() {
                chartType = TimelineConstants.CHART_TYPE_SYSTEM_MEMORY;
                probeType = DataChannelConstants.MSG_DATA_SYSTEM;
                chartName = TimelineChartLabels.SYSTEM_MEMORY_CHART_TITLE;
index ad5c4bb..b45e8af 100644 (file)
@@ -49,8 +49,6 @@ import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuListener;
 
 public class UIEventChart extends TimelineChart {
-       private static UIEventChart instance = null;
-
        private DAChartSeries touchEventSeries;
        /*
         * TODO code about Gesture is commented. it will be reopen when it implemented.
@@ -74,15 +72,7 @@ public class UIEventChart extends TimelineChart {
        private UIEventListDialog uiEventListDialog = new UIEventListDialog(
                        WorkbenchUtil.getWorkbenchWindow().getShell());
 
-       public static UIEventChart getInstance() {
-               if (instance == null) {
-                       instance = new UIEventChart();
-               }
-
-               return instance;
-       }
-
-       private UIEventChart() {
+       public UIEventChart() {
                chartType = TimelineConstants.CHART_TYPE_UIEVENT;
                chartStyle = DAChart.CHART_STYLE_MULTI;
                probeType = DataChannelConstants.MSG_PROBE_UIEVENT;
index 7dbf35f..625ed7c 100644 (file)
@@ -46,10 +46,12 @@ public class AddChartMenuComposite extends Composite {
 
        public AddChartMenuComposite(Composite parent) {
                super(parent, SWT.NONE);
-
-               createAddMenuComp();
        }
 
+       public void setAddItemListButtonListener(DACustomButtonClickEventListener addItemListButtonListener) {
+               this.addItemListButtonListener = addItemListButtonListener;
+       }
+       
        private DACustomButtonClickEventListener addItemListButtonListener = new DACustomButtonClickEventListener() {
                @Override
                public void handleClickEvent(DACustomButton button) {
@@ -61,7 +63,7 @@ public class AddChartMenuComposite extends Composite {
                }
        };
 
-       private void createAddMenuComp() {
+       public void createAddMenuComp() {
                setBackground(ColorResources.VIEW_BG_COLOR);
 
                GridLayout gLayout = new GridLayout(3, false);
index afe776f..73fd8ac 100644 (file)
@@ -42,7 +42,6 @@ import org.tizen.dynamicanalyzer.database.DBInsertManager;
 import org.tizen.dynamicanalyzer.database.DBInserter;
 import org.tizen.dynamicanalyzer.database.DBTable;
 import org.tizen.dynamicanalyzer.database.SqlConnectionManager;
-import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
 import org.tizen.dynamicanalyzer.project.BinaryInfo;
 import org.tizen.dynamicanalyzer.project.LibraryObject;
 import org.tizen.dynamicanalyzer.project.ProcessMemoryMap;
@@ -150,18 +149,18 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer
                targetProcessDBInserter = DBInsertManager.makeInserter(targetProcessDBTable);
                uiEventDBInserter = DBInsertManager.makeInserter(uiEventDBTable);
 
-               initChartMap(CPUChart.getInstance());
-               initChartMap(CPUCoreChart.getInstance());
-               initChartMap(CPUFrequencyChart.getInstance());
-               initChartMap(HeapChart.getInstance());
-               initChartMap(ProcessMemoryChart.getInstance());
-               initChartMap(SystemMemoryChart.getInstance());
-               initChartMap(ScreenshotChart.getInstance());
-               initChartMap(UIEventChart.getInstance());
-               initChartMap(DiskIOChart.getInstance());
-               initChartMap(NetworkIOChart.getInstance());
-               initChartMap(DeviceChart.getInstance());
-               initChartMap(EnergyChart.getInstance());
+               initChartMap(new CPUChart());
+               initChartMap(new CPUCoreChart());
+               initChartMap(new CPUFrequencyChart());
+               initChartMap(new HeapChart());
+               initChartMap(new ProcessMemoryChart());
+               initChartMap(new SystemMemoryChart());
+               initChartMap(new ScreenshotChart());
+               initChartMap(new UIEventChart());
+               initChartMap(new DiskIOChart());
+               initChartMap(new NetworkIOChart());
+               initChartMap(new DeviceChart());
+               initChartMap(new EnergyChart());
 
                loadSavedChartList();
                loadSelectedChartList();
@@ -278,10 +277,6 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer
                }
        }
 
-       public List<DAChartSeries> getDAChartSeriesList(int chartType) {
-               return getChartInstance(chartType).getBaseDASeriesList();
-       }
-
        @SuppressWarnings("unchecked")
        public void addNewCustomChart() {
                if (newCustomChart) {
@@ -416,7 +411,7 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer
                                /*
                                 * Make information for other process
                                 */
-                               List<Object> pidList = new ArrayList<Object>();
+                               List<Object> pIDList = new ArrayList<Object>();
                                List<Object> processLoadList = new ArrayList<Object>();
                                String[] processLoadDatas = log.getOtherProcessLoad().split(CommonConstants.COMMA);
                                for (int ii = 0; ii < processLoadDatas.length; ii++) {
@@ -424,7 +419,7 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer
                                        if (processLoad == null || processLoad.isEmpty()) {
                                                continue;
                                        }
-                                       pidList.add(new Integer(processLoad));
+                                       pIDList.add(new Integer(processLoad));
                                        processLoadList.add(processLoadDatas[++ii]);
                                }
 
@@ -482,7 +477,7 @@ public class TimelineChartManager extends PageDataManager implements IDAChartSer
                                dbSystemData.add(energyUsageAppList);
                                dbSystemData.add(cpuLoadList);
                                dbSystemData.add(cpuFreqeuncyList);
-                               dbSystemData.add(pidList);
+                               dbSystemData.add(pIDList);
                                dbSystemData.add(processLoadList);
                                dbSystemData.add(deviceList);
                                systemDataList.add(dbSystemData);
index 3b036e6..fddf11a 100644 (file)
@@ -79,7 +79,6 @@ import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart;
 import org.tizen.dynamicanalyzer.ui.toolbar.setting.SettingDataManager;
-import org.tizen.dynamicanalyzer.ui.toolbar.setting.TargetData;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
@@ -100,12 +99,13 @@ public class TimelineEditItemsDialog extends DAMessageBox {
        private final static int TEXT_COLUMN_WIDTH = 345;
        private final static int MULTILINE_MARGIN = 8;
        
-       private TableViewer chartTableViewer;
-       private TimelineChartManager chartManager = TimelineChartManager.getInstance();
+       protected TableViewer chartTableViewer;
+       protected List<TimelineChart> chartList = TimelineChartManager.getInstance().getChartList();
+       protected List<TimelineChart> selectedChartList = TimelineChartManager.getInstance().getSelectedChartList();
        private boolean DragItemStartPlg = true;
        private int swapItemIndexA = 0;         // drag source
        private int swapItemIndexB = 0;         // drag target
-       private static boolean RunningDialog = false;
+       protected static boolean RunningDialog = false;
        private Map<Integer, Image> imageMap = new HashMap<Integer, Image>();   // for drag image
        
        public TimelineEditItemsDialog(Shell parent) {
@@ -116,9 +116,14 @@ public class TimelineEditItemsDialog extends DAMessageBox {
                return RunningDialog;
        }
 
+       public void setOkButtonListener(DACustomButtonClickEventListener okButtonListener) {
+               this.okButtonListener = okButtonListener;
+       }
+       
        private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
                @Override
                public void handleClickEvent(DACustomButton button) {
+                       TimelineChartManager chartManager = TimelineChartManager.getInstance();
                        TableItem[] tableitems = chartTableViewer.getTable().getItems();
                        ArrayList<Integer> order = new ArrayList<Integer>();
                        ArrayList<Boolean> showInfo = new ArrayList<Boolean>();
@@ -213,10 +218,7 @@ public class TimelineEditItemsDialog extends DAMessageBox {
                new TableColumn(chartTableViewer.getTable(), SWT.NONE).setWidth(TITLE_COLUMN_WIDTH);    // Column for Title image
                new TableColumn(chartTableViewer.getTable(), SWT.NONE).setWidth(TEXT_COLUMN_WIDTH);     // Column for Title text
 
-               final List<TimelineChart> chartList = chartManager.getChartList();
                int chartListSize = chartList.size();
-               List<TimelineChart> selectedChartList = chartManager
-                               .getSelectedChartList();
 
                final TableItem[] items = new TableItem[chartListSize];
                for (int i = 0; i < chartListSize; i++) {
@@ -557,14 +559,14 @@ public class TimelineEditItemsDialog extends DAMessageBox {
                return chartTableViewer.getTable().getItem(new Point(x, y));
        }
        
-       private static class TableItemData {
-               int index;
-               int chartType;
-               Image titleImage;
-               String titleText;
-               String description = "";
-               boolean isEnabled = false;
-               boolean isHovered = false;
-               boolean isDrag = false;
+       protected static class TableItemData {
+               public int index;
+               public int chartType;
+               public Image titleImage;
+               public String titleText;
+               public String description = "";
+               public boolean isEnabled = false;
+               public boolean isHovered = false;
+               public boolean isDrag = false;
        }
 }
\ No newline at end of file
index bf9a5ac..a7a59b1 100644 (file)
@@ -108,7 +108,7 @@ public class TimelineView extends DAViewComposite {
 
                initializeCharts();
 
-               new AddChartMenuComposite(chartBoard.getTitleComp());
+               new AddChartMenuComposite(chartBoard.getTitleComp()).createAddMenuComp();
 
                setBackground(ColorResources.VIEW_BG_COLOR);
 
index dc022c7..f161f84 100755 (executable)
@@ -64,6 +64,8 @@ import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
 import org.tizen.dynamicanalyzer.ui.common.explorer.DeviceExplorerDialog;
+import org.tizen.dynamicanalyzer.ui.interactive.InteractivePage;
+import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveDataManager;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
 import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
 import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceDialog;
@@ -553,7 +555,13 @@ public class ToolbarArea {
                        }
                });
 
-               AnalyzerUtil.changePage(TimelinePage.pageID);
+               if (InteractiveDataManager.getInstance().getVariableInfoList().isEmpty() == false) {
+                       SettingDialogManager.getInstance().updateTabViewPage();
+                       AnalyzerUtil.changePage(InteractivePage.pageID);
+               } else {
+                       AnalyzerUtil.changePage(TimelinePage.pageID);
+               }
+               
                Logger.performance("TEST", "Start Trace", "Change to the Timeline page");
                AnalyzerManager.setRunningState(true);
                processCombo.initCombo();
index 7689ef0..0f441a5 100644 (file)
@@ -38,6 +38,7 @@ import org.tizen.dynamicanalyzer.common.HostResult;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
 import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.ui.interactive.data.InteractiveDataManager;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
 import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
@@ -256,6 +257,9 @@ public class SettingDialogManager {
                        tabViewList.add(AnalyzerConstants.PAGE_KERNEL);
                } // else nothing
 
+               if (InteractiveDataManager.getInstance().getVariableInfoList().isEmpty() == false) {
+                       tabViewList.add(AnalyzerConstants.PAGE_INTERACTIVE);
+               }
                tabViewList.add(AnalyzerConstants.PAGE_SUMMARY); // default : summary tab
 
                BaseView bv = (BaseView) WorkbenchUtil.getViewPart(BaseView.ID);