[RELEASE] DA 2.3.16
authorMaria Guseva <m.guseva@samsung.com>
Wed, 28 Sep 2016 15:32:51 +0000 (18:32 +0300)
committerMaria Guseva <m.guseva@samsung.com>
Wed, 28 Sep 2016 15:35:35 +0000 (18:35 +0300)
- Improve Memory Statistics table and Heap Allocation charts UX:
    - change data model of Statistics table to tree,
    - add agreggated data for libraries under 'Total' entry,
    - add cross-focus from table to Heap Allocation charts and vice versa,
    - rearrange columns in more sensible order,
    - fixed different names for unknown libraries in charts and table,
    - add charts sorting according to table,
    - improve rendering of starting points on charts
- Timeline markers are numbered now
- Introduce new Memory Range Analysis view
- Introduce new Persistent Memory charts
- Add cross-focus from Persisent Allocations table to chart and vice versa
- Adjust size of Address column in Callstack view
- Adjust Search Dialog controls sizes and positions
- Fix shown zeros of System memory in Memory Details table
- Fix Screenshot feature preferences to be able to be turned off totally
- Change dotted line border of Process sub-chart
- Redesign DA CLI process management
- Refactor TargetData class
- Redesign TargetDataTest and SettingDataManagerTest to match FlatFeature functionality
- Fix 45 FindBugs warnings
- Fix JIRA defects:
    SPTSDKUX-2103,
    SPTSDKUX-2155,
    SPTSDKUX-2167

Change-Id: Id8d5ea89fb25f620c17d2fbc7a8a85cdf8940afe

157 files changed:
org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/base/DADialog.java
org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/base/DAMessageBox.java
org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/base/ProgressDialog.java
org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/CliInternals.java
org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/commands/StopCommand.java
org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManager.java
org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArguments.java
org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsParser.java
org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingProcess.java
org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/utils/Communicator.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/utils/ManagerCommunicationProcessor.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/utils/Message.java
org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/utils/ProcessCommunicationProcessor.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/manager/TracingProcessManagerTest.java
org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsParserTest.java
org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/tracing/TracingArgumentsTest.java
org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/tracing/TracingProcessCommunicationTest.java [deleted file]
org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/CommunicatorTest.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ManagerCommunicationProcessorTest.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/OppositeCommSide.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ProcessCommunicationProcessorTest.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.common.test/src/org/tizen/dynamicanalyzer/unittest/UnitTestConstants.java
org.tizen.dynamicanalyzer.common/src/org/tizen/dynamicanalyzer/util/CommonUtil.java
org.tizen.dynamicanalyzer.test/resources/flatfeature
org.tizen.dynamicanalyzer.test/resources/layout
org.tizen.dynamicanalyzer.test/resources/setting
org.tizen.dynamicanalyzer.test/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/data/SettingDataManagerTest.java
org.tizen.dynamicanalyzer.test/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/data/TargetDataTest.java
org.tizen.dynamicanalyzer.widgets/Images/marker.png
org.tizen.dynamicanalyzer.widgets/Images/marker_nor.png
org.tizen.dynamicanalyzer.widgets/META-INF/MANIFEST.MF
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/dropdown/DACustomDropdown.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomFeatureToggleErrorMessage.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartPlot.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chart/DAChartRenderer.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoardItemCell.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/chartBoard/DAChartBoardItemList.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/combo/DACustomCombo.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/ColorResources.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/FontResources.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/helper/Formatter.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimeline.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/DATimelineTimeRenderer.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/MarkerManager.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/IEventListener.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerAddEvent.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerEvent.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerEventType.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerPositionUpdateEvent.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerRemoveEvent.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerTimeUpdateEvent.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.workbench/about.mappings
org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/common/path/PathManager.java
org.tizen.dynamicanalyzer/META-INF/MANIFEST.MF
org.tizen.dynamicanalyzer/build.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/DAResult.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/BaseCommunicator.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/control/StopTraceManager.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/ConfigureLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/MemoryPageLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/MemoryPageLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/MenuBarLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/MenuBarLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelineChartLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/TimelineChartLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/UserErrorWarningLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/UserErrorWarningLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/Feature.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/FlatFeature.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/FlatPreferences.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/SettingDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/TargetData.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/setting/Template.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/shortcut/ShortCutManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/logparser/LogParser.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/AppStartupData.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/SyscallData.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/WebAppStartupData.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/model/data/WebProfileData.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/LoadSettingDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/SaveSettingDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupRangeAnalysisMenuItemListener.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/PopupRangeAnalysisMenuItemOnChartListener.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/SetRangeMarkerMouseMoveListener.java [deleted file]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/TimelineChartMouseEventListener.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/explorer/DeviceExplorerDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/explorer/FileExplorerDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/explorer/FileTreeExplorerDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileApiListTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/appStartup/AppStartupDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/info/callstack/CallstackView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/interactive/chart/InteractiveChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/CallFlowChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/kernel/ContextSwitchingChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/AllocationTraceSelectionListener.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/ExpandableMemoryRangeComposite.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/HeapChartsSelectionListener.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryCallStackView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryPage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryRangeAnalysisView.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryStatisticsTableView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/StatisticsSelectionListener.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/StatisticsSortListener.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/chart/HeapMemoryChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/chart/MemoryChart.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/chart/MemoryChartBoard.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/data/HeapDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/table/MemoryAllocationTraceTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/table/MemoryDetailsTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/table/MemoryMapTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/table/MemoryStatisticsTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/chart/GLChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/chart/listener/GLFrameRateMouseListener.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/data/GLStatisticsDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/opengl/table/api/GLAPITable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/BaseView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/MenuBar.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/range/RangeDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/ProfilingTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/profiling/WebProfileDataMaker.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/ThreadAPIListTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/thread/chart/ThreadChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/calltrace/CallTraceDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/calltrace/CallTraceTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/chart/ProcessesChartRenderer.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/common/TimelineChartView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/dlog/DlogTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/DAToolBarCustomCombo.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ProcessExplorerDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/RemoteDeviceDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/SaveAsDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/opentrace/OpenTraceDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/replayEditor/RepalyEditSaveDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialogFeaturesTreeTableCellRenderer.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FlatFeatureDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FlatFeatureDialogFeatureListPage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FlatFeatureDialogSelectedFeaturePage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FlatFeatureDialogTargetPage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/PreferencesDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogTemplatePage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/DAGrid.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/SearchDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/table/DATreeComposite.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/utils/AnalyzerUtil.java
package/build.linux
package/changelog
package/pkginfo.manifest

index 452ca2a..e97db17 100644 (file)
@@ -162,7 +162,7 @@ public class DADialog {
                        strMessage.setText(message);
                        strMessage.setBackground(ColorResources.WHITE);
                        strMessage.setAlignment(SWT.LEFT);
-                       strMessage.setForeground(ColorResources.DIALOG_CONTENT_BACKGROUND);
+                       strMessage.setForeground(ColorResources.DIALOG_TEXT_FONT_COLOR);
                        strMessage.setFont(FontResources.DIALOG_CONTENTS_NORMAL_FONT);
 
                        formData = new FormData();
index 6f4a76e..f053901 100644 (file)
@@ -63,6 +63,10 @@ public class DAMessageBox {
                return result;
        }
 
+       protected void setResult(Object result) {
+               this.result = result;
+       }
+
        protected boolean run() {
                return true;
        }
index 8def1cd..dcc20c8 100644 (file)
@@ -95,7 +95,6 @@ public class ProgressDialog {
        private SelectionListener cancelButtonListener = null;
        
        // loading animation
-       private DAAnimationIcon loadingIcon = null;
        private DAAnimationIcon progressIcon = null;
 
        private Listener shellMouseListener = new Listener() {
@@ -431,9 +430,6 @@ public class ProgressDialog {
        public void close() {
                if (progress != null) {
                        if (!progress.isDisposed()) {
-                               if (null != loadingIcon) {
-                                       loadingIcon.stopTimer();
-                               }
                                progress.dispose();
                        }
                        progress = null;
index 6d57471..823c671 100644 (file)
@@ -1,6 +1,5 @@
 package org.tizen.dynamicanalyzer.cli;
 
-import java.io.File;
 import java.rmi.ConnectException;
 import java.util.Arrays;
 import java.util.HashSet;
@@ -478,15 +477,12 @@ public final class CliInternals {
        /**
         * Save collected trace.
         *
-        * @param filename path where trace is to be saved in default save directory
+        * @param file path where trace is to be saved
         * @return <code>true</code> if save was successful
         */
-       public static boolean saveTrace(String filename) {
-               Logger.debug("Saving tracing results to " + filename);
-               if(!filename.startsWith("/"))  // If fileName does not contains absolute path to file
-                       filename = PathManager.DA_SAVE_PATH + File.separator + filename+".zip";
-
-               return CommandAction.saveToZip(filename);
+       public static boolean saveTrace(String file) {
+               Logger.debug("Saving tracing results to " + file);
+               return CommandAction.saveToZip(file);
        }
 
        /**
index 72bbbd5..5ccd62e 100644 (file)
@@ -1,5 +1,7 @@
 package org.tizen.dynamicanalyzer.cli.commands;
 
+import java.io.File;
+import java.io.IOException;
 import java.rmi.ConnectException;
 
 import org.tizen.dynamicanalyzer.cli.CliInternals;
@@ -66,14 +68,14 @@ public class StopCommand extends Command {
                        System.err.println("Can't get time from TracingProcessManager");
                        return ExitCode.EX_OPERATION_FAILED;
                }
-
                System.out.format(
                                "DA tracing finished.%n" +
                                "Total time:   %s%n" +
                                "Tracing time: %s%n" +
                                "Output:       %s%n",
-                               duration, tracingTime, ctx.getArgs().getOutput()+".zip");
-                               // TODO check if output was created
+                               duration,
+                               tracingTime, ctx.getArgs().getOutput());
+               
 
                return ExitCode.EX_SUCCESS;
        }
index 0bafbf8..b85978c 100644 (file)
@@ -18,8 +18,8 @@ import java.util.List;
 import org.tizen.dynamicanalyzer.cli.tracing.TracingArguments;
 import org.tizen.dynamicanalyzer.cli.tracing.TracingArgumentsParser;
 import org.tizen.dynamicanalyzer.cli.tracing.TracingProcess;
-import org.tizen.dynamicanalyzer.cli.utils.Message;
-import org.tizen.dynamicanalyzer.cli.utils.Message.MessageType;
+import org.tizen.dynamicanalyzer.cli.utils.Communicator;
+import org.tizen.dynamicanalyzer.cli.utils.ManagerCommunicationProcessor;
 import org.tizen.dynamicanalyzer.common.path.PathManager;
 import org.tizen.dynamicanalyzer.project.Project;
 import org.tizen.dynamicanalyzer.util.CommonUtil;
@@ -72,8 +72,8 @@ public class TracingProcessManager {
 
                // Set output file name to default if was not defined
                if (args.getOutput() == null) {
-                       File output = new File(PathManager.DA_SAVE_PATH + File.separator
-                                       + Project.constructSaveName(args.getApplication(), new Date()));
+                       String output = PathManager.DA_SAVE_PATH + File.separator
+                                       + Project.constructSaveName(args.getApplication(), new Date());
                        args.setOutput(output);
                }
 
@@ -125,7 +125,7 @@ public class TracingProcessManager {
         * Object, that encapsulated all communication with TracingProcess, starts
         * in constructor
         */
-       private ServerConnection serverConnection;
+       private ManagerCommunicationProcessor communicationProcessor;
 
        /**
         * Communication thread.
@@ -167,9 +167,13 @@ public class TracingProcessManager {
                try {
                        final ServerSocket ss = new ServerSocket(port);
                        Socket socket = ss.accept();
+                       ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+                       oos.flush();
+                       ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+
                        // start processing in separate thread
-                       serverConnection = new ServerConnection(socket);
-                       commThread = new Thread(serverConnection,
+                       communicationProcessor = new ManagerCommunicationProcessor(new Communicator(ois, oos), ctx);
+                       commThread = new Thread(communicationProcessor,
                                        "Communication thread");
                        commThread.start();
                        // finally we should close server socket
@@ -207,9 +211,13 @@ public class TracingProcessManager {
                synchronized (this) {
                        if (ctx.isFinished())
                                return;
-                       serverConnection.sendMessage(MessageType.STOP_TRACING);
+                       communicationProcessor.stopTracing();
                }
 
+               if (tracingTime == 0)
+                       tracingTime = communicationProcessor.getTracingTime();
+
+               communicationProcessor.closeConnection();
                waitForCompletion();
        }
 
@@ -256,19 +264,9 @@ public class TracingProcessManager {
         * @return time value in milliseconds
         */
        public long getTracingTime() {
-               if (tracingTime > 0)
-                       return tracingTime;
-               else {
-                       try {
-                               serverConnection.sendMessage(MessageType.REQUEST_TRACING_TIME);
-                               while (commThread.isAlive()) {
-                                       serverConnection.wait();
-                               }
-                       } catch (IOException | InterruptedException e) {
-                               Logger.error("Communication failed");
-                       }
-                       return tracingTime;
-               }
+               if (tracingTime == 0)
+                       tracingTime = communicationProcessor.getTracingTime();
+               return tracingTime;
        }
 
        /**
@@ -308,86 +306,4 @@ public class TracingProcessManager {
        public synchronized boolean isFinished() {
                return ctx.isFinished();
        }
-
-       private class ServerConnection implements Runnable {
-               ObjectOutputStream oos;
-               ObjectInputStream ois;
-
-               /**
-                * ConnectionProcessor constructor.
-                *
-                * @param socket connection socket
-                * @throws IOException in case of communication initialization error
-                */
-               private ServerConnection(Socket socket) throws IOException {
-                       this.oos = new ObjectOutputStream(socket.getOutputStream());
-                       this.ois = new ObjectInputStream(socket.getInputStream());
-               }
-
-               /**
-                * Send message to stream.
-                *
-                * @param message message to socket
-                * @throws IOException in case of communication error
-                */
-               public void sendMessage(Message message) throws IOException {
-                       oos.writeObject(message);
-                       oos.flush();
-               }
-
-               /**
-                * Send message to stream. Constructs {@link Message} instance on the
-                * fly.
-                *
-                * @param messageT message type
-                * @param args message arguments
-                * @throws IOException in case of communication error
-                */
-               public void sendMessage(MessageType messageT, String... args)
-                               throws IOException {
-                       sendMessage(new Message(messageT, args));
-               }
-               /**
-                * Actual connection processing.
-                */
-               @Override
-               public void run() {
-                       try {
-                               boolean childAlive = true;
-                               while (childAlive) {
-                                       Object rawObj = ois.readObject();
-                                       if (!(rawObj instanceof Message))
-                                               continue;
-
-                                       Message message = (Message) rawObj;
-                                       switch (message.messageT) {
-                                       case STOP_DONE:
-                                               childAlive = false;
-                                               bw.close();
-                                               break;
-                                       case INFO_TRACING_TIME:
-                                               tracingTime = Long.parseLong(message.args[0]);
-                                               break;
-                                       case ERROR_OCCURED:
-                                               ctx.finishContext(Integer.parseInt(message.args[0]));
-                                               break;
-                                       // Wrong requests
-                                       case REQUEST_TRACING_TIME:
-                                       case STOP_TRACING:
-                                       default:
-                                               Logger.warning("wrong request type for TracingProcessManager");
-                                               break;
-                                       }
-                                       this.notifyAll();
-                               }
-                       } catch (ClassNotFoundException e) {
-                               Logger.error("Error while communicating with TracingProcess. Message type can't be resolved.");
-                               this.notifyAll();
-                       } catch (IOException e) {
-                               Logger.info("Communication stopped, stream closed");
-                               this.notifyAll();
-                       }
-               }
-       }
-
-}
+}
\ No newline at end of file
index 9bae62b..c0b95de 100644 (file)
@@ -1,11 +1,13 @@
 package org.tizen.dynamicanalyzer.cli.tracing;
 
 import java.io.File;
+import java.io.IOException;
 import java.io.Serializable;
 import java.util.HashSet;
 import java.util.Set;
 
 import org.tizen.dynamicanalyzer.setting.PrimitiveFeature;
+import org.tizen.dynamicanalyzer.util.Logger;
 
 /**
  * Context class storing all necessary information for tracing start.
@@ -20,7 +22,7 @@ public class TracingArguments implements Cloneable, Serializable {
        private String device;       // device serial number or IP address
        private String application;  // application name
        private Set<PrimitiveFeature> featuresSet; // list of features for analysis
-       private File output;         // file with tracing output
+       private String output;       // absolute path to file with tracing output
        // TODO duration actually is not supported yet by CLI, always set to 0
        private long durationSec;    // tracing duration in seconds (0 is for unlimited duration)
        private int screenshotPeriod = 0; // Screenshot period in s. If 0
@@ -146,9 +148,9 @@ public class TracingArguments implements Cloneable, Serializable {
        }
 
        /**
-        * @return the output file
+        * @return the output file absolute path
         */
-       public File getOutput() {
+       public String getOutput() {
                return output;
        }
 
@@ -156,8 +158,18 @@ public class TracingArguments implements Cloneable, Serializable {
         * @param output the output file to set
         * @return this object to allow chained methods execution
         */
-       public TracingArguments setOutput(File output) {
-               this.output = output;
+       public TracingArguments setOutput(String output) {
+               if (output == null)
+                       return this;
+               if (!output.endsWith(".zip"))
+                       output += ".zip";
+               String out = null;
+               try {
+                       out = new File(output).getCanonicalPath();
+               } catch (IOException e) {
+                       Logger.error(e);
+               }
+               this.output = out;
                return this;
        }
 
index 5895e00..70afe0c 100644 (file)
@@ -1,6 +1,5 @@
 package org.tizen.dynamicanalyzer.cli.tracing;
 
-import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
 
@@ -107,7 +106,7 @@ public class TracingArgumentsParser {
                // Get output file
                if (cmdline.hasOption(output.getOpt())) {
                        String outString = cmdline.getOptionValue(output.getOpt());
-                       result.setOutput(new File(outString));
+                       result.setOutput(outString);
                }
 
                // Get screenshot period
@@ -171,10 +170,10 @@ public class TracingArgumentsParser {
                }
 
                // Output
-               File out = args.getOutput();
+               String out = args.getOutput();
                if (out != null) {
                        result.add('-' + output.getOpt());
-                       result.add(out.getAbsolutePath());
+                       result.add(out);
                }
 
                int period = args.getScreenshotPeriod();
index 218e177..eea0180 100644 (file)
@@ -14,8 +14,8 @@ import org.apache.commons.cli.ParseException;
 import org.tizen.dynamicanalyzer.cli.CliInternals;
 import org.tizen.dynamicanalyzer.cli.commands.ExitCode;
 import org.tizen.dynamicanalyzer.cli.manager.ProcessManager;
-import org.tizen.dynamicanalyzer.cli.utils.Message;
-import org.tizen.dynamicanalyzer.cli.utils.Message.MessageType;
+import org.tizen.dynamicanalyzer.cli.utils.Communicator;
+import org.tizen.dynamicanalyzer.cli.utils.ProcessCommunicationProcessor;
 import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
 import org.tizen.dynamicanalyzer.common.DAState;
 import org.tizen.dynamicanalyzer.common.Global;
@@ -49,9 +49,9 @@ public class TracingProcess {
        private final TracingArguments args;
 
        /**
-        * client communication thread
+        * Client communication thread.
         */
-       private ClientConnection socketConnection;
+       private ProcessCommunicationProcessor communicationProcessor;
 
        /**
         * Start time value in milliseconds. It's initialized at application start
@@ -86,7 +86,7 @@ public class TracingProcess {
        public synchronized ErrorCode startTrace() {
                ErrorCode result =  CliInternals.startTracing(args);
                if (result != ErrorCode.SUCCESS) {
-                       socketConnection.sendMessage(MessageType.ERROR_OCCURED, Integer.toString(result.getErrorNumber()));
+                       communicationProcessor.errorOccured(result.getErrorNumber());
                        return result;
                }
                // Block until StartTraceManager thread starts all needed jobs
@@ -110,8 +110,6 @@ public class TracingProcess {
        public synchronized void stopTrace() {
                tracingTime = System.nanoTime() / 1000 - startTime;
                Global.getProject().setTotalStopTime(tracingTime);
-                       socketConnection.sendMessage(MessageType.INFO_TRACING_TIME,
-                                       Long.toString(tracingTime));
                CliInternals.stopTracing();
        }
 
@@ -121,10 +119,7 @@ public class TracingProcess {
         * @return <code>true</code> if save was successful
         */
        public boolean saveTrace() {
-               // FIXME Currently trace may be saved only to default directory
-               // thus we provide only filename as a parameter.
-               // This is to be fixed for the whole DA
-               return CliInternals.saveTrace(args.getOutput().getName());
+               return CliInternals.saveTrace(args.getOutput());
        }
 
        /**
@@ -140,22 +135,24 @@ public class TracingProcess {
        /**
         * Return result of tracing process.
         *
-        * @return {@link ErrorCode#SUCCESS} if traced finished successfully
-        *         TODO complete error codes documentation
+        * @return {@link ErrorCode#SUCCESS} if traced finished successfully, or
+        *         code of occurred error.
         */
        public synchronized ErrorCode getStatus() {
                return status;
        }
 
        /**
-        * Initializes communication and tracing threads.
-        * Blocks caller until tracing activities will be finished.
+        * Initializes communication and tracing threads. Blocks caller until
+        * tracing activities will be finished.
         *
         * @param args input parameters for tracing process
-        * @return {@link ErrorCode#SUCCESS} if tracing process started and finished successfully, <br/>
-        *         {@link ErrorCode#ERR_WRONG_MESSAGE_FORMAT} if tracing arguments are wrong, <br/>
-        *         {@link ErrorCode#ERR_EXCEPTION_OCCURRED} if critical or unexpected error occurred.
-        *         TODO complete error codes documentation
+        * @return {@link ErrorCode#SUCCESS} if tracing process started and finished
+        *         successfully, <br/>
+        *         {@link ErrorCode#ERR_WRONG_MESSAGE_FORMAT} if tracing arguments
+        *         are wrong, <br/>
+        *         {@link ErrorCode#ERR_EXCEPTION_OCCURRED} if critical or
+        *         unexpected error occurred.
         */
        private static ErrorCode performAllTasks(String[] args, int port) {
                Logger.init(InternalLogger.WARNING);
@@ -172,13 +169,20 @@ public class TracingProcess {
 
                // create instance of tracing process
                final TracingProcess tracingProcess = new TracingProcess(argsParsed);
+
                // communication socket connection
+               Thread commThread = null;
                try {
                        //Socket communication estblished between 2 processes on same device
                        //There were not any secure data, so it is not required to use SSLSocket
                        Socket socket = new Socket(InetAddress.getLocalHost(), port);
-                       tracingProcess.socketConnection = tracingProcess.getConnProc(socket);
-                       Thread commThread = new Thread(tracingProcess.socketConnection);
+                       ObjectInputStream ois = new ObjectInputStream(
+                                       socket.getInputStream());
+                       ObjectOutputStream oos = new ObjectOutputStream(
+                                       socket.getOutputStream());
+                       ProcessCommunicationProcessor communicationProcessor = new ProcessCommunicationProcessor(
+                                       new Communicator(ois, oos), tracingProcess);
+                       commThread = new Thread(communicationProcessor);
                        commThread.start();
                } catch (IOException ioe) {
                        Logger.error("IOException in socket connection.");
@@ -209,23 +213,14 @@ public class TracingProcess {
                        return ErrorCode.ERR_EXCEPTION_OCCURRED;
                }
 
-               // return tracing result
-               return tracingProcess.getStatus();
-       }
-
-       /**
-        * creates ConnectionProcessor by given socket. Return null in case of any
-        * error.
-        *
-        * @param socket
-        * @return
-        */
-       private ClientConnection getConnProc(Socket socket) {
                try {
-                       return new ClientConnection(socket);
-               } catch (IOException e) {
+                       if (commThread != null)
+                               commThread.join();
+               } catch (InterruptedException e) {
+                       Logger.error("Tracing Process was interrupted, while waiting for communication to be closed");
                }
-               return null;
+               // return tracing result
+               return tracingProcess.getStatus();
        }
 
        private static int getPort() {
@@ -248,88 +243,7 @@ public class TracingProcess {
                SystemExit.exit(exitCode.getErrorNumber());
        }
 
-       private class ClientConnection implements Runnable {
-               ObjectOutputStream oos;
-               ObjectInputStream ois;
-
-               /**
-                * ConnectionProcessor constructor.
-                *
-                * @param socket connection socket
-                * @throws IOException in case of communication initialization error
-                */
-               private ClientConnection(Socket socket) throws IOException {
-                       this.ois = new ObjectInputStream(socket.getInputStream());
-                       this.oos = new ObjectOutputStream(socket.getOutputStream());
-                       oos.flush();
-               }
-
-               /**
-                * Send message to stream.
-                *
-                * @param message message to socket
-                * @throws IOException in case of communication error
-                */
-               public void sendMessage(Message message) {
-                       try {
-                               oos.writeObject(message);
-                               oos.flush();
-                       } catch (IOException e) {
-                               Logger.error("Got Exception while sending message to TracingProcessManager");
-                       }
-               }
-
-               /**
-                * Send message to stream. Constructs {@link Message} instance on the
-                * fly.
-                *
-                * @param messageT message type
-                * @param args message arguments
-                * @throws IOException in case of communication error
-                */
-               public void sendMessage(MessageType messageT, String... args) {
-                       sendMessage(new Message(messageT, args));
-               }
-               /**
-                * Actual connection processing.
-                */
-               @Override
-               public void run() {
-                       try {
-                               while (true) {
-                                       Object rawObj = ois.readObject();
-                                       if (!(rawObj instanceof Message))
-                                               continue;
-
-                                       Message message = (Message) rawObj;
-                                       switch (message.messageT) {
-                                       case STOP_TRACING:
-                                               Logger.info("Stopinng TracingProcess");
-                                               synchronized (this) {
-                                                       if (tracingTime == 0) // check that process is still running
-                                                               stopTrace();
-                                               }
-                                               sendMessage(MessageType.STOP_DONE);
-                                               break;
-                                       case REQUEST_TRACING_TIME:
-                                               sendMessage(MessageType.INFO_TRACING_TIME,
-                                                                       Long.toString(tracingTime));
-                                               break;
-                                       //Wrong requests
-                                       case STOP_DONE:
-                                       case INFO_TRACING_TIME:
-                                       default:
-                                               Logger.warning("wrong request type "
-                                                               + message.messageT.toString()
-                                                               + " for TracingProcess");
-                                               break;
-                                       }
-                               }
-                       } catch (ClassNotFoundException e) {
-                               Logger.error("Error while communicating with TracingProcessManager. Message type can't be resolved.");
-                       } catch (IOException e) {
-                               Logger.info("Communication stopped, stream closed");
-                       }
-               }
+       public long getTracingTime() {
+               return tracingTime;
        }
 }
\ No newline at end of file
diff --git a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/utils/Communicator.java b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/utils/Communicator.java
new file mode 100644 (file)
index 0000000..4ba2a9b
--- /dev/null
@@ -0,0 +1,83 @@
+package org.tizen.dynamicanalyzer.cli.utils;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.tizen.dynamicanalyzer.cli.utils.Message.MessageType;
+import org.tizen.dynamicanalyzer.util.Logger;
+
+/**
+ * Class encapsulates methods to start, stop and perform communication by two
+ * object streams.
+ */
+public class Communicator {
+       ObjectOutputStream oos;
+       ObjectInputStream ois;
+
+       /**
+        * ConnectionProcessor constructor.
+        *
+        * @param socket connection socket
+        * @throws IOException in case of communication initialization error
+        */
+       public Communicator(ObjectInputStream ois, ObjectOutputStream oos) {
+               this.ois = ois;
+               this.oos = oos;
+       }
+
+       /**
+        * Send message to stream.
+        *
+        * @param message message to socket
+        * @throws IOException in case of {@link IOException} occurred
+        */
+       public synchronized void sendMessage(Message message) throws IOException {
+               oos.writeObject(message);
+               oos.flush();
+       }
+
+       /**
+        * Send message to stream. Constructs {@link Message} instance on the fly.
+        *
+        * @param tid TID
+        * @param messageT message type
+        * @param args message arguments
+        * @throws IOException in case of {@link IOException} occurred
+        */
+       public void sendMessage(long tid, MessageType messageT, String... args)
+                       throws IOException {
+               sendMessage(new Message(tid, messageT, args));
+       }
+
+       /**
+        * Gets message from ois. Blocking method.
+        *
+        * @return {@link Message} received message
+        */
+       public Message getMessage() {
+
+               Object rawObj;
+               try {
+                       rawObj = ois.readObject();
+                       if (!(rawObj instanceof Message))
+                               return null;
+                       return (Message) rawObj;
+               } catch (ClassNotFoundException | IOException e) {
+                       Logger.debug("Stream closed");
+                       return null;
+               }
+       }
+
+       /**
+        * Method that closes communication streams and stop communication.
+        */
+       public void stop() {
+               try {
+                       oos.close();
+                       ois.close();
+               } catch (IOException e) {
+                       Logger.error(e.getMessage());
+               }
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/utils/ManagerCommunicationProcessor.java b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/utils/ManagerCommunicationProcessor.java
new file mode 100644 (file)
index 0000000..78ba0ec
--- /dev/null
@@ -0,0 +1,130 @@
+package org.tizen.dynamicanalyzer.cli.utils;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.concurrent.Semaphore;
+
+import org.tizen.dynamicanalyzer.cli.manager.TracingProcessContext;
+import org.tizen.dynamicanalyzer.cli.tracing.TracingProcess;
+import org.tizen.dynamicanalyzer.cli.utils.Message.MessageType;
+import org.tizen.dynamicanalyzer.util.Logger;
+
+/**
+ * Encapsulates methods to communicate with {@link TracingProcess}, support
+ * concurrent requests.
+ */
+public class ManagerCommunicationProcessor implements Runnable {
+
+       private Communicator comm;
+       private TracingProcessContext ctx;
+
+       HashMap<Long, Semaphore> requestsPool = new HashMap<Long, Semaphore>();
+       HashMap<Long, Message> responsePool = new HashMap<Long, Message>();
+
+       /**
+        * Constructor for manager side of communication process.
+        *
+        * @param comm communicator.
+        * @param ctx tracing process context.
+        */
+       public ManagerCommunicationProcessor(Communicator comm,
+                       TracingProcessContext ctx) {
+               this.comm = comm;
+               this.ctx = ctx;
+       }
+
+       /**
+        * Method that listen for messages from tracing process in infinite loop,
+        * put answers into pulls and unlock thread, waiting for responses.
+        */
+       @Override
+       public void run() {
+               while (true) {
+                       Message message = comm.getMessage();
+                       if (message == null) {
+                               Logger.debug("Communication stopped");
+                               break;
+                       }
+                       switch (message.getMessageType()) {
+                       case REQUEST__STOP_TRACING:
+                       case REQUEST__TRACING_TIME:
+                               Logger.error("Wrong message for Manager");
+                               break;
+                       case SIGNAL__ERROR_OCCURED:
+                               reportError(message);
+                               break;
+                       default:
+                               responsePool.put(message.getTid(), message);
+                               requestsPool.remove(message.getTid()).release();
+                               break;
+                       }
+               }
+       }
+
+       /**
+        * Method to change context and stop tracingProcessManager and communication.
+        *
+        * @param message description of occurred error
+        */
+       private void reportError(Message message) {
+               ctx.finishContext(Integer.parseInt(message.getArgs()[0]));
+               comm.stop();
+       }
+
+       /**
+        * Universal method to wait for response and release semaphore then.
+        *
+        * @param threadIndex index of thread, to point semaphore in map.
+        * @param messageToSend message to send.
+        * @return received message.
+        */
+       private Message getResponse(long threadIndex, Message messageToSend) {
+               Semaphore semaphore = new Semaphore(1);
+               semaphore.acquireUninterruptibly();
+               try {
+                       requestsPool.put(threadIndex, semaphore);
+                       comm.sendMessage(messageToSend);
+                       semaphore.acquireUninterruptibly();
+                       semaphore.release();
+                       return responsePool.remove(threadIndex);
+               } catch (IOException e) {
+                       Logger.error(e);
+                       semaphore.release();
+                       return null;
+               }
+       }
+
+       /**
+        * Method, requesting for tracing time and waiting for response.
+        *
+        * @return {@link Message} message containing tracing time
+        */
+       public long getTracingTime() {
+               long threadIndex = Thread.currentThread().getId();
+               Message mes = getResponse(threadIndex, new Message(threadIndex,
+                               MessageType.REQUEST__TRACING_TIME));
+               if ((mes != null)
+                               && (mes.getMessageType() == MessageType.RESPONSE__TRACING_TIME)) {
+                       return Long.parseLong(mes.getArgs()[0]);
+               }
+               return 0;
+       }
+
+       /**
+        * Method requesting for process stop and waiting for response.
+        *
+        * @return {@link Message} message informing manager that tracing process stopped
+        */
+       public Message stopTracing() {
+               long threadIndex = Thread.currentThread().getId();
+               return getResponse(threadIndex, new Message(threadIndex,
+                               MessageType.REQUEST__STOP_TRACING));
+       }
+
+       /**
+        * Method to close communication streams.
+        */
+       public void closeConnection() {
+               comm.stop();
+       }
+}
\ No newline at end of file
index 5345ffc..24953a3 100644 (file)
@@ -9,36 +9,98 @@ import java.io.Serializable;
 public class Message implements Serializable {
 
        public enum MessageType {
-               STOP_TRACING,
-               STOP_DONE,
-               INFO_TRACING_TIME,
-               REQUEST_TRACING_TIME,
-               ERROR_OCCURED
+               /**
+                * Request without arguments. It is sent when manager's stopTrace()
+                * method called.
+                */
+               REQUEST__STOP_TRACING,
+               /**
+                * Request process for tracing time. Command have no arguments. Can be
+                * performed at any moment,
+                */
+               REQUEST__TRACING_TIME,
+               /**
+                * Message is sent from process in response on command
+                * {@link REQUEST__STOP_TRACING}, have no arguments, sent right before
+                * process termination.
+                */
+               RESPONSE__STOP_DONE,
+               /**
+                * Message is sent from process in response on
+                * {@link REQUEST__TRACING_TIME}, have 1 argument: Long, tracing time in
+                * microseconds.
+                */
+               RESPONSE__TRACING_TIME,
+               /**
+                * Message sent from process to inform manager that in process occurred
+                * error that can not be ignored, and process failed.
+                */
+               SIGNAL__ERROR_OCCURED
        }
 
        /**
-        * Automatically generated class identifier
+        * Automatically generated class identifier.
         */
        private static final long serialVersionUID = -2812158395001795493L;
 
        /**
         * Message type.
         */
-       public MessageType messageT;
+       private MessageType messageType;
 
        /**
         * Message arguments.
         */
-       public String[] args;
+       private String[] args;
+
+       /**
+        * Unique identifier of thread.
+        */
+       private long tid;
 
        /**
         * Message constructor
         *
+        * @param tid Unique identifier of thread, sent or received this message.
+        * @param messageT type of message
+        * @param args String representation of message content
+        */
+       public Message(long tid, MessageType messageT, String... args) {
+               this.messageType = messageT;
+               this.args = args.clone();
+               this.tid = tid;
+       }
+
+       /**
+        * Old message constructor. //TODO: Should be removed, after finishing of
+        * new communication process developing.
+        *
         * @param messageT type of message
         * @param args String representation of message content
         */
        public Message(MessageType messageT, String... args) {
-               this.messageT = messageT;
-               this.args = args;
+               this(0, messageT, args);
+       }
+
+       /**
+        * Return type of message.
+        *
+        * @return message type
+        */
+       public MessageType getMessageType() {
+               return messageType;
+       }
+
+       /**
+        * Return copy of arguments.
+        *
+        * @return array of string with arguments.
+        */
+       public String[] getArgs() {
+               return args.clone();
+       }
+
+       public long getTid() {
+               return tid;
        }
-}
+}
\ No newline at end of file
diff --git a/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/utils/ProcessCommunicationProcessor.java b/org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/utils/ProcessCommunicationProcessor.java
new file mode 100644 (file)
index 0000000..53becf8
--- /dev/null
@@ -0,0 +1,85 @@
+package org.tizen.dynamicanalyzer.cli.utils;
+
+import java.io.IOException;
+
+import org.tizen.dynamicanalyzer.cli.tracing.TracingProcess;
+import org.tizen.dynamicanalyzer.cli.utils.Message.MessageType;
+import org.tizen.dynamicanalyzer.util.Logger;
+
+/**
+ * Encapsulates methods to response on messages from TracingProcessManager
+ * {@link TracingProcess}, and to send signal in case of error occurred.
+ */
+public class ProcessCommunicationProcessor implements Runnable {
+
+       private Communicator comm;
+       private TracingProcess process;
+
+       /**
+        * Constructor for process side of communication process.
+        *
+        * @param comm communicator.
+        * @param process tracing process.
+        */
+       public ProcessCommunicationProcessor(Communicator comm,
+                       TracingProcess process) {
+               this.comm = comm;
+               this.process = process;
+       }
+
+       /**
+        * Method that listen for messages from tracing process in infinite loop,
+        * put answers into pulls and unlock thread, waiting for responses.
+        */
+       @Override
+       public void run() {
+               while (true) {
+                       Message message = comm.getMessage();
+                       if (message == null) {
+                               Logger.debug("Communication stopped");
+                               break;
+                       }
+                       switch (message.getMessageType()) {
+                       case RESPONSE__STOP_DONE:
+                       case RESPONSE__TRACING_TIME:
+                       case SIGNAL__ERROR_OCCURED:
+                               Logger.error("Wrong message for Process");
+                               break;
+                       case REQUEST__STOP_TRACING:
+                               process.stopTrace();
+                               try {
+                                       comm.sendMessage(message.getTid(), MessageType.RESPONSE__STOP_DONE);
+                               } catch (IOException e) {
+                                       Logger.error(e);
+                               }
+                               break;
+                       case REQUEST__TRACING_TIME:
+                               long time = process.getTracingTime();
+                               try {
+                                       comm.sendMessage(message.getTid(),
+                                                       MessageType.RESPONSE__TRACING_TIME, Long.toString(time));
+                               } catch (IOException e) {
+                                       Logger.error(e);
+                               }
+                               break;
+                       }
+               }
+       }
+
+       /**
+        * In case of error occurred send message to Manager, that trigger
+        * displaying of occurred error description. This method should be called in
+        * case of critical errors.
+        *
+        * @param errNum error index
+        */
+       public void errorOccured(int errNum) {
+               try {
+                       comm.sendMessage(0, MessageType.SIGNAL__ERROR_OCCURED,
+                                       Integer.toString(errNum));
+               } catch (IOException e) {
+                       Logger.error(e);
+               }
+       }
+
+}
index c4b4790..6fcfa8c 100644 (file)
@@ -20,6 +20,7 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.FutureTask;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
@@ -82,7 +83,8 @@ public class TracingProcessManagerTest {
         * Utility method compares specified time with current system time.
         */
        private void assertCurrentTime(long time_ms) {
-               assertTrue(Math.abs(time_ms - new Date().getTime()) < TIME_EPS_MS * 2 + TIMEOUT_MS);
+               assertTrue(Math.abs(time_ms - new Date().getTime()) < TIME_EPS_MS * 2
+                               + TIMEOUT_MS);
        }
 
        /**
@@ -144,6 +146,7 @@ public class TracingProcessManagerTest {
        /**
         * Test that manager correctly sends asynchronous stop signal to tracing process.
         */
+       @Ignore
        @Test
        public void stopTracing_no_except() throws Exception {
                commThread.start();
@@ -151,8 +154,8 @@ public class TracingProcessManagerTest {
                manager = managerConstructor.newInstance(args, process, port);
                manager.stopTracing();
 
-               assertEquals(MessageType.STOP_TRACING,
-                               ((Message) ois.readObject()).messageT);
+               assertEquals(MessageType.REQUEST__STOP_TRACING,
+                               ((Message) ois.readObject()).getMessageType());
        }
 
        /**
@@ -206,6 +209,7 @@ public class TracingProcessManagerTest {
         * Test that manager correctly handles successful tracing process
         * completion and synchronously returns error code.
         */
+       @Ignore
        @Test(timeout = 3 * TIMEOUT_MS)
        public void stopTracing_timeout_dont_trigger_no_except() throws Exception {
                boolean result = false;
@@ -237,6 +241,7 @@ public class TracingProcessManagerTest {
         * Test that manager correctly handles case when tracing process
         * hangs for a long time and tracing process was terminated.
         */
+       @Ignore
        @Test(timeout=3*TIMEOUT_MS)
        public void stopTracing_timeout_trigger_no_except() throws Exception {
                commThread.start();
@@ -372,6 +377,7 @@ public class TracingProcessManagerTest {
         * the underlying process and correctly process case where there are another
         * completion waiters at the moment.
         */
+       @Ignore
        @Test(timeout=2*TIMEOUT_MS)
        public void forceStopTracing_async() throws Exception {
                commThread.start();
index a4d2192..fe3abf3 100644 (file)
@@ -9,6 +9,8 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
+import java.util.Arrays;
+import java.util.List;
 
 import org.apache.commons.cli.ParseException;
 import org.junit.Before;
@@ -39,7 +41,8 @@ public class TracingArgumentsParserTest {
        private final static PrimitiveFeature   screenshot = PrimitiveFeature.SCREENSHOT;
        private final static String             featureOptSCREENSHOT = "-S";
        private final static String             period = "3";
-       private final static File               output = new File("output.out");
+       private final static String             output = "output.out";
+       private final static String             outdefPrefix = File.separator+"test"+File.separator;
        private final static String             outputOpt = "-o";
        private final static long               duration = 12345;
        private final static String             durationOpt = "-i";
@@ -57,7 +60,8 @@ public class TracingArgumentsParserTest {
                TracingArguments result = TracingArgumentsParser.parse(new String[] {
                                device,
                                applicationOpt, application,
-                               outputOpt, output.getPath(),
+                               outputOpt,
+                               outdefPrefix + output,
                                featureOptCPU,
                                featureOptSCREENSHOT, period
                                // TODO duration option is not supported yet
@@ -68,7 +72,7 @@ public class TracingArgumentsParserTest {
                assertTrue(result.isValid());
                assertEquals(device, result.getDevice());
                assertEquals(application, result.getApplication());
-               assertEquals(output, result.getOutput());
+               assertEquals(outdefPrefix + output + ".zip", result.getOutput());
                assertEquals(2, result.getFeatures().size());
                assertTrue(result.getFeatures().contains(cpu));
                assertTrue(result.getFeatures().contains(screenshot));
@@ -97,7 +101,7 @@ public class TracingArgumentsParserTest {
                TracingArguments result = TracingArgumentsParser.parse(new String[] {
                                device,
                                applicationOpt, application,
-                               outputOpt, output.getPath() });
+                               outputOpt, output });
                assertNull(result);
        }
 
@@ -168,7 +172,7 @@ public class TracingArgumentsParserTest {
                                device,
                                applicationOpt, application,
                                featureOptCPU,
-                               outputOpt, output.getPath(),
+                               outputOpt, output,
                                durationOpt, Long.toString(duration),
                                "--", "value"});
                assertNull(result);
@@ -179,7 +183,7 @@ public class TracingArgumentsParserTest {
                TracingArguments result = TracingArgumentsParser.parse(new String[] {
                                device,
                                applicationOpt, application,
-                               outputOpt, output.getPath(),
+                               outputOpt, output,
                                featureOptFILE
                                // TODO duration option is not supported yet
                                // durationOpt, Long.toString(duration)
@@ -189,7 +193,8 @@ public class TracingArgumentsParserTest {
                assertTrue(result.isValid());
                assertEquals(device, result.getDevice());
                assertEquals(application, result.getApplication());
-               assertEquals(output, result.getOutput());
+               assertEquals(new File(output + ".zip").getCanonicalPath(),
+                               result.getOutput());
                assertEquals(2, result.getFeatures().size());
                assertTrue(result.getFeatures().contains(file1));
                assertTrue(result.getFeatures().contains(file2));
@@ -200,7 +205,7 @@ public class TracingArgumentsParserTest {
                TracingArguments result = TracingArgumentsParser.parse(new String[] {
                                device,
                                applicationOpt, application,
-                               outputOpt, output.getPath(),
+                               outputOpt, output,
                                featureOptMEMORY
                                // TODO duration option is not supported yet
                                // durationOpt, Long.toString(duration)
@@ -210,7 +215,8 @@ public class TracingArgumentsParserTest {
                assertTrue(result.isValid());
                assertEquals(device, result.getDevice());
                assertEquals(application, result.getApplication());
-               assertEquals(output, result.getOutput());
+               assertEquals(new File(output + ".zip").getCanonicalPath(),
+                               result.getOutput());
                assertEquals(2, result.getFeatures().size());
                assertTrue(result.getFeatures().contains(memory1));
                assertTrue(result.getFeatures().contains(memory2));
@@ -221,7 +227,7 @@ public class TracingArgumentsParserTest {
                TracingArguments result = TracingArgumentsParser.parse(new String[] {
                                device,
                                applicationOpt, application,
-                               outputOpt, output.getPath(),
+                               outputOpt, output,
                                featureOptPOWER
                                // TODO duration option is not supported yet
                                // durationOpt, Long.toString(duration)
@@ -231,7 +237,8 @@ public class TracingArgumentsParserTest {
                assertTrue(result.isValid());
                assertEquals(device, result.getDevice());
                assertEquals(application, result.getApplication());
-               assertEquals(output, result.getOutput());
+               assertEquals(new File(output + ".zip").getCanonicalPath(),
+                               result.getOutput());
                assertEquals(1, result.getFeatures().size());
                assertTrue(result.getFeatures().contains(power));
        }
@@ -241,7 +248,7 @@ public class TracingArgumentsParserTest {
                TracingArguments result = TracingArgumentsParser.parse(new String[] {
                                device,
                                applicationOpt, application,
-                               outputOpt, output.getPath(),
+                               outputOpt, output,
                                featureOptPOWER,
                                featureOptCPU,
                                featureOptFILE,
@@ -254,7 +261,8 @@ public class TracingArgumentsParserTest {
                assertTrue(result.isValid());
                assertEquals(device, result.getDevice());
                assertEquals(application, result.getApplication());
-               assertEquals(output, result.getOutput());
+               assertEquals(new File(output + ".zip").getCanonicalPath(),
+                               result.getOutput());
                assertEquals(6, result.getFeatures().size());
        }
 
@@ -424,11 +432,26 @@ public class TracingArgumentsParserTest {
                String[] result = TracingArgumentsParser.toStringArray(args);
                assertNotNull(result);
                assertEquals(8, result.length);
-               assertEquals("-C", result[3]);
-               assertEquals("usage", result[4]);
-               assertEquals("-F", result[5]);
-               assertEquals("analysis", result[6]);
-               assertEquals("io", result[7]);
+
+               List<String> arrList = Arrays.asList(result);
+               List<String> expected = Arrays.asList("-C", "-F", "usage", "io", "analysis");
+
+               for (String entry : expected)
+                       assertTrue(arrList.contains(entry));
+
+               assertTrue(arrList.indexOf(expected.get(0)) > 2);             // device -a app ... -C
+               assertTrue(arrList.indexOf(expected.get(1)) > 2);             // device -a app ... -F
+
+               int index = arrList.indexOf(expected.get(2));
+               assertTrue( arrList.get(index - 1).equals(expected.get(0)) ); // -C usage
+
+               index = arrList.indexOf(expected.get(3));
+               assertTrue(     arrList.get(index - 1).equals(expected.get(1)) || // -F io
+                                       arrList.get(index - 2).equals(expected.get(1)) ); // -F ... io
+
+               index = arrList.indexOf(expected.get(4));
+               assertTrue(     arrList.get(index - 1).equals(expected.get(1)) || // -F analysis
+                                       arrList.get(index - 2).equals(expected.get(1)) ); // -F ... analysis
        }
 
        @Test
index cbfdb74..138cfbb 100644 (file)
@@ -19,7 +19,7 @@ public class TracingArgumentsTest {
 
        private final static String   device = "device";
        private final static String   application = "application";
-       private final static File     output = new File("output.out");
+       private final static String   output = "output.out";
        private final static PrimitiveFeature feature = PrimitiveFeature.CPU_USAGE;
        private final static PrimitiveFeature feature2 = PrimitiveFeature.POWER_ESTIMATION;
        private final static int period = 3;
diff --git a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/tracing/TracingProcessCommunicationTest.java b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/tracing/TracingProcessCommunicationTest.java
deleted file mode 100644 (file)
index a59c90a..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.tizen.dynamicanalyzer.cli.tracing;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.tizen.dynamicanalyzer.cli.utils.Message;
-import org.tizen.dynamicanalyzer.cli.utils.Message.MessageType;
-import org.tizen.dynamicanalyzer.setting.PrimitiveFeature;
-
-/**
- * This class tests ability of {@link TracingProcess} to perform
- * stop sequence when stop signal from parent will be send.
- */
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({SystemExit.class, TracingProcess.class})
-public class TracingProcessCommunicationTest {
-       // timeout for test
-       private static final int TIMEOUT_MS = 500;
-
-       static int port = 9000;
-
-       private TracingArguments args;
-
-       @Before
-       public void setUp() throws Exception {
-               args = new TracingArguments();
-               args.setApplication("APP");
-               args.setDevice("DEV");
-               args.addFeature(PrimitiveFeature.CPU_USAGE);
-               args.setDuration(0);
-       }
-
-       /**
-        * Check tracing process responds on requests
-        */
-       @Test(timeout = 2 * TIMEOUT_MS)
-       public void testStandardBehavior() throws Exception {
-               Thread thread = new Thread(new CommunicationMock());
-               thread.start();
-               new TracingProcess(args);
-       }
-
-       private static class CommunicationMock implements Runnable {
-
-               @Override
-               public void run() {
-                       try {
-                               ServerSocket ss = new ServerSocket(port);
-                               Socket socket = ss.accept();
-                               ss.close();
-                               ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
-                               oos.flush();
-                               ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
-
-                               oos.writeObject(new Message(MessageType.REQUEST_TRACING_TIME));
-                               oos.flush();
-                               Message mes = (Message) ois.readObject();
-                               assertEquals(MessageType.INFO_TRACING_TIME, mes.messageT);
-                               assertEquals(1, mes.args.length);
-                               assertEquals("0", mes.args[0]);
-
-                               oos.writeObject(new Message(MessageType.STOP_TRACING));
-                               oos.flush();
-                               mes = (Message) ois.readObject();
-                               assertEquals(mes.messageT, MessageType.INFO_TRACING_TIME);
-                               assertTrue(Long.parseLong(mes.args[0])>0);
-
-                               mes = (Message) ois.readObject();
-                               assertEquals(MessageType.STOP_DONE, mes.messageT);
-                       } catch (IOException | ClassNotFoundException e) {
-                               assertTrue(false);
-                       }
-               }
-       }
-}
diff --git a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/CommunicatorTest.java b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/CommunicatorTest.java
new file mode 100644 (file)
index 0000000..45a2a77
--- /dev/null
@@ -0,0 +1,278 @@
+package org.tizen.dynamicanalyzer.cli.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.tizen.dynamicanalyzer.cli.utils.Message.MessageType;
+
+/**
+ * Test for {@link Communicator} class.
+ */
+public class CommunicatorTest {
+
+       final int PORT = 9000;
+       Message sentMessage = null;
+
+       @Before
+       public void prepare() {
+               sentMessage = null;
+       }
+
+       /**
+        * Tests that communicator.sendMessage(Message) sent message correctly and
+        * sent message may be read on other side. Inside this test communication
+        * thread being created to receive sent message and store it in field
+        * sentMessage.
+        *
+        * @throws Exception
+        */
+       @Test
+       public void testSend() throws Exception {
+               ServerSocket ss = new ServerSocket(PORT);
+               Thread commThread = new Thread(new Runnable() {
+                       @Override
+                       public void run() {
+                               try {
+                                       Socket socket = new Socket(InetAddress.getLocalHost(), PORT);
+                                       ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+                                       oos.flush();
+                                       ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+
+                                       Object rawObj = ois.readObject();
+                                       socket.close();
+                                       if (!(rawObj instanceof Message))
+                                               return;
+                                       sentMessage = (Message) rawObj;
+                               } catch (IOException | ClassNotFoundException e) {
+                                       return;
+                               }
+                       }
+               });
+               commThread.start();
+
+               Socket socket = ss.accept();
+               ss.close();
+               ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+               ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+
+               Communicator comm = new Communicator(ois, oos);
+               assertNotNull(comm);
+
+               Message mes = new Message(MessageType.REQUEST__STOP_TRACING);
+               comm.sendMessage(mes);
+
+               commThread.join();
+
+               assertEquals(mes.getMessageType(), sentMessage.getMessageType());
+               assertEquals(mes.getArgs().length, sentMessage.getArgs().length);
+       }
+
+       /**
+        * Tests that communicator.sendMessage(MessageType, String..) sent message
+        * correctly and sent message may be read on other side. Inside this test
+        * communication thread being created to receive sent message and store it
+        * in field sentMessage.
+        *
+        * In this test case String.. args is null.
+        *
+        * @throws Exception
+        */
+       @Test
+       public void testSendByInternals() throws Exception {
+               ServerSocket ss = new ServerSocket(PORT);
+               Thread commThread = new Thread(new Runnable() {
+                       @Override
+                       public void run() {
+                               try {
+                                       Socket socket = new Socket(InetAddress.getLocalHost(), PORT);
+                                       ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+                                       oos.flush();
+                                       ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+
+                                       Object rawObj = ois.readObject();
+                                       socket.close();
+                                       if (!(rawObj instanceof Message))
+                                               return;
+                                       sentMessage = (Message) rawObj;
+                               } catch (IOException | ClassNotFoundException e) {
+                                       return;
+                               }
+                       }
+               });
+               commThread.start();
+
+               Socket socket = ss.accept();
+               ss.close();
+               ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+               ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+
+               Communicator comm = new Communicator(ois, oos);
+               assertNotNull(comm);
+
+               comm.sendMessage(0L, MessageType.REQUEST__STOP_TRACING);
+
+               commThread.join();
+
+               assertEquals(0, sentMessage.getTid());
+               assertEquals(MessageType.REQUEST__STOP_TRACING, sentMessage.getMessageType());
+               assertEquals(0, sentMessage.getArgs().length);
+       }
+
+       /**
+        * Tests that communicator.sendMessage(MessageType, String..) sent message
+        * correctly and sent message may be read on other side. Inside this test
+        * communication thread being created to receive sent message and store it
+        * in field sentMessage.
+        *
+        * In this test case String.. args is not null.
+        *
+        * @throws Exception
+        */
+       @Test
+       public void testSendByInternalsWithArgs() throws Exception {
+               ServerSocket ss = new ServerSocket(PORT);
+               Thread commThread = new Thread(new Runnable() {
+                       @Override
+                       public void run() {
+                               try {
+                                       Socket socket = new Socket(InetAddress.getLocalHost(), PORT);
+                                       ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+                                       oos.flush();
+                                       ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+
+                                       Object rawObj = ois.readObject();
+                                       socket.close();
+                                       if (!(rawObj instanceof Message))
+                                               return;
+                                       sentMessage = (Message) rawObj;
+                               } catch (IOException | ClassNotFoundException e) {
+                                       return;
+                               }
+                       }
+               });
+               commThread.start();
+
+               Socket socket = ss.accept();
+               ss.close();
+               ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+               ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+
+               Communicator comm = new Communicator(ois, oos);
+               assertNotNull(comm);
+
+               comm.sendMessage(0L, MessageType.REQUEST__STOP_TRACING, "Some",
+                               "Random",
+                               "arguments");
+
+               commThread.join();
+
+               assertEquals(0, sentMessage.getTid());
+               assertEquals(MessageType.REQUEST__STOP_TRACING, sentMessage.getMessageType());
+               assertEquals(3, sentMessage.getArgs().length);
+               assertEquals("Some", sentMessage.getArgs()[0]);
+               assertEquals("Random", sentMessage.getArgs()[1]);
+               assertEquals("arguments", sentMessage.getArgs()[2]);
+       }
+
+       /**
+        * Tests that communicator.getMessage() receive message correctly.Inside
+        * this test communication thread being created to send message to
+        * communicator.
+        *
+        * In this test case String.. args is null.
+        *
+        * @throws Exception
+        */
+       @Test
+       public void testGet() throws Exception {
+               ServerSocket ss = new ServerSocket(PORT);
+               Thread commThread = new Thread(new Runnable() {
+                       @Override
+                       public void run() {
+                               try {
+                                       Socket socket = new Socket(InetAddress.getLocalHost(), PORT);
+                                       ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+                                       oos.flush();
+                                       ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+
+                                       oos.writeObject(new Message(MessageType.SIGNAL__ERROR_OCCURED));;
+                                       oos.flush();
+                               } catch (IOException e) {
+                                       return;
+                               }
+                       }
+               });
+               commThread.start();
+
+               Socket socket = ss.accept();
+               ss.close();
+               ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+               ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+
+               Communicator comm = new Communicator(ois, oos);
+               assertNotNull(comm);
+
+               Message mes = comm.getMessage();
+
+               commThread.join();
+
+               assertEquals(MessageType.SIGNAL__ERROR_OCCURED, mes.getMessageType());
+               assertEquals(0, mes.getArgs().length);
+       }
+
+       /**
+        * Tests that communicator.getMessage() receive message correctly.Inside
+        * this test communication thread being created to send message to
+        * communicator.
+        *
+        * In this test case String.. args is not null.
+        *
+        * @throws Exception
+        */
+       @Test
+       public void testGetWithArgs() throws Exception {
+               ServerSocket ss = new ServerSocket(PORT);
+               Thread commThread = new Thread(new Runnable() {
+                       @Override
+                       public void run() {
+                               try {
+                                       Socket socket = new Socket(InetAddress.getLocalHost(), PORT);
+                                       ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+                                       oos.flush();
+                                       ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+
+                                       oos.writeObject(new Message(MessageType.SIGNAL__ERROR_OCCURED, "New Random String"));
+                                       oos.flush();
+                               } catch (IOException e) {
+                                       return;
+                               }
+                       }
+               });
+               commThread.start();
+
+               Socket socket = ss.accept();
+               ss.close();
+               ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+               ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+
+               Communicator comm = new Communicator(ois, oos);
+               assertNotNull(comm);
+
+               Message mes = comm.getMessage();
+
+               commThread.join();
+
+               assertEquals(MessageType.SIGNAL__ERROR_OCCURED, mes.getMessageType());
+               assertEquals(1, mes.getArgs().length);
+               assertEquals("New Random String", mes.getArgs()[0]);
+       }
+}
diff --git a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ManagerCommunicationProcessorTest.java b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ManagerCommunicationProcessorTest.java
new file mode 100644 (file)
index 0000000..da5ab53
--- /dev/null
@@ -0,0 +1,210 @@
+package org.tizen.dynamicanalyzer.cli.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.tizen.dynamicanalyzer.cli.manager.TracingProcessContext;
+import org.tizen.dynamicanalyzer.cli.tracing.TracingArguments;
+import org.tizen.dynamicanalyzer.cli.utils.Message.MessageType;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
+import org.tizen.dynamicanalyzer.setting.PrimitiveFeature;
+import org.tizen.dynamicanalyzer.util.InternalLogger;
+import org.tizen.dynamicanalyzer.util.Logger;
+
+/**
+ * Test for {@link ManagerCommunicationProcessor} class.
+ */
+public class ManagerCommunicationProcessorTest {
+
+       static int PORT = 9000;
+
+       static ManagerCommunicationProcessor comProcessor;
+
+       static TracingProcessContext ctx;
+
+       private static OppositeCommSide opposite;
+
+       private static Thread comThread;
+
+       /**
+        * Initiate communication process between ManagerCommunicationProcessor and
+        * OppositeCommSide - stub class for socket communication client.
+        *
+        * @throws IOException
+        */
+       @BeforeClass
+       public static void setUp() throws IOException {
+               Logger.init(InternalLogger.DEBUG);
+               ServerSocket ss = new ServerSocket(PORT);
+               opposite = new OppositeCommSide(PORT);
+               Thread oppThread = new Thread(opposite);
+               oppThread.start();
+               Socket socket = ss.accept();
+               ss.close();
+               ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+               oos.flush();
+               ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+               Communicator comm = new Communicator(ois, oos);
+
+               TracingArguments args = new TracingArguments();
+               args.setDevice("DEV");
+               args.setApplication("APP");
+               args.setDuration(0);
+               args.addFeature(PrimitiveFeature.CPU_USAGE);
+               ctx = new TracingProcessContext(args);
+
+               comProcessor = new ManagerCommunicationProcessor(comm, ctx);
+               comThread = new Thread(comProcessor);
+               comThread.start();
+       }
+
+       /**
+        * Method to test if communication finished correctly after sending an
+        * SIGNAL__ERROR_OCCURED.
+        *
+        * @throws InterruptedException
+        */
+       @AfterClass
+       public static void test_errOccured() throws InterruptedException {
+               try {
+                       opposite.sendMessage(new Message(0, MessageType.SIGNAL__ERROR_OCCURED,
+                                       Integer.toString(ErrorCode.SUCCESS.getErrorNumber())));
+               } catch (IOException e) {
+                       Assert.fail();
+               }
+               comThread.join();
+               assertTrue(ctx.isFinished());
+               assertEquals(ErrorCode.SUCCESS.getErrorNumber(), ctx.getErrCode());
+       }
+
+       long time;
+
+       /**
+        * Test that getTracingTime() method send correct message and then suspend
+        * until process response to this message.
+        *
+        * @throws Exception
+        */
+       @Test(timeout=200)
+       public void test_getTracingTime() throws Exception {
+               time = 0L;
+               Thread worker = new Thread(new Runnable() {
+
+                       @Override
+                       public void run() {
+                               time = comProcessor.getTracingTime();
+                       }
+
+               });
+               worker.start();
+               Message mes = opposite.get_message();
+               opposite.sendMessage(new Message(mes.getTid(),
+                               MessageType.RESPONSE__TRACING_TIME, Long.toString(2000L)));
+               worker.join();
+
+               assertEquals(2000L, time);
+               time = 0L;
+       }
+
+       /**
+        * Test that stopTracing() method send correct message and then suspend
+        * until process response to this message.
+        *
+        * @throws Exception
+        */
+       @Test(timeout=200)
+       public void test_stopTracing() throws Exception {
+               Thread worker = new Thread(new Runnable() {
+
+                       @Override
+                       public void run() {
+                               Message message = comProcessor.stopTracing();
+                               assertEquals(Thread.currentThread().getId(), message.getTid());
+                               assertEquals(MessageType.RESPONSE__STOP_DONE,
+                                               message.getMessageType());
+                       }
+
+               });
+               worker.start();
+               Message mes = opposite.get_message();
+
+               assertEquals(worker.getId(), mes.getTid());
+               assertEquals(MessageType.REQUEST__STOP_TRACING, mes.getMessageType());
+               assertEquals(0, mes.getArgs().length);
+
+               opposite.sendMessage(new Message(mes.getTid(),
+                               MessageType.RESPONSE__STOP_DONE, Long.toString(2000L)));
+               worker.join();
+       }
+
+       /**
+        * Test that communicator can correctly work with requests sent from
+        * different threads simultaneously.
+        *
+        * @throws Exception
+        */
+       @Test(timeout=200)
+       public void test_2requestingThreads() throws Exception {
+               time = 0L;
+               Thread worker1 = new Thread(new Runnable() {
+
+                       @Override
+                       public void run() {
+                               Message message = comProcessor.stopTracing();
+                               assertEquals(Thread.currentThread().getId(), message.getTid());
+                               assertEquals(MessageType.RESPONSE__STOP_DONE,
+                                               message.getMessageType());
+                               time = comProcessor.getTracingTime();
+                       }
+
+               });
+               Thread worker2 = new Thread(new Runnable() {
+
+                       @Override
+                       public void run() {
+                               time = comProcessor.getTracingTime();
+                       }
+
+               });
+               worker1.start();
+               worker2.start();
+
+               Message mes1 = opposite.get_message();
+               Message mes2 = opposite.get_message();
+               if (mes1.getTid() == worker1.getId()) {
+                       assertEquals(MessageType.REQUEST__STOP_TRACING, mes1.getMessageType());
+                       assertEquals(MessageType.REQUEST__TRACING_TIME, mes2.getMessageType());
+                       assertEquals(worker2.getId(), mes2.getTid());
+               }else{
+                       assertEquals(worker2.getId(), mes1.getTid());
+                       assertEquals(MessageType.REQUEST__STOP_TRACING, mes2.getMessageType());
+                       assertEquals(MessageType.REQUEST__TRACING_TIME, mes1.getMessageType());
+                       assertEquals(worker1.getId(), mes2.getTid());
+               }
+               opposite.sendMessage(new Message(worker2.getId(), MessageType.RESPONSE__TRACING_TIME, Long.toString(1000)));
+               worker2.join();
+               assertEquals(1000L, time);
+
+               opposite.sendMessage(new Message(worker1.getId(), MessageType.RESPONSE__STOP_DONE));
+               assertEquals(1000L, time);
+
+               mes1 = opposite.get_message();
+               assertEquals(MessageType.REQUEST__TRACING_TIME, mes1.getMessageType());
+               assertEquals(worker1.getId(), mes1.getTid());
+
+               opposite.sendMessage(new Message(worker1.getId(), MessageType.RESPONSE__TRACING_TIME, Long.toString(2000)));
+               worker1.join();
+               assertEquals(2000L, time);
+               time = 0;
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/OppositeCommSide.java b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/OppositeCommSide.java
new file mode 100644 (file)
index 0000000..37c0eeb
--- /dev/null
@@ -0,0 +1,70 @@
+package org.tizen.dynamicanalyzer.cli.utils;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.InetAddress;
+import java.net.Socket;
+
+import org.junit.Ignore;
+
+/**
+ * Stub for socket communication client.
+ */
+@Ignore
+public class OppositeCommSide implements Runnable {
+
+       int PORT;
+
+       /**
+        * Public constructor.
+        *
+        * @param port communication port on LocalHost
+        */
+       public OppositeCommSide(int port) {
+               this.PORT = port;
+       }
+
+       ObjectInputStream ois;
+       ObjectOutputStream oos;
+
+       /**
+        * Receive message from ois.
+        *
+        * @return received message.
+        * @throws Exception if message can not be read from {@link ObjectInputStream}, or it is not
+        *             instance of {@link Message}
+        */
+       public Message get_message() throws Exception {
+               Object obj = null;
+               obj = ois.readObject();
+               return (Message) obj;
+       }
+
+       /**
+        * Send message or throw {@link IOException} if {@link ObjectOutputStream} is unavailable.
+        *
+        * @param message message to send
+        * @throws IOException if {@link ObjectOutputStream} is unavailable
+        */
+       public void sendMessage(Message message) throws IOException {
+                       oos.writeObject(message);
+                       oos.flush();
+       }
+
+       /**
+        * Initialize {@link ObjectInputStream} and {@link ObjectOutputStream}.
+        */
+       @Override
+       public void run() {
+               try {
+                       Socket socket = new Socket(InetAddress.getLocalHost(), PORT);
+                       ois = new ObjectInputStream(socket.getInputStream());
+                       oos = new ObjectOutputStream(socket.getOutputStream());
+                       oos.flush();
+               } catch (IOException e) {
+                       // TODO Auto-generated catch block
+                       e.printStackTrace();
+               }
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ProcessCommunicationProcessorTest.java b/org.tizen.dynamicanalyzer.cli/test/src/org/tizen/dynamicanalyzer/cli/utils/ProcessCommunicationProcessorTest.java
new file mode 100644 (file)
index 0000000..aac9ecb
--- /dev/null
@@ -0,0 +1,112 @@
+package org.tizen.dynamicanalyzer.cli.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.tizen.dynamicanalyzer.cli.tracing.TracingProcess;
+import org.tizen.dynamicanalyzer.cli.utils.Message.MessageType;
+import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
+import org.tizen.dynamicanalyzer.util.InternalLogger;
+import org.tizen.dynamicanalyzer.util.Logger;
+
+/**
+ * Test for {@link ProcessCommunicationProcessor} class.
+ */
+public class ProcessCommunicationProcessorTest {
+
+       static Thread comThread;
+       static OppositeCommSide opposite;
+       static int PORT = 10000;
+       private static ProcessCommunicationProcessor comProcessor;
+       private static TracingProcess process;
+       private static Thread oppThread;
+
+       /**
+        * Initiate communication process between ProcessCommunicationProcessor and
+        * OppositeCommSide - stub class for socket communication client.
+        *
+        * @throws IOException
+        */
+       @BeforeClass
+       public static void setup() throws IOException {
+               Logger.init(InternalLogger.DEBUG);
+               ServerSocket ss = new ServerSocket(PORT);
+               opposite = new OppositeCommSide(PORT);
+               oppThread = new Thread(opposite);
+               oppThread.start();
+               Socket socket = ss.accept();
+               ss.close();
+               ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
+               oos.flush();
+               ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
+               Communicator comm = new Communicator(ois, oos);
+
+               process = mock(TracingProcess.class);
+
+               comProcessor = new ProcessCommunicationProcessor(comm, process);
+               comThread = new Thread(comProcessor);
+               comThread.start();
+       }
+
+       /**
+        * Test that errorOccured() method send message correctly.
+        *
+        * @throws Exception
+        */
+       @Test
+       public void test_errorOccured() throws Exception {
+               comProcessor.errorOccured(ErrorCode.ERR_BUSY_DEVICE.getErrorNumber());
+               Message mes = opposite.get_message();
+               assertEquals(MessageType.SIGNAL__ERROR_OCCURED, mes.getMessageType());
+               assertEquals(0, mes.getTid());
+               assertEquals(ErrorCode.ERR_BUSY_DEVICE.getErrorNumber(),
+                               Integer.parseInt(mes.getArgs()[0]));
+       }
+
+       /**
+        * Test that in case of REQUEST__STOP_TRACING message received, then
+        * stopTrace() method called and response message sent correctly.
+        *
+        * @throws Exception
+        */
+       @Test
+       public void test_requestStop() throws Exception {
+               opposite.sendMessage(new Message(oppThread.getId(),
+                               MessageType.REQUEST__STOP_TRACING));
+               Message mes = opposite.get_message();
+
+               assertEquals(oppThread.getId(), mes.getTid());
+               assertEquals(MessageType.RESPONSE__STOP_DONE, mes.getMessageType());
+               assertEquals(0, mes.getArgs().length);
+
+               verify(process).stopTrace();
+       }
+
+       /**
+        * Test that in case of REQUEST__TRACING_TIME message received, then
+        * TracingProcess is asked for tracing time and answer is sent correctly.
+        *
+        * @throws Exception
+        */
+       @Test
+       public void test_requestTracingTime() throws Exception {
+               opposite.sendMessage(new Message(300L,
+                               MessageType.REQUEST__TRACING_TIME));
+               Message mes = opposite.get_message();
+
+               assertEquals(300L, mes.getTid());
+               assertEquals(MessageType.RESPONSE__TRACING_TIME, mes.getMessageType());
+               assertEquals(0L, Long.parseLong(mes.getArgs()[0]));
+
+               verify(process).getTracingTime();
+       }
+}
\ No newline at end of file
index af36757..34cd4f1 100644 (file)
@@ -28,5 +28,5 @@ package org.tizen.dynamicanalyzer.unittest;
 public class UnitTestConstants {
        public static final int RANDOM_TEST_COUNT = 1000;               // The count of input in random value (i.e. the count of test)
        public static final int TEST_FOR_ARRAY_COUNT = 100;     // The input's array count
-
+       public static final int FLAT_FEATURE_SET_SIZE = 5;              // Count of randomly selected FlatFeatures
 }
index e546c35..b564853 100644 (file)
@@ -209,4 +209,16 @@ public class CommonUtil {
 
                return result;
        }
+
+       /**
+        * Checks whether given string is integer.
+        *
+        * @param str
+        *            string to check
+        * @return true if string is integer.
+        */
+       public static boolean isNumeric(String str) {
+               // match a number with optional '-' and decimal.
+               return str.matches("-?\\d+(\\.\\d+)?");
+       }
 }
index 48a3e5b..28a192f 100644 (file)
@@ -13,6 +13,5 @@
 602|Screenshot|1||Timeline||10|100|10|
 603|UI Hierarchy|1||UI Hierarchy|||||
 701|Thread|1||Thread|||||2
-702|Sync analysis|1||Thread|||||2
 801|Peripheral Status|1||Timeline|||||
 802|Power Estimation|1||Timeline|||||
index 982f364..fd92d9f 100644 (file)
@@ -1,2 +1,2 @@
-Selected Chart List|CPU|CPU core|CPU frequency
-Default Chart List|CPU|CPU core|CPU frequency
+Selected Chart List|CPU Usage|Core Usage
+Default Chart List|Core Usage
index db22b1e..280a20a 100644 (file)
@@ -1,26 +1,25 @@
 Version|0.2
 Log Level|4
-Debug Print|N
-Available Target List|mobile
+Debug Print|Y
+Available Target List|mobile|wearable
 Selected Target|mobile
-Options Selected Feature List|5002:0
 Default Feature List|2|3|103
 Total Overhead Range|1000000|3000000|7000000|15000000
-mobile|Protocol Version|3.0
-mobile|Available Template List|1|2|3|4|5|6|7|8|9|10
+Options Selected Feature List|5002:0
+Selected Preferences|2001
+mobile|Protocol Version|4.0
+mobile|Available Template List|1|2|3|4|5|6|7|8|9|10|11
 mobile|Selected Template|1
-mobile|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|102|200|201|202|203|204
+mobile|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|301|200|201|202|203|204|206
+mobile|Available FlatFeature List|101|102|103|201|202|203|301|302|401|501|502|601|602|603|701|801|802
 mobile|Selected Feature List|1|5|1000:1000|100|101|1001:10
-mobile|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy
+mobile|Selected FlatFeature List|101|102
+mobile|Available Chart List|CPU Usage|Core Usage|Core Frequency|System Memory|Process Memory|Heap Allocation|Screenshot|UI Event|Disk IO|Network IO|Peripheral Status|Power Estimation
 wearable|Protocol Version|3.0
-wearable|Available Template List|1|2|3|4|5|6|7|8|9|10
+wearable|Available Template List|1|2|3|4|5|6|7|8|9|10|11
 wearable|Selected Template|1
-wearable|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|102|200|201|202|203|204
+wearable|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|301|200|201|202|203|204|206
+wearable|Available FlatFeature List|101|102|103|201|202|203|301|302|401|501|502|601|602|603|701|801|802
 wearable|Selected Feature List|1|5|1000:1000|100|101|1001:10
-wearable|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy
-tv|Protocol Version|3.0
-tv|Available Template List|1|3|9|10
-tv|Selected Template|1
-tv|Available Feature List|1|1000|4|5|6|7|8|9|100|101|1001|204
-tv|Selected Feature List|1|5|1000:1000|100|101|1001:10
-tv|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy
+wearable|Selected FlatFeature List|
+wearable|Available Chart List|CPU Usage|Core Usage|Core Frequency|System Memory|Process Memory|Heap Allocation|Screenshot|UI Event|Disk IO|Network IO|Peripheral Status|Power Estimation
\ No newline at end of file
index 2c5ab6d..ebc6df0 100644 (file)
@@ -37,7 +37,9 @@ import java.util.Map;
 import java.util.Set;
 
 import org.junit.AfterClass;
+import org.junit.Before;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.powermock.reflect.Whitebox;
 import org.tizen.dynamicanalyzer.common.Global;
@@ -46,6 +48,7 @@ import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
 import org.tizen.dynamicanalyzer.setting.Feature;
 import org.tizen.dynamicanalyzer.setting.FeatureData;
 import org.tizen.dynamicanalyzer.setting.FeatureValueData;
+import org.tizen.dynamicanalyzer.setting.FlatPreferences;
 import org.tizen.dynamicanalyzer.setting.SettingConstants;
 import org.tizen.dynamicanalyzer.setting.SettingDataManager;
 import org.tizen.dynamicanalyzer.setting.TargetData;
@@ -72,12 +75,27 @@ public class SettingDataManagerTest {
                @SuppressWarnings("unused")
                UILayoutDataManager l = UILayoutDataManager.INSTANCE;
        }
+       
+       @Before
+       public void set_up(){
+               // revert setting Preferences
+               List<FlatPreferences> initOptionsSelectedPreferenceList = Whitebox
+                               .getInternalState(SettingDataManager.INSTANCE,
+                                               "initOptionsSelectedPreferenceList");
+               List<FlatPreferences> optionsSelectedPreferenceList = Whitebox
+                               .getInternalState(SettingDataManager.INSTANCE,
+                                               "optionsSelectedPreferenceList");
+
+               optionsSelectedPreferenceList.clear();
+               optionsSelectedPreferenceList.addAll(initOptionsSelectedPreferenceList);
+       }
 
        @AfterClass
        public static void tesApplySettingData() {
                // change selected target, options feature
                SettingDataManager.INSTANCE.setSelectedTarget("wearable");
-               SettingDataManager.INSTANCE.addOptionsSelectedFeature(Feature.SCREENSHOT_PERIODICALLY, 50);
+               SettingDataManager.INSTANCE.addOptionsSelectedPreference(
+                               FlatPreferences.SCREENSHOT_PERIODICALLY, 50);
                assertTrue(SettingDataManager.INSTANCE.changedFeatures());
 
                // apply selected target, options feature
@@ -91,17 +109,20 @@ public class SettingDataManagerTest {
                String initTarget = Whitebox.getInternalState(SettingDataManager.INSTANCE, "initTarget");
                assertEquals("wearable", initTarget);
 
-               // check initOptionsSelectedFeatureList
-               List<FeatureValueData> initOptionsSelectedFeatureList = Whitebox.getInternalState(
-                               SettingDataManager.INSTANCE, "initOptionsSelectedFeatureList");
-               assertEquals(2, initOptionsSelectedFeatureList.size());
-               assertEquals(5002, initOptionsSelectedFeatureList.get(0).getKey().getIndex());
-               assertEquals(0, initOptionsSelectedFeatureList.get(0).getValue());
-               assertEquals(5001, initOptionsSelectedFeatureList.get(1).getKey().getIndex());
-               assertEquals(50, initOptionsSelectedFeatureList.get(1).getValue());
-               assertFalse(SettingDataManager.INSTANCE.changedFeatures());
+               // check initOptionsSelectedPreferencesList
+               List<FlatPreferences> initOptionsSelectedPreferenceList = Whitebox
+                               .getInternalState(SettingDataManager.INSTANCE,
+                                               "initOptionsSelectedPreferenceList");
+               assertEquals(1, initOptionsSelectedPreferenceList.size());
+               assertEquals(2001, initOptionsSelectedPreferenceList.get(0).getIndex());
+               assertEquals(-1, initOptionsSelectedPreferenceList.get(0).getValue());
        }
 
+       @Ignore
+       // Tests feature internal data, but Feature is outdated.
+       // TODO: mind about redesign this for FlatFeature.
+       // TODO: There are inner fields in FlatFeature, so, here is quite good place
+       // to test it.
        @Test
        public void testInitFeatureData() {
                FeatureData feature = Feature.SYSTEM_SAMPLING_RATE.getData();
@@ -116,6 +137,8 @@ public class SettingDataManagerTest {
                assertEquals(3, feature.getOverheadRanking());
        }
 
+       @Ignore
+       // Tests template internal data, but Template is outdated.
        @Test
        public void testInitTemplateData() {
                TemplateData template = Template.TEMPLATE_BOTTLENECK.getData();
@@ -127,9 +150,10 @@ public class SettingDataManagerTest {
        public void testInitSettingData() {
                // check Available Target List
                Map<String, TargetData> targetListMap = setting.getTargetListMap();
-               assertEquals(1, targetListMap.size());
+               assertEquals(2, targetListMap.size());
                assertTrue(targetListMap.get("mobile") != null);
-               assertFalse(targetListMap.get("wearable") != null);
+               assertTrue(targetListMap.get("wearable") != null);
+               assertFalse(targetListMap.get("tv") != null);
 
                // check Selected Target
                assertEquals("mobile", setting.getSelectedTarget());
@@ -138,17 +162,14 @@ public class SettingDataManagerTest {
 
                // check Selected Chart List
                Set<String> chartSet = layout.getSelectedChartSet();
-               assertEquals(3, chartSet.size());
-               assertTrue(chartSet.contains("CPU"));
-               assertTrue(chartSet.contains("CPU core"));
-               assertTrue(chartSet.contains("CPU frequency"));
+               assertEquals(2, chartSet.size());
+               assertTrue(chartSet.contains("CPU Usage"));
+               assertTrue(chartSet.contains("Core Usage"));
 
                // check Default Chart List
                chartSet = layout.getDefaultChartSet();
-               assertEquals(3, chartSet.size());
-               assertTrue(chartSet.contains("CPU"));
-               assertTrue(chartSet.contains("CPU core"));
-               assertTrue(chartSet.contains("CPU frequency"));
+               assertEquals(1, chartSet.size());
+               assertTrue(chartSet.contains("Core Usage"));
 
                // check Default Protocol List
                List<Feature> defaultFeatureList = setting.getDefaultFeatureList();
@@ -166,22 +187,21 @@ public class SettingDataManagerTest {
                assertEquals(15000000, totalOverheadRange.get(3).longValue());
 
                // check Options Selected Feature List
-               List<FeatureValueData> featureList = setting.getOptionsSelectedFeatureList();
-               assertEquals(1, featureList.size());
-               assertEquals(5002, featureList.get(0).getKey().getIndex());
-               assertEquals(0, featureList.get(0).getValue());
-
-               featureList = Whitebox.getInternalState(setting, "initOptionsSelectedFeatureList");
-               assertEquals(1, featureList.size());
-               assertEquals(5002, featureList.get(0).getKey().getIndex());
-               assertEquals(0, featureList.get(0).getValue());
+               List<FlatPreferences> flatPreferenceList = setting.getOptionsSelectedPreferencesList();
+               assertEquals(1, flatPreferenceList.size());
+               assertEquals(FlatPreferences.SOURCE_VIEW, flatPreferenceList.get(0));
+               assertEquals(-1, flatPreferenceList.get(0).getValue());
+
+               flatPreferenceList = Whitebox.getInternalState(setting, "initOptionsSelectedPreferenceList");
+               assertEquals(1, flatPreferenceList.size());
+               assertEquals(FlatPreferences.SOURCE_VIEW, flatPreferenceList.get(0));
        }
 
        @Test
        public void testWriteTargetData() {
                try {
                        String result = Whitebox.invokeMethod(setting, "writeTargetData");
-                       assertEquals("Available Target List|mobile", result);
+                       assertEquals("Available Target List|mobile|wearable", result);
                } catch (Exception e) {
                        Logger.exception(e);
                }
@@ -191,19 +211,16 @@ public class SettingDataManagerTest {
        public void testWriteChartList() {
                try {
                        // check Selected Chart List
-                       String result = Whitebox
-                                       .invokeMethod(layout, "writeCollection", (Object) layout.getSelectedChartSet(),
+                       String result = Whitebox.invokeMethod(layout, "writeCollection", (Object) layout.getSelectedChartSet(),
                                                        SettingConstants.KEY_SELECTED_CHART_LIST);
-                       assertTrue(result.length() == 46);
-                       assertTrue(result.startsWith("Selected Chart List|CPU"));
-                       assertTrue(result.matches(".*CPU.*CPU.*CPU.*"));
+                       assertTrue(result.length() == 40);
+                       assertTrue(result.equals("Selected Chart List|CPU Usage|Core Usage"));
 
                        // check Default Chart List
                        result = Whitebox.invokeMethod(layout, "writeCollection",
                                        (Object) layout.getDefaultChartSet(), SettingConstants.KEY_DEFAULT_CHART_LIST);
-                       assertTrue(result.length() == 45);
-                       assertTrue(result.startsWith("Default Chart List|CPU"));
-                       assertTrue(result.matches(".*CPU.*CPU.*CPU.*"));
+                       assertTrue(result.length() == 29);
+                       assertTrue(result.equals("Default Chart List|Core Usage"));
                } catch (Exception e) {
                        Logger.exception(e);
                }
@@ -233,16 +250,6 @@ public class SettingDataManagerTest {
        }
 
        @Test
-       public void testWriteOptionsSelectedFeatureListData() {
-               try {
-                       String result = Whitebox.invokeMethod(setting, "writeOptionsSelectedFeatureListData");
-                       assertEquals("5002:0", result);
-               } catch (Exception e) {
-                       Logger.exception(e);
-               }
-       }
-
-       @Test
        public void testFeatureOperation() {
                try {
                        String featureName = Feature.SYSTEM_ENERGY.getName();
@@ -317,7 +324,7 @@ public class SettingDataManagerTest {
 
        @Test
        public void testSettingOperation() {
-               TargetData target = setting.getTarget("wearable");
+               TargetData target = setting.getTarget("not-wearable");
                assertNull(target);
                target = setting.getTarget("mobile");
                assertNotNull(target);
@@ -327,17 +334,17 @@ public class SettingDataManagerTest {
 
                list = setting.getSelectedPageList("mobile");
                assertFalse(list.isEmpty());
-               assertEquals(2, list.size());
+               assertEquals(1, list.size());
                assertTrue(list.contains("Timeline"));
-               assertTrue(list.contains("Summary"));
 
                list = setting.getSelectedChartSet("test-target");
                assertNull(list);
 
                list = setting.getSelectedChartSet("mobile");
                assertNotNull(list);
-               assertEquals(1, list.size());
-               assertTrue(list.contains("CPU"));
+               assertEquals(2, list.size());
+               assertTrue(list.contains("CPU Usage"));
+               assertTrue(list.contains("Core Usage"));
 
                // options tab feature
                assertTrue(setting.isOptionsSelectedFeature(Feature.RECORDING));
@@ -386,27 +393,24 @@ public class SettingDataManagerTest {
        }
 
        @Test
-       public void testChangedFeatures() {
+       public void testChangedFlatFeatures() {
                // change target
                setting.setSelectedTarget("wearable");
                assertTrue(setting.changedFeatures());
                setting.setSelectedTarget("mobile");
 
                // change options feature
-               setting.addOptionsSelectedFeature(Feature.SCREENSHOT_PERIODICALLY, 50);
+               setting.addOptionsSelectedPreference(FlatPreferences.SCREENSHOT_PERIODICALLY, 50);
                assertTrue(setting.changedFeatures());
 
                // same size
-               setting.deleteOptionsSelectedFeature(Feature.RECORDING);
+               setting.deleteOptionsSelectedPreference(FlatPreferences.RECORDING);
                assertTrue(setting.changedFeatures());
 
                // different input value
-               setting.deleteOptionsSelectedFeature(Feature.SCREENSHOT_PERIODICALLY);
-               setting.addOptionsSelectedFeature(Feature.RECORDING, 50);
+               setting.deleteOptionsSelectedPreference(FlatPreferences.SCREENSHOT_PERIODICALLY);
+               setting.addOptionsSelectedPreference(FlatPreferences.RECORDING, 50);
                assertTrue(setting.changedFeatures());
-
-               setting.revertSettingData();
-               assertFalse(setting.changedFeatures());
        }
 
        @Test
@@ -423,10 +427,10 @@ public class SettingDataManagerTest {
                assertEquals("mobile", setting.getSelectedTarget());
 
                // check selected options feature
-               List<FeatureValueData> featureList = setting.getOptionsSelectedFeatureList();
-               assertEquals(1, featureList.size());
-               assertEquals(5002, featureList.get(0).getKey().getIndex());
-               assertEquals(0, featureList.get(0).getValue());
+               List<FlatPreferences> flatPreferencesList = setting.getOptionsSelectedPreferencesList();
+               assertEquals(1, flatPreferencesList.size());
+               assertEquals(2001, flatPreferencesList.get(0).getIndex());
+               assertEquals(-1, flatPreferencesList.get(0).getValue());
 
                assertFalse(setting.changedFeatures());
        }
index 62858ca..6aaffc6 100644 (file)
  */
 package org.tizen.dynamicanalyzer.ui.toolbar.setting.data;
 
-import static java.lang.System.currentTimeMillis;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Random;
+import java.util.Set;
 
 import org.junit.AfterClass;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.powermock.reflect.Whitebox;
+import org.tizen.dynamicanalyzer.common.Global;
+import org.tizen.dynamicanalyzer.common.UIMode;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.setting.Feature;
-import org.tizen.dynamicanalyzer.setting.FeatureValueData;
+import org.tizen.dynamicanalyzer.setting.FlatFeature;
 import org.tizen.dynamicanalyzer.setting.SettingConstants;
 import org.tizen.dynamicanalyzer.setting.TargetData;
-import org.tizen.dynamicanalyzer.setting.Template;
-import org.tizen.dynamicanalyzer.setting.TemplateData;
 import org.tizen.dynamicanalyzer.unittest.UnitTestConstants;
-import org.tizen.dynamicanalyzer.unittest.UnitTestUtil;
 import org.tizen.dynamicanalyzer.util.InternalLogger;
 import org.tizen.dynamicanalyzer.util.Logger;
 
 public class TargetDataTest {
 
        static TargetData targetData = null;
+       static String flatFeatureCodes = "301|502|801|302|401|103|601|101|602|201|802|203|701|202|603|102|501";
 
        @BeforeClass
        public static void initTargetData() {
                Logger.init(InternalLogger.DEBUG);
                targetData = new TargetData("mobile-2.3.0");
-
+               Global.setCurrentUIMode(UIMode.CLI);
                try {
-                       // add available template list
-                       String availableTemplateListData = "mobile-2.3.0|Available Template List|1|2|3|4|5|6|7|8|9|10";
-                       String list[] = availableTemplateListData
-                                       .split(SettingConstants.READ_CSV_SEPARATOR, -1);
-                       Whitebox.invokeMethod(targetData, "makeAvailableTemplateList", (Object) list);
-
-                       // add selected template
-                       targetData.setSelectedTemplate(Template.getTemplate(1));
+                       // add available FlatFeatures
+                       String availableFlatFeatureListData = "mobile|Available FlatFeature List|"+flatFeatureCodes;
+                       String list[] = availableFlatFeatureListData.split(SettingConstants.READ_CSV_SEPARATOR, -1);
+                       Whitebox.invokeMethod(targetData, "makeAvailableFlatFeatureList", (Object) list);
 
-                       // add available feature list
-                       String availableFeatureListData = "mobile-2.3.0|Available Feature List|1|1000|3|4|5|6|7|8|100|101|1001|102|200|201|202|203|204";
-                       list = availableFeatureListData.split(SettingConstants.READ_CSV_SEPARATOR, -1);
-                       Whitebox.invokeMethod(targetData, "makeAvailableFeatureList", (Object) list);
-
-                       // add selected feature list
-                       String selectedFeatureListData = "mobile-2.3.0|Selected Feature List|1|5|1000:1000|100|101|1001:10";
-                       list = selectedFeatureListData.split(SettingConstants.READ_CSV_SEPARATOR, -1);
-                       Whitebox.invokeMethod(targetData, "makeSelectedFeatureList", (Object) list);
+                       // add selected FlatFeatures
+                       String selectedFlatFeatureListData = "mobile|Selected FlatFeature List|201";
+                       list = selectedFlatFeatureListData.split(SettingConstants.READ_CSV_SEPARATOR, -1);
+                       Whitebox.invokeMethod(targetData, "makeSelectedFlatFeatureList", (Object) list);
 
                        // add available chart list
-                       String availableChartListData = "mobile-2.3.0|Available Chart List|CPU|CPU core|CPU frequency|Heap allocation|"
-                                       + "Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy";
+                       String availableChartListData = "mobile|Available Chart List|CPU Usage|Core Usage|Core Frequency|System Memory|Process Memory|Heap Allocation|Screenshot|UI Event|Disk IO|Network IO|Peripheral Status|Power Estimation";
                        list = availableChartListData.split(SettingConstants.READ_CSV_SEPARATOR, -1);
                        Whitebox.invokeMethod(targetData, "makeAvailableChartList", (Object) list);
 
@@ -91,105 +83,76 @@ public class TargetDataTest {
                }
        }
 
+       @Before
+       public void set_up() {
+               Set<FlatFeature> set = new HashSet<FlatFeature>();
+               set.add(FlatFeature.SYSTEM_MEMORY);
+               targetData.setSelectedFlatFeatures(set);
+               targetData.applySettingData();
+       }
+
        @AfterClass
        public static void tesApplySettingData() {
-               // change selected template, feature
-               changeSelectedData();
-               assertTrue(targetData.changedFeatures());
+               // check initial FlatFeature set
+               Set<FlatFeature> initFlatFeatureSet = Whitebox.getInternalState(targetData, "initFlatFeatureSet");
 
-               // apply selected template, feature
-               targetData.applySettingData();
+               targetData.addSelectedFlatFeature(FlatFeature.CPU_USAGE.getName());
 
-               // check init template
-               Template initTemplate = Whitebox.getInternalState(targetData, "initTemplate");
-               assertEquals(9, initTemplate.getIndex());
+               // apply selected FlatFeature
+               targetData.applySettingData();
 
-               // check initFeatureList
-               List<FeatureValueData> initFeatureList = Whitebox.getInternalState(targetData,
-                               "initFeatureList");
-               assertEquals(7, initFeatureList.size());
-               assertEquals(204, initFeatureList.get(6).getKey().getIndex());
-               assertEquals(0, initFeatureList.get(6).getValue());
+               //check that settings applied
+               Set<FlatFeature> newInitFlatFeatureSet = Whitebox.getInternalState(targetData, "initFlatFeatureSet");
+               assertEquals(targetData.getSelectedFlatFeatures().size(), initFlatFeatureSet.size());
+               assertTrue(newInitFlatFeatureSet.containsAll(targetData.getSelectedFlatFeatures()));
        }
 
        @Test
-       public void testMakeAvailableTemplateList() {
-               List<Template> availableTemplateList = targetData.getAvailableTemplateList();
-               assertEquals(10, availableTemplateList.size());
-               assertEquals(1, availableTemplateList.get(0).getIndex());
-               assertEquals(6, availableTemplateList.get(5).getIndex());
-               assertEquals(10, availableTemplateList.get(9).getIndex());
-
-               // test random value
-               try {
-                       TargetData testTargetData = new TargetData("test-target");
-                       String availableTemplateListData = "test-target|Available Template List|"
-                                       + makeRandomInteger(CommonConstants.CMD_SPLIT);
-                       String list[] = availableTemplateListData
-                                       .split(SettingConstants.READ_CSV_SEPARATOR, -1);
-                       Whitebox.invokeMethod(testTargetData, "makeAvailableTemplateList", (Object) list);
-
-                       assertEquals(UnitTestConstants.RANDOM_TEST_COUNT, testTargetData
-                                       .getAvailableTemplateList().size());
-               } catch (Exception e) {
-                       Logger.exception(e);
+       public void testMakeAvailableFlatFeatureList() {
+               Set<FlatFeature> availableFlatFeatureSet = targetData.getAvailableFlatFeatures();
+               assertEquals(FlatFeature.values().length,
+                               availableFlatFeatureSet.size());
+               for (FlatFeature feature : FlatFeature.values()) {
+                       assertTrue(availableFlatFeatureSet.contains(feature));
                }
-       }
-
-       @Test
-       public void testMakeAvailableFeatureList() {
-               List<Feature> availableFeatureList = targetData.getAvailableFeatureList();
-               assertEquals(17, availableFeatureList.size());
-               assertEquals(1, availableFeatureList.get(0).getIndex());
-               assertEquals(102, availableFeatureList.get(11).getIndex());
-               assertEquals(204, availableFeatureList.get(16).getIndex());
 
                // test random value
                try {
                        TargetData testTargetData = new TargetData("test-target");
                        String availableFeatureListData = "test-target|Available Feature List|"
-                                       + makeRandomInteger(CommonConstants.CMD_SPLIT);
-                       String list[] = availableFeatureListData.split(SettingConstants.READ_CSV_SEPARATOR, -1);
-                       Whitebox.invokeMethod(testTargetData, "makeAvailableFeatureList", (Object) list);
+                                       + makeIndexesString(FlatFeature.values().length);
+                       String list[] = availableFeatureListData.split(
+                                       SettingConstants.READ_CSV_SEPARATOR, -1);
+                       Whitebox.invokeMethod(testTargetData, "makeAvailableFlatFeatureList", (Object) list);
 
-                       assertEquals(UnitTestConstants.RANDOM_TEST_COUNT, testTargetData
-                                       .getAvailableFeatureList().size());
+                       assertEquals(FlatFeature.values().length, testTargetData.getAvailableFlatFeatures().size());
                } catch (Exception e) {
                        Logger.exception(e);
                }
        }
 
        @Test
-       public void testMakeSelectedFeatureList() {
+       public void testMakeSelectedFlatFeatureList() {
                // check selectedFeatureList
-               List<FeatureValueData> selectedFeatureList = targetData.getSelectedFeatureList();
-               assertEquals(6, selectedFeatureList.size());
-               assertEquals(1, selectedFeatureList.get(0).getKey().getIndex());
-               assertEquals(1000, selectedFeatureList.get(2).getKey().getIndex());
-               assertEquals(1000, selectedFeatureList.get(2).getValue());
-               assertEquals(1001, selectedFeatureList.get(5).getKey().getIndex());
-               assertEquals(10, selectedFeatureList.get(5).getValue());
+               Set<FlatFeature> selectedFlatFeatures = targetData.getSelectedFlatFeatures();
+               assertEquals(1, selectedFlatFeatures.size());
+               assertTrue(selectedFlatFeatures.contains(FlatFeature.SYSTEM_MEMORY));
 
                // check initFeatureList
-               List<FeatureValueData> initFeatureList = Whitebox.getInternalState(targetData,
-                               "initFeatureList");
-               assertEquals(6, initFeatureList.size());
-               assertEquals(1, initFeatureList.get(0).getKey().getIndex());
-               assertEquals(1000, initFeatureList.get(2).getKey().getIndex());
-               assertEquals(1000, initFeatureList.get(2).getValue());
-               assertEquals(1001, initFeatureList.get(5).getKey().getIndex());
-               assertEquals(10, initFeatureList.get(5).getValue());
+               Set<FlatFeature> initFlatFeatureSet = Whitebox.getInternalState(targetData, "initFlatFeatureSet");
+               assertEquals(1, initFlatFeatureSet.size());
+               assertTrue(initFlatFeatureSet.contains(FlatFeature.SYSTEM_MEMORY));
 
                // test random value
                try {
                        TargetData testTargetData = new TargetData("test-target");
                        String selectedFeatureListData = "test-target|Selected Feature List|"
-                                       + makeRandomSelectedFeatureList();
+                                       + makeIndexesString(UnitTestConstants.FLAT_FEATURE_SET_SIZE);
                        String list[] = selectedFeatureListData.split(SettingConstants.READ_CSV_SEPARATOR, -1);
-                       Whitebox.invokeMethod(testTargetData, "makeSelectedFeatureList", (Object) list);
+                       Whitebox.invokeMethod(testTargetData, "makeSelectedFlatFeatureList", (Object) list);
 
-                       assertEquals(UnitTestConstants.RANDOM_TEST_COUNT, testTargetData
-                                       .getSelectedFeatureList().size());
+                       assertEquals(UnitTestConstants.FLAT_FEATURE_SET_SIZE,
+                                       testTargetData.getSelectedFlatFeatures().size());
                } catch (Exception e) {
                        Logger.exception(e);
                }
@@ -197,21 +160,25 @@ public class TargetDataTest {
 
        @Test
        public void testMakeAvailableChartList() {
-               List<String> availableChartList = targetData.getAvailableChartList();
+               List<String> availableChartList=new ArrayList<String>(targetData.getAvailableChartList());
                assertEquals(12, availableChartList.size());
-               assertEquals("CPU", availableChartList.get(0));
-               assertEquals("Memory", availableChartList.get(5));
-               assertEquals("Energy", availableChartList.get(11));
+               assertEquals("CPU Usage", availableChartList.get(0));
+               assertEquals("Heap Allocation", availableChartList.get(5));
+               assertEquals("Power Estimation", availableChartList.get(11));
 
                // test random value
                try {
                        TargetData testTargetData = new TargetData("test-target");
-                       String availableChartListData = "test-target|Available Chart List|"
-                                       + makeRandomString(CommonConstants.CMD_SPLIT);
-                       String list[] = availableChartListData.split(SettingConstants.READ_CSV_SEPARATOR, -1);
+                       StringBuilder availableChartListData = new StringBuilder();
+                       availableChartListData.append("test-target|Available Chart List");
+                       Collections.shuffle(availableChartList);
+                       for (int i = 0; i<availableChartList.size(); i++){
+                               availableChartListData.append("|"+availableChartList.get(i));
+                       }
+                       String list[] = availableChartListData.toString().split(SettingConstants.READ_CSV_SEPARATOR, -1);
                        Whitebox.invokeMethod(testTargetData, "makeAvailableChartList", (Object) list);
 
-                       assertEquals(UnitTestConstants.RANDOM_TEST_COUNT, testTargetData
+                       assertEquals(availableChartList.size(), testTargetData
                                        .getAvailableChartList().size());
                } catch (Exception e) {
                        Logger.exception(e);
@@ -219,204 +186,134 @@ public class TargetDataTest {
        }
 
        @Test
-       public void testWriteSelectedFeatureListData() {
+       public void testWriteAvailableFlatFeaturesData() {
                try {
-                       String result = Whitebox.invokeMethod(targetData, "writeSelectedFeatureListData");
-                       assertEquals("1|5|1000:1000|100|101|1001:10", result);
+                       String result = Whitebox.invokeMethod(targetData,
+                                       "writeAvailableFlatFeaturesData");
+                       String values[] = result.split(SettingConstants.READ_CSV_SEPARATOR, -1);
+                       for (String s:values){
+                               assertTrue(flatFeatureCodes.indexOf(s) >= 0);
+                       }
                } catch (Exception e) {
                        Logger.exception(e);
                }
        }
 
        @Test
-       public void testWriteAvailableChartListData() {
+       public void testWriteSelectedFlatFeaturesData() {
                try {
-                       String result = Whitebox.invokeMethod(targetData, "writeAvailableChartListData");
-                       assertEquals("CPU|CPU core|CPU frequency|Heap allocation|"
-                                       + "Process Size|Memory|Screenshot|UI event|Disk IO|Network IO|Device|Energy",
-                                       result);
+                       String result = Whitebox.invokeMethod(targetData,
+                                       "writeSelectedFlatFeaturesData");
+                       assertEquals("201", result);
                } catch (Exception e) {
                        Logger.exception(e);
                }
        }
 
        @Test
-       public void testWriteListData() {
+       public void testWriteAvailableChartListData() {
                try {
-                       // check available template list
-                       String result = Whitebox.invokeMethod(targetData, "writeAvailableTemplateListData");
-                       assertEquals("1|2|3|4|5|6|7|8|9|10", result);
-
-                       // check available feature list
-                       result = Whitebox.invokeMethod(targetData, "writeAvailableFeatureListData");
-                       assertEquals("1|1000|3|4|5|6|7|8|100|101|1001|102|200|201|202|203|204", result);
+                       String result = Whitebox.invokeMethod(targetData, "writeAvailableChartListData");
+                       assertEquals(
+                                       "CPU Usage|Core Usage|Core Frequency|System Memory|Process Memory|Heap Allocation|Screenshot|UI Event|Disk IO|Network IO|Peripheral Status|Power Estimation",
+                                       result);
                } catch (Exception e) {
                        Logger.exception(e);
                }
        }
 
        @Test
-       public void testFeatureOperation() {
-               assertTrue(targetData.isSelectedFeature(Feature.getFeature(1)));
-               assertFalse(targetData.isSelectedFeature(Feature.getFeature(12)));
-
-               assertEquals(1000, targetData.getSelectedFeatureValue(Feature.getFeature(1000)));
-               assertEquals(-1, targetData.getSelectedFeatureValue(Feature.getFeature(204)));
-
-               try {
-                       FeatureValueData feature = Whitebox.invokeMethod(targetData, "getFeatureValueData",
-                                       (Object) targetData.getSelectedFeatureList(), Feature.getFeature(0));
-                       assertNull(feature);
-
-                       feature = Whitebox.invokeMethod(targetData, "getFeatureValueData",
-                                       (Object) targetData.getSelectedFeatureList(), Feature.getFeature(1001));
-                       assertEquals(1001, feature.getKey().getIndex());
-                       assertEquals(10, feature.getValue());
-
-                       // copyFeatureList()
-                       List<FeatureValueData> source = new ArrayList<FeatureValueData>();
-                       List<FeatureValueData> dest = new ArrayList<FeatureValueData>();
-                       Whitebox.invokeMethod(targetData, "copyFeatureList", (Object) source, (Object) dest);
-                       assertEquals(0, dest.size());
-
-               } catch (Exception e) {
-                       Logger.exception(e);
-               }
+       public void testAddSelectedFlatFeature(){
+               assertEquals(1, targetData.getSelectedFlatFeatures().size());
+               assertTrue(targetData.getSelectedFlatFeatures().contains(FlatFeature.SYSTEM_MEMORY));
+
+               //add FlatFeature
+               targetData.addSelectedFlatFeature(FlatFeature.CPU_USAGE.getName());
+               assertEquals(2, targetData.getSelectedFlatFeatures().size());
+               assertTrue(targetData.getSelectedFlatFeatures().contains(FlatFeature.SYSTEM_MEMORY));
+               assertTrue(targetData.getSelectedFlatFeatures().contains(FlatFeature.CPU_USAGE));;
+
+               //add containing FlatFeature
+               targetData.addSelectedFlatFeature(FlatFeature.SYSTEM_MEMORY.getName());
+               assertEquals(2, targetData.getSelectedFlatFeatures().size());
+               assertTrue(targetData.getSelectedFlatFeatures().contains(FlatFeature.SYSTEM_MEMORY));
+               assertTrue(targetData.getSelectedFlatFeatures().contains(FlatFeature.CPU_USAGE));
+
+               //add unknown FlatFeature
+               targetData.addSelectedFlatFeature("New Feature");
+               assertEquals(2, targetData.getSelectedFlatFeatures().size());
+               assertTrue(targetData.getSelectedFlatFeatures().contains(FlatFeature.SYSTEM_MEMORY));
+               assertTrue(targetData.getSelectedFlatFeatures().contains(FlatFeature.CPU_USAGE));
        }
 
        @Test
-       public void testChangeSelectecFeatureList() {
-               // change "Process Activity" template
-               TemplateData templateData = new TemplateData(Template.TEMPLATE_PROCESS_ACTIVITY);
-
-               // add feature list
-               String featureListData = "1|5|4|1000:1000|100|101|1001:10";
-               String list[] = featureListData.split(SettingConstants.READ_CSV_SEPARATOR, -1);
-               for (int i = 0; i < list.length; i++) {
-                       templateData.makeFeatureList(list[i]);
-               }
-
-               targetData.changeSelectedFeatureList(Template.TEMPLATE_PROCESS_ACTIVITY);
-               assertEquals(1, targetData.getSelectedTemplate().getIndex());
-
-               targetData.setSelectedTemplate(Template.TEMPLATE_PROCESS_ACTIVITY);
-               targetData.changeSelectedFeatureList(Template.TEMPLATE_PROCESS_ACTIVITY);
-               assertEquals(3, targetData.getSelectedTemplate().getIndex());
-
-               targetData.revertSettingData();
+       public void testIsSelectedFlatFeature() {
+               assertTrue(targetData.isSelectedFlatFeature(FlatFeature.SYSTEM_MEMORY.getName()));
+               assertFalse(targetData.isSelectedFlatFeature(FlatFeature.SCREENSHOT.getName()));
+               assertFalse(targetData.isSelectedFlatFeature("New Feature"));
        }
-
+       
        @Test
-       public void testChangedFeatures() {
-               // change selected template
-               targetData.setSelectedTemplate(Template.getTemplate(9));
-               assertTrue(targetData.changedFeatures());
-               targetData.setSelectedTemplate(Template.getTemplate(1));
-
-               // change selected feature
-               List<FeatureValueData> selectedFeatureList = targetData.getSelectedFeatureList();
-               List<FeatureValueData> newFeatureList = new ArrayList<FeatureValueData>();
-               newFeatureList.addAll(selectedFeatureList);
-
-               FeatureValueData feature = new FeatureValueData(Feature.getFeature(204));
-               newFeatureList.add(newFeatureList.size(), feature);
-               targetData.setSelectedFeatureList(newFeatureList);
-               assertTrue(targetData.changedFeatures());
-
-               // same size
-               feature = newFeatureList.get(0);
-               newFeatureList.remove(0);
-               targetData.setSelectedFeatureList(newFeatureList);
-               assertTrue(targetData.changedFeatures());
-
-               // different input value
-               newFeatureList.add(0, feature);
-               newFeatureList.remove(newFeatureList.size() - 1);
-               targetData.setSelectedFeatureList(newFeatureList);
-               assertFalse(targetData.changedFeatures());
-               feature = newFeatureList.get(newFeatureList.size() - 1);
-               feature.setValue(50);
-               targetData.setSelectedFeatureList(newFeatureList);
-               assertTrue(targetData.changedFeatures());
-
-               targetData.revertSettingData();
+       public void testMakeSelectedFlatFeatures(){
+               targetData.addSelectedFeature(FlatFeature.CPU_USAGE.getName());
+               try{
+                       String selectedFlatFeatureListData = "mobile|Selected FlatFeature List|201";
+                       String list[] = selectedFlatFeatureListData.split(SettingConstants.READ_CSV_SEPARATOR, -1);
+                       Whitebox.invokeMethod(targetData, "makeSelectedFlatFeatureList", (Object) list);
+               }catch(Exception e){
+                       Logger.error(e);
+               }
+               // check initial FlatFeature set
+               Set<FlatFeature> initFlatFeatureSet = Whitebox.getInternalState(
+                               targetData, "initFlatFeatureSet");
+               assertEquals(1, initFlatFeatureSet.size());
+               assertTrue(initFlatFeatureSet.contains(FlatFeature.SYSTEM_MEMORY));
        }
 
        @Test
        public void testRevertSettingData() {
-               // change selected template, feature
-               changeSelectedData();
-               assertTrue(targetData.changedFeatures());
-
-               // revert selected template, feature
-               targetData.revertSettingData();
-
-               // check selected template
-               assertEquals(1, targetData.getSelectedTemplate().getIndex());
+               // check initial FlatFeature set
+               Set<FlatFeature> initFlatFeatureSet = Whitebox.getInternalState(
+                               targetData, "initFlatFeatureSet");
+               assertEquals(1, initFlatFeatureSet.size());
 
-               // check selectedFeatureList
-               List<FeatureValueData> selectedFeatureList = targetData.getSelectedFeatureList();
-               assertEquals(6, selectedFeatureList.size());
-               assertEquals(1, selectedFeatureList.get(0).getKey().getIndex());
-               assertEquals(1000, selectedFeatureList.get(2).getKey().getIndex());
-               assertEquals(1000, selectedFeatureList.get(2).getValue());
-               assertEquals(1001, selectedFeatureList.get(5).getKey().getIndex());
-               assertEquals(10, selectedFeatureList.get(5).getValue());
-
-               assertFalse(targetData.changedFeatures());
-       }
+               // change selected FlatFeatures
+               Set<FlatFeature> buf = new HashSet<FlatFeature>();
+               buf.add(FlatFeature.CPU_USAGE);
+               buf.add(FlatFeature.SCREENSHOT);
+               targetData.setSelectedFlatFeatures(buf);
 
-       private static void changeSelectedData() {
-               // change selected template
-               targetData.setSelectedTemplate(Template.getTemplate(9));
-
-               // change selected feature
-               List<FeatureValueData> selectedFeatureList = targetData.getSelectedFeatureList();
-               List<FeatureValueData> newFeatureList = new ArrayList<FeatureValueData>();
-               newFeatureList.addAll(selectedFeatureList);
-               FeatureValueData feature = new FeatureValueData(Feature.getFeature(204));
-               newFeatureList.add(feature);
-               targetData.setSelectedFeatureList(newFeatureList);
-       }
+               // check changes
+               assertEquals(2, targetData.getSelectedFlatFeatures().size());
 
-       private String makeRandomInteger(String split) {
-               StringBuffer buffer = new StringBuffer();
-               Random r = new Random(currentTimeMillis());
-               for (int i = 0; i < UnitTestConstants.RANDOM_TEST_COUNT; i++) {
-                       buffer.append(r.nextInt(1000));
-                       if (i != UnitTestConstants.RANDOM_TEST_COUNT - 1) {
-                               buffer.append(split);
-                       }
-               }
-               return buffer.toString();
-       }
+               // revert selected FlatFeatures
+               targetData.revertSettingData();
 
-       private String makeRandomString(String split) {
-               StringBuffer buffer = new StringBuffer();
-               for (int i = 0; i < UnitTestConstants.RANDOM_TEST_COUNT; i++) {
-                       buffer.append(UnitTestUtil.makeRandomString(10, true));
-                       if (i != UnitTestConstants.RANDOM_TEST_COUNT - 1) {
-                               buffer.append(split);
-                       }
-               }
-               return buffer.toString();
+               // check selected FlatFeatures
+               assertEquals(initFlatFeatureSet.size(), targetData.getSelectedFlatFeatures().size());
+               assertTrue(targetData.getSelectedFlatFeatures().containsAll(initFlatFeatureSet));
        }
 
-       private String makeRandomSelectedFeatureList() {
-               StringBuffer buffer = new StringBuffer();
-               Random r = new Random(currentTimeMillis());
-               for (int i = 0; i < UnitTestConstants.RANDOM_TEST_COUNT; i++) {
-                       buffer.append(r.nextInt(1000));
-
-                       if (i % 100 == 0) {
-                               buffer.append(CommonConstants.COLON);
-                               buffer.append(r.nextInt(1000));
-                       }
-
-                       if (i != UnitTestConstants.RANDOM_TEST_COUNT - 1) {
-                               buffer.append(CommonConstants.CMD_SPLIT);
-                       }
+       /**
+        * Method to generate random string of FlatFeature's indexes, separated with
+        * CommonConstants.CMD_SPLIT.
+        *
+        * @param countOfArguments count of indexes to be put into string
+        * @return string of separated FlatFeature's indexes
+        */
+       private String makeIndexesString(int countOfArguments) {
+               StringBuilder result = new StringBuilder();
+               List<FlatFeature> notSelected = new ArrayList<FlatFeature>(
+                               Arrays.asList(FlatFeature.values()));
+
+               Random r = new Random(System.currentTimeMillis());
+               for (int i = 0; i < countOfArguments; i++) {
+                       int index = r.nextInt(notSelected.size());
+                       result.append(Integer.toString(notSelected.get(index).getIndex()));
+                       if (i < countOfArguments - 1)
+                               result.append(CommonConstants.CMD_SPLIT);
+                       notSelected.remove(index);
                }
-               return buffer.toString();
+               return result.toString();
        }
 }
index 1da5959..1004775 100644 (file)
Binary files a/org.tizen.dynamicanalyzer.widgets/Images/marker.png and b/org.tizen.dynamicanalyzer.widgets/Images/marker.png differ
index 8b3eb94..1138251 100644 (file)
Binary files a/org.tizen.dynamicanalyzer.widgets/Images/marker_nor.png and b/org.tizen.dynamicanalyzer.widgets/Images/marker_nor.png differ
index ef2cee8..2951628 100644 (file)
@@ -28,5 +28,6 @@ Export-Package: org.tizen.dynamicanalyzer.widgets,
  org.tizen.dynamicanalyzer.widgets.progress,
  org.tizen.dynamicanalyzer.widgets.scale,
  org.tizen.dynamicanalyzer.widgets.timeline,
+ org.tizen.dynamicanalyzer.widgets.timeline.markers,
  org.tizen.dynamicanalyzer.widgets.timer,
  org.tizen.dynamicanalyzer.widgets.tooltip
index 525f0ae..d6f99f8 100644 (file)
@@ -763,14 +763,12 @@ public class DACustomDropdown extends Canvas {
                                        return;\r
                                }\r
 \r
-                               if (null != upArrowButton) {\r
-                                       Rectangle rectangle = upArrowButton.getBounds();\r
-                                       int x = event.x;\r
-                                       int y = event.y;\r
+                               Rectangle rectangle = upArrowButton.getBounds();\r
+                               int x = event.x;\r
+                               int y = event.y;\r
 \r
-                                       if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {\r
-                                               return;\r
-                                       }\r
+                               if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {\r
+                                       return;\r
                                }\r
 \r
                                int size = getItems().size();\r
@@ -821,14 +819,12 @@ public class DACustomDropdown extends Canvas {
                                        return;\r
                                }\r
 \r
-                               if (null != downArrowButton) {\r
-                                       Rectangle rectangle = downArrowButton.getBounds();\r
-                                       int x = event.x;\r
-                                       int y = event.y;\r
+                               Rectangle rectangle = downArrowButton.getBounds();\r
+                               int x = event.x;\r
+                               int y = event.y;\r
 \r
-                                       if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {\r
-                                               return;\r
-                                       }\r
+                               if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {\r
+                                       return;\r
                                }\r
 \r
                                int size = getItems().size();\r
diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomFeatureToggleErrorMessage.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/toggle/DACustomFeatureToggleErrorMessage.java
new file mode 100644 (file)
index 0000000..9ba58bd
--- /dev/null
@@ -0,0 +1,37 @@
+package org.tizen.dynamicanalyzer.widgets.button.toggle;
+
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonAttribute;
+
+/**
+ * Extension of {@link DACustomFeatureToggleButton} that redefined renderer's
+ * method draw(..) Designed to provide ability to post error or info messages on
+ * {@link FlatFeatureDialogFeatureListPage} without redesigning of
+ * {@link FlatFeatureDialog} and drawing mechanism.
+ */
+public class DACustomFeatureToggleErrorMessage extends
+               DACustomFeatureToggleButton {
+
+       /**
+        * Public constructor.
+        *
+        * @param parent defines parent composite
+        * @param style SWT style
+        */
+       public DACustomFeatureToggleErrorMessage(Composite parent, int style) {
+               super(parent, style);
+               setRenderer(new DACustomFeatureToggleButtonRenderer() {
+                       @Override
+                       public void draw(GC gc, Canvas canvas, int state,
+                                       DACustomButtonAttribute attr) {
+                               Rectangle rect = canvas.getClientArea();
+                               drawButton(gc, rect, state, attr);
+                               drawButtonText(gc, rect, attr, state);
+                       }
+               });
+       }
+
+}
index 6cbf54d..d0a46a9 100644 (file)
@@ -65,23 +65,7 @@ public class DAChartPlot {
        private String axisUnit;
        private String secondAxisUnit;
        private UnitType axisUnitType = UnitType.DECIMAL;
-       
-       private List<Double> markerTimeList = new ArrayList<Double>();
-       
-       public void clearMarkerTime() {
-               markerTimeList.clear();
-       }
-       
-       public void addMarkerTime(double time) {
-               if(markerTimeList != null && !markerTimeList.contains(time)) {
-                       markerTimeList.add(time);
-               }
-       }
-       
-       public List<Double> getMarkerTimeList() {
-               return markerTimeList;
-       }
-       
+
        private double boundValue = -1;
        public void setBoundValue(double value) {
                boundValue = value;
index ac410fd..237281c 100644 (file)
@@ -45,6 +45,7 @@ import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
 import org.tizen.dynamicanalyzer.widgets.helper.FontResources;
 import org.tizen.dynamicanalyzer.widgets.helper.Formatter;
 import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
 
 public class DAChartRenderer {
        private static final int MARGIN = 3;
@@ -113,7 +114,7 @@ public class DAChartRenderer {
                gc.setBackground(ColorResources.POINT);
                gc.setLineWidth(2);
                gc.setLineStyle(SWT.LINE_DOT);
-               for(double time : plot.getMarkerTimeList()) {
+               for (double time : MarkerManager.INSTANCE.getMarkerTimeList()) {
                        gc.drawLine(plot.getXPixelFromX(time), r.y, plot.getXPixelFromX(time), r.height);
                }
                
@@ -564,138 +565,130 @@ public class DAChartRenderer {
                List<String> tooltipTexts = new ArrayList<String>();
                List<String> tooltipTimes = new ArrayList<String>();
                List<Color> tooltipColor = new ArrayList<Color>();
+               List<Integer> tooltipAlpha = new ArrayList<Integer>();
 
-               boolean isMultiColumn = false;
-               int seriesCountPerColumn = findColumnSeriesCount(seriesList.size(), r.height);
-               if (seriesCountPerColumn < seriesList.size()) {
-                       isMultiColumn = true;
-               }
                // make text,time & draw auxiliary line
                int textWidthMax = 0;
                double realXVal = tooltip.getStartVal();
                int tooltipSize = 0;
+
                for (int i = 0; i < seriesList.size(); i++) {
                        DAChartSeries series = seriesList.get(i);
+                       String text = "";
+                       String time = "";
+                       Color color;
+
+                       int index = series.getPrevIndexByXvalue(realXVal);
+                       if (index < 0)
+                               continue;
+
+                       double yVal = series.getSeriesItemList().get(index).getY();
+                       double xVal = series.getSeriesItemList().get(index).getX();
+
                        if (plot instanceof DAUIEventChartPlot) {
                                i = (int) (seriesList.size() * tooltip.getYPosRatio());
                                series = seriesList.get(i);
+                               tooltipSize = seriesList.size();
                        } else {
-                               if (series.isDisableTooltip()) {
-                                       tooltipTexts.add(null);
-                                       tooltipTimes.add(null);
-                                       tooltipColor.add(null);
+                               if (series.isDisableTooltip())
                                        continue;
-                               } else {
-                                       tooltipSize++;
-                               }
+
+                               text = series.getName() + ": ";
+                               time = toTimeFormat(xVal);
+
+                               tooltipSize++;
                        }
 
-                       int index = series.getPrevIndexByXvalue(realXVal);
-                       String text = "";
-                       String time = "";
-                       Color color;
-                       if (index >= 0) {
-                               double yVal = series.getSeriesItemList().get(index).getY();
-                               double xVal = series.getSeriesItemList().get(index).getX();
+                       if (true == series.isSummarizeTooltip()
+                                       && true == checkOverlapFromPrevItem(series, index))
+                               text += series.getSummarizeString();
+                       else
+                               text += series.getSeriesItemList().get(index).getTooltipText();
 
-                               if (!(plot instanceof DAUIEventChartPlot)) {
-                                       text += series.getName() + ": ";
-                                       time += toTimeFormat(xVal);
-                               }
+                       if (series.getStyle() == DAChartSeries.SERIES_STYLE_BAR
+                                       || series.getStyle() == DAChartSeries.SERIES_STYLE_LINE
+                                       || series.getStyle() == DAChartSeries.SERIES_STYLE_AREA) {
 
-                               if (true == series.isSummarizeTooltip()
-                                               && true == checkOverlapFromPrevItem(series, index)) {
-                                       text += series.getSummarizeString();
-                               } else {
-                                       text += series.getSeriesItemList().get(index).getTooltipText();
-                               }
+                               int startIndex = series.getPrevIndexByXvalue(plot.getVisibleStartX());
+                               if (startIndex < 0)
+                                       startIndex = 0;
+                               double maxY = getMaxYToDraw(series, startIndex);
 
                                gc.setForeground(tooltip.getLineColor());
                                gc.setLineStyle(SWT.LINE_DOT);
                                gc.setLineWidth(1);
+                               gc.drawLine(0, plot.getYPixelFromY(maxY, yVal, r), r.width,
+                                               plot.getYPixelFromY(maxY, yVal, r));
+                       }
 
-                               if (series.getStyle() == DAChartSeries.SERIES_STYLE_BAR
-                                               || series.getStyle() == DAChartSeries.SERIES_STYLE_LINE
-                                               || series.getStyle() == DAChartSeries.SERIES_STYLE_AREA) {
-                                       int startIndex = series.getPrevIndexByXvalue(plot.getVisibleStartX());
-                                       if (startIndex < 0) {
-                                               startIndex = 0;
-                                       }
-                                       double maxY = getMaxYToDraw(series, startIndex);
-
-                                       gc.drawLine(0, plot.getYPixelFromY(maxY, yVal, r), r.width,
-                                                       plot.getYPixelFromY(maxY, yVal, r));
-                               }
+                       gc.setForeground(ColorResources.CHART_TOOLTIP_TIME_NOW);
+                       gc.setLineWidth(2);
+                       gc.drawLine(plot.getXPixelFromX(xVal), 0, plot.getXPixelFromX(xVal), r.height);
+                       gc.setLineStyle(SWT.LINE_CUSTOM);
 
-                               gc.setForeground(ColorResources.CHART_TOOLTIP_TIME_NOW);
-                               gc.setLineWidth(2);
-                               gc.drawLine(plot.getXPixelFromX(xVal), 0, plot.getXPixelFromX(xVal), r.height);
-                               gc.setLineStyle(SWT.LINE_CUSTOM);
+                       // event color
+                       color = series.getSeriesItemList().get(index).getColor();
+                       if (color == null)
+                               color = series.getColor();
 
-                               // event color
-                               color = series.getSeriesItemList().get(index).getColor();
-                       } else {
-                               text = series.getName();
-                               color = null;
-                       }
+                       double alpha = series.getAlpha() + 0.3;
+                       if (alpha > 1)
+                               alpha = 1;
 
                        tooltipTexts.add(text);
                        tooltipTimes.add(time);
                        tooltipColor.add(color);
+                       tooltipAlpha.add((int) (255 * alpha));
 
-                       int timeMargin = DAChartPlotTooltip.TOOLTIP_TIME_MARGIN;
-                       if (isMultiColumn) {
-                               timeMargin = 10;
-                       }
-                       int textWidth = gc.textExtent(text).x + timeMargin + gc.textExtent(time).x;
-                       if (textWidthMax < textWidth) {
+                       int textWidth = gc.textExtent(text).x + gc.textExtent(time).x;
+                       if (textWidthMax < textWidth)
                                textWidthMax = textWidth;
-                       }
 
-                       if (plot instanceof DAUIEventChartPlot) {
+                       if (plot instanceof DAUIEventChartPlot)
                                break;
-                       }
                }
 
+               if (tooltipTexts.isEmpty())
+                       return;
+
                /*
                 * Drawing Tooltip Box
                 */
+               int seriesCountPerColumn = findColumnSeriesCount(tooltipSize, r.height);
+               int timeMargin = DAChartPlotTooltip.TOOLTIP_TIME_MARGIN;
+               if (seriesCountPerColumn < tooltipSize)
+                       timeMargin = 10;
+               textWidthMax += timeMargin;
+
                int preTextWidthMargin = DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH
                                + (DAChartPlotTooltip.TOOLTIP_MARGIN * 2);
                int totalHeight;
-               if (plot instanceof DAUIEventChartPlot) {
-                       if (!tooltipTexts.isEmpty()) {
-                               totalHeight = gc.textExtent(tooltipTexts.get(0)).y
-                                               + DAChartPlotTooltip.TOOLTIP_MARGIN + DAChartPlotTooltip.TOOLTIP_MARGIN;
-                       } else {
-                               totalHeight = DAChartPlotTooltip.TOOLTIP_TEXT_HEIGHT
-                                       + DAChartPlotTooltip.TOOLTIP_MARGIN + DAChartPlotTooltip.TOOLTIP_MARGIN;
-                       }
-               } else {
-                       totalHeight = seriesCountPerColumn * DAChartPlotTooltip.TOOLTIP_TEXT_HEIGHT
-                                       + DAChartPlotTooltip.TOOLTIP_MARGIN + DAChartPlotTooltip.TOOLTIP_BOTTOM_MARGIN
-                                       + (seriesCountPerColumn - 1) * DAChartPlotTooltip.TOOLTIP_TEXT_MARGIN;
-               }
                int startY;
+
                if (plot instanceof DAUIEventChartPlot) {
-                       tooltipSize = seriesList.size();
+                       totalHeight = gc.textExtent(tooltipTexts.get(0)).y + DAChartPlotTooltip.TOOLTIP_MARGIN
+                                       + DAChartPlotTooltip.TOOLTIP_MARGIN;
+
                        startY = (int) (r.height * (int) (tooltip.getYPosRatio() * tooltipSize) / tooltipSize);
                        if (r.height - startY - totalHeight < 0) {
                                startY = r.height - totalHeight - 1;
-                               if (startY < 0) {
+                               if (startY < 0)
                                        startY = DAChartPlotTooltip.TOOLTIP_MARGIN;
-                               }
                        }
                } else {
+                       totalHeight = seriesCountPerColumn * DAChartPlotTooltip.TOOLTIP_TEXT_HEIGHT
+                                       + DAChartPlotTooltip.TOOLTIP_MARGIN + DAChartPlotTooltip.TOOLTIP_BOTTOM_MARGIN
+                                       + (seriesCountPerColumn - 1) * DAChartPlotTooltip.TOOLTIP_TEXT_MARGIN;
+
                        startY = (r.y + r.height / 2) - (totalHeight / 2);
                }
+
                int columnCount = tooltipSize / seriesCountPerColumn;   // column count of tooltip
                if ((tooltipSize % seriesCountPerColumn) != 0) {
                        columnCount++;
                }
                int startX = getTooltipStartX(realXVal, (preTextWidthMargin + textWidthMax)
                                * columnCount, DAChartPlotTooltip.TOOLTIP_MARGIN);
-//             int tooltipBoxWidth = (preTextWidthMargin + textWidthMax) * columnCount + DAChartPlotTooltip.TOOLTIP_MARGIN;
                int tooltipBoxWidth = (preTextWidthMargin + textWidthMax) * columnCount;
                gc.setAlpha(150);
                gc.setBackground(ColorResources.WHITE);
@@ -710,41 +703,17 @@ public class DAChartRenderer {
                /*
                 * Drawing Tooltip contents (color square, text, time) //[UX] 06 chart area - tool tip a, 1, 2
                 */
-               String timeStr;
-               tooltipSize = -1;
-               for (int i = 0; i < seriesList.size(); i++) {
-                       DAChartSeries series;
-                       if (plot instanceof DAUIEventChartPlot) {
-                               series = seriesList.get((int) (seriesList.size() * tooltip.getYPosRatio()));
-                               tooltipSize = 0;
-                       } else {
-                               series = seriesList.get(i);
-                               if (series.isDisableTooltip()) {
-                                       continue;
-                               } else {
-                                       tooltipSize++;
-                               }
-                       }
-
+               for (int i = 0; i < tooltipTexts.size(); i++) {
                        int y = startY
-                                       + (DAChartPlotTooltip.TOOLTIP_TEXT_HEIGHT * (tooltipSize % seriesCountPerColumn))
+                                       + (DAChartPlotTooltip.TOOLTIP_TEXT_HEIGHT * (i % seriesCountPerColumn))
                                        + DAChartPlotTooltip.TOOLTIP_MARGIN + (i % seriesCountPerColumn)
                                        * DAChartPlotTooltip.TOOLTIP_TEXT_MARGIN;
-                       Color col = tooltipColor.get(i);
-                       if (col == null) {
-                               gc.setBackground(series.getColor());
-                       } else {
-                               gc.setBackground(col);
-                       }
-                       
-                       double alpha = series.getAlpha() + 0.3;
-                       if(alpha > 1) {
-                               alpha = 1;
-                       }
-
-                       gc.setAlpha((int) (255 * alpha));
                        int startColumnX = startX + (i / seriesCountPerColumn)
                                        * (preTextWidthMargin + textWidthMax);
+
+                       // Draw tooltip color rectangle
+                       gc.setBackground(tooltipColor.get(i));
+                       gc.setAlpha(tooltipAlpha.get(i));
                        gc.fillRoundRectangle(startColumnX + DAChartPlotTooltip.TOOLTIP_MARGIN, y
                                        + DAChartPlotTooltip.TOOLTIP_TEXT_HEIGHT / 2
                                        - DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH / 2,
@@ -752,8 +721,9 @@ public class DAChartRenderer {
                                        DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH,
                                        DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH,
                                        DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH);
-                       gc.setBackground(tooltip.getBackgroundColor());
 
+                       // Draw tooltip text
+                       gc.setBackground(tooltip.getBackgroundColor());
                        gc.setAlpha(255);
                        gc.setForeground(tooltip.getTextColor());
                        gc.drawText(tooltipTexts.get(i), startColumnX + DAChartPlotTooltip.TOOLTIP_MARGIN
@@ -761,17 +731,17 @@ public class DAChartRenderer {
                                        + DAChartPlotTooltip.TOOLTIP_MARGIN, y, SWT.DRAW_DELIMITER
                                        | SWT.DRAW_TRANSPARENT);
 
+                       // Draw tooltip time
                        gc.setForeground(tooltip.getTimeColor());
-                       timeStr = tooltipTimes.get(i);
                        gc.drawText(tooltipTimes.get(i), startX + DAChartPlotTooltip.TOOLTIP_MARGIN
                                        + DAChartPlotTooltip.TOOLTIP_SERIES_RECT_LENGTH
                                        + textWidthMax
-                                       - gc.textExtent(timeStr).x
+                                       - gc.textExtent(tooltipTimes.get(i)).x
                                        + (i / seriesCountPerColumn) * (preTextWidthMargin + textWidthMax), y,
                                        SWT.DRAW_DELIMITER | SWT.DRAW_TRANSPARENT);
-                       if (plot instanceof DAUIEventChartPlot) {
+
+                       if (plot instanceof DAUIEventChartPlot)
                                break;
-                       }
                }
        }
 
@@ -1652,7 +1622,6 @@ public class DAChartRenderer {
 
                DAChartSeriesItem seriesItem;
                Color color = series.getColor();
-               Color foreColor;
                gc.setBackground(color);
                gc.setAntialias(SWT.ON);
                
@@ -1671,7 +1640,6 @@ public class DAChartRenderer {
                        double currentX = seriesItem.getX();
                        int pixelStartX = plot.getXPixelFromX(seriesItem.getX(), r);
                        color = seriesItem.getColor();
-                       foreColor = seriesItem.getGradationForegroundColor();
                        int state = (int) seriesItem.getY();
 
                        if (null != color) {
index 40e3825..9746241 100644 (file)
@@ -334,6 +334,9 @@ public class DAChartBoardItemCell extends Composite {
        }
        
        private void redrawExpandBackground() {
+               if (expandButton == null)
+                       return;
+
                expandButton.setBackground(nameCellCurrentBGColorStart);
                expandButton.redraw();
        }
index 80f5b17..4f433b7 100644 (file)
@@ -30,7 +30,9 @@ package org.tizen.dynamicanalyzer.widgets.chartBoard;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.FormAttachment;
@@ -71,6 +73,18 @@ public class DAChartBoardItemList extends Composite {
                childItems.add(item);
                this.layout();
        }
+
+       /**
+        * Returns index of given item in list.
+        *
+        * @param item
+        *            item of list
+        * @return non-negative index if item was found and -1 otherwise.
+        */
+       public int indexOf(DAChartBoardItem item) {
+               return childItems.indexOf(item);
+       }
+
        // for sorting of chart items
        public void registerItem(DAChartBoardItem item, Comparator c) {
                int itemHeight = (int) (item.getHeight() * getBoardItemHeightRatio());
@@ -250,38 +264,53 @@ public class DAChartBoardItemList extends Composite {
                boardItemList.hideItem(childIndex);
                childItems.get(parentIndex).callNotifyResizeChild();
        }
-       
+
+       /**
+        * Rearrange child items according to the given order.
+        * Not specified items will be placed at the end.
+        *
+        * @param a new order of items
+        */
        public void reArrangeItem(Integer a[]) {
-               if (null == childItems) {
+               if (null == childItems || a.length == 0) {
                        return;
                }
-               int itemSize = childItems.size();
 
-               if (a.length != itemSize) {
-                       return;
-               }
+               List<DAChartBoardItem> itemsTemp = new ArrayList<>();
+               Set<Integer> usedItems = new HashSet<>();
+               DAChartBoardItem prevItem = null;
 
-               int index;
-               DAChartBoardItem temp;
-               FormData data;
-               List<DAChartBoardItem> itemsTemp = new ArrayList<DAChartBoardItem>();
+               for (Integer index : a) {
+                       if (index >= childItems.size())
+                               continue;
 
-               for (int i = 0; i < itemSize; i++) {
-                       index = a[i];
-                       temp = childItems.get(index);
-                       data = (FormData) temp.getLayoutData();
-                       if (0 == i) {
+                       DAChartBoardItem temp = childItems.get(index);
+                       FormData data = (FormData) temp.getLayoutData();
+                       if (prevItem == null) {
                                data.top = new FormAttachment(0, 0);
                        } else {
-                               data.top = new FormAttachment(itemsTemp.get(i - 1), 0);
+                               data.top = new FormAttachment(prevItem, 0);
                        }
-                       temp.setLayoutData(data);
+                       prevItem = temp;
+                       itemsTemp.add(temp);
+                       usedItems.add(index);
+               }
+
+               // add remained items
+               for (int i = 0; i < childItems.size(); i++) {
+                       if (usedItems.contains(i))
+                               continue;
+
+                       DAChartBoardItem temp = childItems.get(i);
+
+                       FormData data = (FormData) temp.getLayoutData();
+                       data.top = new FormAttachment(prevItem, 0);
+                       prevItem = temp;
                        itemsTemp.add(temp);
                }
+
                childItems.clear();
                childItems.addAll(itemsTemp);
-               itemsTemp.clear();
-               itemsTemp = null;
        }
 
        public int getItemChartWidth() {
index 078f923..3ffaaff 100755 (executable)
@@ -789,14 +789,12 @@ public class DACustomCombo extends Canvas {
                                        return;
                                }
 
-                               if (null != upArrowButton) {
-                                       Rectangle rectangle = upArrowButton.getBounds();
-                                       int x = event.x;
-                                       int y = event.y;
+                               Rectangle rectangle = upArrowButton.getBounds();
+                               int x = event.x;
+                               int y = event.y;
 
-                                       if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {
-                                               return;
-                                       }
+                               if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {
+                                       return;
                                }
 
                                int size = getItems().size();
@@ -847,14 +845,12 @@ public class DACustomCombo extends Canvas {
                                        return;
                                }
 
-                               if (null != downArrowButton) {
-                                       Rectangle rectangle = downArrowButton.getBounds();
-                                       int x = event.x;
-                                       int y = event.y;
+                               Rectangle rectangle = downArrowButton.getBounds();
+                               int x = event.x;
+                               int y = event.y;
 
-                                       if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {
-                                               return;
-                                       }
+                               if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {
+                                       return;
                                }
 
                                int size = getItems().size();
index ec7dffa..24dcf37 100644 (file)
@@ -82,6 +82,8 @@ public class ColorResources {
        // timeline\r
        public static Color TIMELINE_NUMBER_COLOR = getColor(\r
                        "timeline_number", new RGB(92, 92, 92)); //$NON-NLS-1$\r
+       public static final Color TIMELINE_RANGE_NUMBER_COLOR = POINT; //$NON-NLS-1$\r
+       public static final Color TIMELINE_RANGE_NUMBER_PUSH_COLOR = WHITE; //$NON-NLS-1$\r
        public static Color TIMELINE_TICK_COLOR = getColor(\r
                        "timeline_tick", new RGB(168, 168, 168)); //$NON-NLS-1$\r
        public static Color TIMELINE_BG_COLOR = getColor(\r
index 439ec8e..a179132 100644 (file)
@@ -104,6 +104,8 @@ public class FontResources {
                        "table_font", resizeSystemFont(8));//$NON-NLS-1$\r
        public static final Font TIMELINE_TICK_FONT = getFont(\r
                        "time_tick", resizeSystemFont(6));//$NON-NLS-1$\r
+       public static final Font TIMELINE_RANGE_NUMBER_FONT = getFont(\r
+                       "time_range", setSystemFont(SWT.BOLD, 9));//$NON-NLS-1$\r
        public static final Font TIMELINE_BALLOON_FONT = getFont(\r
                        "time_balloon", resizeSystemFont(7));//$NON-NLS-1$\r
 \r
index 7f8683b..d076d47 100644 (file)
@@ -371,9 +371,7 @@ public class Formatter {
                        ret = String.format("%d",quotient);
                }
                else{
-                       remainder /= 100;
-                       float fValue = remainder;
-                       remainder = Math.round(fValue);
+                       remainder = Math.round(remainder / 100.0);
                        ret = String.format("%d.%d%s", quotient,remainder,unit);
                }
                return ret;
@@ -402,9 +400,7 @@ public class Formatter {
                        ret = String.format("%d%s", quotient, unit);
                }
                else{
-                       remainder /= 100;
-                       float fValue = remainder;
-                       remainder = Math.round(fValue);
+                       remainder = Math.round(remainder / 100.0);
                        ret = String.format("%d.%d%s", quotient, remainder, unit);
                }
                return ret;
@@ -432,8 +428,7 @@ public class Formatter {
                        ret = String.format("%d",quotient);
                }
                else{
-                       remainder /= 100;
-                       remainder = Math.round((float)remainder);
+                       remainder = Math.round(remainder / 100.0);
                        ret = String.format("%d.%d%s", quotient,remainder,unit);
                        ret = String.format("%d.%d%s", quotient,remainder,unit);
                }
index 039fcb8..e9af0a9 100644 (file)
@@ -37,10 +37,12 @@ import org.eclipse.swt.events.MouseTrackAdapter;
 import org.eclipse.swt.events.PaintEvent;
 import org.eclipse.swt.events.PaintListener;
 import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Composite;
-import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
 import org.tizen.dynamicanalyzer.widgets.timeline.DATimelineMarker.MARKER_STATUS;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.IEventListener;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.MarkerEvent;
 
 public class DATimeline extends Canvas {
        public final static int SCALE_100 = 1;
@@ -58,33 +60,6 @@ public class DATimeline extends Canvas {
        private int detailedFrame = -1;
 
        private DATimelineRenderer timelineRenderer;
-       
-       private List<DATimelineMarker> markerList = new ArrayList<DATimelineMarker>();
-       
-       public List<DATimelineMarker> getMarkerList() {
-               return markerList;
-       }
-       
-       public void addMarker(double time) {
-               if(null != markerList) {
-                       boolean duplicate = false;
-                       for(DATimelineMarker marker : markerList) {
-                               if(marker.getTime() == time) {
-                                       duplicate = true;
-                                       break;
-                               }
-                       }
-                       
-                       if(!duplicate) {
-                               DATimelineMarker tmp = new DATimelineMarker(
-                                               ImageResources.MARKER_NOR,
-                                               ImageResources.MARKER,
-                                               ImageResources.MARKER_NOR);
-                               tmp.setTime(time);
-                               markerList.add(tmp);
-                       }
-               }
-       }
 
        public DATimeline(Composite parent, boolean useMarker) {
                super(parent, SWT.DOUBLE_BUFFERED);
@@ -94,6 +69,13 @@ public class DATimeline extends Canvas {
                        this.addMouseListener(new RangeMarkerMouseEventListener());
                        this.addMouseMoveListener(new RangeMarkerMouseMoveEventListener());
                        this.addMouseTrackListener(new RangeMarkerMouseTrackListener());
+
+                       MarkerManager.INSTANCE.addEventListener(new IEventListener() {
+                               @Override
+                               public void handleEvent(MarkerEvent event) {
+                                       DATimeline.this.redraw();
+                               }
+                       });
                }
        }
 
@@ -209,14 +191,43 @@ public class DATimeline extends Canvas {
                }
 
                public void mouseUp(MouseEvent e) {
-                       for(DATimelineMarker marker : markerList){
+                       List<DATimelineMarker> markerList =  MarkerManager.INSTANCE.getMarkerList();
+
+                       for (int i = 0; i < markerList.size(); i++ ) {
+                               DATimelineMarker marker = markerList.get(i);
+
                                if(marker.isPushed()) {
                                        marker.setStatus(MARKER_STATUS.NORMAL);
-                                       DATimeline.this.redraw();
+                                       MarkerManager.INSTANCE.updateOrder(i);
                                        break;
                                }
                        }
                }
+
+               @Override
+               public void mouseDoubleClick(MouseEvent e) {
+                       List<DATimelineMarker> markerList = MarkerManager.INSTANCE.getMarkerList();
+
+                       // search marker to remove
+                       for(int i = 0; i < markerList.size(); i++) {
+                               DATimelineMarker marker = markerList.get(i);
+
+                               Rectangle markerRect = marker.getImage().getBounds();
+                               if(e.x >= secondToPixel(marker.getTime()) - markerRect.width/2.0
+                                               && e.x <= secondToPixel(marker.getTime()) + markerRect.width/2.0) {
+
+                                       MarkerManager.INSTANCE.removeMarker(i);
+                                       return;
+                               }
+
+                       }
+
+                       // if no marker removed -- try to add new marker
+                       double newMarkerTime = pixelToSecond(e.x);
+                       if (newMarkerTime <= totalEndTime) {
+                               MarkerManager.INSTANCE.addMarker(newMarkerTime);
+                       }
+               }
        }
 
        private class RangeMarkerMouseMoveEventListener implements
@@ -253,17 +264,20 @@ public class DATimeline extends Canvas {
                                e.x = timePixel;
                        }
 
-                       for(DATimelineMarker marker : markerList) {
-                               if(marker.isPushed()) {
+                       List<DATimelineMarker> markerList = MarkerManager.INSTANCE.getMarkerList();
+                       for(int i = 0; i < markerList.size(); i++) {
+                               if(markerList.get(i).isPushed()) {
                                        if(e.x < 0) {
                                                e.x = 0;
                                        } else if(e.x > DATimeline.this.getBounds().width) {
                                                e.x = DATimeline.this.getBounds().width;
                                        }
-                                       
+
                                        double movedTime = pixelToSecond(e.x);
-                                       marker.setTime(movedTime);
-                                       DATimeline.this.redraw();
+                                       if (movedTime > totalEndTime)
+                                               movedTime = totalEndTime;
+
+                                       MarkerManager.INSTANCE.weakUpdateMarkerTime(i, movedTime);
                                }
                        }
                }
@@ -276,7 +290,7 @@ public class DATimeline extends Canvas {
                }
                @Override
                public void mouseExit(MouseEvent e) {
-                       for(DATimelineMarker marker : markerList) {
+                       for(DATimelineMarker marker : MarkerManager.INSTANCE.getMarkerList()) {
                                marker.setStatus(MARKER_STATUS.NORMAL);
                        }
                        DATimeline.this.redraw();
@@ -284,7 +298,7 @@ public class DATimeline extends Canvas {
        }
        
        private void setStatusInMarkerImage(int x, int y, MARKER_STATUS status) {
-               for(DATimelineMarker marker : markerList) {
+               for(DATimelineMarker marker : MarkerManager.INSTANCE.getMarkerList()) {
                        double markerPosition = secondToPixel(marker.getTime());
                        if(x >= markerPosition - (int)(marker.getImage().getBounds().width / 2 + 1)
                                        && x <= markerPosition + (int)(marker.getImage().getBounds().width / 2 + 1)) {
index 8f57f9c..5199de9 100644 (file)
@@ -35,6 +35,7 @@ import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
 import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
+import org.tizen.dynamicanalyzer.widgets.helper.FontResources;
 import org.tizen.dynamicanalyzer.widgets.helper.Formatter;
 import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
 
@@ -47,21 +48,39 @@ public class DATimelineTimeRenderer extends DATimelineRenderer {
        protected static final int TICK_LINE_HEIGHT_TALL = 6;
        protected static final int TICK_LINE_HEIGHT_SMALL = 4;
        protected static final int TIME_STRING_PIXEL_Y = 4;
-       protected static final int MARKER_START_Y = 5;
+       protected static final int MARKER_START_Y = 0;
+       protected static final int MARKER_STRING_START_Y = 1;
        
        protected int startTime;
        protected int scale;
 
        protected void drawRangeMarkers(GC gc, DATimeline timeline) {
-               List<DATimelineMarker> markerList = timeline.getMarkerList();
-               
-               for(DATimelineMarker marker : markerList) {
+               List<DATimelineMarker> markerList = MarkerManager.INSTANCE.getMarkerList();
+               gc.setForeground(ColorResources.TIMELINE_RANGE_NUMBER_COLOR);
+               gc.setFont(FontResources.TIMELINE_RANGE_NUMBER_FONT);
+
+               for (int i = 0; i < markerList.size(); i++) {
+                       String idxStr = Integer.toString(i);
+                       DATimelineMarker marker = markerList.get(i);
+
                        if(marker.getTime() >= 0) {
                                Image markerImage = marker.getImage();
-                               
+                               Boolean isPushed = marker.isPushed();
+
                                double markerTime = marker.getTime() - timeline.getStartTime();
-                               int pixelStartX = (int) Math.round(markerTime * scale * DEFAULT_INTERVAL) - markerImage.getBounds().width / 2;
-                               gc.drawImage(markerImage, pixelStartX-1, MARKER_START_Y);
+                               int pixelX = (int) Math.round(markerTime * scale * DEFAULT_INTERVAL);
+                               int pixelStartX = pixelX - markerImage.getBounds().width / 2;
+                               gc.drawImage(markerImage, pixelStartX - 1, MARKER_START_Y);
+
+                               // draw range number
+                               Point p = gc.stringExtent(idxStr);
+                               if (isPushed) {
+                                       gc.setForeground(ColorResources.TIMELINE_RANGE_NUMBER_PUSH_COLOR);
+                               }
+                               gc.drawText(idxStr, pixelX - p.x / 2 - 1, MARKER_STRING_START_Y, true);
+                               if (isPushed) {
+                                       gc.setForeground(ColorResources.TIMELINE_RANGE_NUMBER_COLOR);
+                               }
                        }
                }
        }
diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/MarkerManager.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/MarkerManager.java
new file mode 100644 (file)
index 0000000..edfd42d
--- /dev/null
@@ -0,0 +1,200 @@
+package org.tizen.dynamicanalyzer.widgets.timeline;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.IEventListener;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.MarkerAddEvent;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.MarkerEvent;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.MarkerEventType;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.MarkerPositionUpdateEvent;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.MarkerRemoveEvent;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.MarkerTimeUpdateEvent;
+
+/**
+ * Class supposed for managing timeline markers.
+ */
+public class MarkerManager {
+
+       public final static double MEGA_DOUBLE = 1000000.0;
+       public final static MarkerManager INSTANCE = new MarkerManager();
+
+       /**
+        * Different representations of markers.
+        */
+       private List<DATimelineMarker> markerList = new ArrayList<>();
+       private List<Double> markerTimeList = new ArrayList<>();
+       private List<Long> markerTimeListLong = new ArrayList<>();
+
+       /**
+        * List of registered change listeners.
+        */
+       private List<IEventListener> listeners = new ArrayList<>();
+
+       /**
+        * Find position in array where new marker could be inserted.
+        *
+        * @param time marker time
+        */
+       private int findNewMarkerPosition(double time) {
+               int idx = 0;
+
+               while (idx < markerTimeList.size() && markerTimeList.get(idx) < time)
+                       idx++;
+
+               return idx;
+       }
+
+       /**
+        * Insert new marker in lists.
+        *
+        * @param marker marker to insert
+        */
+       private void insertMarker(DATimelineMarker marker) {
+               int idx = findNewMarkerPosition(marker.getTime());
+
+               markerList.add(idx, marker);
+               markerTimeList.add(idx, marker.getTime());
+               markerTimeListLong.add(idx, (long) (marker.getTime() * MEGA_DOUBLE));
+
+               notifyListeners(new MarkerAddEvent(idx, marker.getTime()));
+       }
+
+       /**
+        * Add new marker.
+        *
+        * @param time marker time
+        */
+       public void addMarker(long time) {
+               addMarker(time / MEGA_DOUBLE);
+       }
+
+       /**
+        * Add new marker.
+        *
+        * @param time marker time
+        */
+       public void addMarker(double time) {
+               if (!markerTimeList.contains(time)) {
+                       DATimelineMarker tmp = new DATimelineMarker(
+                                       ImageResources.MARKER_NOR, ImageResources.MARKER,
+                                       ImageResources.MARKER_NOR);
+                       tmp.setTime(time);
+
+                       insertMarker(tmp);
+               }
+       }
+
+       /**
+        * Update marker time without notifying about changes.
+        *
+        * @param idx marker index
+        * @param time new marker time
+        */
+       public void weakUpdateMarkerTime(int idx, double time) {
+               double oldTime = markerTimeList.get(idx);
+
+               markerList.get(idx).setTime(time);
+               markerTimeList.set(idx, time);
+               markerTimeListLong.set(idx, (long) (time * MEGA_DOUBLE));
+               notifyListeners(new MarkerTimeUpdateEvent(idx, oldTime, time));
+       }
+
+       /**
+        * Remove marker by index.
+        *
+        * @param idx marker index
+        */
+       public void removeMarker(int idx) {
+               double time = markerTimeList.get(idx);
+
+               markerList.remove(idx);
+               markerTimeList.remove(idx);
+               markerTimeListLong.remove(idx);
+               notifyListeners(new MarkerRemoveEvent(idx, time));
+       }
+
+       /**
+        * Get count of markers on timeline.
+        */
+       public int getMarkerCount() {
+               return markerList.size();
+       }
+
+       /**
+        * Get marker list.
+        *
+        * @return list of {@link DATimelineMarker}
+        */
+       public List<DATimelineMarker> getMarkerList() {
+               return markerList;
+       }
+
+       /**
+        * Get list with marker times.
+        *
+        * @return list of {@link Double}
+        */
+       public List<Double> getMarkerTimeList() {
+               return markerTimeList;
+       }
+
+       /**
+        * Get list with marker times.
+        *
+        * @return list of {@link Long}
+        */
+       public List<Long> getMarkerTimeListLong() {
+               return markerTimeListLong;
+       }
+
+       /**
+        * Remove all markers.
+        */
+       public void clearMarkerList() {
+               markerList.clear();
+               markerTimeList.clear();
+               markerTimeListLong.clear();
+               notifyListeners(new MarkerEvent(MarkerEventType.MARKER_CLEAR));
+       }
+
+       /**
+        * Update markers order by time.
+        */
+       public void updateOrder(int idx) {
+               DATimelineMarker tmp = markerList.get(idx);
+               Double tmpTime = markerTimeList.get(idx);
+               Long tmpTimeLong = markerTimeListLong.get(idx);
+
+               markerList.remove(idx);
+               markerTimeList.remove(idx);
+               markerTimeListLong.remove(idx);
+
+               int newIdx = findNewMarkerPosition(tmpTime);
+
+               markerList.add(newIdx, tmp);
+               markerTimeList.add(newIdx, tmpTime);
+               markerTimeListLong.add(newIdx, tmpTimeLong);
+
+               notifyListeners(new MarkerPositionUpdateEvent(idx, newIdx, tmpTime));
+       }
+
+       /**
+        * Add new change listener.
+        *
+        * @param listener listener to add to notify list
+        */
+       public void addEventListener(IEventListener listener) {
+               listeners.add(listener);
+       }
+
+       /**
+        * Notify all listeners about changes.
+        */
+       private void notifyListeners(MarkerEvent event) {
+               for (IEventListener listener : listeners) {
+                       listener.handleEvent(event);
+               }
+       }
+}
diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/IEventListener.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/IEventListener.java
new file mode 100644 (file)
index 0000000..0c0f766
--- /dev/null
@@ -0,0 +1,15 @@
+package org.tizen.dynamicanalyzer.widgets.timeline.markers;
+
+
+/**
+ * Interface for notifying about marker changes.
+ */
+public interface IEventListener {
+
+       /**
+        * Method to call when another marker event occurs.
+        *
+        * @param event corresponding event to handle
+        */
+       public void handleEvent(MarkerEvent event);
+}
\ No newline at end of file
diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerAddEvent.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerAddEvent.java
new file mode 100644 (file)
index 0000000..0c9092c
--- /dev/null
@@ -0,0 +1,35 @@
+package org.tizen.dynamicanalyzer.widgets.timeline.markers;
+
+/**
+ * Event class corresponding to the {@link MarkerEventType#MARKER_ADD} type.
+ */
+public class MarkerAddEvent extends MarkerEvent {
+       int idx;
+       double time;
+
+       /**
+        * Event constructor.
+        *
+        * @param idx position where new marker should be inserted
+        * @param time marker time
+        */
+       public MarkerAddEvent(int idx, double time) {
+               super(MarkerEventType.MARKER_ADD);
+               this.idx = idx;
+               this.time = time;
+       }
+
+       /**
+        * Returns marker position.
+        */
+       public int getIdx() {
+               return idx;
+       }
+
+       /**
+        * Returns marker time.
+        */
+       public double getTime() {
+               return time;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerEvent.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerEvent.java
new file mode 100644 (file)
index 0000000..a515c77
--- /dev/null
@@ -0,0 +1,25 @@
+package org.tizen.dynamicanalyzer.widgets.timeline.markers;
+
+/**
+ * Basic marker event class.
+ */
+public class MarkerEvent {
+       /**
+        * Event type.
+        */
+       MarkerEventType type;
+
+       /**
+        * Creates event with specified event type.
+        */
+       public MarkerEvent(MarkerEventType type) {
+               this.type = type;
+       }
+
+       /**
+        * Returns actual event type of this event.
+        */
+       public MarkerEventType getType() {
+               return type;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerEventType.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerEventType.java
new file mode 100644 (file)
index 0000000..4f3d36e
--- /dev/null
@@ -0,0 +1,39 @@
+package org.tizen.dynamicanalyzer.widgets.timeline.markers;
+
+/**
+ * Types of events occurring with markers.
+ */
+public enum MarkerEventType {
+       /**
+        * Event happens when new marker added.
+        * Event provides actual position of marker and marker time.
+        */
+       MARKER_ADD,
+
+       /**
+        * Event happens when marker was removed.
+        * Event provides position of removed marker and marker time.
+        */
+       MARKER_REMOVE,
+
+       /**
+        * Event happens when marker released, it's time changed and fixed, and
+        * relative position was updated. Event provides old and new position of
+        * marker and actual marker time.
+        * Note: old and new position could be the same.
+        */
+       MARKER_POSITION_UPDATE,
+
+       /**
+        * Event happens when marker is now moving, it's time is being changed but
+        * relative position was not updated yet. Event provides old and new marker
+        * time and position before time update.
+        */
+       MARKER_TIME_UPDATE,
+
+       /**
+        * Event happens when all markers were removed. Event doesn't provide any
+        * additional data.
+        */
+       MARKER_CLEAR
+}
\ No newline at end of file
diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerPositionUpdateEvent.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerPositionUpdateEvent.java
new file mode 100644 (file)
index 0000000..7ba96c7
--- /dev/null
@@ -0,0 +1,45 @@
+package org.tizen.dynamicanalyzer.widgets.timeline.markers;
+
+/**
+ * Event class corresponding to the {@link MarkerEventType#MARKER_POSITION_UPDATE} type.
+ */
+public class MarkerPositionUpdateEvent extends MarkerEvent {
+       int oldIdx;
+       int newIdx;
+       double newTime;
+
+       /**
+        * Event constructor.
+        *
+        * @param oldIdx old marker position
+        * @param newIdx new marker position
+        * @param newTime actual marker time
+        */
+       public MarkerPositionUpdateEvent(int oldIdx, int newIdx, double newTime) {
+               super(MarkerEventType.MARKER_POSITION_UPDATE);
+               this.oldIdx = oldIdx;
+               this.newIdx = newIdx;
+               this.newTime = newTime;
+       }
+
+       /**
+        * Returns old position of marker.
+        */
+       public int getOldIdx() {
+               return oldIdx;
+       }
+
+       /**
+        * Returns new position of marker (may be equal to the old).
+        */
+       public int getNewIdx() {
+               return newIdx;
+       }
+
+       /**
+        * Returns actual marker time.
+        */
+       public double getNewTime() {
+               return newTime;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerRemoveEvent.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerRemoveEvent.java
new file mode 100644 (file)
index 0000000..79a15a5
--- /dev/null
@@ -0,0 +1,35 @@
+package org.tizen.dynamicanalyzer.widgets.timeline.markers;
+
+/**
+ * Event class corresponding to the {@link MarkerEventType#MARKER_REMOVE} type.
+ */
+public class MarkerRemoveEvent extends MarkerEvent {
+       int idx;
+       double time;
+
+       /**
+        * Event constructor.
+        *
+        * @param idx position of marker that was removed
+        * @param time marker time
+        */
+       public MarkerRemoveEvent(int idx, double time) {
+               super(MarkerEventType.MARKER_REMOVE);
+               this.idx = idx;
+               this.time = time;
+       }
+
+       /**
+        * Returns position of marker that was removed.
+        */
+       public int getIdx() {
+               return idx;
+       }
+
+       /**
+        * Returns time of marker that was removed.
+        */
+       public double getTime() {
+               return time;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerTimeUpdateEvent.java b/org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/timeline/markers/MarkerTimeUpdateEvent.java
new file mode 100644 (file)
index 0000000..7fc5c46
--- /dev/null
@@ -0,0 +1,48 @@
+package org.tizen.dynamicanalyzer.widgets.timeline.markers;
+
+/**
+ * Event class corresponding to the {@link MarkerEventType#MARKER_TIME_UPDATE}
+ * type.
+ */
+public class MarkerTimeUpdateEvent extends MarkerEvent {
+
+       int oldIdx;
+       double oldTime;
+       double newTime;
+
+       /**
+        * Event constructor.
+        *
+        * @param oldIdx position of marker
+        * @param oldTime old marker time
+        * @param newTime new marker time
+        */
+       public MarkerTimeUpdateEvent(int oldIdx, double oldTime, double newTime) {
+               super(MarkerEventType.MARKER_TIME_UPDATE);
+               this.oldIdx = oldIdx;
+               this.oldTime = oldTime;
+               this.newTime = newTime;
+       }
+
+       /**
+        * Returns position of marker before time update.
+        */
+       public int getOldIdx() {
+               return oldIdx;
+       }
+
+       /**
+        * Returns marker time before update.
+        */
+       public double getOldTime() {
+               return oldTime;
+       }
+
+       /**
+        * Return marker time after update.
+        */
+       public double getNewTime() {
+               return newTime;
+       }
+
+}
index f0f566f..fc30645 100644 (file)
@@ -1,2 +1,2 @@
-0=2.3.11
-1=20160822-1849
\ No newline at end of file
+0=2.3.5
+1=20160705-1054
\ No newline at end of file
index 16e332f..4926f5a 100644 (file)
@@ -116,15 +116,13 @@ public class PathManager {
 
                        File userSettingsDir = new File(baseDir + File.separator + PathConstants.TEMP_SETTINGS_FOLDER_NAME);
 
-                       // If settings directory does not exist or empty, create new directory
-                       // with default settings
-                       if (!userSettingsDir.exists() || userSettingsDir.list().length == 0)
-                               try {
-                                       FileUtils.copyDirectory(defaultSettingsDir, userSettingsDir);
-                               } catch (IOException e) {
-                                       System.err.println("Failed to copy configuration files: " + e.getMessage());
-                                       return "";
-                               }
+                       try {
+                               FileUtils.deleteDirectory(userSettingsDir);
+                               FileUtils.copyDirectory(defaultSettingsDir, userSettingsDir);
+                       } catch (IOException e) {
+                               System.err.println("Failed to copy configuration files: " + e.getMessage());
+                               return "";
+                       }
 
                        return userSettingsDir.getAbsolutePath();
                }
index 586878a..dde0680 100644 (file)
@@ -11,7 +11,8 @@ Require-Bundle: org.eclipse.ui,
  org.tizen.dynamicanalyzer.common;bundle-version="1.0.0",
  org.tizen.dynamicanalyzer.appearance;bundle-version="1.0.0",
  org.tizen.dynamicanalyzer.widgets;bundle-version="1.0.0",
- org.tizen.dynamicanalyzer.workbench;bundle-version="1.0.0"
+ org.tizen.dynamicanalyzer.workbench;bundle-version="1.0.0",
+ org.eclipse.ui.forms
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Bundle-Activator: org.tizen.dynamicanalyzer.common.AnalyzerPlugin
 Bundle-ActivationPolicy: lazy
index 227dc4b..b8d50af 100644 (file)
@@ -10,4 +10,4 @@ bin.includes = .,\
                .classpath,\
                lib/,\
                lib/org.eclipse.cdt.debug.edc_1.0.0.20160816.jar,\
-               lib/org.eclipse.draw2d_3.10.1.201508170204.jar
+               lib/org.eclipse.draw2d_3.10.1.201508170204.jar
\ No newline at end of file
index 4cb9f09..efaa6dd 100644 (file)
@@ -278,4 +278,7 @@ public class AnalyzerConstants {
        public final static int F_SETLKW = 7;
 
        public final static int SASH_WIDTH = 2;
+
+       // events
+       public final static int TREE_SORT_EVENT = 1001;
 }
index 9c86d15..6402bee 100644 (file)
@@ -68,6 +68,7 @@ public class DAResult implements Serializable {
                ERR_NOT_SUPPORTED(-1012, UserErrorWarningLabels.ERROR_DEVICE_NOT_SUPPORTED),
                ERR_BUSY_DEVICE(-1013, UserErrorWarningLabels.ERROR_DEVICE_IS_BUSY),
                ERR_TRACING_NOT_RUNNING(-1014, UserErrorWarningLabels.ERROR_TRACING_NOT_RUNNING),
+               ERR_DEVICE_TARGET_MISMATCH(-1015, UserErrorWarningLabels.ERROR_DEVICE_TARGET_MISMATCH),
                ERR_NO_APP(-1020, UserErrorWarningLabels.ERROR_NONEXIST_APPLICATION),
                ERR_INVALID_APP(-1021, UserErrorWarningLabels.ERROR_UNSUPPORTED_APPLICATION),
                ERR_BY_SECURITY(-1030, UserErrorWarningLabels.ERROR_BY_SECURITY_REASON),
index 9c5c599..11136d1 100644 (file)
@@ -36,6 +36,7 @@ import java.net.SocketException;
 import java.net.SocketTimeoutException;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
@@ -52,7 +53,6 @@ import org.tizen.dynamicanalyzer.protocol.p30_uihv.Communicator30_UIHV;
 import org.tizen.dynamicanalyzer.protocol.p40.Communicator40;
 import org.tizen.dynamicanalyzer.protocol.p41.Communicator41;
 import org.tizen.dynamicanalyzer.ui.info.screenshot.EmulatorScreenshot;
-import org.tizen.dynamicanalyzer.ui.info.screenshot.SocketClient;
 import org.tizen.dynamicanalyzer.util.ByteUtil;
 import org.tizen.dynamicanalyzer.util.CommonUtil;
 import org.tizen.dynamicanalyzer.util.Logger;
@@ -562,7 +562,7 @@ public class BaseCommunicator {
                                DebugLog.printControl0("%02x ", msg[k]);
                        DebugLog.printControl0("\n");
                } catch (Exception ex) {
-                       Logger.error("msg is invalid - " + msg);
+                       Logger.error("msg is invalid - " + Arrays.toString(msg));
                } finally {
                }
        }
index 7361875..b2d4de0 100755 (executable)
 package org.tizen.dynamicanalyzer.control;
 
 import org.eclipse.swt.widgets.Display;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.DAResult;
-import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.common.DAState;
+import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.handlers.ReplayManager;
 import org.tizen.dynamicanalyzer.handlers.UIActionHolder;
-import org.tizen.dynamicanalyzer.handlers.GUIAction;
 import org.tizen.dynamicanalyzer.nl.MenuBarLabels;
 import org.tizen.dynamicanalyzer.project.Project;
 import org.tizen.dynamicanalyzer.setting.Feature;
@@ -52,11 +52,9 @@ import org.tizen.dynamicanalyzer.ui.timeline.dlog.DLogDataManager;
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
-import org.tizen.dynamicanalyzer.widgets.da.base.ProgressDialog;
 
 public class StopTraceManager implements Runnable {
 
-       private ProgressDialog progressDlg = null;
        private DAResult error;
        private boolean stopFromTarget = false;
        private Thread stopThread = null;
@@ -163,20 +161,6 @@ public class StopTraceManager implements Runnable {
 
                } finally {
 
-                       // close progress dialog if not error case
-                       if (progressDlg != null) {
-                               if (error.isSuccess() || error.equals(DAResult.ErrorCode.ERR_BY_USER_CANCEL)) {
-                                       Display.getDefault().syncExec(new Runnable() {
-                                               @Override
-                                               public void run() {
-                                                       progressDlg.close();
-
-                                               }
-                                       });
-                               } else {
-                                       progressDlg.setOkEnabled(true);
-                               }
-                       }
                        if (Global.isGUIMode()) {
                                startUpdateHeapDataManager();
                        }
@@ -193,7 +177,7 @@ public class StopTraceManager implements Runnable {
                                public void run() {
                                        Logger.info("Run : HeapDataManager for calculating alloc data");
                                        HeapDataManager.getInstance().makeWholeAllocationTraceData();
-                                       HeapDataManager.getInstance().makeWholeStatisticsData();
+                                       HeapDataManager.getInstance().makeStatisticsData(0, 0);
 
                                        Display.getDefault().syncExec(new Runnable() {
                                                @Override
@@ -234,6 +218,7 @@ public class StopTraceManager implements Runnable {
                                        MenuBar.getInstance().setMenuItemEnable(MenuBarLabels.ANALYZE_SCREENSHOT, false);
                                        MenuBar.getInstance().setMenuItemEnable(MenuBarLabels.FILE_NEW, true);
                                        MenuBar.getInstance().setMenuItemEnable(MenuBarLabels.FILE_LOAD, true);
+                                       AnalyzerManager.getCurrentPage().updateView();
                                }
                        });
                }
index 50c2794..65c65d7 100644 (file)
@@ -64,11 +64,13 @@ public class AnalyzerLabels extends NLS {
 
        // tooltip text
        public static String ABOUT;
+       public static String SEARCH;
        public static String SETTING;
        public static String VIEW_SOURCE;
 
        // tooltip text for mac
        public static String ABOUT_MAC;
+       public static String SEARCH_MAC;
        public static String SETTING_MAC;
        public static String VIEW_SOURCE_MAC;
 
index 1df13a9..b5ecc8d 100644 (file)
@@ -27,10 +27,12 @@ CONNECTING=Connecting
 
 #Setting menu
 ABOUT=About Dynamic Analyzer [F1]
+SEARCH=Search [Ctrl + F]
 SETTING=Preferences
 VIEW_SOURCE=View source 
 
 ABOUT_MAC=About Dynamic Analyzer [fn + F1]
+SEARCH_MAC=Search [Ctrl + F]
 SETTING_MAC=Preferences 
 VIEW_SOURCE_MAC=View source 
 
@@ -171,7 +173,7 @@ SEARCH_DLG_DESC_POSTFIX= table
 SEARCH_DLG_CANCEL_BUTTON=Cancel
 SEARCH_DLG_BACK_BUTTON=Back
 SEARCH_DLG_NEXT_BUTTON=Next
-SEARCH_DLG_OPTION=Option
+SEARCH_DLG_OPTION=Options
 SEARCH_DLG_CASE_SENSITIVE=Case sensitive
 SEARCH_DLG_WHOLE_WORD=Whole word
 
index 4de496a..5e2a819 100644 (file)
@@ -244,6 +244,9 @@ public class ConfigureLabels extends NLS {
        
        public static String EXPORT_DIALOG_SELECT_EXPORT_PATH;
 
+       public static String FEATURE_NAME_ERROR_NO_TARGET;
+       public static String FEATURE_DESCRIPTION_ERROR_NO_TARGET;
+
        static {
                NLS.initializeMessages(BUNDLE_NAME, ConfigureLabels.class);
        }
index 6ed7ff5..2dc2931 100644 (file)
@@ -206,3 +206,8 @@ FEATURE_OVERHEAD_RANKING_HIGH=Overhead level: High
 FEATURE_OVERHEAD_RANKING_INPUT_VALUE=The feature overhead may occur depending on the input value
 
 EXPORT_DIALOG_SELECT_EXPORT_PATH=Select export path
+
+FEATURE_NAME_ERROR_NO_TARGET=Not active target
+FEATURE_DESCRIPTION_ERROR_NO_TARGET=This type of target device can not be selected \
+due to device of another type is already selected to be traced with Dynamic Analyzer. \
+To select this target, choose the corresponding device to be traced.
\ No newline at end of file
index e9a712b..e5ebb1a 100644 (file)
@@ -9,6 +9,8 @@ public class MemoryPageLabels extends NLS {
        public static String MEMORY_MAP_VIEW_TITLE;
        public static String MEMORY_CALLSTACK_VIEW_TITLE;
        public static String MEMORY_DETAILS_VIEW_TITLE;
+       public static String MEMORY_RANGE_ANALYSIS_VIEW_TITLE;
+       public static String MEMORY_RANGE_ANALYSIS_VIEW_NO_RANGES_LABEL;
        public static String MEMORY_STATISTICS_VIEW_TITLE;
        public static String MEMORY_ALLOCATION_TRACE_VIEW_TITLE;
        public static String MEMORY_MAIN_EXCUTABLE;
index 0130c55..84b931c 100644 (file)
@@ -2,6 +2,8 @@ MEMORY_CHART_TITLE=Memory
 MEMORY_MAP_VIEW_TITLE=Memory Map\r
 MEMORY_CALLSTACK_VIEW_TITLE=CallStack\r
 MEMORY_DETAILS_VIEW_TITLE=Details\r
+MEMORY_RANGE_ANALYSIS_VIEW_TITLE=Range Analysis\r
+MEMORY_RANGE_ANALYSIS_VIEW_NO_RANGES_LABEL=There are no ranges. Please create new ranges using markers...\r
 MEMORY_STATISTICS_VIEW_TITLE=Statistics\r
 MEMORY_ALLOCATION_TRACE_VIEW_TITLE=Persistent Allocations\r
 MEMORY_MAIN_EXCUTABLE=Main Executable\r
@@ -14,12 +16,12 @@ MEMORY_DETAILS_VIEW_DELTA=delta
 MEMORY_DETAILS_VIEW_MIN=min\r
 MEMORY_DETAILS_VIEW_MAX=max\r
 \r
-MEMORY_STATISTICS_VIEW_PATH=Path\r
+MEMORY_STATISTICS_VIEW_PATH\r
 MEMORY_STATISTICS_VIEW_PERSISTENT_BYTE=Persistent Byte\r
 MEMORY_STATISTICS_VIEW_PERSISTENT=# Persistent\r
 MEMORY_STATISTICS_VIEW_FREED=# Freed\r
 MEMORY_STATISTICS_VIEW_TOTAL_BYTE=Total Byte\r
-MEMORY_STATISTICS_VIEW_TOTAL=# Total\r
+MEMORY_STATISTICS_VIEW_TOTAL=# Total Allocations\r
 \r
 MEMORY_ALLOCATION_TRACE_VIEW_SEQ=Seq #\r
 MEMORY_ALLOCATION_TRACE_VIEW_TIMESTAMP=Timestamp\r
index f585a1c..97b1011 100644 (file)
@@ -52,6 +52,7 @@ public class MenuBarLabels extends NLS {
        public static String VIEW_FAILED_API;
        public static String VIEW_WARNING;
        public static String VIEW_FUNCTION_PROFILING;
+       public static String VIEW_PERSISTENT_MEMORY;
        public static String VIEW_NAVIGATE;
        public static String VIEW_ZOOM_IN;
        public static String VIEW_ZOOM_OUT;
index d444912..52982b0 100644 (file)
@@ -22,6 +22,7 @@ VIEW_REPORT=Report
 VIEW_FAILED_API=Failed API
 VIEW_WARNING=Warning
 VIEW_FUNCTION_PROFILING=Function Profiling
+VIEW_PERSISTENT_MEMORY=Persistent Memory Charts
 VIEW_NAVIGATE=Navigate
 VIEW_ZOOM_IN=Zoom In
 VIEW_ZOOM_OUT=Zoom Out
index 71d9bc2..63c42aa 100644 (file)
@@ -50,7 +50,9 @@ public class TimelineChartLabels extends NLS {
        public static String FILE_CHART_SERIES_NAME_WRITE;
        public static String FILE_CHART_TITLE;
        
+       public static String HEAP_CHART_SERIES_NAME_PROCESS;
        public static String HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION;
+       public static String HEAP_CHART_SERIES_NAME_PERSISTENT;
        public static String HEAP_CHART_SERIES_NAME_APP_ALLOCATION;
        public static String HEAP_CHART_TITLE;
        public static String HEAP_CHART_DESCRIPTOR;
index a8e3aa3..997ef68 100755 (executable)
@@ -16,7 +16,9 @@ FILE_CHART_SERIES_NAME_READ=Read size
 FILE_CHART_SERIES_NAME_WRITE=Write size
 FILE_CHART_TITLE=File Analysis
 
+HEAP_CHART_SERIES_NAME_PROCESS=Process %s
 HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION=Total
+HEAP_CHART_SERIES_NAME_PERSISTENT=Persistent
 HEAP_CHART_SERIES_NAME_APP_ALLOCATION=Application
 HEAP_CHART_TITLE=Heap Allocation
 HEAP_CHART_DESCRIPTOR=Shows the heap memory allocation.
index 581ceca..977c9ef 100644 (file)
@@ -39,6 +39,7 @@ public class UserErrorWarningLabels extends NLS {
        public static String ERROR_DEVICE_NOT_SUPPORTED;
        public static String ERROR_DEVICE_IS_BUSY;
        public static String ERROR_TRACING_NOT_RUNNING;
+       public static String ERROR_DEVICE_TARGET_MISMATCH;
        public static String ERROR_DEVICE_NOT_FOUND;
        public static String ERROR_UNSUPPORTED_PROTOCOL;
 
index 4bad47e..c84bc4e 100644 (file)
@@ -6,6 +6,7 @@ ERROR_DEVICE_CONNECTION= Failed to connect with the device. \nRe-run the dynamic
 ERROR_DEVICE_NOT_SUPPORTED=Current device is not supported.
 ERROR_DEVICE_IS_BUSY=Current device is occupied by another tracing process.
 ERROR_TRACING_NOT_RUNNING=Failed to stop tracing. \nCurrent device is not being traced.
+ERROR_DEVICE_TARGET_MISMATCH=Connected device does not match selected target type.
 ERROR_DEVICE_NOT_FOUND=No connected device is found. \nCheck the connection.
 ERROR_UNSUPPORTED_PROTOCOL=Device platform version is not supported.\nUpdate the device platform and retry.
 ERROR_BY_SECURITY_REASON=Current device is not available in the root or developer account mode.
index f16d17d..976a23e 100644 (file)
@@ -113,10 +113,6 @@ public enum Feature {
                return data;
        }
 
-       public boolean equals(Feature op) {
-               return (this.index == op.index);
-       }
-
        public static Feature getFeature(String name) {
                return featureByName.get(name);
        }
index ef3d4ae..f9b14c8 100644 (file)
@@ -26,6 +26,8 @@
  */
 package org.tizen.dynamicanalyzer.setting;
 
+import java.io.Serializable;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -93,7 +95,7 @@ public enum FlatFeature {
        private int overheadRanking = 0;
 
        private FlatFeature(PrimitiveFeature primitive) {
-               this.primitive= primitive;
+               this.primitive = primitive;
        }
 
        static {
@@ -242,10 +244,6 @@ public enum FlatFeature {
                return primitive.getChart();
        }
 
-       public boolean equals(FlatFeature op) {
-               return (this.primitive.getIndex() == op.primitive.getIndex());
-       }
-
        public static FlatFeature getFlatFeature(String name) {
                return featureByName.get(name);
        }
@@ -304,4 +302,24 @@ public enum FlatFeature {
                return ret;
        }
 
+       public static IndexComparator getIndexComparator() {
+               return indexComparator;
+       }
+
+       private static IndexComparator indexComparator = new IndexComparator();
+
+       private static class IndexComparator implements Comparator<FlatFeature>,
+                       Serializable {
+               /**
+                * Generated serial id.
+                */
+               private static final long serialVersionUID = 7911468647564611213L;
+
+               @Override
+               public int compare(FlatFeature arg0, FlatFeature arg1) {
+                       if (arg0 == arg1)
+                               return 0;
+                       return arg0.getIndex() > arg1.getIndex() ? 1 : -1;
+               }
+       }
 }
index 5f0ff38..ebae10f 100644 (file)
@@ -63,10 +63,6 @@ public enum FlatPreferences {
        public int getDefaultValue() {
                return this.defaultdata;
        }
-       
-       public boolean equals(FlatPreferences op) {
-               return (this.index == op.index);
-       }
 
        public static FlatPreferences getFlatPreferences(String name) {
                if(!featureByName.containsKey(name))
index 95cfc06..ad64fd2 100644 (file)
@@ -74,6 +74,7 @@ public enum SettingDataManager {
        // init selected information : for revert button
        private String initTarget = null;
        private List<FeatureValueData> initOptionsSelectedFeatureList = new ArrayList<FeatureValueData>();
+       private List<FlatPreferences> initOptionsSelectedPreferenceList = new ArrayList<FlatPreferences>();
 
        // mutable information
        private String selectedTarget = null;
@@ -285,6 +286,7 @@ public enum SettingDataManager {
                                                } // else : feature is on/off type
 
                                                optionsSelectedPreferenceList.add(selected);
+                                               initOptionsSelectedPreferenceList.add(selected);
                                        }
                                } else if (list[0].equals(SettingConstants.KEY_PLATFORM_DA)) {
                                        for (int i = 1; i < list.length; i++) {
@@ -521,10 +523,10 @@ public enum SettingDataManager {
                }
 
                // calculate
-               if (featureForFrequency.equals(Feature.SYSTEM_SAMPLING_RATE)
-                               || featureForFrequency.equals(Feature.FUNCTION_SAMPLING_RATE)) {
+               if (featureForFrequency == Feature.SYSTEM_SAMPLING_RATE
+                               || featureForFrequency == Feature.FUNCTION_SAMPLING_RATE) {
                        count = 1000.0 / inputValue; // millisecond
-               } else if (featureForFrequency.equals(Feature.SCREENSHOT_PERIODICALLY)) {
+               } else if (featureForFrequency == Feature.SCREENSHOT_PERIODICALLY) {
                        count = 1.0 / inputValue; // second
                }
 
@@ -554,10 +556,10 @@ public enum SettingDataManager {
                TargetData target = getTarget(targetName);
                if (null != target) {
                        Set<String> selectedChartSet = new HashSet<String>();
-                       List<FlatFeature> featureList = target.getSelectedFlatFeatureList();
-                       for (int i = 0; i < featureList.size(); i++) {
-                               if (featureList.get(i).getChart() != null)
-                                       selectedChartSet.add(featureList.get(i).getChart());
+                       Set<FlatFeature> featureSet = target.getSelectedFlatFeatures();
+                       for (FlatFeature feature : featureSet) {
+                               if (feature.getChart() != null)
+                                       selectedChartSet.add(feature.getChart());
                        }
                        return selectedChartSet;
                } else {
@@ -587,9 +589,14 @@ public enum SettingDataManager {
                }
        }
 
-       public TargetData getConnectedTarget() {
-               // do not unit test the connected device.
-               // check connected target
+       /**
+        * Returns target type of connected device, if there is one.
+        * Returns <b>null</b> if there are no connected device.
+        *
+        * @return device description as an instance of {@link TargetData} or null
+        */
+       public TargetData getConnected() {
+
                DeviceInfo currentDevice = Global.getCurrentDeviceInfo();
 
                if (null != currentDevice) {
@@ -602,6 +609,31 @@ public enum SettingDataManager {
                                }
                        }
                }
+               return null;
+       }
+
+       /**
+        * Return {@value true} if no device connected, or target type of connected device
+        * equals to selected target.
+        */
+       public boolean checkConnectedTargetType() {
+               TargetData connected = getConnected();
+               if (connected == null) // User should be able to select any target if no
+                                                               // device connected.
+                       return true;
+               return connected.getTargetName().equals(getSelectedTarget());
+       }
+
+       /**
+        * Returns target type of connected device, if there is one.
+        * Returns <b>selected</b> target if there are no connected device.
+        *
+        * @return device description as an instance of {@link TargetData} or null
+        */
+       public TargetData getConnectedTarget() {
+               TargetData tData = getConnected();
+               if (tData != null)
+                       return tData;
 
                return targetListMap.get(selectedTarget);
        }
@@ -645,7 +677,7 @@ public enum SettingDataManager {
 
        public void deleteOptionsSelectedFeature(Feature feature) {
                for (int i = 0; i < optionsSelectedFeatureList.size(); i++) {
-                       if (optionsSelectedFeatureList.get(i).getKey().equals(feature)) {
+                       if (optionsSelectedFeatureList.get(i).getKey() == feature) {
                                optionsSelectedFeatureList.remove(i);
                                break;
                        } // else : do nothing
@@ -654,7 +686,7 @@ public enum SettingDataManager {
        
        public void deleteOptionsSelectedPreference(FlatPreferences feature) {
                for (int i = 0; i < optionsSelectedPreferenceList.size(); i++) {
-                       if (optionsSelectedPreferenceList.get(i).equals(feature)) {
+                       if (optionsSelectedPreferenceList.get(i) == feature) {
                                optionsSelectedPreferenceList.remove(i);
                                break;
                        } // else : do nothing
@@ -679,6 +711,17 @@ public enum SettingDataManager {
                }
        }
 
+       /**
+        * Get selection state of specified feature.
+        *
+        * @param feature feature to check selection
+        * @return <code>true</code> if feature selected,
+        *         <code>false</code> otherwise
+        */
+       public boolean isFlatFeatureSelected(FlatFeature feature) {
+               return getSelectedFlatFeatureSet().contains(feature);
+       }
+
        public int getOptionsFeatureValue(Feature feature) {
                int value = 0;
                FeatureValueData featureVal = getFeatureValueData(optionsSelectedFeatureList, feature);
@@ -713,7 +756,7 @@ public enum SettingDataManager {
                // get init value
                int value = -1;
                for (int i = 0; i < initOptionsSelectedFeatureList.size(); i++) {
-                       if (initOptionsSelectedFeatureList.get(i).getKey().equals(feature)) {
+                       if (initOptionsSelectedFeatureList.get(i).getKey() == feature) {
                                value = initOptionsSelectedFeatureList.get(i).getValue();
                                break;
                        }
@@ -733,7 +776,7 @@ public enum SettingDataManager {
                } // else : search FeatureValueData object
 
                for (int i = 0; i < featureList.size(); i++) {
-                       if (featureList.get(i).getKey().equals(feature)) {
+                       if (featureList.get(i).getKey() == feature) {
                                return featureList.get(i);
                        } // else : do nothing
                }
@@ -774,10 +817,10 @@ public enum SettingDataManager {
 
                TargetData target = getTarget(targetName);
                if (null != target) {
-                       List<FlatFeature> featureList = target.getSelectedFlatFeatureList();
-                       for (int i = 0; i < featureList.size(); i++) {
-                               if (featureList.get(i).getPage() != null)
-                                       selectedPageList.add(featureList.get(i).getPage());
+                       Set<FlatFeature> featureSet = target.getSelectedFlatFeatures();
+                       for (FlatFeature feature : featureSet) {
+                               if (feature.getPage() != null)
+                                       selectedPageList.add(feature.getPage());
                        }
                } else {
                        Logger.debug("Does not exist targetName : " + targetName);
@@ -804,30 +847,29 @@ public enum SettingDataManager {
                        return true;
                }
 
-               // check options feature
-               if (optionsSelectedFeatureList.size() != initOptionsSelectedFeatureList.size()) {
+               //check options FlatPreferences
+               if (optionsSelectedPreferenceList.size() != initOptionsSelectedPreferenceList.size()) {
                        return true;
                }
 
-               for (int i = 0; i < optionsSelectedFeatureList.size(); i++) {
+               for (int i = 0; i < optionsSelectedPreferenceList.size(); i++) {
                        // check featureName
-                       FeatureValueData selectedFeature = optionsSelectedFeatureList.get(i);
-                       FeatureValueData initFeature = getFeatureValueData(initOptionsSelectedFeatureList,
-                                       selectedFeature.getKey());
-                       if (initFeature == null) {
+                       FlatPreferences preference = optionsSelectedPreferenceList.get(i);
+                       int initPreferenceIndex = getFlatPreferences(initOptionsSelectedPreferenceList, preference);
+                       if (initPreferenceIndex < 0) {
                                return true;
                        } else {
                                // check value
-                               if (selectedFeature.getValue() != initFeature.getValue()) {
+                               if (preference.getValue() != initOptionsSelectedPreferenceList.get(initPreferenceIndex).getValue()) {
                                        return true;
                                } // else : return false;
                        }
                }
 
-               // check template, feature
+               // check selected FlatFeatures
                for (Map.Entry<String, TargetData> entry : targetListMap.entrySet()) {
                        TargetData target = entry.getValue();
-                       if (target.changedFeatures() == true) {
+                       if (target.changedFlatFeatures()) {
                                return true;
                        }
                }
@@ -904,7 +946,8 @@ public enum SettingDataManager {
        }
        
        public Set<FlatPreferences> getSelectedPreferenceSet() {
-               List<FlatFeature> featureList = getConnectedTarget().getSelectedFlatFeatureList();
+               Set<FlatFeature> featureSet = getConnectedTarget()
+                               .getSelectedFlatFeatures();
                
                Set<FlatPreferences> selectedFeatures = new HashSet<FlatPreferences>();
 
@@ -921,7 +964,7 @@ public enum SettingDataManager {
                if (!isOptionsSelectedPrefereces(FlatPreferences.SYSTEM_ALL_PROCESSES)) {
                        selectedFeatures.add(FlatPreferences.SYSTEM_ALL_PROCESSES);
                }
-               if (!featureList.contains(FlatFeature.PROCESS_MEMORY)
+               if (!featureSet.contains(FlatFeature.PROCESS_MEMORY)
                                && !isOptionsSelectedPrefereces(FlatPreferences.PROCESS_MEMORY)) {
                        selectedFeatures.add(FlatPreferences.PROCESS_MEMORY);
                }
@@ -935,10 +978,8 @@ public enum SettingDataManager {
 
                // add selected target features
                TargetData target = getConnectedTarget();
-               List<FlatFeature> featureList = target.getSelectedFlatFeatureList();
-               for (int i = 0; i < featureList.size(); i++) {
-                       selectedFlatFeatures.add(featureList.get(i));
-               }
+               Set<FlatFeature> featureSet = target.getSelectedFlatFeatures();
+               selectedFlatFeatures.addAll(featureSet);
                Logger.debug(selectedFlatFeatures);
 
                return selectedFlatFeatures;
index b40100b..c7b5ecb 100644 (file)
@@ -29,6 +29,8 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -44,18 +46,18 @@ public class TargetData {
        // available information
        private List<Template> availableTemplateList = new ArrayList<Template>();
        private List<Feature> availableFeatureList = new ArrayList<Feature>();
-       private List<FlatFeature> availableFlatFeatureList = new ArrayList<FlatFeature>();
+       private Set<FlatFeature> availableFlatFeatureSet = new HashSet<FlatFeature>();
 
        /** write information **/
        // init selected information : for revert button
        private Template initTemplate = null;
        private List<FeatureValueData> initFeatureList = new ArrayList<FeatureValueData>();
-       private List<FlatFeature> initFlatFeatureList = new ArrayList<FlatFeature>();
+       private Set<FlatFeature> initFlatFeatureSet = new HashSet<FlatFeature>();
 
        // dialog selected information
        private Template selectedTemplate = null;
        private List<FeatureValueData> selectedFeatureList = new ArrayList<FeatureValueData>();
-       private List<FlatFeature> selectedFlatFeatureList = new ArrayList<FlatFeature>();
+       private Set<FlatFeature> selectedFlatFeatureSet = new HashSet<FlatFeature>();
        private List<String> availableChartList = new ArrayList<String>();
 
        public TargetData(String targetName) {
@@ -93,9 +95,9 @@ public class TargetData {
        public List<Feature> getAvailableFeatureList() {
                return Collections.unmodifiableList(availableFeatureList);
        }
-       
-       public List<FlatFeature> getAvailableFlatFeatureList() {
-               return Collections.unmodifiableList(availableFlatFeatureList);
+
+       public Set<FlatFeature> getAvailableFlatFeatures() {
+               return Collections.unmodifiableSet(availableFlatFeatureSet);
        }
 
        public List<String> getAvailableChartList() {
@@ -107,6 +109,11 @@ public class TargetData {
                this.selectedFeatureList.addAll(selectedFeatureList);
        }
 
+       public void setSelectedFlatFeatures(Set<FlatFeature> set) {
+               this.selectedFlatFeatureSet.clear();
+               this.selectedFlatFeatureSet.addAll(set);
+       }
+
        public void addSelectedFeature(String featureName) {
                FeatureValueData featureValue = new FeatureValueData(Feature.getFeature(featureName));
                this.selectedFeatureList.add(featureValue);
@@ -114,8 +121,10 @@ public class TargetData {
 
        public void addSelectedFlatFeature(String featureName) {
                FlatFeature feature = FlatFeature.getFlatFeature(featureName);
-               if (!this.selectedFlatFeatureList.contains(feature)) {
-                       this.selectedFlatFeatureList.add(feature);
+               if (null != feature) {
+                       if (!this.selectedFlatFeatureSet.contains(feature)) {
+                               this.selectedFlatFeatureSet.add(feature);
+               }
                if (feature == FlatFeature.SCREENSHOT)
                        SettingDataManager.INSTANCE.addOptionsSelectedPreference(FlatPreferences.SCREENSHOT_ON_SCENE_TRANSITION, 1);
                }
@@ -127,14 +136,7 @@ public class TargetData {
 
        public void removeSelectedFlatFeature(String featureName) {
                FlatFeature feature = FlatFeature.getFlatFeature(featureName);
-               if (selectedFlatFeatureList.contains(feature)) {
-                       for (int i = 0 ; i < selectedFlatFeatureList.size() ; i++) {
-                               if (selectedFlatFeatureList.get(i).getName() == featureName) {
-                                       this.selectedFlatFeatureList.remove(i);
-                                       break;
-                               }
-                       }
-               }
+               selectedFlatFeatureSet.remove(feature);
        }
 
        public void clearSelectedFeature() {
@@ -145,8 +147,8 @@ public class TargetData {
                return Collections.unmodifiableList(selectedFeatureList);
        }
 
-       public List<FlatFeature> getSelectedFlatFeatureList() {
-               return Collections.unmodifiableList(selectedFlatFeatureList);
+       public Set<FlatFeature> getSelectedFlatFeatures() {
+               return Collections.unmodifiableSet(selectedFlatFeatureSet);
        }
 
        public boolean isSelectedFeature(Feature feature) {
@@ -157,13 +159,10 @@ public class TargetData {
                        return false;
                }
        }
-       
+
        public boolean isSelectedFlatFeature(String name) {
-               for (int i = 0 ; i < selectedFlatFeatureList.size(); i++) {
-                       if (selectedFlatFeatureList.get(i).getName() == name)
-                               return true;
-               }
-               return false;
+               FlatFeature feature = FlatFeature.getFlatFeature(name);
+               return selectedFlatFeatureSet.contains(feature);
        }
 
        private FeatureValueData getFeatureValueData(List<FeatureValueData> featureList, Feature feature) {
@@ -173,7 +172,7 @@ public class TargetData {
                } // else : search FeatureValueData object
 
                for (int i = 0; i < featureList.size(); i++) {
-                       if (featureList.get(i).getKey().equals(feature)) {
+                       if (featureList.get(i).getKey() == feature) {
                                return featureList.get(i);
                        } // else : do nothing
                }
@@ -186,7 +185,7 @@ public class TargetData {
         * @param template selected template
         */
        public void changeSelectedFeatureList(Template template) {
-               if (template.equals(selectedTemplate)) {
+               if (template == selectedTemplate) {
                        selectedFeatureList.clear();
                        selectedFeatureList.addAll(template.getData().getFeatureList());
                } else {
@@ -249,9 +248,10 @@ public class TargetData {
        }
 
        private void makeAvailableFlatFeatureList(String list[]) {
+               availableFlatFeatureSet.clear();
                if (list != null) {
                        for (int i = 2; i < list.length; i++) {
-                               availableFlatFeatureList.add(FlatFeature.getFlatFeature(Integer.parseInt(list[i])));
+                               availableFlatFeatureSet.add(FlatFeature.getFlatFeature(Integer.parseInt(list[i])));
                        }
                } // else do nothing
        }
@@ -273,17 +273,19 @@ public class TargetData {
        }
 
        private void makeSelectedFlatFeatureList(String list[]) {
+               selectedFlatFeatureSet.clear();
                for (int i = 2; i < list.length; i++) {
                        String valueList[] = list[i].split(CommonConstants.COLON);
                        FlatFeature feature = FlatFeature.getFlatFeature(Integer.parseInt(valueList[0]));
 
-                       selectedFlatFeatureList.add(feature);
+                       selectedFlatFeatureSet.add(feature);
                }
                // init FlatFeature list
-               copyFlatFeatureList(selectedFlatFeatureList, initFlatFeatureList);
+               copyFlatFeatureSet(selectedFlatFeatureSet, initFlatFeatureSet);
        }
 
        private void makeAvailableChartList(String list[]) {
+               availableChartList.clear();
                if (list != null) {
                        for (int i = 2; i < list.length; i++) {
                                availableChartList.add(list[i]);
@@ -313,13 +315,13 @@ public class TargetData {
                                + SettingConstants.WRITE_CSV_SEPARATOR + writeAvailableFeatureListData());
                writer.println(targetName + SettingConstants.WRITE_CSV_SEPARATOR
                                + SettingConstants.KEY_AVAILABLE_FLATFEATURE_LIST
-                               + SettingConstants.WRITE_CSV_SEPARATOR + writeAvailableFlatFeatureListData());
+                               + SettingConstants.WRITE_CSV_SEPARATOR + writeAvailableFlatFeaturesData());
                writer.println(targetName + SettingConstants.WRITE_CSV_SEPARATOR
                                + SettingConstants.KEY_SELECTED_FEATURE_LIST + SettingConstants.WRITE_CSV_SEPARATOR
                                + writeSelectedFeatureListData());
                writer.println(targetName + SettingConstants.WRITE_CSV_SEPARATOR
                                + SettingConstants.KEY_SELECTED_FLATFEATURE_LIST + SettingConstants.WRITE_CSV_SEPARATOR
-                               + writeSelectedFlatFeatureListData());
+                               + writeSelectedFlatFeaturesData());
                writer.println(targetName + SettingConstants.WRITE_CSV_SEPARATOR
                                + SettingConstants.KEY_AVAILABLE_CHART_LIST + SettingConstants.WRITE_CSV_SEPARATOR
                                + writeAvailableChartListData());
@@ -343,14 +345,15 @@ public class TargetData {
                return buffer.toString();
        }
 
-       private String writeSelectedFlatFeatureListData() {
+       private String writeSelectedFlatFeaturesData() {
                StringBuffer buffer = new StringBuffer();
-               for (int i = 0; i < selectedFlatFeatureList.size(); i++) {
-                       FlatFeature feature = selectedFlatFeatureList.get(i);
+               Iterator<FlatFeature> iter = selectedFlatFeatureSet.iterator();
+               while (iter.hasNext()) {
+                       FlatFeature feature = iter.next();
 
                        buffer.append(feature.getIndex());
 
-                       if (i < selectedFlatFeatureList.size() - 1) {
+                       if (iter.hasNext()) {
                                buffer.append(SettingConstants.WRITE_CSV_SEPARATOR);
                        } // else : the last value will be written to a csv file does not contain a comma.
                }
@@ -395,55 +398,41 @@ public class TargetData {
                return buffer.toString();
        }
 
-       private String writeAvailableFlatFeatureListData() {
+       private String writeAvailableFlatFeaturesData() {
                StringBuffer buffer = new StringBuffer();
-               for (int i = 0; i < availableFlatFeatureList.size(); i++) {
-                       if (i < availableFlatFeatureList.size() - 1) {
-                               buffer.append(availableFlatFeatureList.get(i).getIndex()
+               Iterator<FlatFeature> iter = availableFlatFeatureSet.iterator();
+               while (iter.hasNext()) {
+                       FlatFeature feature = iter.next();
+                       if (iter.hasNext()) {
+                               buffer.append(feature.getIndex()
                                                + SettingConstants.WRITE_CSV_SEPARATOR);
                        } else {
-                               buffer.append(availableFlatFeatureList.get(i).getIndex());
+                               buffer.append(feature.getIndex());
                        }
                }
                return buffer.toString();
        }
 
-       public boolean changedFeatures() {
-               // check template
-               if (!initTemplate.equals(selectedTemplate)) {
+       public boolean changedFlatFeatures() {
+               // check FlatFeature
+               if (selectedFlatFeatureSet.size() != initFlatFeatureSet.size()) {
                        return true;
                }
 
-               // check feature
-               if (selectedFeatureList.size() != initFeatureList.size()) {
-                       return true;
-               }
-
-               for (int i = 0; i < selectedFeatureList.size(); i++) {
-                       // check featureName
-                       FeatureValueData selectedFeature = selectedFeatureList.get(i);
-                       FeatureValueData initFeature = getFeatureValueData(initFeatureList,
-                                       selectedFeature.getKey());
-                       if (initFeature == null) {
-                               return true;
-                       } else {
-                               // check value
-                               if (selectedFeature.getValue() != initFeature.getValue()) {
-                                       return true;
-                               } // else : return false;
-                       }
+               if (selectedFlatFeatureSet.containsAll(initFlatFeatureSet)) {
+                       return false;
                }
-               return false;
+               return true;
        }
 
        public void applySettingData() {
                // set feature
-               copyFlatFeatureList(selectedFlatFeatureList, initFlatFeatureList);
+               copyFlatFeatureSet(selectedFlatFeatureSet, initFlatFeatureSet);
        }
 
        public void revertSettingData() {
                // set feature
-               copyFlatFeatureList(initFlatFeatureList, selectedFlatFeatureList);
+               copyFlatFeatureSet(initFlatFeatureSet, selectedFlatFeatureSet);
        }
 
        private void copyFeatureList(List<FeatureValueData> source, List<FeatureValueData> dest) {
@@ -458,20 +447,14 @@ public class TargetData {
                }
        }
 
-       private void copyFlatFeatureList(List<FlatFeature> source, List<FlatFeature> dest) {
+       private void copyFlatFeatureSet(Set<FlatFeature> source,
+                       Set<FlatFeature> dest) {
                dest.clear();
 
                if (source.isEmpty()) {
                        return;
                }
 
-               for (int i = 0; i < source.size(); i++) {
-                       dest.add(source.get(i));
-               }
-       }
-
-       public void setSelectedFlatFeatures(Set<FlatFeature> set) {
-               selectedFlatFeatureList.clear();
-               selectedFlatFeatureList.addAll(set);
+               dest.addAll(source);
        }
 }
index d94ac4d..ec9d0d7 100644 (file)
@@ -94,10 +94,6 @@ public enum Template {
                return data;
        }
 
-       public boolean equals(Template op) {
-               return (this.index == op.index);
-       }
-
        public static Template getTemplate(String name) {
                return templateByName.get(name);
        }
index 0195813..0e16c80 100644 (file)
@@ -54,6 +54,7 @@ public class ShortCutManager {
        public static String COOLBAR_AREA_MEMORY_TOOLTIP = null;
 
        public static String COOLBAR_AREA_ABOUT = null;
+       public static String COOLBAR_AREA_SEARCH = null;
        public static String COOLBAR_AREA_SETTING = null;
        public static String COOLBAR_AREA_VIEW_SOURCE = null;
 
@@ -77,6 +78,7 @@ public class ShortCutManager {
                        COOLBAR_AREA_MEMORY_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_MEMORY_TOOLTIP_MAC;
 
                        COOLBAR_AREA_ABOUT = AnalyzerLabels.ABOUT_MAC;
+                       COOLBAR_AREA_SEARCH = AnalyzerLabels.SEARCH_MAC;
                        COOLBAR_AREA_SETTING = AnalyzerLabels.SETTING_MAC;
                        COOLBAR_AREA_VIEW_SOURCE = AnalyzerLabels.VIEW_SOURCE_MAC;
                } else {
@@ -98,6 +100,7 @@ public class ShortCutManager {
                        COOLBAR_AREA_MEMORY_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_MEMORY_TOOLTIP;
 
                        COOLBAR_AREA_ABOUT = AnalyzerLabels.ABOUT;
+                       COOLBAR_AREA_SEARCH = AnalyzerLabels.SEARCH;
                        COOLBAR_AREA_SETTING = AnalyzerLabels.SETTING;
                        COOLBAR_AREA_VIEW_SOURCE = AnalyzerLabels.VIEW_SOURCE;
                }
index b6f39bb..37ce904 100644 (file)
@@ -308,7 +308,7 @@ public class LogParser extends DataThread<List<LogData>> {
 
        private boolean processWebFunctionData(WebProfileData pData) {
                int msgID = pData.getMsgID();
-               Deque<webFunctionEntryInfo> functionStack = getWebFunctionEntryStack(pData.getTID());
+               Deque<webFunctionEntryInfo> functionStack = getWebFunctionEntryStack(pData.getTid());
                webFunctionEntryInfo info = null;
 
                // entry / exit pair matching
@@ -336,7 +336,7 @@ public class LogParser extends DataThread<List<LogData>> {
                // make web function profiling
                if (info.userFunction) {
                        WebProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
-                                       .getWebProfileDataMakerByPid(pData.getPID());
+                                       .getWebProfileDataMakerByPid(pData.getPid());
                        profiler.makeWebFunctionUsageProfileData(pData);
                }
 
index 0a6d7eb..b5edfb8 100644 (file)
@@ -65,11 +65,11 @@ public class AppStartupData extends LogData {
                return true;
        }
 
-       public int getPID() {
+       public int getPid() {
                return pid;
        }
 
-       public void setPID(int pid) {
+       public void setPid(int pid) {
                this.pid = pid;
        }
 
index 5f9db19..7c70071 100644 (file)
@@ -78,19 +78,19 @@ public class SyscallData extends LogData {
                return true;
        }
 
-       public int getPID() {
+       public int getPid() {
                return pid;
        }
 
-       public void setPID(int pid) {
+       public void setPid(int pid) {
                this.pid = pid;
        }
 
-       public int getTID() {
+       public int getTid() {
                return tid;
        }
 
-       public void setTID(int tid) {
+       public void setTid(int tid) {
                this.tid = tid;
        }
 
index 4947e75..d1222f1 100644 (file)
@@ -80,11 +80,11 @@ public class WebAppStartupData extends LogData {
                return true;
        }
 
-       public int getPID() {
+       public int getPid() {
                return pid;
        }
 
-       public void setPID(int pid) {
+       public void setPid(int pid) {
                this.pid = pid;
        }
 
index 4b0447a..d20b2c8 100644 (file)
@@ -87,19 +87,19 @@ public class WebProfileData extends LogData {
                return true;
        }
 
-       public int getPID() {
+       public int getPid() {
                return pid;
        }
 
-       public void setPID(int pid) {
+       public void setPid(int pid) {
                this.pid = pid;
        }
 
-       public int getTID() {
+       public int getTid() {
                return tid;
        }
 
-       public void setTID(int tid) {
+       public void setTid(int tid) {
                this.tid = tid;
        }
 
index 36ff332..53b3f9d 100644 (file)
@@ -282,10 +282,10 @@ public class LoadSettingDialog extends DAMessageBox {
                }
                File saveFile = new File(path);
                if (!saveFile.exists() || !saveFile.isFile()) {
-                       result = null;
+                       setResult(null);
                        return;
                } else {
-                       result = path;
+                       setResult(path);
                        return;
                }
 //             
index a426711..4903ef1 100644 (file)
@@ -93,7 +93,7 @@ public class SaveSettingDialog extends DAMessageBox {
                        }
 
                        if (executeSaveTrace()) {
-                               result = AnalyzerConstants.SUCCESS;
+                               setResult(AnalyzerConstants.SUCCESS);
                        }
                        shell.dispose();
                }
index e7aa757..926cc97 100644 (file)
@@ -1,27 +1,15 @@
 package org.tizen.dynamicanalyzer.ui.common;\r
 \r
-import java.util.Collections;\r
-\r
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;\r
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;\r
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;\r
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;\r
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuListener;\r
 \r
 public class PopupRangeAnalysisMenuItemListener extends DAPopupMenuListener {\r
-       protected DAPopupMenuItem menuItem;\r
-       protected DAChartBoard chartBoard;\r
-       protected RangeDataManager rangeDataManager = RangeDataManager.getInstance();\r
-       \r
-       public PopupRangeAnalysisMenuItemListener(DAPopupMenuItem menuItem, DAChartBoard chartBoard) {\r
-               this.menuItem = menuItem;\r
-               this.chartBoard = chartBoard;\r
-       }\r
 \r
        @Override\r
        public void widgetSelected(DAPopupMenuItem menuItem) {\r
                double time = menuItem.getDoubleData();\r
-               Collections.sort(RangeDataManager.getInstance().getMarerTimeList());\r
                RangeDataManager.getInstance().setRangeFromMarkerList((long) (time * TimelineConstants.MEGA_DOUBLE));\r
        }\r
 \r
index 235e2c6..a060c0b 100644 (file)
@@ -3,11 +3,7 @@
  */
 package org.tizen.dynamicanalyzer.ui.common;
 
-import java.util.Collections;
-
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
-import org.tizen.dynamicanalyzer.ui.thread.chart.ThreadChartView;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
@@ -19,17 +15,17 @@ import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
 
 public class PopupRangeAnalysisMenuItemOnChartListener extends PopupRangeAnalysisMenuItemListener {
 
+       DAChartBoard chartBoard;
        DAChart chart;
 
-       public PopupRangeAnalysisMenuItemOnChartListener(DAPopupMenuItem menuItem, DAChartBoard chartBoard, DAChart chart) {
-               super(menuItem, chartBoard);
+       public PopupRangeAnalysisMenuItemOnChartListener(DAPopupMenuItem item, DAChartBoard chartBoard, DAChart chart) {
+               this.chartBoard = chartBoard;
                this.chart = chart;
        }
 
        @Override
        public void widgetSelected(DAPopupMenuItem menuItem) {
                double time = menuItem.getDoubleData();
-               Collections.sort(RangeDataManager.getInstance().getMarerTimeList());
                RangeDataManager.getInstance().setRangeFromMarkerList((long) (time * TimelineConstants.MEGA_DOUBLE));
 
                DAChartPlotMarker marker = chart.getPlot().getMarkers().get(0);
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/SetRangeMarkerMouseMoveListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/SetRangeMarkerMouseMoveListener.java
deleted file mode 100644 (file)
index 7fcbfa3..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *  Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 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.common;
-
-import java.util.List;
-
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
-import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
-import org.tizen.dynamicanalyzer.widgets.timeline.DATimelineMarker;
-import org.tizen.dynamicanalyzer.widgets.timeline.DATimelineRenderer;
-
-public class SetRangeMarkerMouseMoveListener extends MouseAdapter implements MouseMoveListener {
-       private DATimeline timeline;
-
-       public SetRangeMarkerMouseMoveListener(RangeDataManager rangeDataManager,
-                       DAChartBoard chartBoard, DATimeline timeline) {
-               this.timeline = timeline;
-       }
-
-       @Override
-       public void mouseMove(MouseEvent e) {
-               List<DATimelineMarker> markerList = timeline.getMarkerList();
-               for(int i = 0; i < markerList.size(); i++) {
-                       DATimelineMarker marker = markerList.get(i);
-                       if(marker.isPushed()) {
-                               long longTime = (long) (marker.getTime() * TimelineConstants.MEGA_DOUBLE);
-                               if(longTime > Toolbar.INSTANCE.getTime()) {
-                                       AnalyzerUtil.moveMarker(i, Toolbar.INSTANCE.getTime());
-                               } else {
-                                       AnalyzerUtil.moveMarker(i, longTime);
-                               }
-
-                               break;
-                       }
-               }
-       }
-
-       @Override
-       public void mouseDoubleClick(MouseEvent e) {
-               List<DATimelineMarker> markerList = timeline.getMarkerList();
-               for(int i = 0; i < markerList.size(); i++) {
-                       DATimelineMarker marker = markerList.get(i);
-                       int markerWidth = marker.getImage().getBounds().width;
-                       if(e.x >= secondToPixel(marker.getTime()) - markerWidth/2
-                                       && e.x <= secondToPixel(marker.getTime()) + markerWidth/2
-                                       && e.y >= 8) {
-                               long longTime = (long) (marker.getTime() * TimelineConstants.MEGA_DOUBLE);
-                               AnalyzerUtil.removeMarker(i, longTime);
-                               break;
-                       }
-                       
-               }
-       }
-       
-       private double secondToPixel(double second) {
-               return (second - timeline.getStartTime()) * timeline.getScale()
-                               * DATimelineRenderer.DEFAULT_INTERVAL;
-       }
-}
index fc02912..99629f8 100644 (file)
@@ -40,20 +40,9 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.DASelectionData;
-import org.tizen.dynamicanalyzer.ui.file.FileChartView;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
 import org.tizen.dynamicanalyzer.ui.info.screenshot.ScreenshotDialog;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryChartView;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;
-import org.tizen.dynamicanalyzer.ui.network.NetworkChartView;
-import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
-import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
-import org.tizen.dynamicanalyzer.ui.opengl.chart.GLChartView;
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
-import org.tizen.dynamicanalyzer.ui.thread.chart.ThreadChartView;
 import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.util.Logger;
@@ -72,6 +61,7 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
 import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
 
 public class TimelineChartMouseEventListener extends MouseAdapter implements MouseMoveListener {
        protected RangeDataManager rangeDataManager = RangeDataManager.getInstance();
@@ -295,7 +285,7 @@ public class TimelineChartMouseEventListener extends MouseAdapter implements Mou
                long longTime = (long) (time * TimelineConstants.MEGA_DOUBLE);
                
                if(longTime <= Toolbar.INSTANCE.getTime()) {
-                       AnalyzerUtil.addMarker(longTime);
+                       MarkerManager.INSTANCE.addMarker(time);
                }
        }
 
index fa7bb40..82b4f20 100644 (file)
@@ -118,7 +118,7 @@ public class DeviceExplorerDialog extends DAMessageBox {
                                                // enter the directory
                                                explorer.setCurrent(sel.get(0).getFullPath());
                                        } else {
-                                               result = sel;
+                                               setResult(sel);
                                                shell.dispose();
                                        }
                                }
@@ -168,7 +168,7 @@ public class DeviceExplorerDialog extends DAMessageBox {
                                if (!entry.isDirectory() && !entry.isRoot()) {
                                        List<FileEntry> entries = new ArrayList<FileEntry>();
                                        entries.add(entry);
-                                       result = entries;
+                                       setResult(entries);
                                        shell.dispose();
                                }
                        }
index e659ae1..770ccf5 100644 (file)
@@ -109,7 +109,7 @@ public class FileExplorerDialog extends DAMessageBox {
 
                        @Override
                        public void handleClickEvent(DACustomButton button) {
-                               result = explorer.getSelection();
+                               setResult(explorer.getSelection());
                                if (null != result) {
                                        shell.dispose();
                                }
@@ -128,7 +128,7 @@ public class FileExplorerDialog extends DAMessageBox {
 
                        @Override
                        public void handleClickEvent(DACustomButton button) {
-                               result = (Boolean)false;
+                               setResult((Boolean) false);
                                shell.dispose();
                        }
                });
@@ -159,7 +159,7 @@ public class FileExplorerDialog extends DAMessageBox {
                                if (!entry.isDirectory()) {
                                        List<File> entries = new ArrayList<File>();
                                        entries.add(entry);
-                                       result = entries;
+                                       setResult(entries);
                                        shell.dispose();
                                }
                        }
index face04b..ae36144 100644 (file)
@@ -92,7 +92,7 @@ public class FileTreeExplorerDialog extends DAMessageBox {
 
                        @Override
                        public void handleClickEvent(DACustomButton button) {
-                               result = explorerTree.getSelection();
+                               setResult(explorerTree.getSelection());
                                shell.dispose();
                        }
                });
@@ -128,7 +128,7 @@ public class FileTreeExplorerDialog extends DAMessageBox {
                                                item.fireEvent(SWT.Expand);
                                        }
                                } else {
-                                       result = entry;
+                                       setResult(entry);
                                        shell.dispose();
                                }
 
index 177b358..e79a37f 100644 (file)
@@ -57,26 +57,12 @@ import org.tizen.dynamicanalyzer.ui.file.manager.FileDataManager;
 import org.tizen.dynamicanalyzer.ui.file.model.FileAccessor;
 import org.tizen.dynamicanalyzer.ui.file.model.FileEvent;
 import org.tizen.dynamicanalyzer.ui.file.model.FileSelectedData;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryChartView;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;
-import org.tizen.dynamicanalyzer.ui.network.NetworkChartView;
-import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
-import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
-import org.tizen.dynamicanalyzer.ui.opengl.chart.GLChartView;
-import org.tizen.dynamicanalyzer.ui.page.BaseView;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
-import org.tizen.dynamicanalyzer.ui.thread.chart.ThreadChartView;
-import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DAApiListTableComposite;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
 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.timeline.MarkerManager;
 
 public class FileApiListTable extends DAApiListTableComposite {
        private FileDataManager fileDataManager = FileDataManager.getInstance();
@@ -142,11 +128,11 @@ public class FileApiListTable extends DAApiListTableComposite {
                                }
                                List<Object> markerData = ((DATableDataFormat) ti[0].getData()).getData();
                                long markerTime = Long.parseLong((String)markerData.get(1));
-                               AnalyzerUtil.addMarker(markerTime);
+                               MarkerManager.INSTANCE.addMarker(markerTime);
                        }
                });
        }
-       
+
        @Override
        protected List<TableInput> makeTableInput() {
                FileApiListView view = (FileApiListView) AnalyzerManager.getCurrentPage().getView(FilePage.apilistViewID);
index 27fc60e..d24f67d 100644 (file)
@@ -28,7 +28,6 @@ package org.tizen.dynamicanalyzer.ui.file;
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.util.List;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StackLayout;
@@ -56,7 +55,6 @@ import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
 import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
 import org.tizen.dynamicanalyzer.ui.file.manager.FileDataManager;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
@@ -137,11 +135,6 @@ public class FileChartView extends DAViewComposite {
                LifecycleLogParser.getInstance().registerLifecycleBar(fileChartBoard.getLifecycleBar());
                LifecycleLogParser.getInstance().registerTimeline(timeline);
 
-               SetRangeMarkerMouseMoveListener listener = new SetRangeMarkerMouseMoveListener(
-                               rangeDataManager, fileChartBoard, timeline);
-               timeline.addMouseMoveListener(listener);
-               timeline.addMouseListener(listener);
-
                processCombo = makeDACustomCombo(fileChartBoard.getTitleComp());
                FormData data = new FormData();
                data.top = new FormAttachment(0, 0);
@@ -315,23 +308,8 @@ public class FileChartView extends DAViewComposite {
                }
        }
        
-       public void updateMarker() {
-               List<Double> markerTimeList = Toolbar.INSTANCE.getMarkerTimeList();
-               List<FileChart> chartList = fileChartBoard.getChartList();
-               for(FileChart chart : chartList) {
-                       chart.getChart().getPlot().clearMarkerTime();
-               }
-               for(double time : markerTimeList) {
-                       for(FileChart chart : chartList) {
-                               chart.getChart().getPlot().addMarkerTime(time);
-                       }
-                       fileChartBoard.getTimeline().addMarker(time);
-               }
-       }
-
        @Override
        public void updateView() {
-               updateMarker();
                updateScale();
                updateProcessCombo();
                fileChartBoard.updateChart();
@@ -364,7 +342,6 @@ public class FileChartView extends DAViewComposite {
 
        @Override
        public void updateView(DAViewData data) {
-               updateMarker();
                updateScale();
                updateProcessCombo();
                fileChartBoard.updateChart();
index dcdea97..c9b20ec 100644 (file)
@@ -96,7 +96,7 @@ public class AppStartupDataManager extends PageDataManager {
 
                                try {
                                        insertRowData.add(new Long(data.getSeq()));
-                                       insertRowData.add(new Integer(data.getPID()));
+                                       insertRowData.add(new Integer(data.getPid()));
                                        insertRowData.add(new Integer(data.getstageID()));
                                        insertRowData.add(new Long(data.getStartTime()));
                                        insertRowData.add(new Long(data.getEndTime()));
@@ -124,7 +124,7 @@ public class AppStartupDataManager extends PageDataManager {
 
                                try {
                                        insertRowData.add(new Long(data.getSeq()));
-                                       insertRowData.add(new Integer(data.getPID()));
+                                       insertRowData.add(new Integer(data.getPid()));
                                        insertRowData.add(new Integer(data.getStageID()));
                                        insertRowData.add(new Integer(data.getResourceID()));
                                        insertRowData.add(data.getResourcePath());                                      
index c10f0ef..53d4a0e 100644 (file)
@@ -44,7 +44,7 @@ public class CallstackView extends DAViewComposite {
        private String[] columnNames = { InformationViewLabels.CALLSTACK_VIEW_FUNCTION,
                        InformationViewLabels.CALLSTACK_VIEW_ADDRESS,
                        InformationViewLabels.CALLSTACK_VIEW_BINARY_PATH };
-       private int[] columnSizes = { 120, 70, 400 };
+       private int[] columnSizes = { 120, 80, 390 };
        private boolean[] columnVisibility = { true, true, true };
        Composite contents = null;
 
index f62b5e3..fed8f7f 100644 (file)
@@ -43,7 +43,6 @@ import org.tizen.dynamicanalyzer.common.DASelectionData;
 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.TimeLineChartKeyListener;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
 import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
@@ -132,7 +131,6 @@ public class InteractiveChartView extends DAViewComposite {
 
                timeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
                timeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
-               timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(rangeDataManager, chartBoard, timeline));
 
                InteractiveDataManager.getInstance().setChartView(this);
        }
index 96f1f7a..bfc0042 100644 (file)
@@ -39,7 +39,6 @@ import org.tizen.dynamicanalyzer.common.DASelectionData;
 import org.tizen.dynamicanalyzer.nl.KernelPageLabels;
 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.UICommonConstants;
 import org.tizen.dynamicanalyzer.ui.kernel.data.KernelSelectionData;
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
@@ -153,9 +152,6 @@ public class CallFlowChartView extends DAViewComposite {
                LifecycleLogParser.getInstance().registerLifecycleBar(
                                callflowChart.getLifecycleBar());
                LifecycleLogParser.getInstance().registerTimeline(timeline);
-
-               timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(
-                               rangeDataManager, callflowChart, timeline));
        }
 
        @Override
index 4960058..b044052 100644 (file)
@@ -39,7 +39,6 @@ import org.tizen.dynamicanalyzer.common.DASelectionData;
 import org.tizen.dynamicanalyzer.nl.KernelPageLabels;
 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.UICommonConstants;
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
@@ -144,11 +143,6 @@ public class ContextSwitchingChartView extends DAViewComposite {
                LifecycleLogParser.getInstance().registerLifecycleBar(
                                contextChart.getLifecycleBar());
                LifecycleLogParser.getInstance().registerTimeline(threadTimeline);
-
-               threadTimeline
-                               .addMouseMoveListener(new SetRangeMarkerMouseMoveListener(
-                                               RangeDataManager.getInstance(), contextChart,
-                                               threadTimeline));
        }
 
        private void handleSelection(DAChartBoardItem selectItem) {
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/AllocationTraceSelectionListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/AllocationTraceSelectionListener.java
new file mode 100644 (file)
index 0000000..e5a160c
--- /dev/null
@@ -0,0 +1,68 @@
+package org.tizen.dynamicanalyzer.ui.memory;
+
+import java.util.List;
+
+import org.eclipse.nebula.widgets.grid.Grid;
+import org.eclipse.nebula.widgets.grid.GridItem;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.tizen.dynamicanalyzer.ui.memory.chart.MemoryChartBoard;
+import org.tizen.dynamicanalyzer.ui.memory.table.MemoryAllocationTraceTable.MemoryAllocationTraceTableIndex;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.util.Logger;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotMarker;
+
+public class AllocationTraceSelectionListener extends SelectionAdapter {
+       MemoryPage page;
+
+       public AllocationTraceSelectionListener(MemoryPage memoryPage) {
+               page = memoryPage;
+       }
+
+       @Override
+       public void widgetSelected(SelectionEvent e) {
+               long t = System.nanoTime();  // TODO: this instruction required to
+               // analyze performance and must be removed.
+               if (!(e.widget instanceof Grid))
+                       return;
+               GridItem[] items = ((Grid) e.widget).getSelection();
+               if (null == items || items.length == 0) {
+                       return;
+               }
+
+               int size = items.length;
+               double eventStartTime_sec = 0;
+               double eventEndTime_sec = 0;
+               if (size == 1) {
+                       // one item selected - find one point on chart.
+                       List<Object> data = ((DATableDataFormat) items[0].getData()).getData();
+                       long time_micSec = (Long) data.get(MemoryAllocationTraceTableIndex.TIMESTAMP.getIndex());
+                       eventStartTime_sec = time_micSec / TimelineConstants.MEGA_DOUBLE;
+                       eventEndTime_sec = eventStartTime_sec;
+               } else {
+                       // few items selected - find corresponding range on chart.
+                       List<Object> startData = ((DATableDataFormat) items[0].getData()).getData();
+                       List<Object> endData = ((DATableDataFormat) items[size - 1].getData()).getData();
+                       long startTime_micSec = (Long) startData.get(MemoryAllocationTraceTableIndex.TIMESTAMP.getIndex());
+                       eventStartTime_sec = startTime_micSec / TimelineConstants.MEGA_DOUBLE;
+                       long endTime_micSec = (Long) endData.get(MemoryAllocationTraceTableIndex.TIMESTAMP.getIndex());
+                       eventEndTime_sec = endTime_micSec / TimelineConstants.MEGA_DOUBLE;
+               }
+
+               MemoryChartBoard chartBoard = (MemoryChartBoard) page.memoryChartView.getChartBoard();
+               DAChartPlot plot = chartBoard.getMemoryChartList().get(0).getChart().getPlot();
+               DAChartPlotMarker marker = plot.getMarkers().get(0);
+               if (!(marker instanceof DAChartPlotIntervalMarker)) {
+                       return;
+               }
+               DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker;
+               intervalMarker.setInterval(eventStartTime_sec, eventEndTime_sec);
+               chartBoard.getMemoryChartList().get(0).getChart().redraw();
+               Logger.debug("Time spent for cross-focusing (nano) = "
+                               + (System.nanoTime() - t));  // TODO: this instruction required to
+               // analyze performance and must be removed.
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/ExpandableMemoryRangeComposite.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/ExpandableMemoryRangeComposite.java
new file mode 100644 (file)
index 0000000..0ab06df
--- /dev/null
@@ -0,0 +1,129 @@
+package org.tizen.dynamicanalyzer.ui.memory;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.memory.table.MemoryStatisticsTable;
+import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
+import org.tizen.dynamicanalyzer.widgets.helper.Formatter;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
+
+/**
+ * Expandable composite for memory statistics table aggregation
+ * used to manage and reflect specific time range.
+ */
+public class ExpandableMemoryRangeComposite extends ExpandableComposite {
+       /**
+        * Index of range to reflect information for, starting from 0.
+        */
+       private int rangeIdx = 0;
+
+       /**
+        * Range start time.
+        */
+       private long startTime = 0;
+
+       /**
+        * Range end time.
+        */
+       private long endTime = 0;
+
+       /**
+        * Style for expandable composite.
+        */
+       private static final int expandableStyle = ExpandableComposite.TWISTIE
+                       | ExpandableComposite.NO_TITLE_FOCUS_BOX;
+
+       /**
+        * Top margin for this composite.
+        */
+       private static final int TOP_MARGIN_HEIGHT = 5;
+
+       /**
+        * Memory statistics table wrapped by this composite.
+        */
+       private MemoryStatisticsTable memoryTable;
+
+       /**
+        * Composite constructor.
+        *
+        * @param parent parent composite where this view should be placed
+        * @param style SWT composite style
+        */
+       public ExpandableMemoryRangeComposite(final Composite parent, int style) {
+               super(parent, style, expandableStyle);
+               this.setForeground(ColorResources.TABLE_HEADER_FONT_COLOR);
+               this.setFont(FontResources.TABLE_HEADER_FONT);
+
+               memoryTable = new MemoryStatisticsTable(this, SWT.NONE, SWT.MULTI
+                               | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
+
+               memoryTable.setColumnVisibilityState(true);
+
+               this.marginHeight = TOP_MARGIN_HEIGHT;
+               this.setClient(memoryTable);
+               this.setLayout(new FillLayout(SWT.VERTICAL));
+       }
+
+       /**
+        * Update text in expandable header.
+        */
+       private void updateText() {
+               this.setText(String.format("Range %d (%s - %s)", rangeIdx,
+                               Formatter.toTimeFormat(startTime),
+                               Formatter.toTimeFormat(endTime)));
+       }
+
+       /**
+        * Return wrapped table.
+        */
+       public MemoryStatisticsTable getMemoryTable() {
+               return memoryTable;
+       }
+
+       /**
+        * Set index of range that should be reflected by this composite.
+        * @param idx range index
+        */
+       public void setIndex(int idx) {
+               this.rangeIdx = idx;
+               updateText();
+       }
+
+       /**
+        * Update range borders that should be reflected by this composite. Updates
+        * borders in accordance with current range index.
+        */
+       public void updateRange() {
+               List<Long> markerList = MarkerManager.INSTANCE.getMarkerTimeListLong();
+
+               if (rangeIdx == 0) {
+                       startTime = 0;
+               } else {
+                       startTime = markerList.get(rangeIdx - 1);
+               }
+
+               if (rangeIdx == markerList.size()) {
+                       endTime = Toolbar.INSTANCE.getTime();
+               } else {
+                       endTime = markerList.get(rangeIdx);
+               }
+
+               updateText();
+
+               updateTable();
+       }
+
+       /**
+        * Force update table range and data.
+        */
+       private void updateTable() {
+               memoryTable.setSelectionRange(startTime, endTime);
+               memoryTable.updateTable();
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/HeapChartsSelectionListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/HeapChartsSelectionListener.java
new file mode 100644 (file)
index 0000000..c799581
--- /dev/null
@@ -0,0 +1,116 @@
+package org.tizen.dynamicanalyzer.ui.memory;
+
+import org.eclipse.nebula.widgets.grid.Grid;
+import org.eclipse.nebula.widgets.grid.GridItem;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.nl.MemoryPageLabels;
+import org.tizen.dynamicanalyzer.ui.memory.chart.MemoryChart;
+import org.tizen.dynamicanalyzer.ui.memory.chart.MemoryChartBoard;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItemList;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardSelectionListener;
+
+/**
+ * HeapChartsSelectionListener class represents listener for selection events in
+ * MemoryChartBoard.
+ */
+public class HeapChartsSelectionListener extends DAChartBoardSelectionListener {
+
+       private Grid table = null;
+
+       public HeapChartsSelectionListener(Grid statisticsTable) {
+               this.table = statisticsTable;
+       }
+
+       /**
+        * Selection event handler.
+        */
+       @Override
+       public void handleSelectionEvent(DAChartBoardItem item) {
+               if (table == null || item == null)
+                       return;
+
+               // Remove selection: if in the end there is no selection then there is
+               // no entry in Statistics table corresponding to selected chart.
+               table.deselectAll();
+
+               // Get MemoryChartBoard from item
+               MemoryChartBoard chartBoard = (MemoryChartBoard) item.getChartBoard();
+               if (item.getParent() != null && item.getParent() instanceof DAChartBoardItemList) {
+                       // If it is library chart (child of pid chart)
+                       Composite parentItem = ((DAChartBoardItemList) item.getParent()).getParent();
+                       if (parentItem instanceof DAChartBoardItem)
+                               chartBoard = (MemoryChartBoard) ((DAChartBoardItem) parentItem).getChartBoard();
+               }
+
+               if (chartBoard == null)
+                       return;
+
+               int pid = 0;
+               String entryName = "";
+
+               // Find PID and name of entry to select
+               for (MemoryChart chart : chartBoard.getMemoryChartList()) {
+                       if (chart.getChartItem() == item) {
+                               pid = chart.getPid();
+
+                               if (chart.getChartName().equals(MemoryPageLabels.MEMORY_CHART_HEAP_MEMORY))
+                                       entryName = Integer.toString(pid);
+                               else
+                                       entryName = chart.getChartName().replace('\n', '/');
+
+                               break;
+                       }
+               }
+
+               selectEntry(pid, entryName);
+       }
+
+       /**
+        * Selects specified entry in Statistics table by <code>pid</code> and
+        * <code>name</code>.
+        * 
+        * @param pid
+        *            corresponding PID
+        * @param name
+        *            name of entry
+        */
+       private void selectEntry(int pid, String name) {
+               if (pid == 0 || name.isEmpty())
+                       return;
+
+               // Walk through every item checking its name
+               for (GridItem gridItem : table.getItems()) {
+                       DATableDataFormat itemData = (DATableDataFormat) gridItem.getData();
+                       if (((String) itemData.getObject()).equals(name)) {
+
+                               if (!CommonUtil.isNumeric(name)) {
+                                       // Not PID entry: need to check its parent on PID
+                                       // correctness
+
+                                       if (gridItem.getParentItem() != null) {
+                                               // library entry
+                                               DATableDataFormat parentData = (DATableDataFormat) gridItem.getParentItem().getData();
+
+                                               // same library but from another process or from
+                                               // 'Total' entry
+                                               if (!((String) parentData.getObject()).equals(Integer.toString(pid)))
+                                                       continue;
+
+                                       } else
+                                               // Total entry or something else:
+                                               // should not enter here
+                                               return;
+                               }
+
+                               // select and return
+                               table.select(table.indexOf(gridItem));
+                               table.showItem(gridItem);
+                               return;
+                       }
+               }
+       }
+
+}
index 3b5759a..2798598 100644 (file)
@@ -48,7 +48,7 @@ public class MemoryCallStackView extends DAViewComposite {
        private String[] columnNames = { InformationViewLabels.CALLSTACK_VIEW_FUNCTION,
                        InformationViewLabels.CALLSTACK_VIEW_ADDRESS,
                        InformationViewLabels.CALLSTACK_VIEW_BINARY_PATH };
-       private int[] columnSizes = { 120, 70, 400 };
+       private int[] columnSizes = { 120, 80, 390 };
        private boolean[] columnVisibility = { true, true, true };
        Composite contents = null;
 
index b3794a4..7a7193b 100644 (file)
@@ -24,8 +24,6 @@
 
 package org.tizen.dynamicanalyzer.ui.memory;
 
-import java.util.List;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StackLayout;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -48,9 +46,7 @@ import org.tizen.dynamicanalyzer.project.Project;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
 import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
-import org.tizen.dynamicanalyzer.ui.memory.chart.MemoryChart;
 import org.tizen.dynamicanalyzer.ui.memory.chart.MemoryChartBoard;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
@@ -73,7 +69,6 @@ public class MemoryChartView extends DAViewComposite {
        private final Composite contents;
        private MemoryChartBoard memoryChartBoard;
        private final StackLayout stackLayout;
-       private Boolean isLatestTraceMode = true;
        
        private DAToolBarCustomCombo processCombo;
        
@@ -94,19 +89,14 @@ public class MemoryChartView extends DAViewComposite {
                memoryChartBoard = new MemoryChartBoard(contents, 
                                MemoryPageLabels.MEMORY_CHART_TITLE, DAChartBoard.BOARD_STYLE_TIME);
                memoryChartBoard.setNameFont(FontResources.CHART_NAME_FONT);
-               memoryChartBoard.setSelectable(false);
+               memoryChartBoard.setSelectable(true);
                
                ScrollBar hScrollBar = memoryChartBoard.getHScrollBar();
                hScrollBar.addSelectionListener(new SelectionAdapter() {
                        @Override
                        public void widgetSelected(SelectionEvent e) {
-                               synchronized(isLatestTraceMode) {
-                                       if (memoryChartBoard.isMaximumScrolled()) {
-                                               isLatestTraceMode = true;
-                                       } else {
-                                               isLatestTraceMode = false;
-                                       }
-                               }
+                               AnalyzerUtil.setLatestTraceMode(MemoryPage.pageID,
+                                               memoryChartBoard.isMaximumScrolled());
                        }
                });
                
@@ -121,11 +111,6 @@ public class MemoryChartView extends DAViewComposite {
                LifecycleLogParser.getInstance().registerLifecycleBar(memoryChartBoard.getLifecycleBar());
                LifecycleLogParser.getInstance().registerTimeline(timeline);
 
-               SetRangeMarkerMouseMoveListener listener = new SetRangeMarkerMouseMoveListener(rangeDataManager,
-                               memoryChartBoard, timeline);
-               timeline.addMouseMoveListener(listener);
-               timeline.addMouseListener(listener);
-               
                processCombo = makeDACustomCombo(memoryChartBoard.getTitleComp());
                FormData data = new FormData();
                data.top = new FormAttachment(0, 0);
@@ -305,30 +290,15 @@ public class MemoryChartView extends DAViewComposite {
                });
        }
        
-       public void updateMarker() {
-               List<Double> markerTimeList = Toolbar.INSTANCE.getMarkerTimeList();
-               List<MemoryChart> chartList = memoryChartBoard.getMemoryChartList();
-               for(MemoryChart chart : chartList) {
-                       chart.getChart().getPlot().clearMarkerTime();
-               }
-               for(double time : markerTimeList) {
-                       for(MemoryChart chart : chartList) {
-                               chart.getChart().getPlot().addMarkerTime(time);
-                       }
-                       memoryChartBoard.getTimeline().addMarker(time);
-               }
-       }
-       
        @Override
        public void updateView() {
                updateScale();
                updateProcessCombo();
-               updateMarker();
                /*
                 * In case of Latest status, update visibleStartTime of chartBoard.
                 * Because Chart should be refreshed automatically even Page change.
                 */
-               if (isLatestTraceMode) {
+               if (AnalyzerUtil.isLatestTraceMode(MemoryPage.pageID)) {
                        memoryChartBoard.updateVisibleStartTime();
                        memoryChartBoard.setTotalEndTime(Toolbar.INSTANCE.getTime(), true);
                } else {
@@ -359,7 +329,6 @@ public class MemoryChartView extends DAViewComposite {
        @Override
        public void updateView(DAViewData data) {
                updateScale();
-               updateMarker();
        }
        
        @Override
index 40c9c57..4bf074a 100644 (file)
@@ -26,6 +26,7 @@ package org.tizen.dynamicanalyzer.ui.memory;
 
 import java.util.Map;
 
+import org.eclipse.nebula.widgets.grid.Grid;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.SashForm;
 import org.eclipse.swt.layout.FillLayout;
@@ -38,8 +39,11 @@ import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.setting.SettingDataManager;
 import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
+import org.tizen.dynamicanalyzer.ui.memory.chart.MemoryChartBoard;
 import org.tizen.dynamicanalyzer.ui.memory.data.HeapDataManager;
 import org.tizen.dynamicanalyzer.ui.memory.data.MemoryDataManager;
+import org.tizen.dynamicanalyzer.ui.memory.table.MemoryAllocationTraceTable;
+import org.tizen.dynamicanalyzer.ui.memory.table.MemoryStatisticsTable;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
 import org.tizen.dynamicanalyzer.ui.page.PageInfoRegistry;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineTableView;
@@ -57,27 +61,27 @@ public class MemoryPage extends DAPageComposite {
        public static final String mapViewID = MemoryMapView.class.getName();
        public static final String allocationtraceViewID = MemoryAllocationTraceTableView.class.getName();
 
-       
-       SashForm baseForm;              
+       SashForm baseForm;
        SashForm topForm;
        SashForm bottomForm;
        SashForm bottomRightForm;
        SashForm bottomLeftForm;
-       
+
        private DATabComposite memoryTabView = null;
 
        MemoryChartView memoryChartView;
        MemoryDetailsTableView memoryDetailsTableView;
+       MemoryRangeAnalysisView memoryRangeAnalysisView;
        MemoryStatisticsTableView memoryStatisticsTableView;
        MemoryAllocationTraceTableView memoryAllocationTraceTableView;
        MemoryMapView memoryMapView;
        MemoryCallStackView memoryCallStackView;
-       
+
        boolean isDetailMode = true;
-       
+
        int tableHeight = -1;
        int tableWeight = 65;
-       
+
        boolean wasSashCreated = false;
 
        public MemoryPage(Composite parent, int style) {
@@ -112,11 +116,17 @@ public class MemoryPage extends DAPageComposite {
                        memoryTabView.addView(memoryDetailsTableView, false);
                        addView(memoryDetailsTableView);
                        
+                       memoryRangeAnalysisView = new MemoryRangeAnalysisView(memoryTabView.getContentComposite(), SWT.NONE);
+                       memoryTabView.addView(memoryRangeAnalysisView, true);
+                       addView(memoryRangeAnalysisView);
+
                        memoryStatisticsTableView = new MemoryStatisticsTableView(memoryTabView.getContentComposite(), SWT.NONE);
                        memoryTabView.addView(memoryStatisticsTableView, false);
                        addView(memoryStatisticsTableView);
 
                        memoryAllocationTraceTableView = new MemoryAllocationTraceTableView(memoryTabView.getContentComposite(), SWT.NONE);
+                       ((MemoryAllocationTraceTable) memoryAllocationTraceTableView.getControl())
+                                       .getTable().addSelectionListener(new AllocationTraceSelectionListener(this));
                        memoryTabView.addView(memoryAllocationTraceTableView, false);
                        addView(memoryAllocationTraceTableView);
                }
@@ -143,6 +153,20 @@ public class MemoryPage extends DAPageComposite {
                bottomForm.setWeights(new int[] { tableWeight, 100 - tableWeight });
                
                addTableWeightListener();
+
+               MemoryChartBoard chartBoard = (MemoryChartBoard) memoryChartView.getChartBoard();
+               Grid statisticsGrid = ((MemoryStatisticsTable) memoryStatisticsTableView.getControl()).getTable();
+               MemoryStatisticsTable statisticsTable = (MemoryStatisticsTable) memoryStatisticsTableView.getControl();
+
+               chartBoard.addSelectionListener(new HeapChartsSelectionListener(statisticsGrid));
+               
+               StatisticsSelectionListener statisticsSelectionListener = new StatisticsSelectionListener(chartBoard);
+               StatisticsSortListener statisticsSortListener = new StatisticsSortListener(chartBoard);
+               statisticsGrid.addSelectionListener(statisticsSelectionListener);
+               statisticsTable.addListener(AnalyzerConstants.TREE_SORT_EVENT, statisticsSortListener);
+
+               memoryRangeAnalysisView.setStatisticsSelectionListener(statisticsSelectionListener);
+               memoryRangeAnalysisView.setStatisticsSortListener(statisticsSortListener);
        }
        
        private void addHeightWeightListener() {
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryRangeAnalysisView.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/MemoryRangeAnalysisView.java
new file mode 100644 (file)
index 0000000..f63cf02
--- /dev/null
@@ -0,0 +1,493 @@
+package org.tizen.dynamicanalyzer.ui.memory;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.nebula.widgets.grid.Grid;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.DAState;
+import org.tizen.dynamicanalyzer.nl.MemoryPageLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.memory.table.MemoryStatisticsTable;
+import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.IEventListener;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.MarkerAddEvent;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.MarkerEvent;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.MarkerEventType;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.MarkerPositionUpdateEvent;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.MarkerRemoveEvent;
+
+/**
+ * This view represents UI container for statistics table corresponding to
+ * ranges between timeline markers. Number of ranges is always greater by one
+ * than number of markers.
+ */
+public class MemoryRangeAnalysisView extends DAViewComposite {
+
+       public static final String ID = MemoryRangeAnalysisView.class.getName();
+       private static int childCompositeStyle = SWT.NONE | SWT.BORDER;
+
+       /**
+        * Margin height for child composites.
+        */
+       private static final int CHILD_MARGIN_HEIGHT = 5;
+
+       /**
+        * Scrollable area composite, parent of {@link #content}.
+        */
+       private ScrolledComposite scrolledComposite;
+
+       /**
+        * Main content composite.
+        */
+       private Composite content;
+
+       /**
+        * Ordered range composites.
+        */
+       private List<ExpandableMemoryRangeComposite> rangeComposites = new LinkedList<>();
+
+       /**
+        * Persistent range composite to reflect residual range.
+        */
+       private ExpandableMemoryRangeComposite lastRangeComposite;
+
+       /**
+        * Currently focused composite.
+        */
+       private ExpandableMemoryRangeComposite focusedComposite = null;
+
+       /**
+        * Stub to display when there are no markers exist.
+        */
+       private Label noRangesLabel;
+
+       /**
+        * Listener for selection events of child statistics tables.
+        */
+       private StatisticsSelectionListener statisticsSelectionListener;
+
+       /**
+        * Listener for sort event of child statistics tables.
+        */
+       private StatisticsSortListener statisticsSortListener;
+
+       /**
+        * Saved state from last update.
+        */
+       private DAState lastUpdateState;
+
+       /**
+        * Listener for marker events to reflect correspondingly on range changes.
+        */
+       private class MarkerEventsListener implements IEventListener {
+               @Override
+               public void handleEvent(MarkerEvent event) {
+                       switch (event.getType()) {
+                       case MARKER_CLEAR:
+                               removeAllRangeComposites();
+                               break;
+                       case MARKER_ADD:
+                               MarkerAddEvent addEvent = (MarkerAddEvent) event;
+                               createRangeComposite(addEvent.getIdx());
+                               break;
+                       case MARKER_REMOVE:
+                               MarkerRemoveEvent removeEvent = (MarkerRemoveEvent) event;
+                               removeRangeComposite(removeEvent.getIdx());
+                               break;
+                       case MARKER_POSITION_UPDATE:
+                               MarkerPositionUpdateEvent updateEvent = (MarkerPositionUpdateEvent) event;
+                               updateRangeCompositePosition(updateEvent.getOldIdx(),
+                                               updateEvent.getNewIdx());
+                               break;
+                       default:
+                               break;
+                       }
+
+                       if (event.getType() != MarkerEventType.MARKER_TIME_UPDATE) {
+                               recalculateScrollArea();
+                       }
+               }
+       }
+
+       /**
+        * Update neighbor composites attachments to each other.
+        *
+        * @param pos position of composite to update neighborhood
+        */
+       private void updateLayoutData(int pos) {
+               Composite current = rangeComposites.get(pos);
+               FormData currentData = new FormData();
+
+               currentData.left = new FormAttachment(0);
+               currentData.right = new FormAttachment(100);
+
+               if (pos > 0) {
+                       currentData.top = new FormAttachment(rangeComposites.get(pos - 1),
+                                       CHILD_MARGIN_HEIGHT);
+               } else {
+                       currentData.top = new FormAttachment(0, CHILD_MARGIN_HEIGHT);
+               }
+
+               current.setLayoutData(currentData);
+
+               if (pos + 1 < rangeComposites.size()) {
+                       Composite nextComposite = rangeComposites.get(pos + 1);
+                       FormData nextData = (FormData) nextComposite.getLayoutData();
+                       nextData.top = new FormAttachment(current, CHILD_MARGIN_HEIGHT);
+                       nextComposite.setLayoutData(nextData);
+               }
+       }
+
+       /**
+        * Recalculate scroll composite area to show appropriate bars.
+        */
+       private void recalculateScrollArea() {
+               content.layout();
+               int width = scrolledComposite.getClientArea().width;
+               scrolledComposite.setMinSize(content.computeSize(width, SWT.DEFAULT));
+       }
+
+       /**
+        * Setup listeners on specific events from child.
+        */
+       private void setupChildCompositeListeners(ExpandableMemoryRangeComposite child) {
+               child.addExpansionListener(new ExpansionAdapter() {
+                       @Override
+                       public void expansionStateChanged(ExpansionEvent e) {
+                               recalculateScrollArea();
+                       }
+               });
+
+               Listener eventListener = new Listener() {
+                       @Override
+                       public void handleEvent(Event event) {
+                               recalculateScrollArea();
+                       }
+               };
+
+               MemoryStatisticsTable table = child.getMemoryTable();
+               table.getTable().addListener(SWT.Collapse, eventListener);
+               table.getTable().addListener(SWT.Expand, eventListener);
+
+               if (statisticsSelectionListener != null) {
+                       table.getTable().addSelectionListener(statisticsSelectionListener);
+               }
+
+               if (statisticsSortListener != null) {
+                       table.addListener(AnalyzerConstants.TREE_SORT_EVENT,
+                                       statisticsSortListener);
+               }
+       }
+
+       /**
+        * Set expanded state for range composite and bring focus to it.
+        *
+        * @param composite expandable composite to manipulate on
+        */
+       private void focusRangeComposite(ExpandableMemoryRangeComposite composite) {
+               composite.setExpanded(true);
+               recalculateScrollArea();
+               scrolledComposite.showControl(composite);
+
+               if (focusedComposite != null && !focusedComposite.isDisposed()) {
+                       focusedComposite.setBackground(ColorResources.WHITE);
+               }
+
+               focusedComposite = composite;
+
+               composite.setBackground(ColorResources.TABLE_HEADER_BG);
+               composite.setFocus();
+       }
+
+       /**
+        * Create new range composite in specified position.
+        *
+        * @param pos position of a new range composite
+        */
+       private void createRangeComposite(int pos) {
+               ExpandableMemoryRangeComposite newComposite = new ExpandableMemoryRangeComposite(
+                               content,
+                               childCompositeStyle);
+               setupChildCompositeListeners(newComposite);
+
+               rangeComposites.add(pos, newComposite);
+
+               for (int i = pos; i < rangeComposites.size(); i++) {
+                       rangeComposites.get(i).setIndex(i);
+               }
+
+               // next composite always exists
+               ExpandableMemoryRangeComposite next = rangeComposites.get(pos + 1);
+               newComposite.moveAbove(next);
+               newComposite.updateRange();
+               next.updateRange();
+
+               updateLayoutData(pos);
+               noRangesLabel.setVisible(false);
+
+               focusRangeComposite(newComposite);
+       }
+
+       /**
+        * Update position of range composite.
+        *
+        * @param oldPos position of composite before update
+        * @param newPos position of composite after update
+        */
+       private void updateRangeCompositePosition(int oldPos, int newPos) {
+               if (newPos == oldPos) {
+                       rangeComposites.get(newPos).updateRange();
+                       rangeComposites.get(newPos + 1).updateRange();
+
+                       updateLayoutData(newPos);
+               } else {
+                       ExpandableMemoryRangeComposite toMove = rangeComposites.get(oldPos);
+                       ExpandableMemoryRangeComposite oldNext = rangeComposites
+                                       .get(oldPos + 1);
+
+                       rangeComposites.remove(oldPos);
+                       rangeComposites.add(newPos, toMove);
+
+                       // next composite always exists
+                       ExpandableMemoryRangeComposite newNext = rangeComposites
+                                       .get(newPos + 1);
+                       toMove.moveAbove(newNext);
+
+                       for (int i = Math.min(oldPos, newPos); i <= Math
+                                       .max(oldPos, newPos); i++) {
+                               rangeComposites.get(i).setIndex(i);
+                       }
+
+                       toMove.updateRange();
+                       oldNext.updateRange();
+                       newNext.updateRange();
+
+                       updateLayoutData(oldPos);
+                       updateLayoutData(newPos);
+               }
+
+               focusRangeComposite(rangeComposites.get(newPos));
+       }
+
+       /**
+        * Remove all child ranges except last.
+        */
+       private void removeAllRangeComposites() {
+               for (ExpandableMemoryRangeComposite composite : rangeComposites) {
+                       if (composite != lastRangeComposite)
+                               composite.dispose();
+               }
+
+               rangeComposites.clear();
+
+               rangeComposites.add(lastRangeComposite);
+               lastRangeComposite.setIndex(0);
+               lastRangeComposite.updateRange();
+
+               noRangesLabel.setVisible(true);
+               focusedComposite = null;
+       }
+
+       /**
+        * Remove range composite from specified position.
+        *
+        * @param pos position of composite to remove
+        */
+       private void removeRangeComposite(int pos) {
+               rangeComposites.get(pos).dispose();
+               rangeComposites.remove(pos);
+
+               for (int i = pos; i < rangeComposites.size(); i++) {
+                       rangeComposites.get(i).setIndex(i);
+               }
+
+               // next composite always exists
+               ExpandableMemoryRangeComposite nextComposite = rangeComposites.get(pos);
+               nextComposite.updateRange();
+
+               updateLayoutData(pos);
+               if (rangeComposites.size() == 1) {
+                       noRangesLabel.setVisible(true);
+               }
+
+               // if next composite is last
+               if (nextComposite == lastRangeComposite) {
+                       // then focus on previous range
+                       if (pos - 1 >= 0) {
+                               focusRangeComposite(rangeComposites.get(pos - 1));
+                       }
+               } else {
+                       // otherwise focus on next
+                       focusRangeComposite(nextComposite);
+               }
+       }
+
+       /**
+        * Set selection listener for statistics tables.
+        * This method removes previous listener if any was set.
+        */
+       public void setStatisticsSelectionListener(StatisticsSelectionListener listener) {
+               if (statisticsSelectionListener == listener)
+                       return;
+
+               for (ExpandableMemoryRangeComposite child : rangeComposites) {
+                       Grid table = child.getMemoryTable().getTable();
+
+                       if (statisticsSelectionListener != null) {
+                               table.removeSelectionListener(statisticsSelectionListener);
+                       }
+
+                       if (listener != null) {
+                               table.addSelectionListener(listener);
+                       }
+               }
+               statisticsSelectionListener = listener;
+       }
+
+       /**
+        * Set sort listener for statistics tables.
+        * This method removes previous listener if any was set.
+        */
+       public void setStatisticsSortListener(StatisticsSortListener listener) {
+               if (statisticsSortListener == listener)
+                       return;
+
+               for (ExpandableMemoryRangeComposite child : rangeComposites) {
+                       MemoryStatisticsTable table = child.getMemoryTable();
+
+                       if (statisticsSortListener != null) {
+                               table.removeListener(AnalyzerConstants.TREE_SORT_EVENT,
+                                               statisticsSortListener);
+                       }
+
+                       if (listener != null) {
+                               table.addListener(AnalyzerConstants.TREE_SORT_EVENT, listener);
+                       }
+               }
+               statisticsSortListener = listener;
+       }
+
+       /**
+        * Hide and set zero size for range composite.
+        *
+        * @param pos position of composite to hide
+        */
+       private void hideRangeComposite(int pos) {
+               Composite composite = rangeComposites.get(pos);
+
+               FormData formData = new FormData();
+               formData.top = new FormAttachment(0);
+               formData.right = new FormAttachment(0);
+               formData.bottom = new FormAttachment(0);
+               formData.left = new FormAttachment(0);
+
+               composite.setLayoutData(formData);
+               composite.setVisible(false);
+               recalculateScrollArea();
+       }
+
+       /**
+        * Show and restore layout data for range composite.
+        *
+        * @param pos positions of composite to show
+        */
+       private void showRangeComposite(int pos) {
+               Composite composite = rangeComposites.get(pos);
+               composite.setVisible(true);
+               updateLayoutData(pos);
+               recalculateScrollArea();
+       }
+
+       /**
+        * View constructor.
+        *
+        * @param parent parent composite where this view should be placed
+        * @param style SWT composite style
+        */
+       public MemoryRangeAnalysisView(Composite parent, int style) {
+               super(parent, style, false);
+
+               MarkerManager.INSTANCE.addEventListener(new MarkerEventsListener());
+
+               setLayout(new FillLayout(SWT.VERTICAL));
+               setTitle(MemoryPageLabels.MEMORY_RANGE_ANALYSIS_VIEW_TITLE);
+
+               // setup content area
+               final Composite viewContentArea = getContentArea();
+               viewContentArea.setLayout(new FillLayout(SWT.VERTICAL));
+
+               scrolledComposite = new ScrolledComposite(viewContentArea, SWT.V_SCROLL);
+               scrolledComposite.setBackgroundMode(SWT.INHERIT_DEFAULT);
+               scrolledComposite.setBackground(ColorResources.WHITE);
+               content = new Composite(scrolledComposite, SWT.NONE);
+               content.setLayout(new FormLayout());
+               scrolledComposite.setContent(content);
+               scrolledComposite.setExpandHorizontal(true);
+               scrolledComposite.setExpandVertical(true);
+               scrolledComposite.addListener(SWT.Resize, new Listener() {
+                       @Override
+                       public void handleEvent(Event event) {
+                               recalculateScrollArea();
+                       }
+               });
+
+               // create persistent composite
+               lastRangeComposite = new ExpandableMemoryRangeComposite(content,
+                               childCompositeStyle);
+               rangeComposites.add(lastRangeComposite);
+               setupChildCompositeListeners(lastRangeComposite);
+               hideRangeComposite(0);
+
+               // create stub label
+               noRangesLabel = new Label(content, SWT.NONE);
+               noRangesLabel.setText(
+                               MemoryPageLabels.MEMORY_RANGE_ANALYSIS_VIEW_NO_RANGES_LABEL);
+               noRangesLabel.setFont(FontResources.TABLE_HEADER_FONT);
+
+               FormData labelData = new FormData();
+               labelData.top = new FormAttachment(0, CHILD_MARGIN_HEIGHT);
+               labelData.left = new FormAttachment(0, CHILD_MARGIN_HEIGHT);
+               labelData.right = new FormAttachment(100);
+               noRangesLabel.setLayoutData(labelData);
+       }
+
+       @Override
+       public void updateView() {
+               DAState currentState = DAState.getCurrentState();
+               if (currentState == lastUpdateState)
+                       return;
+
+               // check trace data is not fully collected
+               if (currentState != DAState.DONE) {
+                       // hide last range
+                       hideRangeComposite(rangeComposites.size() - 1);
+
+                       // show label if no other ranges exist
+                       noRangesLabel.setVisible(rangeComposites.size() == 1);
+               } else {
+                       lastRangeComposite.setIndex(rangeComposites.size() - 1);
+                       lastRangeComposite.updateRange();
+                       showRangeComposite(rangeComposites.size() - 1);
+
+                       noRangesLabel.setVisible(false);
+               }
+
+               recalculateScrollArea();
+               lastUpdateState = currentState;
+       }
+}
index 5fe1b51..d67d31b 100644 (file)
@@ -52,9 +52,6 @@ public class MemoryStatisticsTableView extends DAViewComposite {
        private boolean tableVisible;
 
        private MemoryStatisticsTable tableComp = null;
-       
-       private boolean[] columnVisibilityEnable = { true, true, true, true, true, true, true, false };
-       private boolean[] columnVisibilityDisable = { false, false, false, false, false, false, false, true };
 
        public MemoryStatisticsTableView(Composite parent, int style) {
                super(parent, style, false);
@@ -67,7 +64,7 @@ public class MemoryStatisticsTableView extends DAViewComposite {
                                | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
                
 
-               tableComp.setColumnVisibility(columnVisibilityEnable);
+               tableComp.setColumnVisibilityState(true);
                
                tableUpdate = false;
                tableVisible = false;
@@ -92,11 +89,11 @@ public class MemoryStatisticsTableView extends DAViewComposite {
                }
                
                if(tableVisible == true) {
-                       tableComp.setColumnVisibility(columnVisibilityEnable);
+                       tableComp.setColumnVisibilityState(true);
                }
                else {
                        tableComp.clear();
-                       tableComp.setColumnVisibility(columnVisibilityDisable);
+                       tableComp.setColumnVisibilityState(false);
                }
                
                if(tableUpdate == true) {
@@ -119,7 +116,7 @@ public class MemoryStatisticsTableView extends DAViewComposite {
                        
                        if(DAState.isRunning()) {
                                tableVisible = false;
-                               tableComp.setColumnVisibility(columnVisibilityDisable);
+                               tableComp.setColumnVisibilityState(false);
                                return;
                        }
                }
@@ -134,11 +131,11 @@ public class MemoryStatisticsTableView extends DAViewComposite {
                }
 
                if(tableVisible == true) {
-                       tableComp.setColumnVisibility(columnVisibilityEnable);
+                       tableComp.setColumnVisibilityState(true);
                }
                else {
                        tableComp.clear();
-                       tableComp.setColumnVisibility(columnVisibilityDisable);
+                       tableComp.setColumnVisibilityState(false);
                }
 
                tableComp.updateTable();
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/StatisticsSelectionListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/StatisticsSelectionListener.java
new file mode 100644 (file)
index 0000000..33055c6
--- /dev/null
@@ -0,0 +1,125 @@
+package org.tizen.dynamicanalyzer.ui.memory;
+
+import org.eclipse.nebula.widgets.grid.Grid;
+import org.eclipse.nebula.widgets.grid.GridItem;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.tizen.dynamicanalyzer.nl.MemoryPageLabels;
+import org.tizen.dynamicanalyzer.ui.memory.chart.MemoryChart;
+import org.tizen.dynamicanalyzer.ui.memory.chart.MemoryChartBoard;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
+
+/**
+ * StatisticsSelectionListener class represents listener for selection event in
+ * MemoryStatisticsTable.
+ */
+public class StatisticsSelectionListener extends SelectionAdapter {
+
+       private MemoryChartBoard chartBoard = null;
+
+       public StatisticsSelectionListener(MemoryChartBoard chartBoard) {
+               this.chartBoard = chartBoard;
+       }
+
+       /**
+        * Selection event handler.
+        */
+       public void widgetSelected(SelectionEvent e) {
+               if (chartBoard == null || !(e.widget instanceof Grid))
+                       return;
+
+               Grid grid = (Grid) e.widget;
+               int index = grid.getSelectionIndex();
+               if (index < 0)
+                       return;
+
+               GridItem gridItem = grid.getItem(index);
+               if (gridItem == null)
+                       return;
+
+               if (gridItem.getParentItem() != null)
+                       // library entry is selected
+                       selectLibraryChart(gridItem);
+               else
+                       // PID or Total entry is selected
+                       selectPidChart(gridItem);
+       }
+
+       /**
+        * Selects heap allocation chart for library by data from given
+        * {@link GridItem}.
+        * 
+        * @param gridItem
+        *            selected library item in Statistics table.
+        */
+       private void selectLibraryChart(GridItem gridItem) {
+               DATableDataFormat pidData = (DATableDataFormat) gridItem.getParentItem().getData();
+               DATableDataFormat libData = (DATableDataFormat) gridItem.getData();
+
+               String pidStr = (String) pidData.getData().get(0);
+               if (!CommonUtil.isNumeric(pidStr))
+                       // Child of Total entry - nothing to select
+                       return;
+
+               int pid = Integer.parseInt(pidStr);
+               String libName = (String) libData.getData().get(0);
+               libName = chartBoard.getChartName(libName);
+
+               DAChartBoardItem pidItem = null;
+               int pidChartIndex = 0;
+
+               // Search for necessary PID chart
+               for (MemoryChart chart : chartBoard.getMemoryChartList()) {
+                       DAChartBoardItem item = chart.getChartItem();
+
+                       if (chart.getChartName().equals(MemoryPageLabels.MEMORY_CHART_HEAP_MEMORY) && chart.getPid() == pid) {
+                               item.unFoldChild();
+                               pidItem = item;
+                               pidChartIndex = chartBoard.getItemList().indexOf(item);
+                       }
+               }
+
+               if (pidItem == null)
+                       return;
+
+               // Search and select library chart under found PID chart
+               for (MemoryChart chart : chartBoard.getMemoryChartList()) {
+                       DAChartBoardItem item = chart.getChartItem();
+
+                       if (chart.getPid() == pid && chart.getChartName().equals(libName)) {
+                               int libChartIndex = pidItem.getChildItemList().indexOf(item);
+                               chartBoard.selectItem(pidChartIndex, libChartIndex);
+                               return;
+                       }
+               }
+       }
+
+       /**
+        * Selects heap allocation chart for PID by data from given
+        * {@link GridItem}.
+        * 
+        * @param gridItem
+        *            selected PID item in Statistics table.
+        */
+       private void selectPidChart(GridItem gridItem) {
+               DATableDataFormat pidData = (DATableDataFormat) gridItem.getData();
+               String pidStr = (String) pidData.getData().get(0);
+               if (!CommonUtil.isNumeric(pidStr))
+                       // Total entry - nothing to select
+                       return;
+
+               int pid = Integer.parseInt(pidStr);
+
+               for (MemoryChart chart : chartBoard.getMemoryChartList()) {
+                       DAChartBoardItem item = chart.getChartItem();
+
+                       if (chart.getChartName().equals("Heap Allocation") && chart.getPid() == pid) {
+                               int pidChartIndex = chartBoard.getItemList().indexOf(item);
+                               chartBoard.selectItem(pidChartIndex);
+                               return;
+                       }
+               }
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/StatisticsSortListener.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/memory/StatisticsSortListener.java
new file mode 100644 (file)
index 0000000..2dc33e6
--- /dev/null
@@ -0,0 +1,141 @@
+package org.tizen.dynamicanalyzer.ui.memory;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.nebula.widgets.grid.GridItem;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.nl.MemoryPageLabels;
+import org.tizen.dynamicanalyzer.ui.memory.chart.MemoryChart;
+import org.tizen.dynamicanalyzer.ui.memory.chart.MemoryChartBoard;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
+import org.tizen.dynamicanalyzer.util.Logger;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItemList;
+
+/**
+ * StatisticsSortListener class represents listener for sort events in
+ * {@link MemoryStatisticsTable}.
+ */
+public class StatisticsSortListener implements Listener {
+
+       private MemoryChartBoard chartBoard = null;
+       private Map<String, Map<String, DAChartBoardItem>> itemMap = new HashMap<String, Map<String, DAChartBoardItem>>();
+
+       public StatisticsSortListener(MemoryChartBoard chartBoard) {
+               this.chartBoard = chartBoard;
+       }
+
+       @Override
+       public void handleEvent(Event event) {
+               if (event.type != AnalyzerConstants.TREE_SORT_EVENT || chartBoard == null)
+                       return;
+
+               // Prepare items lookup table
+               itemMap.clear();
+               for (MemoryChart chart : chartBoard.getMemoryChartList()) {
+                       String chartName = chart.getChartName();
+                       String pidStr = Integer.toString(chart.getPid());
+
+                       if (!itemMap.containsKey(pidStr))
+                               itemMap.put(pidStr, new HashMap<String, DAChartBoardItem>());
+
+                       itemMap.get(pidStr).put(chartName, chart.getChartItem());
+               }
+
+               DAChartBoardItemList pidList = chartBoard.getItemList();
+
+               // lists wiht new chart indices
+               List<Integer> pidSortList = new ArrayList<Integer>();
+               Map<String, List<Integer>> libSortMap = new HashMap<String, List<Integer>>();
+
+               // add 'System Memory' chart first if there is one
+               if (itemMap.containsKey("0")) {
+                       DAChartBoardItem systemItem = itemMap.get("0").get(MemoryPageLabels.MEMORY_CHART_SYSTEM_MEMORY);
+                       if (systemItem != null)
+                               pidSortList.add(pidList.indexOf(systemItem));
+               }
+
+               // for each row in Statistics table
+               for (GridItem gridItem : (GridItem[]) event.data) {
+                       DATableDataFormat data = (DATableDataFormat) gridItem.getData();
+                       String entryName = chartBoard.getChartName((String) data.getData().get(0));
+
+                       if (CommonUtil.isNumeric(entryName)) {
+                               // PID
+
+                               if (!itemMap.containsKey(entryName)) {
+                                       Logger.warning("Charts for PID#" + entryName + " are missing! Nothing to sort.");
+                                       return;
+                               }
+
+                               // 'ProcessMemory' chart
+                               DAChartBoardItem pidItem = itemMap.get(entryName).get(MemoryPageLabels.MEMORY_CHART_PROCESS_MEMORY);
+                               if (pidItem != null)
+                                       pidSortList.add(pidList.indexOf(pidItem));
+
+                               // 'Heap Memory' chart
+                               pidItem = itemMap.get(entryName).get(MemoryPageLabels.MEMORY_CHART_HEAP_MEMORY);
+                               if (pidItem != null)
+                                       pidSortList.add(pidList.indexOf(pidItem));
+
+                       } else {
+                               // not PID
+                               if (gridItem.getParentItem() == null)
+                                       // Total entry or something else
+                                       continue;
+
+                               // library
+                               DATableDataFormat pidData = (DATableDataFormat) gridItem.getParentItem().getData();
+                               String pidStr = (String) pidData.getData().get(0);
+                               if (!CommonUtil.isNumeric(pidStr))
+                                       // Child of total entry
+                                       continue;
+
+                               if (!itemMap.containsKey(pidStr)) {
+                                       Logger.warning("Charts for PID#" + pidStr + " are missing! Nothing to sort.");
+                                       return;
+                               }
+
+                               DAChartBoardItem pidItem = itemMap.get(pidStr).get(MemoryPageLabels.MEMORY_CHART_HEAP_MEMORY);
+                               DAChartBoardItem libItem = itemMap.get(pidStr).get(entryName);
+                               if (pidItem == null || libItem == null)
+                                       // Should not normally occur
+                                       continue;
+
+                               DAChartBoardItemList libList = pidItem.getChildItemList();
+
+                               if (!libSortMap.containsKey(pidStr))
+                                       libSortMap.put(pidStr, new ArrayList<Integer>());
+
+                               int libIndex = libList.indexOf(libItem);
+                               if (libIndex >= 0)
+                                       libSortMap.get(pidStr).add(libIndex);
+                       }
+               }
+
+               // sort pid charts
+               pidList.reArrangeItem(pidSortList.toArray(new Integer[0]));
+               pidList.layout(true, true);
+
+               // sort library charts
+               for (int i = 0; i < pidList.getItemSize(); i++) {
+                       DAChartBoardItem pidItem = pidList.get(i);
+                       MemoryChart chart = chartBoard.getChart(pidItem);
+                       if (!chart.getChartName().equals(MemoryPageLabels.MEMORY_CHART_HEAP_MEMORY))
+                               continue;
+
+                       String pidStr = Integer.toString(chart.getPid());
+                       DAChartBoardItemList children = pidItem.getChildItemList();
+                       if (children != null && libSortMap.containsKey(pidStr)) {
+                               children.reArrangeItem(libSortMap.get(pidStr).toArray(new Integer[0]));
+                               children.layout(true, true);
+                       }
+               }
+       }
+}
index e93d794..332b85c 100644 (file)
@@ -30,9 +30,11 @@ import java.util.List;
 import java.util.Map;\r
 \r
 import org.tizen.dynamicanalyzer.common.Global;\r
+import org.tizen.dynamicanalyzer.nl.MemoryPageLabels;\r
 import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;\r
 import org.tizen.dynamicanalyzer.resources.ColorResources;\r
 import org.tizen.dynamicanalyzer.resources.ImageResources;\r
+import org.tizen.dynamicanalyzer.ui.memory.data.MemAllocDBTable;\r
 import org.tizen.dynamicanalyzer.ui.memory.data.ProcessMemoryDBTable;\r
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;\r
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;\r
@@ -45,6 +47,8 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;\r
 \r
 public class HeapMemoryChart extends MemoryChart {\r
+       private static final double PERSISTENT_SAMPLING_TIME = 0.5;\r
+\r
        private Map<Integer, Map<Integer, DAChartSeries>> seriesPerProcessMap = \r
                        new HashMap<Integer, Map<Integer, DAChartSeries>>();\r
        \r
@@ -55,10 +59,14 @@ public class HeapMemoryChart extends MemoryChart {
        \r
        private int libId;\r
        private String libName;\r
+       private double endTime = 0;\r
        \r
        private DAChartSeries totalSeries;\r
        private DAChartSeries appSeries;\r
        \r
+       private DAChartSeries totalSeriesPersistent;\r
+       private DAChartSeries appSeriesPersistent;\r
+\r
        public String getLibName() {\r
                return libName;\r
        }\r
@@ -85,23 +93,31 @@ public class HeapMemoryChart extends MemoryChart {
                \r
                if(libId == appAllocSeriesID) {\r
                        totalSeries = new DAChartSeries(\r
-                                       TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION,\r
+                                       String.format(TimelineChartLabels.HEAP_CHART_SERIES_NAME_PROCESS,\r
+                                                       TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION),\r
                                        DAChartSeries.SERIES_STYLE_AREA, ColorResources.CHART_SERIES_YELLOW);\r
                        chart.addSeries(totalSeries);\r
+\r
+                       totalSeriesPersistent = new DAChartSeries(\r
+                                       String.format(TimelineChartLabels.HEAP_CHART_SERIES_NAME_PROCESS,\r
+                                                       TimelineChartLabels.HEAP_CHART_SERIES_NAME_PERSISTENT),\r
+                                       DAChartSeries.SERIES_STYLE_AREA, ColorResources.CHART_SERIES_ORANGE);\r
                }\r
                \r
+               String template = "%s";\r
+               if (libName.equals(MemoryPageLabels.MEMORY_MAIN_EXCUTABLE))\r
+                       template = libName + " %s";\r
+\r
                appSeries = new DAChartSeries(\r
-                               getLibName(libName),\r
+                               String.format(template, TimelineChartLabels.HEAP_CHART_SERIES_NAME_TOTAL_ALLOCATION),\r
                                DAChartSeries.SERIES_STYLE_AREA, ColorResources.CHART_SERIES_YELLOW, 0.5);\r
                chart.addSeries(appSeries);\r
+\r
+               appSeriesPersistent = new DAChartSeries(\r
+                               String.format(template, TimelineChartLabels.HEAP_CHART_SERIES_NAME_PERSISTENT),\r
+                               DAChartSeries.SERIES_STYLE_AREA, ColorResources.CHART_SERIES_ORANGE, 0.5);\r
        }\r
-       \r
-       private String getLibName(String libPath) {\r
-               int index = libPath.lastIndexOf("/");\r
-               \r
-               return libPath.substring(index+1);\r
-       }\r
-       \r
+\r
        @Override\r
        public void inputChartSeries(List<Object> dataList) {\r
                if(totalSeries != null) {\r
@@ -109,6 +125,8 @@ public class HeapMemoryChart extends MemoryChart {
                }\r
                appSeries.clear();\r
                \r
+               endTime = 0;\r
+\r
                if(Global.getProject() == null) {\r
                        return;\r
                }\r
@@ -130,6 +148,11 @@ public class HeapMemoryChart extends MemoryChart {
                        return;\r
                }\r
                \r
+               // Add starting points\r
+               appSeries.addSeriesItem(new DAChartSeriesItem(0, 0, Formatter.toByteFormat(0)));\r
+               if (totalSeries != null)\r
+                       totalSeries.addSeriesItem(new DAChartSeriesItem(0, 0, Formatter.toByteFormat(0)));\r
+\r
                for(int i = 0; i < processData.size(); i++) {\r
                        List<Object> row = processData.get(i);\r
                        double time = (Long) row.get(ProcessMemoryDBTable.COLUMN.SAMPLING_TIME.index)\r
@@ -158,6 +181,8 @@ public class HeapMemoryChart extends MemoryChart {
                                totalSeries.addSeriesItem(new DAChartSeriesItem(time, totalAlloc, Formatter\r
                                                .toByteFormat(totalAlloc)));\r
                        }\r
+\r
+                       endTime = endTime < time ? time : endTime;\r
                }\r
        }\r
        \r
@@ -180,4 +205,109 @@ public class HeapMemoryChart extends MemoryChart {
                        childBoardItemList.get(i).dispose();\r
                }\r
        }\r
+\r
+       /**\r
+        * Updates Persistent Memory Series with provided <code>data</code>.\r
+        *\r
+        * @param data list of data about persistent allocations from MEM_ALLOC_DB\r
+        *            table.\r
+        */\r
+       public void updatePersistentSeries(List<List<Object>> data) {\r
+               appSeriesPersistent.clear();\r
+               if (totalSeriesPersistent != null)\r
+                       totalSeriesPersistent.clear();\r
+\r
+               long appSize = 0;\r
+               long totalSize = 0;\r
+               double prevTime = -1;\r
+\r
+               // draw starting points\r
+               addPersistentSeries(0, appSize, totalSize);\r
+\r
+               // for each row in data\r
+               for (List<Object> row : data) {\r
+                       // get time in seconds (microseconds / 1000000.0)\r
+                       double time = (long) row.get(MemAllocDBTable.COLUMN.ALLOCATED_TIME.index) / TimelineConstants.MEGA_DOUBLE;\r
+                       long size = (long) row.get(MemAllocDBTable.COLUMN.ALLOCATED_MEMORY_SIZE.index);\r
+                       int libId = (int) row.get(MemAllocDBTable.COLUMN.CALLER_LIBRARY_ID.index);\r
+                       int pid = (int) row.get(MemAllocDBTable.COLUMN.PID.index);\r
+\r
+                       // do not draw any excessive data\r
+                       if (time >= endTime)\r
+                               break;\r
+\r
+                       // nothing to draw\r
+                       if (pid != this.pid || size < 0)\r
+                               continue;\r
+\r
+                       // calculate new points\r
+                       totalSize += size;\r
+                       if (libId == this.libId)\r
+                               appSize += size;\r
+\r
+                       // do not draw points too close to each other\r
+                       if (time - prevTime < PERSISTENT_SAMPLING_TIME)\r
+                               continue;\r
+\r
+                       prevTime = time;\r
+\r
+                       addPersistentSeries(time, appSize, totalSize);\r
+               }\r
+\r
+               // draw ending points\r
+               addPersistentSeries(endTime, appSize, totalSize);\r
+       }\r
+\r
+       /**\r
+        * Adds items to application and total persistent series.\r
+        *\r
+        * @param time x-axis value\r
+        * @param appSize y-axis value for application series\r
+        * @param totalSize y-axis value for total series\r
+        */\r
+       private void addPersistentSeries(double time, double appSize, double totalSize) {\r
+               appSeriesPersistent.addSeriesItem(new DAChartSeriesItem(time, appSize, Formatter.toByteFormat(appSize)));\r
+\r
+               if (totalSeries != null)\r
+                       totalSeriesPersistent\r
+                                       .addSeriesItem(new DAChartSeriesItem(time, totalSize, Formatter.toByteFormat(totalSize)));\r
+       }\r
+\r
+       /**\r
+        * Shows Persistent Memory Series on chart.\r
+        */\r
+       public void showPersistentSeries() {\r
+               if (isVisiblePersistentSeries())\r
+                       return;\r
+\r
+               if (totalSeries != null)\r
+                       chart.addSeries(totalSeriesPersistent);\r
+               chart.addSeries(appSeriesPersistent);\r
+       }\r
+\r
+       /**\r
+        * Hides Persistent Memory Series from chart.\r
+        */\r
+       public void hidePersistentSeries() {\r
+               List<DAChartSeries> series = chart.getSeriesList();\r
+               series.remove(appSeriesPersistent);\r
+               if (totalSeries != null)\r
+                       series.remove(totalSeriesPersistent);\r
+       }\r
+\r
+       /**\r
+        * Checks whether Persistent Memory Series are visible in chart.\r
+        *\r
+        * @return <code>true</code> if visible.\r
+        */\r
+       public boolean isVisiblePersistentSeries() {\r
+               List<DAChartSeries> series = chart.getSeriesList();\r
+               if (series.contains(appSeriesPersistent)) {\r
+                       if (totalSeries == null)\r
+                               return true;\r
+                       return series.contains(totalSeries);\r
+               }\r
+\r
+               return false;\r
+       }\r
 }\r
index 29cdc7f..4081b16 100644 (file)
@@ -52,7 +52,7 @@ public class MemoryChart {
        protected Image addIcon;\r
        protected String pageID;\r
        protected DAPopupMenu popupMenu;\r
-       protected int pid;\r
+       protected int pid = 0;\r
        \r
        private List<MemoryChart> children = new ArrayList<MemoryChart>();\r
        \r
index 8f25aad..4b62b12 100644 (file)
@@ -31,6 +31,8 @@ import java.util.Map;
 import java.util.Set;\r
 \r
 import org.eclipse.swt.widgets.Composite;\r
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;\r
+import org.tizen.dynamicanalyzer.common.DAState;\r
 import org.tizen.dynamicanalyzer.common.Global;\r
 import org.tizen.dynamicanalyzer.nl.MemoryPageLabels;\r
 import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;\r
@@ -46,8 +48,10 @@ import org.tizen.dynamicanalyzer.ui.common.TimeLineChartKeyListener;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;\r
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;\r
 import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;\r
+import org.tizen.dynamicanalyzer.ui.memory.data.HeapDataManager;\r
 import org.tizen.dynamicanalyzer.ui.memory.data.MemoryDataManager;\r
 import org.tizen.dynamicanalyzer.ui.memory.data.ProcessMemoryDBTable;\r
+import org.tizen.dynamicanalyzer.ui.page.MenuBar;\r
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;\r
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;\r
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;\r
@@ -66,15 +70,16 @@ public class MemoryChartBoard extends DAChartBoard {
        private int preSelectedPID = -1;\r
        \r
        private final int appAllocSeriesID = -10;\r
-       private final String libNameMainExecutable = "Main Executable";\r
-       private final String libNameUnknown = "Unknown";\r
        \r
        private Set<String> targetChartList = null;\r
+       private List<List<Object>> persistentData = null;\r
+       private boolean showPersistentSeries = false;\r
        \r
        private List<MemoryChart> memoryChartList = new ArrayList<MemoryChart>();\r
        \r
        public MemoryChartBoard(Composite parent, String title, int boardStyle) {\r
                super(parent, title, boardStyle);\r
+               showPersistentSeries = MenuBar.getInstance().getPersistentMemoryChartsSelection();\r
        }\r
        \r
        public void initalizeChart() {\r
@@ -82,6 +87,21 @@ public class MemoryChartBoard extends DAChartBoard {
                initializeMemoryCharts();\r
        }\r
        \r
+       /**\r
+        * Shows or hides Persistent Memory series depending on <code>show</code>\r
+        * argument.\r
+        * \r
+        * @param show\r
+        *            whether Persistent Memory series are needed to be shown.\r
+        */\r
+       public void showPersistentSeries(boolean show) {\r
+               if (showPersistentSeries == show)\r
+                       return;\r
+\r
+               showPersistentSeries = show;\r
+               updateChartBoard();\r
+       }\r
+\r
        public List<MemoryChart> getMemoryChartList() {\r
                return memoryChartList;\r
        }\r
@@ -201,23 +221,23 @@ public class MemoryChartBoard extends DAChartBoard {
                        }\r
                }\r
        }\r
-       \r
+\r
        private String getLibNameByID(int id) {\r
                if(id == appAllocSeriesID) {\r
-                       return libNameMainExecutable;\r
+                       return MemoryPageLabels.MEMORY_MAIN_EXCUTABLE;\r
                }\r
                else {\r
                        Project project = Global.getProject();\r
                        BinaryInfo binaryInfo = project.getDeviceStatusInfo().getBinaryInfo(id);\r
-                       \r
+\r
                        if(binaryInfo == null) {\r
-                               return libNameUnknown;\r
+                               return AnalyzerConstants.UNKNOWN_LIB;\r
                        } else {\r
                                return binaryInfo.getTargetBinaryPath();\r
                        }\r
                }\r
        }\r
-       \r
+\r
        private boolean isExistSystemChart(){\r
                for(MemoryChart chart: memoryChartList) {\r
                        if(chart instanceof SystemMemoryChart) {\r
@@ -345,7 +365,7 @@ public class MemoryChartBoard extends DAChartBoard {
                memoryChartList.add(childHeapMemoryChart);\r
        }\r
        \r
-       private String getChartName(String libPath) {\r
+       public String getChartName(String libPath) {\r
                int index = libPath.lastIndexOf("/");\r
                \r
                if(index < 1) {\r
@@ -354,7 +374,15 @@ public class MemoryChartBoard extends DAChartBoard {
                        \r
                return libPath.substring(0, index) + "\n" + libPath.substring(index+1);\r
        }\r
-       \r
+\r
+       public MemoryChart getChart(DAChartBoardItem item) {\r
+               for (MemoryChart chart : memoryChartList)\r
+                       if (chart.getChartItem() == item)\r
+                               return chart;\r
+\r
+               return null;\r
+       }\r
+\r
        private void initMemoryChart(MemoryChart chart) {\r
                if(null == chart) {\r
                        return;\r
@@ -433,7 +461,22 @@ public class MemoryChartBoard extends DAChartBoard {
                        chart.inputChartSeries(dataList);\r
                        \r
                        if(chart instanceof HeapMemoryChart) {\r
-                               chart.chart.getPlot().setAxisRangeY(0, getNormalizedHeight(targetProcessDBData));\r
+                               HeapMemoryChart heapChart = (HeapMemoryChart) chart;\r
+                               heapChart.chart.getPlot().setAxisRangeY(0, getNormalizedHeight(targetProcessDBData));\r
+\r
+                               // Draw Persistent Memory Series only if tracing is stopped\r
+                               if (!DAState.isRunning() && showPersistentSeries) {\r
+                                       // no need to select data from DB every time if it is not\r
+                                       // changing\r
+                                       if (persistentData == null)\r
+                                               persistentData = HeapDataManager.getInstance().remainedAllocatedListForRange(start, end);\r
+\r
+                                       heapChart.showPersistentSeries();\r
+                                       heapChart.updatePersistentSeries(persistentData);\r
+                               } else {\r
+                                       heapChart.hidePersistentSeries();\r
+                                       persistentData = null;\r
+                               }\r
                        }\r
                }\r
        }\r
index 94dd15e..f57271b 100755 (executable)
@@ -25,6 +25,7 @@
 package org.tizen.dynamicanalyzer.ui.memory.data;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
@@ -53,7 +54,9 @@ import org.tizen.dynamicanalyzer.utils.Formatter;
 public class HeapDataManager extends PageDataManager {
        
        private static HeapDataManager instance = new HeapDataManager();
-       
+
+       private final int TOTAL_PID = -1;
+
        private final int MEM_API_TYPE_ALLOC = 0;
        private final int MEM_API_TYPE_FREE = 1;
        
@@ -66,8 +69,7 @@ public class HeapDataManager extends PageDataManager {
        
        private MemAllocDBTable allocateDBTable = null;
        private MemFreeDBTable freeDBTable = null;
-       private MemHeapDBTable heapDBTable = null;
-       
+
        private DBInserter allocateDBInserter = null;
        private DBInserter freeDBInserter = null;
        
@@ -75,7 +77,7 @@ public class HeapDataManager extends PageDataManager {
        private ArrayList<List<Object>> memoryfreeDataList = new ArrayList<List<Object>> ();
        
        private List<TableInput> allocationTraceTreeInput = new ArrayList<TableInput>();
-       private List<TableInput> statisticsTreeInput = new ArrayList<TableInput>();
+       private List<TreeInput> statisticsTreeInput = new ArrayList<TreeInput>();
        
        private List<List<Object>> preAllocDataList = new ArrayList<List<Object>>();
        private List<List<Object>> preFreeDataList = new ArrayList<List<Object>>();
@@ -90,8 +92,7 @@ public class HeapDataManager extends PageDataManager {
        private HeapDataManager() {
                allocateDBTable = new MemAllocDBTable();
                freeDBTable = new MemFreeDBTable();
-               heapDBTable = new MemHeapDBTable();
-               
+
                allocateDBInserter = makeInserter(allocateDBTable);
                freeDBInserter = makeInserter(freeDBTable);
                
@@ -137,21 +138,6 @@ public class HeapDataManager extends PageDataManager {
        
                makeHeapData(allocatedlogs);
        }
-       
-       public List<List<Object>> getHeapStaticData(long start, long end, String targetIds) {
-               List<List<Object>> output = new ArrayList<List<Object>> ();
-               
-               String where = getTimeWhereQuery(start, end, targetIds, MemHeapDBTable.COLUMN.CALL_TIME.name);          
-               where += " ORDER BY " + MemHeapDBTable.COLUMN.SEQUENCE_NUMBER.name;
-
-               List<List<Object>> queryResult = heapDBTable.selectAllColumnData(where);
-               if (queryResult == null) {
-                       return output;
-               }
-               output = queryResult;
-
-               return output;
-       }
 
        /**
         * Request MEM_ALLOC_DB for row, where sequence number equals to specified
@@ -188,7 +174,7 @@ public class HeapDataManager extends PageDataManager {
                return allocatedResult;
        }
 
-       public List<List<Object>> getFreeDataFromDB(long start, long end, String targetPIDs) {
+       private List<List<Object>> getFreeDataFromDB(long start, long end, String targetPIDs) {
                List<List<Object>> freeResult = new ArrayList<List<Object>> ();
                
                String where = getTimeWhereQuery(start, end, targetPIDs, MemFreeDBTable.COLUMN.FREE_TIME.name);         
@@ -235,51 +221,67 @@ public class HeapDataManager extends PageDataManager {
                }
        }
        
-       public void makeWholeStatisticsData() {
-               if(DAState.isRunning() == true) {
-                       return;
-               }
-               
+       /**
+        * Constructs TreeInput list for MemoryStatisticsTable based on selected
+        * time range (0 as start and end time means whole range).
+        * 
+        * @param startTime
+        *            start time of selected range
+        * @param endTime
+        *            end time of selected range
+        */
+       public void makeStatisticsData(long startTime, long endTime) {
                String pidliststring = getTargetPIDString();
 
-               Map<Integer, List<Object>> staticdatas = remainedAllocStaticData(0, 0, pidliststring);
-               
-               long persistentSize = 0;
-               long persistentCount = 0;
-               long freecount = 0;
-               long totalSize = 0;             
+               Map<Integer, Map<Integer, List<Object>>> staticdatas = remainedAllocStaticData(startTime, endTime,
+                               pidliststring);
+
                int index = 0;
-               
-               List<TableInput> output = new ArrayList<TableInput>();
-               for(Map.Entry<Integer, List<Object>> elem : staticdatas.entrySet()) {
-                       if((Long) elem.getValue().get(PRESISTENT_COUNT_INDEX) == 0) {
-                               //continue;
-                       }
+               List<TreeInput> output = new ArrayList<TreeInput>();
+
+               // for each PID
+               for (Map.Entry<Integer, Map<Integer, List<Object>>> elem : staticdatas.entrySet()) {
+                       long persistentSizeForPid = 0;
+                       long persistentCountForPid = 0;
+                       long freeCountForPid = 0;
+                       long totalSizeForPid = 0;
+
+                       List<TreeInput> children = new ArrayList<TreeInput>();
+                       int parentIndex = index++;
                        
-                       String apiName = Global.getLibraryName(elem.getKey());
-                       TableInput staticInput = makeTreeInputForDatas(apiName, elem.getValue(), index++);
+                       // for each library
+                       for (Map.Entry<Integer, List<Object>> libEntry : elem.getValue().entrySet()) {
+                               String apiName = Global.getLibraryName(libEntry.getKey());
+                               TreeInput staticInput = makeTreeInputForDatas(apiName, libEntry.getValue(), index++);
+
+                               if (staticInput == null)
+                                       continue;
 
-                       if (staticInput != null){
-                               output.add(staticInput);
+                               children.add(staticInput);
+
+                               persistentSizeForPid += (Long) libEntry.getValue().get(0);
+                               persistentCountForPid += (Long) libEntry.getValue().get(1);
+                               freeCountForPid += (Long) libEntry.getValue().get(2);
+                               totalSizeForPid += (Long) libEntry.getValue().get(3);
                        }
-                       
-                       persistentSize += (Long) elem.getValue().get(0);
-                       persistentCount += (Long) elem.getValue().get(1);
-                       freecount += (Long) elem.getValue().get(2);
-                       totalSize += (Long) elem.getValue().get(3);
+
+                       List<Object> total = new ArrayList<Object>();
+
+                       total.add(persistentSizeForPid);
+                       total.add(persistentCountForPid);
+                       total.add(freeCountForPid);
+                       total.add(totalSizeForPid);
+                       total.add(persistentCountForPid + freeCountForPid);
+
+                       TreeInput parent = makeTreeInputForDatas(elem.getKey().toString(), total, parentIndex);
+
+                       if (parent == null)
+                               continue;
+
+                       parent.getChildren().addAll(children);
+                       output.add(parent);
                }
-               
-               List<Object> total = new ArrayList<Object> ();
-               
-               total.add(persistentSize);
-               total.add(persistentCount);
-               total.add(freecount);
-               total.add(totalSize);
-               total.add(persistentCount + freecount);
-               
-               TableInput totalInput = makeTreeInputForDatas("Total", total, index++);
-               output.add(totalInput);
-               
+
                synchronized(lockStatisticsCal) {
                        statisticsTreeInput = output;
                }
@@ -297,26 +299,32 @@ public class HeapDataManager extends PageDataManager {
                return output;
        }
        
-       public List<TableInput> getWholeStatisticsTreeInput (){
-               List<TableInput> output = null;
+       public List<TreeInput> getStatisticsTreeInput() {
+               List<TreeInput> output = null;
                
                synchronized(lockStatisticsCal) {
                        if(this.statisticsTreeInput == null)
-                               this.statisticsTreeInput = new ArrayList<TableInput>();
+                               this.statisticsTreeInput = new ArrayList<TreeInput>();
                        
                        output = this.statisticsTreeInput;
                }
                return output;
        }
        
-       public Map<Integer, List<Object>> remainedAllocStaticData(long startTime, long endTime, String targetPIDs) {
+       public Map<Integer, Map<Integer, List<Object>>> remainedAllocStaticData(long startTime, long endTime,
+                       String targetPIDs) {
                getAllocationFreeDatas(startTime, endTime, targetPIDs);
                
-               Map<Integer, List<Object>> result = makeRemainedAllocatedStatic(preAllocDataList, preFreeDataList);
+               Map<Integer, Map<Integer, List<Object>>> result = makeRemainedAllocatedStatic(preAllocDataList,
+                               preFreeDataList);
                
                return result;
        }
        
+       public List<List<Object>> remainedAllocatedListForRange(long startTime, long endTime) {
+               return remainedAllocatedListForRange(startTime, endTime, getTargetPIDString());
+       }
+
        public List<List<Object>> remainedAllocatedListForRange(long startTime, long endTime, String targetPIDs) {
 
                List<List<Object>> rangeDataList = new ArrayList<List<Object>> ();
@@ -335,12 +343,82 @@ public class HeapDataManager extends PageDataManager {
                
                return rangeDataList;
        }
-       
-       private Map<Integer, List<Object>> makeRemainedAllocatedStatic(List<List<Object>> allocData, List<List<Object>> freeData) {
+
+       /**
+        * Updates library entry with id equal to <code>binaryId</code> in given
+        * map. It increases allocated and total size by <code>allocSize</code> and
+        * increments allocated count.
+        * 
+        * @param libStatisticMap
+        *            statistics map for libraries
+        * @param binaryId
+        *            library id
+        * @param allocSize
+        *            size of allocation
+        */
+       private void updateStatisticDataAllocs(Map<Integer, List<Object>> libStatisticMap, int binaryId, long allocSize) {
+               if (libStatisticMap.containsKey(binaryId)) {
+                       List<Object> libstaticdata = libStatisticMap.get(binaryId);
+
+                       libstaticdata.set(PRESISTENT_SIZE_INDEX, (Long) libstaticdata.get(PRESISTENT_SIZE_INDEX) + allocSize);
+                       libstaticdata.set(PRESISTENT_COUNT_INDEX, (Long) libstaticdata.get(PRESISTENT_COUNT_INDEX) + 1);
+                       libstaticdata.set(TOTAL_SIZE_INDEX, (Long) libstaticdata.get(TOTAL_SIZE_INDEX) + allocSize);
+
+                       libStatisticMap.put(binaryId, libstaticdata);
+               } else {
+                       /*
+                        * 0: allocated size
+                        * 1: allocated count
+                        * 2: free count
+                        * 3: total size
+                        */
+                       libStatisticMap.put(binaryId, Arrays.asList((Object) allocSize, 1l, 0l, allocSize));
+               }
+       }
+
+       /**
+        * Updates library entry with id equal to <code>binaryId</code> in given
+        * map. It decreases allocated size by <code>freeSize</code>, increments
+        * free count and decrements persistent count.
+        * 
+        * @param libStatisticMap
+        *            statistics map for libraries
+        * @param binaryId
+        *            library id
+        * @param freeSize
+        *            size of freed allocation
+        */
+       private void updateStatisticDataFrees(Map<Integer, List<Object>> libStatisticMap, int binaryId, long freeSize) {
+               if (libStatisticMap.containsKey(binaryId)) {
+                       List<Object> libstaticdata = libStatisticMap.get(binaryId);
+
+                       libstaticdata.set(PRESISTENT_SIZE_INDEX, (Long) libstaticdata.get(PRESISTENT_SIZE_INDEX) - freeSize);
+                       libstaticdata.set(PRESISTENT_COUNT_INDEX, (Long) libstaticdata.get(PRESISTENT_COUNT_INDEX) - 1);
+                       libstaticdata.set(FREE_COUNT_INDEX, (Long) libstaticdata.get(FREE_COUNT_INDEX) + 1);
+
+                       libStatisticMap.put(binaryId, libstaticdata);
+               }
+       }
+
+       /**
+        * Constructs data map for Statistics table.
+        * 
+        * @param allocData
+        *            data from MEM_ALLOC_DB database table
+        * @param freeData
+        *            data from MEM_FREE_DB database table
+        * @return constructed map
+        */
+       private Map<Integer, Map<Integer, List<Object>>> makeRemainedAllocatedStatic(List<List<Object>> allocData,
+                       List<List<Object>> freeData) {
                Map<Long, List<List<Object>>> addressMap = new HashMap<Long, List<List<Object>>>();
-               Map<Integer, List<Object>> libStatisticMap = new HashMap<Integer, List<Object>>();
-               
-               int allocDataSize = allocData.size();           
+               Map<Integer, Map<Integer, List<Object>>> pidStatisticMap = new HashMap<Integer, Map<Integer, List<Object>>>();
+
+               // 'Total' entry
+               Map<Integer, List<Object>> libStatisticMapTotal = new HashMap<Integer, List<Object>>();
+               pidStatisticMap.put(TOTAL_PID, libStatisticMapTotal);
+
+               int allocDataSize = allocData.size();
                for (int j = 0; j < allocDataSize; j++) {
                        List<Object> iAllocData = allocData.get(j);
                        
@@ -348,6 +426,7 @@ public class HeapDataManager extends PageDataManager {
                        long alloctime = (Long) iAllocData.get(MemAllocDBTable.COLUMN.ALLOCATED_TIME.index);
                        long allocSize = (Long) iAllocData.get(MemAllocDBTable.COLUMN.ALLOCATED_MEMORY_SIZE.index);
                        int binaryId = (Integer) iAllocData.get(MemAllocDBTable.COLUMN.CALLER_LIBRARY_ID.index);
+                       int pid = (Integer) iAllocData.get(MemAllocDBTable.COLUMN.PID.index);
                        
                        if(!addressMap.containsKey(address)) {
                                List<List<Object>> newlist = new ArrayList<List<Object>>();
@@ -361,39 +440,20 @@ public class HeapDataManager extends PageDataManager {
                        
                        addressMap.get(address).add(onedata);
                        
-                       if(libStatisticMap.containsKey(binaryId)) {
-                               List<Object> libstaticdata = libStatisticMap.get(binaryId);
-                               
-                               libstaticdata.set(PRESISTENT_SIZE_INDEX, (Long)libstaticdata.get(PRESISTENT_SIZE_INDEX) + allocSize);
-                               libstaticdata.set(PRESISTENT_COUNT_INDEX, (Long)libstaticdata.get(PRESISTENT_COUNT_INDEX) + 1);
-                               libstaticdata.set(TOTAL_SIZE_INDEX, (Long)libstaticdata.get(TOTAL_SIZE_INDEX) + allocSize);
-                               
-                               libStatisticMap.put(binaryId, libstaticdata);
-                       }
-                       else {
-                               List<Object> newbinary = new ArrayList<Object>();
-                               
-                               /*
-                                * 0: allocated size
-                                * 1: allocated count
-                                * 2: free count
-                                * 3 : total size
-                                */
-                               
-                               newbinary.add(allocSize);
-                               newbinary.add((long) 1);                                
-                               newbinary.add((long) 0);
-                               newbinary.add(allocSize);
-                               
-                               libStatisticMap.put(binaryId, newbinary);
-                       }
+                       if (!pidStatisticMap.containsKey(pid))
+                               pidStatisticMap.put(pid, new HashMap<Integer, List<Object>>());
+
+                       updateStatisticDataAllocs(pidStatisticMap.get(pid), binaryId, allocSize);
+                       updateStatisticDataAllocs(libStatisticMapTotal, binaryId, allocSize);
                }
 
                for (int i = 0; i < freeData.size(); i++) {
                        List<Object> iFreeData = freeData.get(i);
                        long address = (Long) iFreeData.get(MemFreeDBTable.COLUMN.ALLOCATED_ADDRESS.index);
                        long freetime = (Long) iFreeData.get(MemFreeDBTable.COLUMN.FREE_TIME.index);
-                       
+                       int pid = (int) iFreeData.get(MemFreeDBTable.COLUMN.PID.index);
+                       Map<Integer, List<Object>> libStatisticMapPid = pidStatisticMap.get(pid);
+
                        if(addressMap.containsKey(address)) {
                                int size = addressMap.get(address).size();
                                
@@ -403,27 +463,18 @@ public class HeapDataManager extends PageDataManager {
                                        if((Long) onedata.get(0)  <= freetime) {
                                                long freeSize = (Long) onedata.get(1);
                                                int binaryId = (Integer) onedata.get(2);
-                                               
-                                               if(libStatisticMap.containsKey(binaryId)) {
-                                                       List<Object> libstaticdata = libStatisticMap.get(binaryId);
-                                                       
-                                                       libstaticdata.set(PRESISTENT_SIZE_INDEX, (Long)libstaticdata.get(PRESISTENT_SIZE_INDEX) - freeSize);
-                                                       libstaticdata.set(PRESISTENT_COUNT_INDEX, (Long)libstaticdata.get(PRESISTENT_COUNT_INDEX) - 1);
-                                                       libstaticdata.set(FREE_COUNT_INDEX, (Long)libstaticdata.get(FREE_COUNT_INDEX) + 1);
-                                                       
-                                                       libStatisticMap.put(binaryId, libstaticdata);                                                   
-                                               }
-                                               
+
+                                               updateStatisticDataFrees(libStatisticMapPid, binaryId, freeSize);
+                                               updateStatisticDataFrees(libStatisticMapTotal, binaryId, freeSize);
+
                                                addressMap.get(address).remove(removeindex);
                                                break;
                                        }
                                }
                        }
-                       else {
-                               //Logger.info("Unknow : 0x%s", Long.toHexString(address));
-                       }
                }
-               return libStatisticMap;
+
+               return pidStatisticMap;
        }
        
        private List<List<Object>> makeRemainedAllocatedList(List<List<Object>> allocData, List<List<Object>> freeData) {
@@ -471,58 +522,54 @@ public class HeapDataManager extends PageDataManager {
 
                return output;
        }
-       
-       public TableInput makeTreeInputForDatas(String path, List<Object> staticdata, int index) {
+
+       /**
+        * Creates {@link TreeInput} entry for Statistics table.
+        * 
+        * @param name
+        *            name of entry
+        * @param staticdata
+        *            data in format of list of 4 long numbers
+        * @param index
+        *            entry index
+        * @return created {@link TreeInput} entry
+        */
+       public TreeInput makeTreeInputForDatas(String name, List<Object> staticdata, int index) {
                DATableDataFormat tableData = new DATableDataFormat(index);
 
                List<String> text = new ArrayList<String>();
                List<Object> data = new ArrayList<Object>();
 
                if (staticdata == null) {
-                       Logger.error("very strange case !!");
+                       Logger.error("No statistics data for '%d' entry!", name);
                        return null;
                }
 
-               // Path
-               String libname = path;
+               String entryName = name;
+               if (name.equals(Global.getProject().getApplicationInfo().getExecPath()))
+                       entryName = MemoryPageLabels.MEMORY_MAIN_EXCUTABLE;
 
-               if(path == Global.getProject().getApplicationInfo().getExecPath()) {
-                       libname = MemoryPageLabels.MEMORY_MAIN_EXCUTABLE;
-               }
+               if (entryName.equals(Integer.toString(TOTAL_PID)))
+                       entryName = "Total";
 
-               text.add(libname);
-               data.add(libname);
-               // Persistent byte              
-               Long PByte = (Long) staticdata.get(0);
-               text.add(Formatter.toByteFormat(PByte));
-               data.add(PByte);
-               
-               // Persistent count
-               //Integer PCount = (Integer) staticdata.get(1);
-               Long PCount = (Long) staticdata.get(1);
-               text.add(String.format("%,d", PCount));
-               data.add(PCount);
-
-               // Free count
-               //Integer FCount = (Integer) staticdata.get(2);
-               Long FCount = (Long) staticdata.get(2);
-               text.add(String.format("%,d", FCount));
-               data.add(FCount);
+               Long PByte      = (Long) staticdata.get(0);
+               Long PCount     = (Long) staticdata.get(1);
+               Long FCount     = (Long) staticdata.get(2);
+               Long TotalByte  = (Long) staticdata.get(3);
+               Long TotalCount = PCount + FCount;
 
-               // Total Byte
-               Long TotalByte = (Long) staticdata.get(3);
-               text.add(Formatter.toByteFormat(TotalByte));
-               data.add(TotalByte);
+               text.add(entryName);                         data.add(entryName);
+               text.add(String.format("%,d", TotalCount));  data.add(TotalCount);
+               text.add(String.format("%,d", FCount));      data.add(FCount);
+               text.add(String.format("%,d", PCount));      data.add(PCount);
+               text.add(Formatter.toByteFormat(TotalByte)); data.add(TotalByte);
+               text.add(Formatter.toByteFormat(PByte));     data.add(PByte);
 
-               // Total count
-               //Integer TotalCount = PCount + FCount;
-               Long TotalCount = PCount + FCount;
-               text.add(String.format("%,d", TotalCount));
-               data.add(TotalCount);
+               tableData.getData().addAll(data);
+               tableData.setObject(entryName);
 
                TreeInput output = new TreeInput();
                output.setText(text);
-               tableData.getData().addAll(data);
                output.setData(tableData);
 
                return output;
@@ -758,8 +805,8 @@ public class HeapDataManager extends PageDataManager {
                        return;
                }
                
-               preAllocDataList = HeapDataManager.getInstance().getAllocationDataFromDB(start, end, targetIds);
-               preFreeDataList = HeapDataManager.getInstance().getFreeDataFromDB(start, end, targetIds);
+               preAllocDataList = getAllocationDataFromDB(start, end, targetIds);
+               preFreeDataList = getFreeDataFromDB(start, end, targetIds);
                
                preQueryTime.set(0, start);
                preQueryTime.set(1, end);
index a7469b3..3e9813e 100644 (file)
@@ -44,14 +44,13 @@ import org.tizen.dynamicanalyzer.model.TableInput;
 import org.tizen.dynamicanalyzer.nl.MemoryPageLabels;
 import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;
 import org.tizen.dynamicanalyzer.ui.memory.data.HeapDataManager;
-import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
-import org.tizen.dynamicanalyzer.ui.timeline.calltrace.FunctionEntryDBTable;
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DefaultTableComparator;
 import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.util.Logger;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
 
 public class MemoryAllocationTraceTable extends DATableComposite {
 
@@ -84,39 +83,9 @@ public class MemoryAllocationTraceTable extends DATableComposite {
        private int COLUMN_SIZE__SIZE = 45;
        private int COLUMN_SIZE__LIBRARY = 205;
        private int COLUMN_SIZE__CALLED = 115;
-
-       private int[] columnSizes = { COLUMN_SIZE__SEQ, COLUMN_SIZE__TIMESTAMP,
-                       COLUMN_SIZE__PID, COLUMN_SIZE__TID,
-                       COLUMN_SIZE__ALLOCATED_ADDRESS, COLUMN_SIZE__SIZE, COLUMN_SIZE__LIBRARY,
-                       COLUMN_SIZE__CALLED, 15, 800 };
-
-       private int[] columnAlignment = { SWT.RIGHT, SWT.CENTER, SWT.RIGHT,
-                       SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.LEFT, SWT.CENTER,
-                       SWT.LEFT, SWT.CENTER };
        
        private Long StartTime;
        private Long EndTime;
-       
-       private String[] columnNames = { 
-                       MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_SEQ,
-                       MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_TIMESTAMP,
-                       MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_PID,
-                       MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_TID,
-                       MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_ALLOCATED_ADDRESS,
-                       MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_SIZE,
-                       MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_LIBRARY,
-                       MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_CALLED_FUNCTION,
-                       "",
-                       "Streaming is not supported. Please select range or stop Tracing"
-       };
-       
-       int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NUM,
-                       AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
-                       AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
-                       AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_STRING,
-                       AnalyzerConstants.SORT_TYPE_STRING,
-                       AnalyzerConstants.SORT_TYPE_NONE,
-                       AnalyzerConstants.SORT_TYPE_STRING };
 
        public MemoryAllocationTraceTable(Composite parent, int style, int tableStyle) {
                super(parent, style, tableStyle);
@@ -126,9 +95,33 @@ public class MemoryAllocationTraceTable extends DATableComposite {
                
                setTableName(MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_TITLE);
                setComparator(new DefaultTableComparator());
-               setSortTypes(sortTypes);
-               setColumnAlignment(columnAlignment);
-               setColumns(columnNames);
+               setSortTypes(new int[] { AnalyzerConstants.SORT_TYPE_NUM,
+                               AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
+                               AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
+                               AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_STRING,
+                               AnalyzerConstants.SORT_TYPE_STRING,
+                               AnalyzerConstants.SORT_TYPE_NONE,
+                               AnalyzerConstants.SORT_TYPE_STRING });
+               setColumnAlignment(new int[] { SWT.RIGHT, SWT.CENTER, SWT.RIGHT,
+                               SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.LEFT, SWT.CENTER,
+                               SWT.LEFT, SWT.CENTER });
+               setColumns(new String[] {
+                               MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_SEQ,
+                               MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_TIMESTAMP,
+                               MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_PID,
+                               MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_TID,
+                               MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_ALLOCATED_ADDRESS,
+                               MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_SIZE,
+                               MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_LIBRARY,
+                               MemoryPageLabels.MEMORY_ALLOCATION_TRACE_VIEW_CALLED_FUNCTION,
+                               "",
+                               "Streaming is not supported. Please select range or stop Tracing"
+               });
+
+               int[] columnSizes = { COLUMN_SIZE__SEQ, COLUMN_SIZE__TIMESTAMP,
+                               COLUMN_SIZE__PID, COLUMN_SIZE__TID,
+                               COLUMN_SIZE__ALLOCATED_ADDRESS, COLUMN_SIZE__SIZE, COLUMN_SIZE__LIBRARY,
+                               COLUMN_SIZE__CALLED, 15, 800 };
                setColumnSize(columnSizes);
                setTableToolTipEnable(false);
                parent.addControlListener(new TableColumnSizePackListener(this, columnSizes));
@@ -137,6 +130,8 @@ public class MemoryAllocationTraceTable extends DATableComposite {
 
                        @Override
                        public void widgetSelected(SelectionEvent e) {
+                               long t = System.nanoTime();// TODO: this instruction required to
+                               // analyze performance and must be removed.
                                GridItem[] items = ((Grid) e.widget).getSelection();
                                if (null == items|| items.length == 0) {
                                        return;
@@ -152,6 +147,9 @@ public class MemoryAllocationTraceTable extends DATableComposite {
                                DASelectionData data = new DASelectionData(MemoryPage.allocationtraceViewID, startTime,
                                                endTime, items, table);
                                AnalyzerManager.getCurrentPage().updateView(data);
+                               Logger.debug("Time spent for update of memory page(nano)       = "
+                                               + (System.nanoTime() - t));// TODO: this instruction required to
+                               // analyze performance and must be removed.
                        }
 
                        @Override
@@ -169,7 +167,7 @@ public class MemoryAllocationTraceTable extends DATableComposite {
                                }
                                List<Object> markerData = ((DATableDataFormat) ti[0].getData()).getData();
                                long markerTime = (Long) markerData.get(1);
-                               AnalyzerUtil.addMarker(markerTime);
+                               MarkerManager.INSTANCE.addMarker(markerTime);
                        }
                        
                        @Override
index 6f9afa1..988eff7 100644 (file)
@@ -41,6 +41,8 @@ import org.tizen.dynamicanalyzer.nl.MemoryPageLabels;
 import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;\r
 import org.tizen.dynamicanalyzer.project.BinaryInfo;\r
 import org.tizen.dynamicanalyzer.project.Project;\r
+import org.tizen.dynamicanalyzer.setting.FlatFeature;\r
+import org.tizen.dynamicanalyzer.setting.SettingDataManager;\r
 import org.tizen.dynamicanalyzer.ui.memory.data.MemoryDataManager;\r
 import org.tizen.dynamicanalyzer.ui.memory.data.ProcessMemoryDBTable;\r
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;\r
@@ -52,33 +54,11 @@ import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.utils.Formatter;\r
 \r
 public class MemoryDetailsTable extends DATreeComposite {\r
-\r
-       private int[] columnSizes = { 210, 80, 85, 85, 85, 85, 85, 15 };\r
-       private boolean[] columnVisibility = { true, true, true, true, true, true, true, true };\r
-       private int[] columnAlignment = { SWT.LEFT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, 
-                       SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT };\r
        \r
        private int keyindex = 0;\r
        private Long StartTime;\r
        private Long EndTime;
        private Long Current;\r
-       
-       private String[] columnNames = { 
-                       MemoryPageLabels.MEMORY_DETAILS_VIEW_ITEM,
-                       MemoryPageLabels.MEMORY_DETAILS_VIEW_CURRENT,
-                       MemoryPageLabels.MEMORY_DETAILS_VIEW_START,
-                       MemoryPageLabels.MEMORY_DETAILS_VIEW_END,
-                       MemoryPageLabels.MEMORY_DETAILS_VIEW_DELTA,
-                       MemoryPageLabels.MEMORY_DETAILS_VIEW_MIN,
-                       MemoryPageLabels.MEMORY_DETAILS_VIEW_MAX,\r
-                       ""
-       };
-       
-       int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NONE, AnalyzerConstants.SORT_TYPE_NONE,
-                       AnalyzerConstants.SORT_TYPE_NONE, AnalyzerConstants.SORT_TYPE_NONE,
-                       AnalyzerConstants.SORT_TYPE_NONE, AnalyzerConstants.SORT_TYPE_NONE,
-                       AnalyzerConstants.SORT_TYPE_NONE, AnalyzerConstants.SORT_TYPE_NONE
-       };\r
 \r
        public MemoryDetailsTable(Composite parent, int style, int tableStyle) {\r
                super(parent, style, tableStyle);\r
@@ -91,11 +71,30 @@ public class MemoryDetailsTable extends DATreeComposite {
                setComparator(new DefaultTableComparator());\r
 \r
                setTree(true);\r
-               setSortTypes(sortTypes);\r
-               setColumnAlignment(columnAlignment);\r
-               setColumns(columnNames);\r
+\r
+               setSortTypes(new int[] { AnalyzerConstants.SORT_TYPE_NONE, AnalyzerConstants.SORT_TYPE_NONE,\r
+                               AnalyzerConstants.SORT_TYPE_NONE, AnalyzerConstants.SORT_TYPE_NONE,\r
+                               AnalyzerConstants.SORT_TYPE_NONE, AnalyzerConstants.SORT_TYPE_NONE,\r
+                               AnalyzerConstants.SORT_TYPE_NONE, AnalyzerConstants.SORT_TYPE_NONE\r
+               });\r
+\r
+               setColumnAlignment(new int[] { SWT.LEFT, SWT.RIGHT, SWT.RIGHT,\r
+                               SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT });\r
+\r
+               setColumns(new String[] {\r
+                               MemoryPageLabels.MEMORY_DETAILS_VIEW_ITEM,\r
+                               MemoryPageLabels.MEMORY_DETAILS_VIEW_CURRENT,\r
+                               MemoryPageLabels.MEMORY_DETAILS_VIEW_START,\r
+                               MemoryPageLabels.MEMORY_DETAILS_VIEW_END,\r
+                               MemoryPageLabels.MEMORY_DETAILS_VIEW_DELTA,\r
+                               MemoryPageLabels.MEMORY_DETAILS_VIEW_MIN,\r
+                               MemoryPageLabels.MEMORY_DETAILS_VIEW_MAX,\r
+                               ""\r
+               });\r
+\r
+               int[] columnSizes = { 210, 80, 85, 85, 85, 85, 85, 15 };\r
                setColumnSize(columnSizes);\r
-               setColumnVisibility(columnVisibility);\r
+               setColumnVisibility(new boolean[] { true, true, true, true, true, true, true, true });\r
                \r
                setTableToolTipEnable(false);\r
                \r
@@ -137,11 +136,9 @@ public class MemoryDetailsTable extends DATreeComposite {
                }\r
                \r
                TreeInput systemMemdata = makeSystemMemory();\r
-               if(systemMemdata == null)\r
-                       return output;\r
-               \r
-               output.add(systemMemdata);\r
-               \r
+               if(systemMemdata != null)\r
+                       output.add(systemMemdata);\r
+\r
                List<Integer> pidlist = new ArrayList<Integer>();\r
                keyindex = 0;\r
                \r
@@ -190,7 +187,9 @@ public class MemoryDetailsTable extends DATreeComposite {
 \r
                String parentString = "System Memory (Used)";\r
 \r
-               if(memorylist.size() == 0)\r
+               if (memorylist.size() == 0\r
+                               || !SettingDataManager.INSTANCE\r
+                                               .isFlatFeatureSelected(FlatFeature.SYSTEM_MEMORY))\r
                        return null;\r
 \r
                if(Current != -1) {\r
index 7b75b3a..82b62d0 100644 (file)
@@ -45,22 +45,6 @@ import org.tizen.dynamicanalyzer.ui.widgets.table.DefaultTableComparator;
 import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
 
 public class MemoryMapTable extends DATableComposite {
-       
-       private int[] columnSizes = { 40, 60, 150, 80, 80,5};
-       private boolean[] columnVisibility = { true, true, true, true, true, true };
-       private int[] columnAlignment = { SWT.CENTER, SWT.RIGHT, SWT.LEFT, SWT.RIGHT, SWT.RIGHT ,SWT.LEFT };
-       
-       private String[] columnNames = { 
-                       MemoryPageLabels.MEMORY_MEMORYMAP_TYPE,
-                       MemoryPageLabels.MEMORY_MEMORYMAP_SIZE,
-                       MemoryPageLabels.MEMORY_MEMORYMAP_LIBNAME,
-                       MemoryPageLabels.MEMORY_MEMORYMAP_ADDRESS_LOW,
-                       MemoryPageLabels.MEMORY_MEMORYMAP_ADDRESS_HIGH,
-                       ""
-       };
-       
-       int[] sortTypes = { AnalyzerConstants.SORT_TYPE_STRING, AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_STRING, 
-                       AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NONE };
 
        public MemoryMapTable(Composite parent, int style, int tableStyle) {
                super(parent, style, tableStyle);
@@ -68,11 +52,24 @@ public class MemoryMapTable extends DATableComposite {
                setTableName(MemoryPageLabels.MEMORY_MAP_VIEW_TITLE);
                setComparator(new DefaultTableComparator());
                
-               setSortTypes(sortTypes);
-               setColumnAlignment(columnAlignment);
-               setColumns(columnNames);
+               setSortTypes(new int[] { AnalyzerConstants.SORT_TYPE_STRING, AnalyzerConstants.SORT_TYPE_NUM,
+                               AnalyzerConstants.SORT_TYPE_STRING, AnalyzerConstants.SORT_TYPE_NUM,
+                               AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NONE });
+
+               setColumnAlignment(new int[] { SWT.CENTER, SWT.RIGHT, SWT.LEFT, SWT.RIGHT, SWT.RIGHT, SWT.LEFT });
+
+               setColumns(new String[] {
+                               MemoryPageLabels.MEMORY_MEMORYMAP_TYPE,
+                               MemoryPageLabels.MEMORY_MEMORYMAP_SIZE,
+                               MemoryPageLabels.MEMORY_MEMORYMAP_LIBNAME,
+                               MemoryPageLabels.MEMORY_MEMORYMAP_ADDRESS_LOW,
+                               MemoryPageLabels.MEMORY_MEMORYMAP_ADDRESS_HIGH,
+                               ""
+               });
+
+               int[] columnSizes = { 40, 60, 150, 80, 80, 5 };
                setColumnSize(columnSizes);
-               setColumnVisibility(columnVisibility);
+               setColumnVisibility(new boolean[] { true, true, true, true, true, true });
                
                setTableToolTipEnable(false);
                
index 23e39f6..577626e 100644 (file)
@@ -26,49 +26,52 @@ package org.tizen.dynamicanalyzer.ui.memory.table;
 \r
 import java.util.ArrayList;\r
 import java.util.List;\r
-import java.util.Map;\r
 \r
+import org.eclipse.nebula.widgets.grid.GridItem;\r
 import org.eclipse.swt.SWT;\r
 import org.eclipse.swt.widgets.Composite;\r
+import org.eclipse.swt.widgets.Event;\r
+import org.eclipse.swt.widgets.Listener;\r
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;\r
-import org.tizen.dynamicanalyzer.common.DAState;\r
 import org.tizen.dynamicanalyzer.common.Global;\r
-import org.tizen.dynamicanalyzer.model.TableInput;\r
+import org.tizen.dynamicanalyzer.model.TreeInput;\r
 import org.tizen.dynamicanalyzer.nl.MemoryPageLabels;\r
 import org.tizen.dynamicanalyzer.ui.memory.data.HeapDataManager;\r
-import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;\r
-import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;\r
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATreeComposite;\r
 import org.tizen.dynamicanalyzer.ui.widgets.table.DefaultTableComparator;\r
 import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;\r
 \r
-public class MemoryStatisticsTable extends DATableComposite {\r
-\r
-       private int[] columnSizes = { 265 , 98, 88, 88, 88, 88, 15, 800 };\r
-       \r
-       private int[] columnAlignment = { SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, \r
+public class MemoryStatisticsTable extends DATreeComposite {\r
+
+       private int[] columnSizes = { 265, 140, 90, 90, 90, 110, 15, 800 };\r
+
+       private int[] columnAlignment = { SWT.LEFT, SWT.RIGHT, SWT.RIGHT, SWT.RIGHT,\r
                        SWT.RIGHT, SWT.RIGHT, SWT.RIGHT, SWT.CENTER };\r
 \r
+       private boolean[] columnVisibilityEnable = { true, true, true, true, true, true, true, false };\r
+       private boolean[] columnVisibilityDisable = { false, false, false, false, false, false, false, true };\r
+\r
        private Long StartTime;\r
        private Long EndTime;\r
 \r
        private String[] columnNames = {\r
-                       MemoryPageLabels.MEMORY_STATISTICS_VIEW_PATH,\r
-                       MemoryPageLabels.MEMORY_STATISTICS_VIEW_PERSISTENT_BYTE,\r
-                       MemoryPageLabels.MEMORY_STATISTICS_VIEW_PERSISTENT,\r
+                       MemoryPageLabels.MEMORY_STATISTICS_VIEW_PATH,
+                       MemoryPageLabels.MEMORY_STATISTICS_VIEW_TOTAL,\r
                        MemoryPageLabels.MEMORY_STATISTICS_VIEW_FREED,\r
+                       MemoryPageLabels.MEMORY_STATISTICS_VIEW_PERSISTENT,\r
                        MemoryPageLabels.MEMORY_STATISTICS_VIEW_TOTAL_BYTE,\r
-                       MemoryPageLabels.MEMORY_STATISTICS_VIEW_TOTAL,\r
+                       MemoryPageLabels.MEMORY_STATISTICS_VIEW_PERSISTENT_BYTE,
                        "",\r
                        "Streaming is not supported. Please select range or stop Tracing"\r
        };\r
 \r
        private int[] sortTypes = { AnalyzerConstants.SORT_TYPE_STRING, AnalyzerConstants.SORT_TYPE_NUM,\r
                        AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,\r
-                       AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NONE,\r
-                       AnalyzerConstants.SORT_TYPE_STRING\r
+                       AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,\r
+                       AnalyzerConstants.SORT_TYPE_NONE, AnalyzerConstants.SORT_TYPE_NONE\r
        };\r
 \r
-       public MemoryStatisticsTable(Composite parent, int style, int tableStyle) {\r
+       public MemoryStatisticsTable(Composite parent, int style, int tableStyle) {
                super(parent, style, tableStyle);               \r
                \r
                StartTime = (long)0;\r
@@ -77,6 +80,7 @@ public class MemoryStatisticsTable extends DATableComposite {
                setTableName(MemoryPageLabels.MEMORY_STATISTICS_VIEW_TITLE);\r
                setComparator(new DefaultTableComparator());\r
                \r
+               setTree(true);\r
                setSortTypes(sortTypes);                \r
                setColumnAlignment(columnAlignment);            \r
                setColumns(columnNames);                        \r
@@ -86,117 +90,70 @@ public class MemoryStatisticsTable extends DATableComposite {
                \r
                comparator.setType(AnalyzerConstants.SORT_TYPE_NUM);\r
                comparator.setColumn(1);\r
-               comparator.setDirection(false);\r
-               \r
+               
                parent.addControlListener(new TableColumnSizePackListener(this, columnSizes));\r
-       }\r
 \r
-       public void setSelectionRange(Long start, Long end){\r
+               table.addListener(SWT.Expand, new Listener() {\r
+\r
+                       @Override\r
+                       public void handleEvent(Event event) {\r
+                               GridItem item = (GridItem) event.item;\r
+                               setExpand(item, true);\r
+                       }\r
+               });\r
+\r
+               table.addListener(SWT.Collapse, new Listener() {\r
+                       @Override\r
+                       public void handleEvent(Event event) {\r
+                               GridItem item = (GridItem) event.item;\r
+                               setExpand(item, false);\r
+                       }\r
+               });\r
+       }\r
+
+       public void setSelectionRange(Long start, Long end){
                StartTime = start;\r
                EndTime = end;\r
        }\r
 \r
        @Override\r
-       protected List<TableInput> makeTableInput() {\r
-               List<TableInput> output = new ArrayList<TableInput>();\r
+       public List<TreeInput> makeTreeInput() {\r
+               List<TreeInput> output = new ArrayList<TreeInput>();
                if(Global.getProject() == null) {\r
                        return output;\r
                }\r
-               \r
-               if(DAState.isRunning() == false) {\r
-                       if(StartTime == 0 && EndTime == 0 && Toolbar.INSTANCE.getSelectedPid() <= 0) {\r
-                               List<TableInput> wholedata = HeapDataManager.getInstance().getWholeStatisticsTreeInput();\r
-                               if(wholedata.size() != 0) {                                     \r
-                                       return wholedata;\r
-                               }\r
-                       }\r
-               }\r
-               \r
-               String pidliststring = getTargetPIDString();\r
-\r
-               Map<Integer, List<Object>> staticdatas = HeapDataManager.getInstance().remainedAllocStaticData(StartTime, EndTime, pidliststring);\r
-               \r
-               long persistentSize = 0;\r
-               long persistentCount = 0;\r
-               long freecount = 0;\r
-               long totalSize = 0;             \r
-               \r
-               int index = 0;\r
-               for(Map.Entry<Integer, List<Object>> elem : staticdatas.entrySet()) {\r
-                       // 0 : PRESISTENT_COUNT_INDEX\r
-                       if((Long) elem.getValue().get(0) == 0) {\r
-                               //continue;\r
-                       }\r
-                       \r
-                       String apiName = Global.getLibraryName(elem.getKey());\r
-                       TableInput staticInput = HeapDataManager.getInstance().makeTreeInputForDatas(apiName, elem.getValue(), index++);\r
-\r
-                       if (staticInput != null){\r
-                               output.add(staticInput);\r
-                       }\r
-                       \r
-                       persistentSize += (Long) elem.getValue().get(0);\r
-                       persistentCount += (Long) elem.getValue().get(1);\r
-                       freecount += (Long) elem.getValue().get(2);\r
-                       totalSize += (Long) elem.getValue().get(3);\r
-               }\r
-               \r
-               List<Object> total = new ArrayList<Object> ();\r
-               \r
-               total.add(persistentSize);\r
-               total.add(persistentCount);\r
-               total.add(freecount);\r
-               total.add(totalSize);\r
-               total.add(persistentCount + freecount);\r
-               \r
-               TableInput totalInput = HeapDataManager.getInstance().makeTreeInputForDatas("Total", total, index++);\r
-               output.add(0, totalInput);\r
-\r
-               return output;\r
+               
+               HeapDataManager.getInstance().makeStatisticsData(StartTime, EndTime);\r
+               return HeapDataManager.getInstance().getStatisticsTreeInput();\r
        }\r
-\r
-       private String getTargetPIDString(){\r
-               List<Integer> pidlist = new ArrayList<Integer>();\r
 
-               int[] pids = Global.getProject().getProcessIDs();\r
-               int targetPID = Toolbar.INSTANCE.getSelectedPid();\r
-\r
-               if(targetPID > 0) {\r
-                       pidlist.add(targetPID);\r
-               }\r
-               else {\r
-                       for (int i = 0; i < pids.length; i++) {\r
-                               pidlist.add(pids[i]);\r
-                       }       \r
-               }\r
-\r
-               String pidliststring = "(";\r
-\r
-               for(int i = 0 ; i < pidlist.size() ; i++) {\r
-                       pidliststring += Integer.toString(pidlist.get(i));\r
-\r
-                       if(i != pidlist.size() - 1) {\r
-                               pidliststring += ", ";\r
-                       }\r
-               }\r
-\r
-               pidliststring += ")";\r
-\r
-               return pidliststring;\r
-       }\r
-\r
        public void removeSelection() {         \r
                table.removeAll();\r
                updateTable();\r
        }\r
-       \r
+       
        @Override\r
        public void clear() {\r
                table.removeAll();\r
                getSelectionIndex().clear();\r
-               getSelections().clear();\r
+               getSelections().clear();
                \r
                StartTime = (long)0;\r
                EndTime = (long)0;\r
        }\r
+\r
+       /**\r
+        * Set column visibility state corresponding to two table states:\r
+        *  {@code enabled == true} - data columns are visible, warning column is hidden\r
+        *  {@code enabled == false} - data columns are hidden, warning columns is visible\r
+        *\r
+        * @param enabled column state to set\r
+        */\r
+       public void setColumnVisibilityState(boolean enabled) {\r
+               if (enabled) {\r
+                       setColumnVisibility(columnVisibilityEnable);\r
+               } else {\r
+                       setColumnVisibility(columnVisibilityDisable);\r
+               }\r
+       }\r
 }
index 6590cea..be8b572 100644 (file)
@@ -27,8 +27,6 @@
 
 package org.tizen.dynamicanalyzer.ui.network;
 
-import java.util.List;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StackLayout;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -54,7 +52,6 @@ import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
 import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
 import org.tizen.dynamicanalyzer.ui.network.data.NetworkDataManager;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
@@ -138,11 +135,6 @@ public class NetworkChartView extends DAViewComposite {
                LifecycleLogParser.getInstance().registerLifecycleBar(networkChartBoard.getLifecycleBar());
                LifecycleLogParser.getInstance().registerTimeline(timeline);
 
-               SetRangeMarkerMouseMoveListener listener = new SetRangeMarkerMouseMoveListener(rangeDataManager,
-                               networkChartBoard, timeline);
-               timeline.addMouseMoveListener(listener);
-               timeline.addMouseListener(listener);
-               
                processCombo = makeDACustomCombo(networkChartBoard.getTitleComp());
                FormData data = new FormData();
                data.top = new FormAttachment(0, 0);
@@ -330,25 +322,10 @@ public class NetworkChartView extends DAViewComposite {
                });
        }
        
-       public void updateMarker() {
-               List<Double> markerTimeList = Toolbar.INSTANCE.getMarkerTimeList();
-               List<NetworkChart> chartList = networkChartBoard.getNetworkChartList();
-               for(NetworkChart chart : chartList) {
-                       chart.getChart().getPlot().clearMarkerTime();
-               }
-               for(double time : markerTimeList) {
-                       for(NetworkChart chart : chartList) {
-                               chart.getChart().getPlot().addMarkerTime(time);
-                       }
-                       networkChartBoard.getTimeline().addMarker(time);
-               }
-       }
-
        @Override
        public void updateView() {
                updateScale();
                updateProcessCombo();
-               updateMarker();
                networkChartBoard.updateChart();
 
                /*
@@ -383,7 +360,6 @@ public class NetworkChartView extends DAViewComposite {
        public void updateView(DAViewData data) {
                updateScale();
                updateProcessCombo();
-               updateMarker();
                networkChartBoard.updateChart();
                if (data instanceof DASelectionData == false) {
                        return;
index 7243893..53b581f 100644 (file)
@@ -48,29 +48,15 @@ import org.tizen.dynamicanalyzer.error.ErrorCodeManager;
 import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
 import org.tizen.dynamicanalyzer.model.FilterProperty;
 import org.tizen.dynamicanalyzer.model.TableInput;
-import org.tizen.dynamicanalyzer.ui.file.FileChartView;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryChartView;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;
 import org.tizen.dynamicanalyzer.ui.network.data.NetworkAPIDBManager;
 import org.tizen.dynamicanalyzer.ui.network.data.NetworkDataManager;
 import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkAPIType;
 import org.tizen.dynamicanalyzer.ui.network.data.type.NetworkSelectionType;
-import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
-import org.tizen.dynamicanalyzer.ui.opengl.chart.GLChartView;
-import org.tizen.dynamicanalyzer.ui.page.BaseView;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
-import org.tizen.dynamicanalyzer.ui.thread.chart.ThreadChartView;
-import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DAApiListTableComposite;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
-import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
 
 public class NetworkTable extends DAApiListTableComposite {
        public NetworkTable(Composite parent, int compStyle, int tableStyle) {
@@ -135,11 +121,11 @@ public class NetworkTable extends DAApiListTableComposite {
                                }
                                List<Object> markerData = ((DATableDataFormat) ti[0].getData()).getData();
                                long markerTime = Long.parseLong((String)markerData.get(1));
-                               AnalyzerUtil.addMarker(markerTime);
+                               MarkerManager.INSTANCE.addMarker(markerTime);
                        }
                });
        }
-       
+
        @Override
        protected List<TableInput> makeTableInput() {
 
index 9d45dd6..cff6220 100644 (file)
@@ -27,8 +27,6 @@
 
 package org.tizen.dynamicanalyzer.ui.opengl.chart;
 
-import java.util.List;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StackLayout;
 import org.eclipse.swt.events.SelectionAdapter;
@@ -57,15 +55,11 @@ import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.model.data.LogData;
-import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
 import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
 import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
 import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataManager;
 import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLSelectionData;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUChart;
-import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
 import org.tizen.dynamicanalyzer.ui.toolbar.DAToolBarCustomCombo;
@@ -79,7 +73,6 @@ import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
-import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardHeightChangeableItem;
 import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;
 import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
 import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
@@ -128,8 +121,6 @@ public class GLChartView extends DAViewComposite {
                DATimeline frameTimeline = frameTimeChartBoard.getTimeline();
                frameTimeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
                frameTimeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
-               frameTimeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(RangeDataManager
-                               .getInstance(), frameTimeChartBoard, frameTimeline));
 
                DATimeline frameRateline = frameRateChartBoard.getTimeline();
                frameRateline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
@@ -137,10 +128,6 @@ public class GLChartView extends DAViewComposite {
                LifecycleLogParser.getInstance()
                                .registerLifecycleBar(frameRateChartBoard.getLifecycleBar());
                LifecycleLogParser.getInstance().registerTimeline(frameRateline);
-               SetRangeMarkerMouseMoveListener listener = new SetRangeMarkerMouseMoveListener(RangeDataManager
-                               .getInstance(), frameRateChartBoard, frameRateline);
-               frameRateline.addMouseMoveListener(listener);
-               frameRateline.addMouseListener(listener);
                
                frameRateChartBoard.getTitleComp().setLayout(new FormLayout());
                frameTimeChartBoard.getTitleComp().setLayout(new FormLayout());
@@ -596,42 +583,10 @@ public class GLChartView extends DAViewComposite {
                }
        }
        
-       public void updateMarker() {
-               List<Double> markerTimeList = Toolbar.INSTANCE.getMarkerTimeList();
-               List<TimelineChart> chartList = frameRateChartBoard.getChartList();
-               for(TimelineChart chart : chartList) {
-                       chart.getChart().getPlot().clearMarkerTime();
-                       
-                       if(chart instanceof CPUChart) {
-                               DAChartBoardHeightChangeableItem proceeChart = ((CPUChart) chart).getProcessChart();
-                               if(proceeChart != null) {
-                                       proceeChart.getChart().getPlot().clearMarkerTime();
-                               }
-                       }
-               }
-               
-               GLFrameRateChart.getInstance().chart.getPlot().clearMarkerTime();
-               for(double time : markerTimeList) {
-                       for(TimelineChart chart : chartList) {
-                               chart.getChart().getPlot().addMarkerTime(time);
-                               
-                               if(chart instanceof CPUChart) {
-                                       DAChartBoardHeightChangeableItem proceeChart = ((CPUChart) chart).getProcessChart();
-                                       if(proceeChart != null) {
-                                               proceeChart.getChart().getPlot().addMarkerTime(time);
-                                       }
-                               }
-                       }
-                       GLFrameRateChart.getInstance().chart.getPlot().addMarkerTime(time);
-                       frameRateChartBoard.getTimeline().addMarker(time);
-               }
-       }
-
        @Override
        public void updateView() {
                updateScale();
                updateProcessCombo();
-               updateMarker();
                if (stackLayout.topControl == frameTimeChartBoard) {
                        frameTimeChartBoard.updateView();
                } else {
@@ -643,7 +598,6 @@ public class GLChartView extends DAViewComposite {
        public void updateView(DAViewData vdata) {
                updateScale();
                updateProcessCombo();
-               updateMarker();
                if (vdata instanceof GLSelectionData) {
                        updateViewFromHistory((GLSelectionData) vdata);
                } else if (vdata instanceof DASelectionData) {
index fb76638..6488175 100644 (file)
@@ -32,25 +32,12 @@ import java.util.List;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.MouseEvent;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.ui.file.FileChartView;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryChartView;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;
-import org.tizen.dynamicanalyzer.ui.network.NetworkChartView;
-import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
 import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
-import org.tizen.dynamicanalyzer.ui.opengl.chart.GLChartView;
 import org.tizen.dynamicanalyzer.ui.opengl.data.GLDataManager;
 import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLFrameRateInfo;
 import org.tizen.dynamicanalyzer.ui.opengl.data.type.GLSelectionData;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
-import org.tizen.dynamicanalyzer.ui.thread.chart.ThreadChartView;
-import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
@@ -58,6 +45,7 @@ import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotMarker;
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;
 import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
 
 public class GLFrameRateMouseListener extends GLChartMouseListener {
 
@@ -183,7 +171,7 @@ public class GLFrameRateMouseListener extends GLChartMouseListener {
                long longTime = (long) (time * TimelineConstants.MEGA_DOUBLE);
                
                if(longTime <= Toolbar.INSTANCE.getTime()) {
-                       AnalyzerUtil.addMarker(longTime);
+                       MarkerManager.INSTANCE.addMarker(time);
                }
        }
 }
index a513088..26123ad 100644 (file)
@@ -57,6 +57,13 @@ public class GLStatisticsDataManager {
        private ConcurrentHashMap<String, GLRedundantDataType> redundantHsahMap = new ConcurrentHashMap<String, GLRedundantDataType>();
        private double totalAPICount = 0;
 
+       /**
+        * Add new {@link GLES20LogData} in aggregated statistics.
+        * This method is not thread-safe and should be used from one thread only.
+        * XXX: FindBugs MT_CORRECTNESS warning may be ignored until method called from one thread.
+        *
+        * @param logData data to add
+        */
        public void addAPI(GLES20LogData logData) {
                String hashKey = logData.getApiName() + logData.getArgs();
                GLRedundantDataType savedHash = redundantHsahMap.get(hashKey);
@@ -77,6 +84,11 @@ public class GLStatisticsDataManager {
                                .insertRedundantData(getRedundantTableData());
        }
 
+       /**
+        * Recalculate aggregated statistics using data from DB.
+        * This method is not thread-safe and should be used from one thread only.
+        * XXX: FindBugs MT_CORRECTNESS warning may be ignored until method called from one thread.
+        */
        public void selectRedundantData() {
                List<GLRedundantDataType> redundantList = GLDataManager.getInstance()
                                .getRedundantDBTable().select();
index 5e54100..37365de 100644 (file)
@@ -68,6 +68,7 @@ import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
 import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
 
 public class GLAPITable extends DATableComposite {
 
@@ -124,7 +125,7 @@ public class GLAPITable extends DATableComposite {
                                        return;
                                }
                                DATableDataFormat dataFormat = (DATableDataFormat) ti[0].getData();
-                               AnalyzerUtil.addMarker(((GLAPIData)(dataFormat.getLogData())).getTime());
+                               MarkerManager.INSTANCE.addMarker(((GLAPIData)(dataFormat.getLogData())).getTime());
                        }
                });
        }
index 1bd321e..7c1adea 100644 (file)
@@ -58,7 +58,6 @@ import org.tizen.dynamicanalyzer.handlers.CommandAction;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.ui.toolbar.setting.FlatFeatureDialog;
 import org.tizen.dynamicanalyzer.ui.toolbar.setting.PreferencesDialog;
@@ -71,6 +70,7 @@ import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
 import org.tizen.dynamicanalyzer.widgets.da.view.DABaseComposite;
 import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
 import org.tizen.dynamicanalyzer.widgets.da.view.DATabComposite;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
 import org.tizen.dynamicanalyzer.workbench.LayoutManager;
 
 public class BaseView extends ViewPart {
@@ -141,9 +141,7 @@ public class BaseView extends ViewPart {
                                        AnalyzerUtil.captureScreenshot();
                                } else if(e.keyCode == SWT.F5) {
                                        if(DAState.isStartable() && Toolbar.INSTANCE.getStartButton().getState() == DACustomButton.STATE_NORMAL) { //start trace
-                                               Toolbar.INSTANCE.clearMarkerTimeList();
-                                               RangeDataManager.getInstance().clearMarkerTime();
-                                               RangeDataManager.getInstance().clearTimelineMarker();
+                                               MarkerManager.INSTANCE.clearMarkerList();
                                                CommandAction.startTrace(false);
                                        } else if(DAState.isRunning() && Toolbar.INSTANCE.getStartButton().getState() == DACustomButton.STATE_NORMAL) { //stop trace
                                                CommandAction.stopTrace(new DAResult(ErrorCode.SUCCESS), false);
index 09755ce..6243deb 100644 (file)
@@ -50,12 +50,13 @@ import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.setting.SettingDataManager;
 import org.tizen.dynamicanalyzer.ui.file.FileChartView;
 import org.tizen.dynamicanalyzer.ui.file.FilePage;
+import org.tizen.dynamicanalyzer.ui.memory.MemoryChartView;
 import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;
+import org.tizen.dynamicanalyzer.ui.memory.chart.MemoryChartBoard;
 import org.tizen.dynamicanalyzer.ui.network.NetworkChartView;
 import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
 import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
 import org.tizen.dynamicanalyzer.ui.opengl.chart.GLChartView;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
 import org.tizen.dynamicanalyzer.ui.summary.failed.FailedApiListView;
 import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfilingView;
 import org.tizen.dynamicanalyzer.ui.summary.warning.WarningDataView;
@@ -80,6 +81,7 @@ import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardManager;
 import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
 import org.tizen.dynamicanalyzer.widgets.scale.DAScale;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
 
 public class MenuBar {
        
@@ -92,6 +94,7 @@ public class MenuBar {
        private MenuItem fileNew;
        private MenuItem viewDetail;
        private MenuItem analyzeSearchItem;
+       private MenuItem viewPersistentMemoryCharts;
        
        public MenuItem getFileNew() {
                return fileNew;
@@ -105,6 +108,18 @@ public class MenuBar {
                return analyzeSearchItem;
        }
 
+       /**
+        * Returns selection of 'Persistent Memory Charts' {@link MenuItem}.
+        *
+        * @return {@code true} if selected.
+        */
+       public boolean getPersistentMemoryChartsSelection() {
+               if (viewPersistentMemoryCharts != null)
+                       return viewPersistentMemoryCharts.getSelection();
+
+               return false;
+       }
+
        public MenuBar() {
                currentShell = WorkbenchUtil.getWorkbenchWindow().getShell();
        }
@@ -190,6 +205,10 @@ public class MenuBar {
                viewReportWarning.setText(MenuBarLabels.VIEW_WARNING);
                viewReportWarning.addSelectionListener(viewReportMenuListener);
 
+               viewPersistentMemoryCharts = new MenuItem(viewReportMenu, SWT.CHECK);
+               viewPersistentMemoryCharts.setText(MenuBarLabels.VIEW_PERSISTENT_MEMORY);
+               viewPersistentMemoryCharts.addSelectionListener(viewReportMenuListener);
+
                MenuItem viewNavigate = new MenuItem(viewMenu, SWT.CASCADE);
                viewNavigate.setText(MenuBarLabels.VIEW_NAVIGATE);
 
@@ -257,14 +276,15 @@ public class MenuBar {
                                        setMenuItemEnable(MenuBarLabels.FILE_SAVE, false);
 
                                        CommonAction.clear();
-                                       Toolbar.INSTANCE.clearMarkerTimeList();
-                                       RangeDataManager.getInstance().clearMarkerTime();
-                                       RangeDataManager.getInstance().clearTimelineMarker();
+                                       MarkerManager.INSTANCE.clearMarkerList();
 
                                        // change UI state
                                        Toolbar.INSTANCE.changeUIState(DAState.INIT);
                                        Toolbar.INSTANCE.setScaleSelection(DAScale.DEFAULT_SCALE_INDEX);
 
+                                       DAState.changeCurrentState(DAState.INIT);
+                                       AnalyzerManager.getCurrentPage().updateView();
+
                                        FlatFeatureDialog featureDialog = new FlatFeatureDialog(currentShell);
                                        featureDialog.open();
                                        
@@ -467,6 +487,12 @@ public class MenuBar {
                                        }
                                        tableView.removeView(WarningDataView.class.getName(), false);
                                }
+                       } else if (menuName.equals(MenuBarLabels.VIEW_PERSISTENT_MEMORY)) {
+                               MemoryChartView chartView = (MemoryChartView) AnalyzerUtil.getView(MemoryPage.pageID,
+                                               MemoryChartView.class.getName());
+
+                               if (chartView != null)
+                                       ((MemoryChartBoard) chartView.getChartBoard()).showPersistentSeries(source.getSelection());
                        }
                        ((TimelinePage)AnalyzerUtil.getTabPage(TimelinePage.pageID)).resizeTableButton();
                }
@@ -753,19 +779,12 @@ public class MenuBar {
 
                final Object result = dialog.open();
                if (null != result) {
-                       Toolbar.INSTANCE.clearMarkerTimeList();
-                       RangeDataManager.getInstance().clearMarkerTime();
-                       RangeDataManager.getInstance().clearTimelineMarker();
-                       Thread loadthread = new Thread(new Runnable() {
-                               @Override
-                               public void run() {
-                                       String decompresspath = CommandAction.loadFromZip((String) result);
-
-                                       OpenTraceProgressManager.getInstance().setSavePath(decompresspath);
-                                       OpenTraceProgressManager.getInstance().startOpenTraceThread();
-                               }
-                       });
-                       loadthread.run();
+                       MarkerManager.INSTANCE.clearMarkerList();
+
+                       String decompresspath = CommandAction.loadFromZip((String) result);
+
+                       OpenTraceProgressManager.getInstance().setSavePath(decompresspath);
+                       OpenTraceProgressManager.getInstance().startOpenTraceThread();
                }
        }
 
index eefa6cb..60c3f66 100644 (file)
@@ -47,28 +47,16 @@ import org.tizen.dynamicanalyzer.project.callstack.RangeCallstackManager;
 import org.tizen.dynamicanalyzer.protocol.ProtocolConstants;
 import org.tizen.dynamicanalyzer.swap.model.data.ProfileData;
 import org.tizen.dynamicanalyzer.swap.model.data.WebProfileData;
-import org.tizen.dynamicanalyzer.ui.file.FileChartView;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryChartView;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;
-import org.tizen.dynamicanalyzer.ui.network.NetworkChartView;
-import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
-import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
-import org.tizen.dynamicanalyzer.ui.opengl.chart.GLChartView;
 import org.tizen.dynamicanalyzer.ui.summary.SummaryDataManager;
 import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionSampleDBTable;
 import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
 import org.tizen.dynamicanalyzer.ui.summary.profiling.RangeProfileDataMaker;
 import org.tizen.dynamicanalyzer.ui.summary.profiling.WebProfileDataMaker;
-import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
-import org.tizen.dynamicanalyzer.ui.thread.chart.ThreadChartView;
 import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
 import org.tizen.dynamicanalyzer.ui.timeline.calltrace.FunctionEntryDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.calltrace.FunctionExitDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.calltrace.WebFunctionEntryDBTable;
 import org.tizen.dynamicanalyzer.ui.timeline.calltrace.WebFunctionExitDBTable;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
@@ -78,6 +66,7 @@ import org.tizen.dynamicanalyzer.widgets.da.view.DABaseComposite;
 import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
 import org.tizen.dynamicanalyzer.widgets.da.view.DATabButton;
 import org.tizen.dynamicanalyzer.widgets.da.view.DATabComposite;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
 
 public class RangeDataManager implements Runnable {
        private static RangeDataManager instance = null;
@@ -91,8 +80,6 @@ public class RangeDataManager implements Runnable {
        private long analysisStartTime = 0;
        private long analysisEndTime = 0;
 
-       private List<Long> markerTimeList = null;
-       
        private boolean isBeingAnalyzed = false;
 
        private enum Function {
@@ -124,36 +111,13 @@ public class RangeDataManager implements Runnable {
 
        private RangeDataManager() {
                rangeCallstackManager = new RangeCallstackManager();
-               markerTimeList = new ArrayList<Long>();
-       }
-       
-       public void clearTimelineMarker() {
-               TimelineChartView TLchartView = (TimelineChartView) AnalyzerUtil.getView(TimelinePage.pageID, TimelineChartView.class.getName());
-               NetworkChartView NETchartView = (NetworkChartView) AnalyzerUtil.getView(NetworkPage.pageID, NetworkChartView.class.getName());
-               ThreadChartView THRchartView = (ThreadChartView) AnalyzerUtil.getView(ThreadPage.pageID, ThreadChartView.class.getName());
-               FileChartView FLchartView = (FileChartView) AnalyzerUtil.getView(FilePage.pageID, FileChartView.class.getName());
-               GLChartView GLchartview = (GLChartView) AnalyzerUtil.getView(GLPage.pageID, GLChartView.class.getName());
-               MemoryChartView MMchartView = (MemoryChartView) AnalyzerUtil.getView(MemoryPage.pageID, MemoryChartView.class.getName());
-               
-               if(TLchartView != null)
-                       TLchartView.getChartBoard().getTimeline().getMarkerList().clear();
-               if(NETchartView != null)
-                       NETchartView.getChartBoard().getTimeline().getMarkerList().clear();
-               if(THRchartView != null)
-                       THRchartView.getChartBoard().getTimeline().getMarkerList().clear();
-               if(FLchartView != null)
-                       FLchartView.getChartBoard().getTimeline().getMarkerList().clear();
-               if(GLchartview != null)
-                       GLchartview.getChartBoard().getTimeline().getMarkerList().clear();
-               if(MMchartView != null)
-                       MMchartView.getChartBoard().getTimeline().getMarkerList().clear();
        }
 
-       public void clearRange() {
+       public synchronized void clearRange() {
                rangeCallstackManager.clear();
                if (profileDataMakerMap != null)
                        profileDataMakerMap.clear();
-               
+
                if (webProfileDataMakerMap != null) {
                        webProfileDataMakerMap.clear();
                }
@@ -280,56 +244,35 @@ public class RangeDataManager implements Runnable {
                        markerStartTime = endTime;      
                }
        }
-       
-       public void clearMarkerTime() {
-               if(markerTimeList != null) {
-                       markerTimeList.clear();
-               }
-       }
-       
-       public void removeMarkerTime(long time) {
-               for(int i = 0; i < markerTimeList.size(); i++) {
-                       if(markerTimeList.get(i) == time) {
-                               markerTimeList.remove(i);
-                       }
-               }
-       }
-       
-       public void addMarkerTime(long time) {
-               if(markerTimeList != null && !markerTimeList.contains(time)) {
-                       markerTimeList.add(time);
-               }
-       }
-       
-       public List<Long> getMarerTimeList() {
-               return markerTimeList;
-       }
-       
+
        public void setRangeFromMarkerList(long time) {
-               if(markerTimeList != null && markerTimeList.size() >= 1 && !markerTimeList.contains(time)) {
+               List<Long> markerTimeListLong = MarkerManager.INSTANCE
+                               .getMarkerTimeListLong();
+
+               if(markerTimeListLong.size() >= 1 && !markerTimeListLong.contains(time)) {
                        int findIndex = -1;
-                       
-                       for(int i = 0; i < markerTimeList.size(); i++) {
-                               if(markerTimeList.get(i) > time) {
+
+                       for(int i = 0; i < markerTimeListLong.size(); i++) {
+                               if(markerTimeListLong.get(i) > time) {
                                        findIndex = i;
                                        break;
                                }
                        }
-                       
+
                        if(findIndex == 0) {
                                markerStartTime = 0;
-                               markerEndTime = markerTimeList.get(findIndex);
+                               markerEndTime = markerTimeListLong.get(findIndex);
                        } else if(findIndex == -1) {
-                               markerStartTime = markerTimeList.get(markerTimeList.size()-1);
-                               markerEndTime = Toolbar.INSTANCE.getTime(); 
+                               markerStartTime = markerTimeListLong.get(markerTimeListLong.size()-1);
+                               markerEndTime = Toolbar.INSTANCE.getTime();
                        } else {
-                               markerStartTime = markerTimeList.get(findIndex-1);
-                               markerEndTime = markerTimeList.get(findIndex);
+                               markerStartTime = markerTimeListLong.get(findIndex-1);
+                               markerEndTime = markerTimeListLong.get(findIndex);
                        }
-                       
+
                        // if click analyze range, setDlogselection false.
                        Toolbar.INSTANCE.setDlogSelection(false);
-                       
+
                        AnalyzerManager.getCurrentPage().updateView(
                                        new DASelectionData(TimelinePage.timelineViewID, markerStartTime, markerEndTime, null, null));
                }
@@ -593,7 +536,7 @@ public class RangeDataManager implements Runnable {
                                                break;
                                        }
                                        
-                                       WebProfileDataMaker profiler = getWebProfileDataMakerByPid(top.getPID());
+                                       WebProfileDataMaker profiler = getWebProfileDataMakerByPid(top.getPid());
 
                                        switch (top.getMsgID()) {
                                        case ProtocolConstants.MSG_WEB_FUNCTION_ENTRY:
index b007dca..6535861 100644 (file)
@@ -46,7 +46,6 @@ import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerManager;
 import org.tizen.dynamicanalyzer.common.DASelectionData;
@@ -59,36 +58,15 @@ import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
 import org.tizen.dynamicanalyzer.ui.range.RangePage;
 import org.tizen.dynamicanalyzer.ui.summary.SummaryPage;
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
-import org.tizen.dynamicanalyzer.ui.widgets.FilterDialog;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableHeaderRenderer;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATreeComposite;
 import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
 import org.tizen.dynamicanalyzer.ui.widgets.table.TreeDataComparator;
 import org.tizen.dynamicanalyzer.util.Logger;
-import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
 import org.tizen.dynamicanalyzer.utils.Formatter;
 
 public class ProfilingTable extends DATreeComposite {
-       protected String[] columnNames = {
-                       SummaryLabels.FUNCTION_USER_PROFILING_VIEW_NAME,
-                       SummaryLabels.FUNCTION_USER_PROFILING_VIEW_CPU_TIME,
-                       SummaryLabels.FUNCTION_USER_PROFILING_VIEW_CPU_RATE,
-                       SummaryLabels.FUNCTION_USER_PROFILING_VIEW_ELAPSED_TIME,
-                       SummaryLabels.FUNCTION_USER_PROFILING_VIEW_CPU_TIME,
-                       SummaryLabels.FUNCTION_USER_PROFILING_VIEW_CPU_RATE,
-                       SummaryLabels.FUNCTION_USER_PROFILING_VIEW_ELAPSED_TIME,
-                       SummaryLabels.FUNCTION_USER_PROFILING_VIEW_CALL_COUNT };
-       protected int[] columnSizes = { 260, 0, 0, 0, 0, 0, 0, 0 };
-       private int[] columnAlignment = { SWT.LEFT, SWT.RIGHT, SWT.LEFT, SWT.RIGHT,
-                       SWT.RIGHT,SWT.LEFT,SWT.RIGHT,SWT.RIGHT};
-       protected boolean[] columnVisibility = { true, true, true, true, true,
-                       true, true, true };
-       protected int[] sortTypes = { AnalyzerConstants.SORT_TYPE_NUM,
-                       AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
-                       AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
-                       AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
-                       AnalyzerConstants.SORT_TYPE_NUM };
 
        private boolean isRange = false;
 
@@ -101,12 +79,21 @@ public class ProfilingTable extends DATreeComposite {
                comparator.setDirection(false); // default descending sort
                
                setTree(true);
-               setSortTypes(sortTypes);
-               setColumnAlignment(columnAlignment);
-               List<ColumnData> columnData = createColumnData();
-               setColumns(columnData);
+
+               setSortTypes(new int[] { AnalyzerConstants.SORT_TYPE_NUM,
+                               AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
+                               AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
+                               AnalyzerConstants.SORT_TYPE_NUM, AnalyzerConstants.SORT_TYPE_NUM,
+                               AnalyzerConstants.SORT_TYPE_NUM });
+
+               setColumnAlignment(new int[] { SWT.LEFT, SWT.RIGHT, SWT.LEFT, SWT.RIGHT,
+                               SWT.RIGHT, SWT.LEFT, SWT.RIGHT, SWT.RIGHT });
+
+               setColumns(createColumnData());
+
+               int[] columnSizes = { 260, 0, 0, 0, 0, 0, 0, 0 };
                setColumnSize(columnSizes);
-               setColumnVisibility(columnVisibility);
+               setColumnVisibility(new boolean[] { true, true, true, true, true, true, true, true });
                setTableToolTipEnable(false);
                setTableName(SummaryLabels.FUNCTION_USER_PROFILING_VIEW_TITLE);
                parent.addControlListener(new TableColumnSizePackListener(this, columnSizes));
@@ -178,16 +165,27 @@ public class ProfilingTable extends DATreeComposite {
        }
 
        private List<ColumnData> createColumnData() {
+               String[] tableColumnNames = {
+                               SummaryLabels.FUNCTION_USER_PROFILING_VIEW_NAME,
+                               SummaryLabels.FUNCTION_USER_PROFILING_VIEW_CPU_TIME,
+                               SummaryLabels.FUNCTION_USER_PROFILING_VIEW_CPU_RATE,
+                               SummaryLabels.FUNCTION_USER_PROFILING_VIEW_ELAPSED_TIME,
+                               SummaryLabels.FUNCTION_USER_PROFILING_VIEW_CPU_TIME,
+                               SummaryLabels.FUNCTION_USER_PROFILING_VIEW_CPU_RATE,
+                               SummaryLabels.FUNCTION_USER_PROFILING_VIEW_ELAPSED_TIME,
+                               SummaryLabels.FUNCTION_USER_PROFILING_VIEW_CALL_COUNT
+               };
+
                int columnIndex = 0;
                List<ColumnData> columnData = new ArrayList<ColumnData>();
-               ColumnData data0 = new ColumnData(columnNames[columnIndex++]);
+               ColumnData data0 = new ColumnData(tableColumnNames[columnIndex++]);
                columnData.add(data0);
 
                ColumnData data1 = new ColumnData(
                                SummaryLabels.FUNCTION_USER_PROFILING_VIEW_EXCLUSIVE);
-               ColumnData data1Child1 = new ColumnData(columnNames[columnIndex++]);
-               ColumnData data1Child2 = new ColumnData(columnNames[columnIndex++]);
-               ColumnData data1Child3 = new ColumnData(columnNames[columnIndex++]);
+               ColumnData data1Child1 = new ColumnData(tableColumnNames[columnIndex++]);
+               ColumnData data1Child2 = new ColumnData(tableColumnNames[columnIndex++]);
+               ColumnData data1Child3 = new ColumnData(tableColumnNames[columnIndex++]);
                data1.getChildren().add(data1Child1);
                data1.getChildren().add(data1Child2);
                data1.getChildren().add(data1Child3);
@@ -195,15 +193,15 @@ public class ProfilingTable extends DATreeComposite {
 
                ColumnData data2 = new ColumnData(
                                SummaryLabels.FUNCTION_USER_PROFILING_VIEW_INCLUSIVE);
-               ColumnData data2Child1 = new ColumnData(columnNames[columnIndex++]);
-               ColumnData data2Child2 = new ColumnData(columnNames[columnIndex++]);
-               ColumnData data2Child3 = new ColumnData(columnNames[columnIndex++]);
+               ColumnData data2Child1 = new ColumnData(tableColumnNames[columnIndex++]);
+               ColumnData data2Child2 = new ColumnData(tableColumnNames[columnIndex++]);
+               ColumnData data2Child3 = new ColumnData(tableColumnNames[columnIndex++]);
                data2.getChildren().add(data2Child1);
                data2.getChildren().add(data2Child2);
                data2.getChildren().add(data2Child3);
                columnData.add(data2);
 
-               ColumnData data3 = new ColumnData(columnNames[columnIndex++]);
+               ColumnData data3 = new ColumnData(tableColumnNames[columnIndex++]);
                columnData.add(data3);
                return columnData;
        }
index a2d5087..8131159 100644 (file)
@@ -56,7 +56,7 @@ public class WebProfileDataMaker {
        public void makeWebFunctionUsageProfileData(WebProfileData log) {
                long exeTime = 0;
                int type = log.getMsgID();
-               int tid = log.getTID();
+               int tid = log.getTid();
                WebProfilingData function = null;
                
                if (type == ProtocolConstants.MSG_WEB_FUNCTION_ENTRY) {
@@ -68,7 +68,7 @@ public class WebProfileDataMaker {
                                
                                // make function
                                function = makeWebProfilingData(log);
-                               currentFunctionTidMap.put(log.getTID(), function);
+                               currentFunctionTidMap.put(log.getTid(), function);
                        } else {
                                Integer profilingDataID = symbolIDMap.get(log.generateFunctionKey());
 
@@ -91,7 +91,7 @@ public class WebProfileDataMaker {
                                } else {
                                        Logger.debug("Current function does not exist");
                                }
-                               currentFunctionTidMap.put(log.getTID(), function);
+                               currentFunctionTidMap.put(log.getTid(), function);
                        }
 
                } else if (type == ProtocolConstants.MSG_WEB_FUNCTION_EXIT) {
@@ -128,7 +128,7 @@ public class WebProfileDataMaker {
                                Logger.debug("Parent profilingData of " + current.generateFunctionKey() + " is not found");
                        }
                        
-                       currentFunctionTidMap.put(log.getTID(), current.getParent());
+                       currentFunctionTidMap.put(log.getTid(), current.getParent());
                        current.initRelationData();
                        
                        // TODO: check recursive or called more than once in the same call tree line
index d565609..8198cf1 100644 (file)
@@ -52,17 +52,6 @@ import org.tizen.dynamicanalyzer.model.FilterProperty;
 import org.tizen.dynamicanalyzer.model.TableInput;
 import org.tizen.dynamicanalyzer.swap.model.data.ProbeCommonData;
 import org.tizen.dynamicanalyzer.swap.model.data.SyncData;
-import org.tizen.dynamicanalyzer.ui.file.FileChartView;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryChartView;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;
-import org.tizen.dynamicanalyzer.ui.network.NetworkChartView;
-import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
-import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
-import org.tizen.dynamicanalyzer.ui.opengl.chart.GLChartView;
-import org.tizen.dynamicanalyzer.ui.page.BaseView;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.thread.chart.ThreadChartView;
 import org.tizen.dynamicanalyzer.ui.thread.data.ThreadDataManager;
 import org.tizen.dynamicanalyzer.ui.thread.db.SyncAPIDBTable;
 import org.tizen.dynamicanalyzer.ui.thread.db.ThreadAPIDBTable;
@@ -70,16 +59,11 @@ import org.tizen.dynamicanalyzer.ui.thread.type.ThreadPageData;
 import org.tizen.dynamicanalyzer.ui.thread.type.ThreadPageSyncData;
 import org.tizen.dynamicanalyzer.ui.thread.type.ThreadPageSyncDataEvent;
 import org.tizen.dynamicanalyzer.ui.thread.type.ThreadPageThreadData;
-import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DAApiListTableComposite;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
 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.timeline.MarkerManager;
 
 public class ThreadAPIListTable extends DAApiListTableComposite {
 
@@ -150,7 +134,7 @@ public class ThreadAPIListTable extends DAApiListTableComposite {
                                }
                                List<Object> markerData = ((DATableDataFormat) ti[0].getData()).getData();
                                long markerTime = Long.parseLong((String)markerData.get(1));
-                               AnalyzerUtil.addMarker(markerTime);
+                               MarkerManager.INSTANCE.addMarker(markerTime);
                        }
                });
        }
@@ -492,4 +476,4 @@ public class ThreadAPIListTable extends DAApiListTableComposite {
                
                return columnName;
        }
-}
+}
\ No newline at end of file
index 407fa12..9297502 100644 (file)
 
 package org.tizen.dynamicanalyzer.ui.thread.chart;
 
-import java.util.List;
-
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StackLayout;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.GC;
 import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Listener;
@@ -57,7 +52,6 @@ import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.model.data.LogDataFactory;
 import org.tizen.dynamicanalyzer.swap.model.data.ProbeCommonData;
-import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
 import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
@@ -70,9 +64,6 @@ import org.tizen.dynamicanalyzer.ui.toolbar.ToolBarComboListener;
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
-import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonAttribute;
-import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer;
 import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
@@ -501,36 +492,10 @@ public class ThreadChartView extends DAViewComposite {
                }
        }
        
-       public void updateMarker() {
-               List<Double> markerTimeList = Toolbar.INSTANCE.getMarkerTimeList();
-               
-               List<ThreadChart> threadChartList = threadChartBoard.getThreadChartItemList();
-               for(ThreadChart threadChart : threadChartList) {
-                       threadChart.getChart().getPlot().clearMarkerTime();
-               }
-               for(double time : markerTimeList) {
-                       for(ThreadChart threadChart : threadChartList) {
-                               threadChart.getChart().getPlot().addMarkerTime(time);
-                       }
-                       threadChartBoard.getTimeline().addMarker(time);
-               }
-               
-               List<SyncChart> syncChartList = threadChartBoard.getSyncChartList();
-               for(SyncChart syncChart : syncChartList) {
-                       syncChart.getChart().getPlot().clearMarkerTime();
-               }
-               for(double time : markerTimeList) {
-                       for(SyncChart syncChart : syncChartList) {
-                               syncChart.getChart().getPlot().addMarkerTime(time);
-                       }
-               }
-       }
-
        @Override
        public void updateView() {
                updateScale();
                updateProcessCombo();
-               updateMarker();
                if (stackLayout.topControl == syncChartBoard) {
                        updateTimeLine(syncChartBoard);
                        updateRange(syncChartBoard);
@@ -576,7 +541,6 @@ public class ThreadChartView extends DAViewComposite {
        public void updateView(DAViewData data) {
                updateScale();
                updateProcessCombo();
-               updateMarker();
                if (data instanceof DASelectionData == false) {
                        return;
                }
@@ -686,13 +650,6 @@ public class ThreadChartView extends DAViewComposite {
                LifecycleLogParser.getInstance().registerTimeline(threadTimeline);
                LifecycleLogParser.getInstance().registerLifecycleBar(syncChartBoard.getLifecycleBar());
                LifecycleLogParser.getInstance().registerTimeline(syncTimeline);
-
-               SetRangeMarkerMouseMoveListener listener = new SetRangeMarkerMouseMoveListener(
-                               RangeDataManager.getInstance(), threadChartBoard, threadTimeline);
-               threadTimeline.addMouseMoveListener(listener);
-               threadTimeline.addMouseListener(listener);
-               syncTimeline.addMouseMoveListener(listener);
-               syncTimeline.addMouseListener(listener);
        }
        
        public DAChartBoard getChartBoard(){
index bdbbb42..9b7131c 100644 (file)
@@ -173,8 +173,8 @@ public class CallTraceDataManager extends PageDataManager {
 
                                try {
                                        insertRowData.add(new Long(pData.getSeq()));
-                                       insertRowData.add(new Integer(pData.getPID()));
-                                       insertRowData.add(new Integer(pData.getTID()));
+                                       insertRowData.add(new Integer(pData.getPid()));
+                                       insertRowData.add(new Integer(pData.getTid()));
                                        insertRowData.add(new Integer(pData.getFunctionLineNumber()));
                                        insertRowData.add(pData.getFunctionName());
                                        insertRowData.add(pData.getFunctionURL());
@@ -186,7 +186,7 @@ public class CallTraceDataManager extends PageDataManager {
 
                                // for calltrace table windowing
                                ProcessInformation process = Global.getProject().getProcessInformation(
-                                               pData.getPID());
+                                               pData.getPid());
                                process.addFunctionEntryLogCount();
                        }
                        if (insertData.size() > 0) {
index 82d48c5..0cd9018 100644 (file)
@@ -45,26 +45,14 @@ import org.tizen.dynamicanalyzer.model.TableInput;
 import org.tizen.dynamicanalyzer.nl.TimelinePageLabels;
 import org.tizen.dynamicanalyzer.project.BinaryInfo;
 import org.tizen.dynamicanalyzer.project.ProcessInformation;
-import org.tizen.dynamicanalyzer.ui.file.FileChartView;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryChartView;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;
-import org.tizen.dynamicanalyzer.ui.network.NetworkChartView;
-import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
-import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
-import org.tizen.dynamicanalyzer.ui.opengl.chart.GLChartView;
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
-import org.tizen.dynamicanalyzer.ui.thread.chart.ThreadChartView;
 import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
 import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DAWindowingTableComposite;
 import org.tizen.dynamicanalyzer.ui.widgets.table.WindowingTableColumnSizePackListener;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
 
 public class CallTraceTable extends DAWindowingTableComposite {
        // disable parameter and return column until we can get those values
@@ -126,7 +114,7 @@ public class CallTraceTable extends DAWindowingTableComposite {
                                }
                                List<Object> markerData = ((DATableDataFormat) ti[0].getData()).getData();
                                long markerTime = (Long) markerData.get(FunctionEntryDBTable.COLUMN.START_TIME.index);
-                               AnalyzerUtil.addMarker(markerTime);
+                               MarkerManager.INSTANCE.addMarker(markerTime);
                        }
 
                        @Override
@@ -141,7 +129,7 @@ public class CallTraceTable extends DAWindowingTableComposite {
                });
 
        }
-       
+
        @Override
        protected List<TableInput> makeTableInput() {
                List<List<Object>> queriedData = getQueriedObjectData();
index 75b8a4f..9890b6a 100644 (file)
@@ -181,13 +181,14 @@ public class ProcessesChartRenderer extends DAChartRenderer {
                                                        .getTooltipText();
                                }
 
-                               gc.setForeground(tooltip.getLineColor());
+                               gc.setForeground(ColorResources.CHART_TOOLTIP_TIME_NOW);
                                gc.setLineStyle(SWT.LINE_DOT);
-                               gc.setLineWidth(1);
+                               gc.setLineWidth(2);
 
                                gc.drawLine(plot.getXPixelFromX(xVal), 0,
                                                plot.getXPixelFromX(xVal), r.height);
                                gc.setLineStyle(SWT.LINE_CUSTOM);
+                               gc.setLineWidth(1);
 
                                // event color
                                color = series.getSeriesItemList().get(index).getColor();
index c1ea306..bd852f9 100644 (file)
@@ -54,7 +54,6 @@ import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.setting.UILayoutDataManager;
-import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
 import org.tizen.dynamicanalyzer.ui.common.TimeLineChartKeyListener;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
 import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
@@ -62,7 +61,6 @@ import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
 import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
 import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
-import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUChart;
 import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart;
 import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
 import org.tizen.dynamicanalyzer.ui.toolbar.DAToolBarCustomCombo;
@@ -74,7 +72,6 @@ import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer;
 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.DAChartBoardHeightChangeableItem;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
 import org.tizen.dynamicanalyzer.widgets.da.view.DAViewComposite;
 import org.tizen.dynamicanalyzer.widgets.da.view.DAViewData;
@@ -138,10 +135,6 @@ public class TimelineChartView extends DAViewComposite {
 
                timeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
                timeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
-               SetRangeMarkerMouseMoveListener listener = new SetRangeMarkerMouseMoveListener(
-                               rangeDataManager, chartBoard, timeline);
-               timeline.addMouseMoveListener(listener);
-               timeline.addMouseListener(listener);
                
                processCombo = makeDACustomCombo(chartBoard.getTitleComp());
                FormData data = new FormData();
@@ -333,32 +326,11 @@ public class TimelineChartView extends DAViewComposite {
                        }
                }
        }
-
-       public void updateMarker() {
-               List<Double> markerTimeList = Toolbar.INSTANCE.getMarkerTimeList();
-               List<TimelineChart> chartList = TimelineChartManager.getInstance().getChartList();
-               for(TimelineChart chart : chartList) {
-                       chart.getChart().getPlot().clearMarkerTime();
-                       if(chart instanceof CPUChart && ((CPUChart) chart).getProcessChart() != null) {
-                               ((CPUChart) chart).getProcessChart().getChart().getPlot().clearMarkerTime();
-                       }
-               }
-               for(double time : markerTimeList) {
-                       for(TimelineChart chart : chartList) {
-                               chart.getChart().getPlot().addMarkerTime(time);
-                               if(chart instanceof CPUChart && ((CPUChart) chart).getProcessChart() != null) {
-                                       ((CPUChart) chart).getProcessChart().getChart().getPlot().addMarkerTime(time);
-                               }
-                       }
-                       chartBoard.getTimeline().addMarker(time);
-               }
-       }
-
+       
        @Override
        public void updateView(DAViewData data) {
                updateScale();
                updateProcessCombo();
-               updateMarker();
                if (data instanceof DASelectionData) {
                        DASelectionData selData = (DASelectionData) data;
 
@@ -386,7 +358,6 @@ public class TimelineChartView extends DAViewComposite {
        public void updateView() {
                updateScale();
                updateProcessCombo();
-               updateMarker();
                timelineChartManager.makeChartSeries(AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleStartTime()), 
                                AnalyzerUtil.translateSecToMicroSec(chartBoard.getVisibleEndTime()));
                
index af1958d..e0ec688 100644 (file)
@@ -47,18 +47,7 @@ import org.tizen.dynamicanalyzer.model.TableInput;
 import org.tizen.dynamicanalyzer.resources.ColorResources;\r
 import org.tizen.dynamicanalyzer.resources.FontResources;\r
 import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;\r
-import org.tizen.dynamicanalyzer.ui.file.FileChartView;\r
-import org.tizen.dynamicanalyzer.ui.file.FilePage;\r
-import org.tizen.dynamicanalyzer.ui.memory.MemoryChartView;\r
-import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;\r
-import org.tizen.dynamicanalyzer.ui.network.NetworkChartView;\r
-import org.tizen.dynamicanalyzer.ui.network.NetworkPage;\r
-import org.tizen.dynamicanalyzer.ui.opengl.GLPage;\r
-import org.tizen.dynamicanalyzer.ui.opengl.chart.GLChartView;\r
 import org.tizen.dynamicanalyzer.ui.page.BaseView;\r
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;\r
-import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;\r
-import org.tizen.dynamicanalyzer.ui.thread.chart.ThreadChartView;\r
 import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;\r
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView;\r
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;\r
@@ -74,6 +63,7 @@ import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenu;\r
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuItem;\r
 import org.tizen.dynamicanalyzer.widgets.popupMenu.DAPopupMenuListener;\r
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;\r
 import org.tizen.sdblib.util.StringUtil;\r
 \r
 public class DlogTable extends DATableComposite {\r
@@ -249,7 +239,7 @@ public class DlogTable extends DATableComposite {
                                }\r
                                List<Object> markerData = ((DATableDataFormat) ti[0].getData()).getData();\r
                                long markertime = (Long)  markerData.get(0);\r
-                               AnalyzerUtil.addMarker(markertime);\r
+                               MarkerManager.INSTANCE.addMarker(markertime);\r
                        }\r
                });\r
                \r
@@ -351,7 +341,7 @@ public class DlogTable extends DATableComposite {
             }\r
         });\r
        }\r
-       \r
+\r
        private void setDlogSelecetionRange(long startTime, long endTime){\r
                \r
                double startMarkerTime = startTime\r
index fc6c66e..8769a6b 100644 (file)
@@ -827,14 +827,12 @@ public class DAToolBarCustomCombo extends Canvas {
                                        return;\r
                                }\r
 \r
-                               if (null != downArrowButton) {\r
-                                       Rectangle rectangle = downArrowButton.getBounds();\r
-                                       int x = event.x;\r
-                                       int y = event.y;\r
+                               Rectangle rectangle = downArrowButton.getBounds();\r
+                               int x = event.x;\r
+                               int y = event.y;\r
 \r
-                                       if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {\r
-                                               return;\r
-                                       }\r
+                               if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {\r
+                                       return;\r
                                }\r
 \r
                                int size = getItems().size();\r
index 292a206..acd742b 100644 (file)
@@ -127,9 +127,10 @@ public class ProcessExplorerDialog extends DAMessageBox {
 
                        @Override
                        public void handleClickEvent(DACustomButton button) {
-                               result = explorer.getSelectedProcess();
+                               setResult(explorer.getSelectedProcess());
 
                                if (null != result) {
+                                       @SuppressWarnings("unchecked")
                                        Boolean process_validation = checkInvalidProcess((Map<Integer, String>) result);
                                         if(process_validation){
                                                 shell.dispose();
index 275bf8c..b6e1d0c 100644 (file)
@@ -404,7 +404,7 @@ public class RemoteDeviceDialog extends DAMessageBox {
        public void setConnectionResult(boolean bresult) {
                if (bresult) {
                        // if succeeded to connect remote device
-                       result = AnalyzerConstants.SUCCESS;
+                       setResult(AnalyzerConstants.SUCCESS);
                        shell.close();
                } else {
                        // if failed to connect remote device
index 7f35e35..6a0c4f8 100644 (file)
@@ -190,7 +190,7 @@ public class SaveAsDialog extends DAMessageBox {
                                saveFileName = saveFileName.substring(0, CommonConstants.FILE_NAME_MAX);
                        }
 
-                       result = AnalyzerConstants.SUCCESS;
+                       setResult(AnalyzerConstants.SUCCESS);
                        shell.dispose();
                }
        };
index 7ec83a0..35e164b 100644 (file)
@@ -73,20 +73,7 @@ import org.tizen.dynamicanalyzer.setting.Feature;
 import org.tizen.dynamicanalyzer.setting.SettingDataManager;
 import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
 import org.tizen.dynamicanalyzer.ui.common.explorer.DeviceExplorerDialog;
-import org.tizen.dynamicanalyzer.ui.file.FileChartView;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryChartView;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;
-import org.tizen.dynamicanalyzer.ui.network.NetworkChartView;
-import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
-import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
-import org.tizen.dynamicanalyzer.ui.opengl.chart.GLChartView;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
-import org.tizen.dynamicanalyzer.ui.thread.chart.ThreadChartView;
-import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView;
 import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceDialog;
 import org.tizen.dynamicanalyzer.ui.toolbar.replayEditor.ReplayEditDialog;
 import org.tizen.dynamicanalyzer.ui.toolbar.setting.PreferencesDialog;
@@ -101,6 +88,7 @@ import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButton;
 import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;
 import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboSelectionListener;
 import org.tizen.dynamicanalyzer.widgets.da.base.ProgressDialog;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
 import org.tizen.dynamicanalyzer.widgets.timer.IAlarm;
 import org.tizen.dynamicanalyzer.widgets.timer.TimerClock;
 import org.tizen.dynamicanalyzer.workbench.LayoutManager;
@@ -152,8 +140,7 @@ public enum Toolbar {
        
        private static final int DEVICE_COMBO = 0;
        private static final int APP_COMBO = 1;
-       
-       private List<Double> markerTimeList = new ArrayList<Double>();
+
        private long chartDragStart = -1;
        private long chartDragEnd = -1;
        private boolean dlogTimeSelection = true;
@@ -162,118 +149,6 @@ public enum Toolbar {
                return startButton;
        }
        
-       public void clearMarkerTimeList() {
-               if(markerTimeList != null) {
-                       markerTimeList.clear();
-               }
-       }
-       
-       public void addMarkerTime(double time) {
-               if(markerTimeList != null && !markerTimeList.contains(time)) {
-                       markerTimeList.add(time);
-               }
-               
-               TimelineChartView TLchartView = (TimelineChartView) AnalyzerUtil.getView(TimelinePage.pageID, TimelineChartView.class.getName());
-               NetworkChartView NETchartView = (NetworkChartView) AnalyzerUtil.getView(NetworkPage.pageID, NetworkChartView.class.getName());
-               ThreadChartView THRchartView = (ThreadChartView) AnalyzerUtil.getView(ThreadPage.pageID, ThreadChartView.class.getName());
-               FileChartView FLchartView = (FileChartView) AnalyzerUtil.getView(FilePage.pageID, FileChartView.class.getName());
-               GLChartView GLchartview = (GLChartView) AnalyzerUtil.getView(GLPage.pageID, GLChartView.class.getName());
-               MemoryChartView MMchartView = (MemoryChartView) AnalyzerUtil.getView(MemoryPage.pageID, MemoryChartView.class.getName());
-               
-               if(TLchartView != null)
-                       TLchartView.updateView();
-               if(NETchartView != null)
-                       NETchartView.updateView();
-               if(THRchartView != null)
-                       THRchartView.updateView();
-               if(FLchartView != null)
-                       FLchartView.updateView();
-               if(GLchartview != null)
-                       GLchartview.updateView();
-               if(MMchartView != null)
-                       MMchartView.updateView();
-       }
-       
-       public void removeMarkerTime(int index, double time) {
-               if(markerTimeList != null && markerTimeList.contains(time)) {
-                       markerTimeList.remove(index);
-               }
-               
-               TimelineChartView TLchartView = (TimelineChartView) AnalyzerUtil.getView(TimelinePage.pageID, TimelineChartView.class.getName());
-               NetworkChartView NETchartView = (NetworkChartView) AnalyzerUtil.getView(NetworkPage.pageID, NetworkChartView.class.getName());
-               ThreadChartView THRchartView = (ThreadChartView) AnalyzerUtil.getView(ThreadPage.pageID, ThreadChartView.class.getName());
-               FileChartView FLchartView = (FileChartView) AnalyzerUtil.getView(FilePage.pageID, FileChartView.class.getName());
-               GLChartView GLchartview = (GLChartView) AnalyzerUtil.getView(GLPage.pageID, GLChartView.class.getName());
-               MemoryChartView MMchartView = (MemoryChartView) AnalyzerUtil.getView(MemoryPage.pageID, MemoryChartView.class.getName());
-               
-               if(TLchartView != null) {
-                       TLchartView.getChartBoard().getTimeline().getMarkerList().remove(index);
-                       TLchartView.updateView();
-               }
-               if(NETchartView != null) {
-                       NETchartView.getChartBoard().getTimeline().getMarkerList().remove(index);
-                       NETchartView.updateView();
-               }
-               if(THRchartView != null) {
-                       THRchartView.getChartBoard().getTimeline().getMarkerList().remove(index);
-                       THRchartView.updateView();
-               }
-               if(FLchartView != null) {
-                       FLchartView.getChartBoard().getTimeline().getMarkerList().remove(index);
-                       FLchartView.updateView();
-               }
-               if(GLchartview != null) {
-                       GLchartview.getChartBoard().getTimeline().getMarkerList().remove(index);
-                       GLchartview.updateView();
-               }
-               if(MMchartView != null) {
-                       MMchartView.getChartBoard().getTimeline().getMarkerList().remove(index);
-                       MMchartView.updateView();
-               }
-       }
-       
-       public void setMarkerTime(int index, double time) {
-               if(markerTimeList != null) {
-                       getMarkerTimeList().set(index, time);
-               }
-               
-               TimelineChartView TLchartView = (TimelineChartView) AnalyzerUtil.getView(TimelinePage.pageID, TimelineChartView.class.getName());
-               NetworkChartView NETchartView = (NetworkChartView) AnalyzerUtil.getView(NetworkPage.pageID, NetworkChartView.class.getName());
-               ThreadChartView THRchartView = (ThreadChartView) AnalyzerUtil.getView(ThreadPage.pageID, ThreadChartView.class.getName());
-               FileChartView FLchartView = (FileChartView) AnalyzerUtil.getView(FilePage.pageID, FileChartView.class.getName());
-               GLChartView GLchartview = (GLChartView) AnalyzerUtil.getView(GLPage.pageID, GLChartView.class.getName());
-               MemoryChartView MMchartView = (MemoryChartView) AnalyzerUtil.getView(MemoryPage.pageID, MemoryChartView.class.getName());
-               
-               if(TLchartView != null) {
-                       TLchartView.getChartBoard().getTimeline().getMarkerList().get(index).setTime(time);
-                       TLchartView.updateView();
-               }
-               if(NETchartView != null) {
-                       NETchartView.getChartBoard().getTimeline().getMarkerList().get(index).setTime(time);
-                       NETchartView.updateView();
-               }
-               if(THRchartView != null) {
-                       THRchartView.getChartBoard().getTimeline().getMarkerList().get(index).setTime(time);
-                       THRchartView.updateView();
-               }
-               if(FLchartView != null) {
-                       FLchartView.getChartBoard().getTimeline().getMarkerList().get(index).setTime(time);
-                       FLchartView.updateView();
-               }
-               if(GLchartview != null) {
-                       GLchartview.getChartBoard().getTimeline().getMarkerList().get(index).setTime(time);
-                       GLchartview.updateView();
-               }
-               if(MMchartView != null) {
-                       MMchartView.getChartBoard().getTimeline().getMarkerList().get(index).setTime(time);
-                       MMchartView.updateView();
-               }
-       }
-       
-       public List<Double> getMarkerTimeList() {
-               return markerTimeList;
-       }
-       
        private int scaleSelection = 2;
        
        public int getScaleSelection() {
@@ -527,10 +402,22 @@ public enum Toolbar {
 
                        @Override
                        public void handleClickEvent(DACustomButton button) {
+                               if (!SettingDataManager.INSTANCE.checkConnectedTargetType()) {
+                                       UIActionHolder.getUIAction().showWarning(
+                                                       button.getShell(),
+                                                       DAResult.ErrorCode.ERR_DEVICE_TARGET_MISMATCH
+                                                                       .getErrorMessage()
+                                                                       + "\nDevice type: "
+                                                                       + SettingDataManager.INSTANCE.getConnected().getTargetName()
+                                                                       + "\nSelected target: "
+                                                                       + SettingDataManager.INSTANCE.getSelectedTarget());
+                                       Logger.info(DAResult.ErrorCode.ERR_DEVICE_TARGET_MISMATCH
+                                                       .getErrorMessage());
+                                       return;
+                               }
+
                                if (DAState.isStartable()) {
-                                       clearMarkerTimeList();
-                                       RangeDataManager.getInstance().clearMarkerTime();
-                                       RangeDataManager.getInstance().clearTimelineMarker();
+                                       MarkerManager.INSTANCE.clearMarkerList();
                                        CommandAction.startTrace(false);
                                } else if (DAState.isRunning()) {
                                        CommandAction.stopTrace(new DAResult(ErrorCode.SUCCESS), false);
@@ -718,7 +605,7 @@ public enum Toolbar {
                // Creates about button.
                searchButton = new DACustomButton(parent, ImageResources.SEARCH, ImageResources.SEARCH_PUSH,
                                ImageResources.SEARCH_HOVER, ImageResources.SEARCH_DISABLE);
-               //searchButton.setToolTipText(ShortCutManager.COOLBAR_AREA_ABOUT);
+               searchButton.setToolTipText(ShortCutManager.COOLBAR_AREA_SEARCH);
                searchButton.setBackground(ColorResources.GRAY_220);
                buttons.put(SEARCH_BUTTON, searchButton);
                        
@@ -1414,14 +1301,12 @@ public enum Toolbar {
                        pkg.getBinaryInformation(binPaths);
                }
                progressDlg.setValues("Done", 100);
-               if (progressDlg != null) {
-                       Display.getDefault().syncExec(new Runnable() {
-                               @Override
-                               public void run() {
-                                       progressDlg.close();
-                               }
-                       });
-               }
+               Display.getDefault().syncExec(new Runnable() {
+                       @Override
+                       public void run() {
+                               progressDlg.close();
+                       }
+               });
        }
        
        /// Check AppList from target updated or not and update newPkgList
index 7c2a72b..d399f6e 100644 (file)
@@ -280,7 +280,7 @@ public class OpenTraceDialog extends DAMessageBox {
                                OpenTraceProgressManager.getInstance().setSavePath(openPath);
                                OpenTraceProgressManager.getInstance().startOpenTraceThread();
 
-                               result = AnalyzerConstants.SUCCESS;
+                               setResult(AnalyzerConstants.SUCCESS);
 
                                shell.dispose();
                        }
index 420238a..2fb8a7b 100644 (file)
@@ -176,7 +176,7 @@ public class RepalyEditSaveDialog extends DAMessageBox {
                                saveFileName = old.substring(0, MAX_SAVE_FILE_NAME_LENGTH - 1);
                        }
                        if (executeSaveTrace()) {
-                               result = AnalyzerConstants.SUCCESS;
+                               setResult(AnalyzerConstants.SUCCESS);
                        }
                        shell.dispose();
                }
index 1894cef..5c1e583 100644 (file)
@@ -87,7 +87,7 @@ public class FeatureDialog extends DAMessageBox {
                                SettingDialogManager.INSTANCE.setFeaturesValueFromTableItemsList(table);
 
                                // update template view
-                               result = Boolean.valueOf(true);
+                               setResult(Boolean.valueOf(true));
                        }
                        shell.dispose(); // close dialog
                }
index 2647784..9b363da 100644 (file)
@@ -37,7 +37,6 @@ import org.tizen.dynamicanalyzer.ui.widgets.table.DATableCellRenderer;
 public class FeatureDialogFeaturesTreeTableCellRenderer extends DATableCellRenderer {
        
        private static final int LEFT_MARGIN = 4;
-       protected FeatureDialogFeaturesTreeTableToggleRenderer toggleRenderer;
        private Grid table = null;
 
        public FeatureDialogFeaturesTreeTableCellRenderer(Grid table) {
index 247a8e4..125e9db 100644 (file)
@@ -25,6 +25,8 @@
  */
 package org.tizen.dynamicanalyzer.ui.toolbar.setting;
 
+import java.util.LinkedList;
+
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.DisposeEvent;
 import org.eclipse.swt.events.DisposeListener;
@@ -42,13 +44,12 @@ import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.dynamicanalyzer.common.DAState;
 import org.tizen.dynamicanalyzer.handlers.CommonAction;
-import org.tizen.dynamicanalyzer.handlers.GUIAction;
 import org.tizen.dynamicanalyzer.handlers.UIActionHolder;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
 import org.tizen.dynamicanalyzer.nl.WidgetLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.setting.FlatFeature;
 import org.tizen.dynamicanalyzer.setting.SettingDataManager;
 import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
 import org.tizen.dynamicanalyzer.widgets.da.base.DAMessageBox;
@@ -88,6 +89,8 @@ public class FlatFeatureDialog extends DAMessageBox {
        final public int SELECTED_WIDTH = 285;  // SelectedList have to draw line
        final public int SELECTED_HEIGHT = 489 + TITLE_HEIGHT;
 
+       LinkedList<FlatFeature> orderedFeatureList = new LinkedList<FlatFeature>();
+
        public FlatFeatureDialog(Shell parentShell) {
                super(parentShell);
        }
index 0d79610..38bb2fa 100644 (file)
  */
 package org.tizen.dynamicanalyzer.ui.toolbar.setting;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
+
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.ScrolledComposite;
 import org.eclipse.swt.events.PaintEvent;
@@ -37,7 +41,6 @@ import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Listener;
@@ -46,15 +49,14 @@ import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.setting.Feature;
 import org.tizen.dynamicanalyzer.setting.FlatFeature;
 import org.tizen.dynamicanalyzer.setting.SettingDataManager;
 import org.tizen.dynamicanalyzer.setting.TargetData;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
-import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomMultiToggleButtonGroup;
-import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButton;
 import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomFeatureToggleButton;
+import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomFeatureToggleErrorMessage;
+import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomMultiToggleButtonGroup;
 import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
 import org.tizen.dynamicanalyzer.widgets.tooltip.DACustomTooltip;
 
@@ -67,9 +69,6 @@ public class FlatFeatureDialogFeatureListPage extends DAPageComposite {
        private Composite featureListInputComp = null;
        private Composite itemComp = null;
        private Label featureListLabel = null;
-       private Label featureListNameLabel = null;
-       private Label featureListDescLabel = null;
-       private Label featureListPageLabel = null;
        private DACustomTooltip tooltip = null;
        private DACustomMultiToggleButtonGroup featuretoggleGroup = null;
        private Cursor daCursor = null;
@@ -129,21 +128,6 @@ public class FlatFeatureDialogFeatureListPage extends DAPageComposite {
                        featureListLabel = null;
                }
 
-               if (null != featureListNameLabel) {
-                       featureListNameLabel.dispose();
-                       featureListNameLabel = null;
-               }
-
-               if (null != featureListDescLabel) {
-                       featureListDescLabel.dispose();
-                       featureListDescLabel = null;
-               }
-
-               if (null != featureListPageLabel) {
-                       featureListPageLabel.dispose();
-                       featureListPageLabel = null;
-               }
-
                if (null != featureListScrolledComp) {
                        featureListScrolledComp.dispose();
                        featureListScrolledComp = null;
@@ -245,16 +229,18 @@ public class FlatFeatureDialogFeatureListPage extends DAPageComposite {
                        DACustomFeatureToggleButton toggleButton = (DACustomFeatureToggleButton) event.widget;
                        TargetData target = SettingDataManager.INSTANCE.getTarget(null);
                        if (!toggleButton.isToggled()) {
+                               featureDialog.orderedFeatureList.remove(FlatFeature.getFlatFeature(toggleButton.getText()));
                                target.removeSelectedFlatFeature(toggleButton.getText());
                                toggleButton.getParent().setBackground(ColorResources.FEATURE_FEATURELISTCOMP_NORMAL_BACKGROUND);
                                toggleButton.getTooltipButton().setBackground(ColorResources.FEATURE_FEATURELISTCOMP_NORMAL_BACKGROUND);
                        }
                        else {
+                               featureDialog.orderedFeatureList.add(0, FlatFeature.getFlatFeature(toggleButton.getText()));
                                target.addSelectedFlatFeature(toggleButton.getText());
                                toggleButton.getParent().setBackground(ColorResources.FEATURE_FEATURELISTCOMP_SELECT_BACKGROUND);
                                toggleButton.getTooltipButton().setBackground(ColorResources.FEATURE_FEATURELISTCOMP_SELECT_BACKGROUND);                
                        }
-                       featureDialog.getSelectedFeaturePage().createSelectedFeatureComposite();
+                       featureDialog.getSelectedFeaturePage().createSelectedFeatureComposite(featureDialog.orderedFeatureList);
                }
        };
 
@@ -338,94 +324,157 @@ public class FlatFeatureDialogFeatureListPage extends DAPageComposite {
 
                // listing available feature list
                TargetData target = SettingDataManager.INSTANCE.getTarget(null);
-               List<Feature> featurel = target.getAvailableFeatureList();
-               List<FlatFeature> featureList = target.getAvailableFlatFeatureList();
-               target.getSelectedFlatFeatureList();
-
-               featuretoggleGroup = new DACustomMultiToggleButtonGroup();
-
-               Point imagePoint = new Point(22, 24);
-               int topPosition = 0;
-
-               for (int i = 0 ; i < featureList.size(); i++) {
-                       if (featureList.get(i) == null)
-                               continue;
-                       final FlatFeature feature = featureList.get(i);
+               if (!SettingDataManager.INSTANCE.checkConnectedTargetType()) {
+                       featuretoggleGroup = new DACustomMultiToggleButtonGroup();
                        itemComp = new Composite(featureListInputComp, SWT.NONE);
                        itemComp.setLayout(new FormLayout());
                        data = new FormData();
-                       data.top = new FormAttachment(0, topPosition);
+                       data.top = new FormAttachment(0, 0);
                        data.left = new FormAttachment(0, 0);
                        data.width = FEATURELIST_BODY_ITEM_WIDTH;
                        data.height = FEATURELIST_BODY_ITEM_HEIGHT;
                        itemComp.setLayoutData(data);
 
-                       DACustomButton infoButton = new DACustomButton(itemComp, SWT.TRANSPARENT);
-                       infoButton.setBackground(ColorResources.WHITE);
-                       infoButton.setImages(ImageResources.TOOLTIP_INFO_FEATURELIST_NORMAL,
-                                                                 ImageResources.TOOLTIP_INFO_FEATURELIST_NORMAL,
-                                                                 ImageResources.TOOLTIP_INFO_FEATURELIST_HOVER,
-                                                                 ImageResources.TOOLTIP_INFO_FEATURELIST_HOVER);
-                       data = new FormData();
-                       data.top = new FormAttachment(0, FEATURELIST_TOOLTIP_UPPER_MARGIN);
-                       data.left = new FormAttachment(0, FEATURELIST_COMP_WIDTH - FEATURELIST_TOOLTIP_BOX_WIDTH);
-                       data.width = FEATURELIST_TOOLTIP_SIZE;
-                       data.height = FEATURELIST_TOOLTIP_SIZE;
-                       infoButton.setLayoutData(data);
-                       infoButton.setData("tooltipmsg", feature.getOverheadRankingMessage());
-                       infoButton.addListener(SWT.MouseHover, new Listener() {
-                               @Override
-                               public void handleEvent(Event event) {
-                                       DACustomButton tempButton = (DACustomButton)event.widget;
-                                       Point p = tempButton.toDisplay(tempButton.getLocation());
-
-                                       tooltip.open(featureListInputComp.getShell());
-                                       tooltip.setTooltipMessage((String)tempButton.getData("tooltipmsg"));
-                                       // TODO: Need to adjust tooltip location as architecture
-                                       tooltip.setTooltipLocation(p, -50, -620);
+                       DACustomFeatureToggleErrorMessage toggle = new DACustomFeatureToggleErrorMessage(
+                                       itemComp, SWT.FILL);
+                       toggle.setTitle(ConfigureLabels.FEATURE_NAME_ERROR_NO_TARGET);
+                       toggle.setDescription(ConfigureLabels.FEATURE_DESCRIPTION_ERROR_NO_TARGET);
+                       toggle.setColors(ColorResources.SETTING_BUTTON_NORMAL_COLOR,
+                                       ColorResources.SETTING_BUTTON_NORMAL_COLOR,
+                                       ColorResources.SETTING_BUTTON_NORMAL_COLOR,
+                                       ColorResources.SETTING_BUTTON_NORMAL_COLOR,
+                                       ColorResources.SETTING_BUTTON_NORMAL_COLOR,
+                                       ColorResources.SETTING_BUTTON_NORMAL_COLOR,
+                                       ColorResources.SETTING_BUTTON_NORMAL_COLOR);
+                       toggle.setTitleFont(FontResources.SETTING_TITLE_FONT);
+                       toggle.setDescFont(FontResources.SETTING_DESCRIPTION_FONT);
+
+                       FormData toggledata = new FormData();
+                       toggledata.top = new FormAttachment(0, 0);
+                       toggledata.left = new FormAttachment(0, 0);
+                       toggledata.width = FEATURELIST_BODY_ITEM_WIDTH;
+                       toggledata.height = FEATURELIST_BODY_ITEM_HEIGHT
+                                       * target.getAvailableFlatFeatures().size();
+                       toggle.setLayoutData(toggledata);
+                       target.setSelectedFlatFeatures(new HashSet<FlatFeature>());
+               } else {
+                       List<FlatFeature> features = new ArrayList<FlatFeature>();
+                       features.addAll(target.getAvailableFlatFeatures());
+                       Collections.sort(features, FlatFeature.getIndexComparator());
+                       if ((featureDialog.orderedFeatureList.isEmpty())
+                                       && (!target.getSelectedFlatFeatures().isEmpty()))
+                               featureDialog.orderedFeatureList.addAll(target
+                                               .getSelectedFlatFeatures());
+                       Logger.debug("Available FlatFeature list: " + features);
+
+                       featuretoggleGroup = new DACustomMultiToggleButtonGroup();
+
+                       Point imagePoint = new Point(22, 24);
+                       int topPosition = 0;
+
+                       for (final FlatFeature feature : features) {
+                               if (feature == null)
+                                       continue;
+                               itemComp = new Composite(featureListInputComp, SWT.NONE);
+                               itemComp.setLayout(new FormLayout());
+                               data = new FormData();
+                               data.top = new FormAttachment(0, topPosition);
+                               data.left = new FormAttachment(0, 0);
+                               data.width = FEATURELIST_BODY_ITEM_WIDTH;
+                               data.height = FEATURELIST_BODY_ITEM_HEIGHT;
+                               itemComp.setLayoutData(data);
+
+                               DACustomButton infoButton = new DACustomButton(itemComp,
+                                               SWT.TRANSPARENT);
+                               infoButton.setBackground(ColorResources.WHITE);
+                               infoButton.setImages(
+                                               ImageResources.TOOLTIP_INFO_FEATURELIST_NORMAL,
+                                               ImageResources.TOOLTIP_INFO_FEATURELIST_NORMAL,
+                                               ImageResources.TOOLTIP_INFO_FEATURELIST_HOVER,
+                                               ImageResources.TOOLTIP_INFO_FEATURELIST_HOVER);
+                               data = new FormData();
+                               data.top = new FormAttachment(0,
+                                               FEATURELIST_TOOLTIP_UPPER_MARGIN);
+                               data.left = new FormAttachment(0, FEATURELIST_COMP_WIDTH
+                                               - FEATURELIST_TOOLTIP_BOX_WIDTH);
+                               data.width = FEATURELIST_TOOLTIP_SIZE;
+                               data.height = FEATURELIST_TOOLTIP_SIZE;
+                               infoButton.setLayoutData(data);
+                               infoButton.setData("tooltipmsg",
+                                               feature.getOverheadRankingMessage());
+                               infoButton.addListener(SWT.MouseHover, new Listener() {
+                                       @Override
+                                       public void handleEvent(Event event) {
+                                               DACustomButton tempButton = (DACustomButton) event.widget;
+                                               Point p = tempButton.toDisplay(tempButton.getLocation());
+
+                                               tooltip.open(featureListInputComp.getShell());
+                                               tooltip.setTooltipMessage((String) tempButton
+                                                               .getData("tooltipmsg"));
+                                               // TODO: Need to adjust tooltip location as architecture
+                                               tooltip.setTooltipLocation(p, -50, -620);
+                                       }
+                               });
+                               infoButton.addListener(SWT.MouseExit, new Listener() {
+                                       @Override
+                                       public void handleEvent(Event event) {
+                                               if (tooltip != null)
+                                                       tooltip.close();
+                                       }
+                               });
+
+                               if (featuretoggleGroup.getGroupLength() < features.size()) {
+                                       DACustomFeatureToggleButton toggle = createToggleButton(
+                                                       itemComp, feature.getNormalImage(),
+                                                       feature.getOverImage(), feature.getFocusImage(),
+                                                       feature.getDimImage(), imagePoint,
+                                                       feature.getName(), null,
+                                                       FEATURELIST_BODY_ITEM_WIDTH
+                                                                       - FEATURELIST_TOOLTIP_BOX_WIDTH,
+                                                       FEATURELIST_BODY_ITEM_HEIGHT, 0, 0);
+                                       toggle.setDescription(feature.getDescription());
+                                       toggle.setPage(feature.getPage());
+                                       toggle.setOverhead(feature.getOverheadRankingMessage());
+                                       toggle.setTitleFont(FontResources.SETTING_TITLE_FONT);
+                                       toggle.setDescFont(FontResources.SETTING_DESCRIPTION_FONT);
+                                       toggle.setPageFont(FontResources.SETTING_DESCRIPTION_FONT);
+                                       toggle.setOverheadFont(FontResources.SETTING_DESCRIPTION_FONT);
+                                       toggle.setTooltipButton(infoButton);
+                                       // TODO: Set title, description, page font size
+                                       featuretoggleGroup.addToggleButton(toggle);
+                                       toggle.addListener(SWT.MouseUp, toggleListener);
+                                       toggle.addListener(SWT.MouseDown, toggleDownListener);
+                                       toggle.addListener(SWT.MouseEnter, cursorListener);
+                                       toggle.addListener(SWT.MouseExit, cursorListener);
                                }
-                       });
-                       infoButton.addListener(SWT.MouseExit, new Listener() {
-                               @Override
-                               public void handleEvent(Event event) {
-                                       if (tooltip != null)
-                                               tooltip.close();
+                               if (target.isSelectedFlatFeature(feature.getName())) {
+                                       featuretoggleGroup.setSelection(feature.getName(), true);
+                                       featuretoggleGroup
+                                                       .getButton(feature.getName())
+                                                       .getParent()
+                                                       .setBackground(
+                                                                       ColorResources.FEATURE_FEATURELISTCOMP_SELECT_BACKGROUND);
+                                       featuretoggleGroup
+                                                       .getButton(feature.getName())
+                                                       .getTooltipButton()
+                                                       .setBackground(
+                                                                       ColorResources.FEATURE_FEATURELISTCOMP_SELECT_BACKGROUND);
+                               } else {
+                                       featuretoggleGroup.setSelection(feature.getName(), false);
+                                       featuretoggleGroup
+                                                       .getButton(feature.getName())
+                                                       .getParent()
+                                                       .setBackground(
+                                                                       ColorResources.FEATURE_FEATURELISTCOMP_NORMAL_BACKGROUND);
+                                       featuretoggleGroup
+                                                       .getButton(feature.getName())
+                                                       .getTooltipButton()
+                                                       .setBackground(
+                                                                       ColorResources.FEATURE_FEATURELISTCOMP_NORMAL_BACKGROUND);
                                }
-                       });
-
-                       if (featuretoggleGroup.getGroupLength() < featureList.size()) {
-                               DACustomFeatureToggleButton toggle = createToggleButton(itemComp,
-                                               feature.getNormalImage(), feature.getOverImage(), feature.getFocusImage(), feature.getDimImage(),
-                                               imagePoint, feature.getName(),
-                                               null, FEATURELIST_BODY_ITEM_WIDTH - FEATURELIST_TOOLTIP_BOX_WIDTH, FEATURELIST_BODY_ITEM_HEIGHT,
-                                               0, 0);
-                               toggle.setDescription(feature.getDescription());
-                               toggle.setPage(feature.getPage());
-                               toggle.setOverhead(feature.getOverheadRankingMessage());
-                               toggle.setTitleFont(FontResources.SETTING_TITLE_FONT);
-                               toggle.setDescFont(FontResources.SETTING_DESCRIPTION_FONT);
-                               toggle.setPageFont(FontResources.SETTING_DESCRIPTION_FONT);
-                               toggle.setOverheadFont(FontResources.SETTING_DESCRIPTION_FONT);
-                               toggle.setTooltipButton(infoButton);
-                               // TODO: Set title, description, page font size
-                               featuretoggleGroup.addToggleButton(toggle);
-                               toggle.addListener(SWT.MouseUp,  toggleListener);
-                               toggle.addListener(SWT.MouseDown, toggleDownListener);
-                               toggle.addListener(SWT.MouseEnter, cursorListener);
-                               toggle.addListener(SWT.MouseExit, cursorListener);
-                       }
-                       if (target.isSelectedFlatFeature(feature.getName())) {
-                               featuretoggleGroup.setSelection(feature.getName(), true);
-                               featuretoggleGroup.getButton(feature.getName()).getParent().setBackground(ColorResources.FEATURE_FEATURELISTCOMP_SELECT_BACKGROUND);
-                               featuretoggleGroup.getButton(feature.getName()).getTooltipButton().setBackground(ColorResources.FEATURE_FEATURELISTCOMP_SELECT_BACKGROUND);
-                       }
-                       else {
-                               featuretoggleGroup.setSelection(feature.getName(), false);
-                               featuretoggleGroup.getButton(feature.getName()).getParent().setBackground(ColorResources.FEATURE_FEATURELISTCOMP_NORMAL_BACKGROUND);
-                               featuretoggleGroup.getButton(feature.getName()).getTooltipButton().setBackground(ColorResources.FEATURE_FEATURELISTCOMP_NORMAL_BACKGROUND);
-                       }
 
-                       topPosition += (FEATURELIST_BODY_ITEM_HEIGHT + FEATURELIST_BODY_ITEM_MARGIN);
+                               topPosition += (FEATURELIST_BODY_ITEM_HEIGHT + FEATURELIST_BODY_ITEM_MARGIN);
+                       }
                }
                featureListComp.layout(true);
                featureListInputComp.layout(true);
index f9ddb8e..7b9fecf 100644 (file)
@@ -25,7 +25,9 @@
  */
 package org.tizen.dynamicanalyzer.ui.toolbar.setting;
 
-import java.util.List;
+import java.util.Collections;
+import java.util.LinkedList;
+
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.ScrolledComposite;
 import org.eclipse.swt.events.PaintEvent;
@@ -37,7 +39,6 @@ import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Listener;
@@ -50,7 +51,6 @@ import org.tizen.dynamicanalyzer.setting.FlatFeature;
 import org.tizen.dynamicanalyzer.setting.SettingDataManager;
 import org.tizen.dynamicanalyzer.setting.TargetData;
 import org.tizen.dynamicanalyzer.util.Logger;
-import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomFeatureToggleButton;
 import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButton;
 import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
 
@@ -123,7 +123,7 @@ public class FlatFeatureDialogSelectedFeaturePage extends DAPageComposite {
                NOITEM_UPPER_MARGIN = (BODY_HEIGHT-TITLE_FONT_SIZE)/2;
                NOITEM_LEFT_MARGIN = 15;                // TODO: Replace '15' with string length
 
-               createSelectedFeatureComposite();
+               createSelectedFeatureComposite(featureDialog.orderedFeatureList);
        }
 
        private void initSelectedFeatureCompositeWidget() {
@@ -220,12 +220,21 @@ public class FlatFeatureDialogSelectedFeaturePage extends DAPageComposite {
                        DACustomToggleButton toggleButton = (DACustomToggleButton) event.widget;
                        TargetData target = SettingDataManager.INSTANCE.getTarget(null);
                        target.removeSelectedFlatFeature(toggleButton.getText());
+                       featureDialog.orderedFeatureList.remove(FlatFeature.getFlatFeature(toggleButton.getText()));
                        featureDialog.getFeatureListPage().featureToggleUnselect(toggleButton.getText());
-                       createSelectedFeatureComposite();
+                       createSelectedFeatureComposite(featureDialog.orderedFeatureList);
                }
        };
 
-       public void createSelectedFeatureComposite() {
+       /**
+        * Shows list of selected FlatFeatures, if parameter is not null then
+        * FlatFeatures will be represented in order they were selected in, else
+        * they will be ordered by indexes.
+        *
+        * @param orderedFeatureList List, contains selected FlatFeatures in selection order.
+        */
+       public void createSelectedFeatureComposite(
+                       LinkedList<FlatFeature> orderedFeatureList) {
                initSelectedFeatureCompositeWidget();
 
                // label
@@ -288,10 +297,19 @@ public class FlatFeatureDialogSelectedFeaturePage extends DAPageComposite {
                });
 
                // listing selected feature list
-               TargetData target = SettingDataManager.INSTANCE.getTarget(null);
-               List<FlatFeature> featureList = target.getSelectedFlatFeatureList();
+               if (orderedFeatureList == null) {
+                       orderedFeatureList = new LinkedList<FlatFeature>();
+               }
+               if (orderedFeatureList.isEmpty()) {
+                       TargetData target = SettingDataManager.INSTANCE.getTarget(null);
+                       if (!target.getSelectedFlatFeatures().isEmpty()) {
+                               orderedFeatureList.addAll(target.getSelectedFlatFeatures());
+                               Collections.sort(orderedFeatureList, FlatFeature.getIndexComparator());
+                       }
+               }
+               Logger.debug(orderedFeatureList);
 
-               if (featureList.size() > 0)
+               if (orderedFeatureList.size() > 0)
                        featureDialog.getOKButton().setEnabled(true);
                else {
                        featureDialog.getOKButton().setEnabled(false);
@@ -312,9 +330,7 @@ public class FlatFeatureDialogSelectedFeaturePage extends DAPageComposite {
 
                int topPosition = BODY_TOP_MARGIN;
                int leftPosition = ITEM_LEFT;
-               for (int i = featureList.size() - 1 ; i >= 0 ; i--) {
-                       FlatFeature feature = featureList.get(i);
-
+               for (FlatFeature feature : orderedFeatureList) {
                        // image
                        selectedIcon = new Label(selectedInputComp, SWT.TRANSPARENT);
                        selectedIcon.setImage(feature.getSmallImage());
index f375a12..3b7d363 100644 (file)
@@ -115,7 +115,6 @@ public class FlatFeatureDialogTargetPage extends DAPageComposite {
        private Label targetLabel = null;
        private ScrolledComposite targetScrolledComposite = null;
        private Composite targetInputComposite = null;
-       private Label targetNameLabel = null;
        private Cursor daCursor = null;
        
        private int TARGET_TITLE_FONT_SIZE = 0;
@@ -184,11 +183,6 @@ public class FlatFeatureDialogTargetPage extends DAPageComposite {
                        targetInputComposite.dispose();
                        targetInputComposite = null;
                }
-               
-               if (null != targetNameLabel) {
-                       targetNameLabel.dispose();
-                       targetNameLabel = null;
-               }
        }
 
        private Listener cursorListener = new Listener() {
@@ -219,7 +213,7 @@ public class FlatFeatureDialogTargetPage extends DAPageComposite {
 
                                // update feature list, selected feature pages
                                featureDialog.getFeatureListPage().createFeatureListComposite();
-                               featureDialog.getSelectedFeaturePage().createSelectedFeatureComposite();
+                               featureDialog.getSelectedFeaturePage().createSelectedFeatureComposite(featureDialog.orderedFeatureList);
                        }
                }
        };
index 05db102..a7272cb 100644 (file)
@@ -274,25 +274,13 @@ public class PreferencesDialog extends DAMessageBox {
                        periodicallyToggle.addClickListener(new DACustomButtonClickEventListener() {
                                @Override
                                public void handleClickEvent(DACustomButton button) {
-                                       boolean toggled = periodicallyToggle.isToggled();
-                                       screenshotRateCombo.setEnabled(toggled);
-                                       if (!toggled && !onSceneTransitionToggle.isToggled())
-                                               onSceneTransitionToggle.setToggled(true);
+                                       screenshotRateCombo.setEnabled(periodicallyToggle.isToggled());
                                }
                        });
 
                        // On scene transition
                        createLabel(screenshotView, PreferencesDialogLabels.ON_SCENE_TRANSITION, 2);
                        onSceneTransitionToggle = createToggleButton(screenshotView);
-                       onSceneTransitionToggle.addClickListener(new DACustomButtonClickEventListener() {
-                               @Override
-                               public void handleClickEvent(DACustomButton button) {
-                                       if (!periodicallyToggle.isToggled() && !onSceneTransitionToggle.isToggled()) {
-                                               periodicallyToggle.setToggled(true);
-                                               screenshotRateCombo.setEnabled(true);
-                                       }
-                               }
-                       });
                }
 
                scrolledComp.setContent(baseCom);
index 71e2623..1b724ad 100644 (file)
@@ -706,7 +706,7 @@ public class SettingDialogTemplatePage extends DAPageComposite {
                        }
 
                        // set selection template
-                       if (templateList.get(i).equals(selectedTemplate)) {
+                       if (templateList.get(i) == selectedTemplate) {
                                targetGroup.setSelection(toggle);
                        }
                }
index a22021b..d6b8cd2 100644 (file)
@@ -32,6 +32,7 @@ import org.eclipse.nebula.widgets.grid.GridColumnGroup;
 import org.eclipse.nebula.widgets.grid.GridItem;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.ScrollBar;
 
 public class DAGrid extends Grid {
 
@@ -46,4 +47,19 @@ public class DAGrid extends Grid {
                return;
        }
 
+       /**
+        * Computes preferred grid size with regard to the scrollbar size.
+        * XXX: workaround for last table row partly hidden behind scrollbar.
+        */
+       @Override
+       public Point computeSize(int wHint, int hHint, boolean changed) {
+               Point oldSize = super.computeSize(wHint, hHint, changed);
+               ScrollBar hBar = getHorizontalBar();
+
+               if (hBar != null) {
+                       oldSize.y += hBar.getSize().y;
+               }
+               return oldSize;
+       }
+
 }
index 1cbe071..ed16394 100644 (file)
@@ -26,8 +26,6 @@
 
 package org.tizen.dynamicanalyzer.ui.widgets;
 
-import java.util.List;
-
 import org.eclipse.nebula.widgets.grid.Grid;
 import org.eclipse.nebula.widgets.grid.GridItem;
 import org.eclipse.swt.SWT;
@@ -35,19 +33,15 @@ import org.eclipse.swt.events.KeyEvent;
 import org.eclipse.swt.events.KeyListener;
 import org.eclipse.swt.events.PaintEvent;
 import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
 import org.tizen.dynamicanalyzer.appearance.DesignConstants;
@@ -56,32 +50,29 @@ import org.tizen.dynamicanalyzer.model.FindProperty;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
-import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATreeComposite;
-import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
-import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
-import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer;
-import org.tizen.dynamicanalyzer.widgets.button.dropdown.DACustomDropdown;
-import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
 import org.tizen.dynamicanalyzer.widgets.da.base.DAMessageBox;
 
 public class SearchDialog extends DAMessageBox {
 
        private static final int ENTER_KEY_CODE = 13;
 
-       final private int WIDTH = 430;
-       final private int HEIGHT = 230 - 7;     // Should remove 7 pixel on titlebar area at MAC
+       private static final int WIDTH = 430;
+       private static final int HEIGHT = 230 - 7;      // Should remove 7 pixel on titlebar area at MAC
+       private static final int HORIZONTAL_SPACING = 15;
+       private static final int VERTICAL_SPACING = 15;
+       private static final int HEIGHT_MARGIN = 20;
+       private static final int WIDTH_MARGIN = 26;
+       private static final int BUTTON_HEIGHT = 30;
+       private static final int CONTENT_COMP_HEIGHT = 138;
 
-       private DACustomDropdown categoryDropdown= null;
        private Text textBox = null;
-       private DAButton cancelButton = null;
-       private DAButton backButton = null;
-       private DAButton nextButton = null;
+       private Button cancelButton = null;
+       private Button backButton = null;
+       private Button nextButton = null;
        private Button caseButton = null;
-       private Label caseButtonLabel = null;
        private Button wholeWordButton = null;
-       private Label wholeWordButtonLabel = null;
 
        private FindProperty findProperty = null;
 
@@ -120,9 +111,9 @@ public class SearchDialog extends DAMessageBox {
                shell.addPaintListener(new PaintListener() {
                        public void paintControl(PaintEvent e) {
                                e.gc.setForeground(ColorResources.DIALOG_TOP_LINE_COLOR);
-                               e.gc.drawLine(0, 0,  WIDTH, 0);
+                               e.gc.drawLine(0, 0, WIDTH, 0);
                                e.gc.setForeground(ColorResources.DIALOG_BUTTON_LINE_COLOR);
-                               e.gc.drawLine(0,  139,  WIDTH, 139);
+                               e.gc.drawLine(0, CONTENT_COMP_HEIGHT + 1, WIDTH, CONTENT_COMP_HEIGHT + 1);
                        }
                });
 
@@ -135,15 +126,13 @@ public class SearchDialog extends DAMessageBox {
                data.top = new FormAttachment(0, 1);
                data.left = new FormAttachment(0, 0);
                data.width = WIDTH;
-               data.height = 138;
+               data.height = CONTENT_COMP_HEIGHT;
                contentComp.setLayoutData(data);
 
                Label descriptionLabel = new Label(contentComp, SWT.TRANSPARENT);
                data = new FormData();
-               data.top = new FormAttachment(0, 30);
-               data.left = new FormAttachment(0, 20);
-               data.height = 26;
-               data.width = WIDTH-20;
+               data.top = new FormAttachment(0, HEIGHT_MARGIN);
+               data.left = new FormAttachment(0, WIDTH_MARGIN);
                descriptionLabel.setLayoutData(data);
                descriptionLabel.setBackground(ColorResources.DIALOG_CONTENT_BACKGROUND);
                descriptionLabel.setForeground(ColorResources.DIALOG_TEXT_FONT_COLOR);
@@ -151,79 +140,54 @@ public class SearchDialog extends DAMessageBox {
                                                                        + CommonConstants.SPACE + viewName + CommonConstants.SPACE
                                                                        + AnalyzerLabels.SEARCH_DLG_DESC_POSTFIX);
 
-               categoryDropdown = makeDACustomDropdown(contentComp);
-               data = new FormData();
-               data.top = new FormAttachment(0, 30+26);
-               data.left = new FormAttachment(0, 20);
-               data.bottom = new FormAttachment(0, 30+26+24);
-               data.right = new FormAttachment(0, 20+96);
-               categoryDropdown.setLayoutData(data);
-               categoryDropdown.addListener(SWT.Selection, dropdownListener);
-
                textBox = new Text(contentComp, SWT.SINGLE | SWT.BORDER);
                data = new FormData();
-               data.top = new FormAttachment(0, 30+26);
-               data.left = new FormAttachment(0, 20+96+10);
-               data.bottom = new FormAttachment(0, 30+26+24);
-               data.right = new FormAttachment(0, 20+96+10+284);
+               data.top = new FormAttachment(descriptionLabel, VERTICAL_SPACING);
+               data.left = new FormAttachment(0, WIDTH_MARGIN);
+               // data.height = TEXTBOX_HEIGHT;
+               data.right = new FormAttachment(100, -WIDTH_MARGIN);
                textBox.setLayoutData(data);
-               textBox.setFont(new Font(textBox.getDisplay(), "Arial", 10, SWT.NONE));
+               textBox.setFont(new Font(textBox.getDisplay(), "Arial", 10, SWT.NORMAL));
                textBox.addKeyListener(keyListener);
 
+               FormAttachment top = new FormAttachment(textBox, VERTICAL_SPACING);
+
                Label optionLabel = new Label(contentComp, SWT.TRANSPARENT);
                data = new FormData();
-               data.top = new FormAttachment(0, 30+26+24+16);
-               data.left = new FormAttachment(0, 20);
-               data.height = 18;
-               data.width = 40 + 66;
+               data.top = top;
+               data.left = new FormAttachment(0, WIDTH_MARGIN);
                optionLabel.setLayoutData(data);
                optionLabel.setBackground(ColorResources.DIALOG_CONTENT_BACKGROUND);
                optionLabel.setForeground(ColorResources.DIALOG_TEXT_FONT_COLOR);
                optionLabel.setText(AnalyzerLabels.SEARCH_DLG_OPTION);
 
-               caseButton = new Button(contentComp, SWT.CHECK);
-               data = new FormData();
-               data.top = new FormAttachment(0, 30+26+24+16);
-               data.left = new FormAttachment(optionLabel, 0);
-               data.width = 18;
-               data.height = 18;
-               caseButton.setLayoutData(data);
-               caseButton.addSelectionListener(caseButtonListener);
-               if (findProperty.isCaseSensitive())
-                       caseButton.setSelection(true);
-               
-               caseButtonLabel = new Label(contentComp, SWT.NONE);
-               data = new FormData();
-               data.top = new FormAttachment(0, 30+26+24+16);
-               data.left = new FormAttachment(caseButton, 4);
-               data.height = 18;
-               data.width = 100;
-               caseButtonLabel.setLayoutData(data);
-               caseButtonLabel.setBackground(ColorResources.DIALOG_CONTENT_BACKGROUND);
-               caseButtonLabel.setText(AnalyzerLabels.SEARCH_DLG_CASE_SENSITIVE);
-               caseButtonLabel.addListener(SWT.MouseUp, caseButtonLabelListener);
-
-               wholeWordButton = new Button(contentComp, SWT.CHECK);
+               wholeWordButton = new Button(contentComp, SWT.CHECK | SWT.NO_FOCUS);
                data = new FormData();
-               data.top = new FormAttachment(0, 30+26+24+16);
-               data.left = new FormAttachment(caseButtonLabel, 38);
-               data.width = 18;
-               data.height = 18;
+               data.top = top;
+               data.right = new FormAttachment(100, -WIDTH_MARGIN);
                wholeWordButton.setLayoutData(data);
-               wholeWordButton.addSelectionListener(wholeWordButtonListener);
-               if (findProperty.isWholeWord())
-                       wholeWordButton.setSelection(true);
+               wholeWordButton.setText(AnalyzerLabels.SEARCH_DLG_WHOLE_WORD);
+               wholeWordButton.setSelection(findProperty.isWholeWord());
+               wholeWordButton.addSelectionListener(new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               findProperty.setWholeWord(wholeWordButton.getSelection());
+                       }
+               });
 
-               wholeWordButtonLabel = new Label(contentComp, SWT.NONE);
+               caseButton = new Button(contentComp, SWT.CHECK | SWT.NO_FOCUS);
                data = new FormData();
-               data.top = new FormAttachment(0, 30+26+24+16);
-               data.left = new FormAttachment(wholeWordButton, 4);
-               data.height = 18;
-               data.width = 130;
-               wholeWordButtonLabel.setLayoutData(data);
-               wholeWordButtonLabel.setBackground(ColorResources.DIALOG_CONTENT_BACKGROUND);
-               wholeWordButtonLabel.setText(AnalyzerLabels.SEARCH_DLG_WHOLE_WORD);
-               wholeWordButtonLabel.addListener(SWT.MouseUp, wholeWordButtonLabelListener);
+               data.top = top;
+               data.right = new FormAttachment(wholeWordButton, -HORIZONTAL_SPACING);
+               caseButton.setLayoutData(data);
+               caseButton.setText(AnalyzerLabels.SEARCH_DLG_CASE_SENSITIVE);
+               caseButton.setSelection(findProperty.isCaseSensitive());
+               caseButton.addSelectionListener(new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               findProperty.setCaseSensitive(caseButton.getSelection());
+                       }
+               });
 
                Composite buttonComp = new Composite(shell, SWT.NONE);
                FormLayout buttonLayout = new FormLayout();
@@ -231,93 +195,79 @@ public class SearchDialog extends DAMessageBox {
                buttonComp.setBackground(ColorResources.DIALOG_BUTTON_BACKGROUND);
 
                data = new FormData();
-               data.top = new FormAttachment(0, 140);
+               data.top = new FormAttachment(contentComp, 2);
                data.left = new FormAttachment(0, 0);
                data.width = WIDTH;
-               data.height = 60;
+               data.height = shell.getClientArea().height - CONTENT_COMP_HEIGHT - 1;
                buttonComp.setLayoutData(data);
 
-               cancelButton = new DAButton(buttonComp, SWT.NONE);
-               data = new FormData();
-               data.top = new FormAttachment(0, 17);
-               data.left = new FormAttachment(100, DesignConstants.DA_BUTTON_WIDTH*(-1)*3-20-20);
-               data.height = 25;
-               data.width = DesignConstants.DA_BUTTON_WIDTH;
-               cancelButton.setLayoutData(data);
-               cancelButton.setText(AnalyzerLabels.SEARCH_DLG_CANCEL_BUTTON);
-               cancelButton.addClickListener(cancelButtonListener);
-               cancelButton.setOutlineColors(ColorResources.WHITE,
-                               ColorResources.WHITE,
-                               ColorResources.WHITE,
-                               ColorResources.WHITE);
+               top = new FormAttachment(0, (int) ((data.height - BUTTON_HEIGHT) / 2));
 
-               backButton = new DAButton(buttonComp, SWT.NONE);
-               data = new FormData();
-               data.top = new FormAttachment(0, 17);
-               data.left = new FormAttachment(100, DesignConstants.DA_BUTTON_WIDTH*(-1)*2-20-10);
-               data.height = 25;
-               data.width = DesignConstants.DA_BUTTON_WIDTH;
+               nextButton = new Button(buttonComp, SWT.NONE);
+               data = new FormData(DesignConstants.DA_BUTTON_WIDTH, BUTTON_HEIGHT);
+               data.top = top;
+               data.right = new FormAttachment(100, -WIDTH_MARGIN);
+               nextButton.setLayoutData(data);
+               nextButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+               nextButton.setText(AnalyzerLabels.SEARCH_DLG_NEXT_BUTTON);
+               nextButton.addSelectionListener(new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               search(false);
+                       }
+               });
+
+               int buttonSpacing = HORIZONTAL_SPACING / -2;
+
+               backButton = new Button(buttonComp, SWT.NONE);
+               data = new FormData(DesignConstants.DA_BUTTON_WIDTH, BUTTON_HEIGHT);
+               data.top = top;
+               data.right = new FormAttachment(nextButton, buttonSpacing);
                backButton.setLayoutData(data);
+               backButton.setFont(FontResources.DIALOG_BUTTON_FONT);
                backButton.setText(AnalyzerLabels.SEARCH_DLG_BACK_BUTTON);
-               backButton.addClickListener(backButtonListener);
-               backButton.setOutlineColors(ColorResources.WHITE,
-                               ColorResources.WHITE,
-                               ColorResources.WHITE,
-                               ColorResources.WHITE);
+               backButton.addSelectionListener(new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               search(true);
+                       }
+               });
 
-               nextButton = new DAButton(buttonComp, SWT.NONE);
-               data = new FormData();
-               data.top = new FormAttachment(0, 17);
-               data.left = new FormAttachment(100, DesignConstants.DA_BUTTON_WIDTH*(-1)*1-20);
-               data.height = 25;
-               data.width = DesignConstants.DA_BUTTON_WIDTH;
-               nextButton.setLayoutData(data);
-               nextButton.setText(AnalyzerLabels.SEARCH_DLG_NEXT_BUTTON);
-               nextButton.addClickListener(nextButtonListener);
-               nextButton.setOutlineColors(ColorResources.WHITE,
-                               ColorResources.WHITE,
-                               ColorResources.WHITE,
-                               ColorResources.WHITE);
+               cancelButton = new Button(buttonComp, SWT.NONE);
+               data = new FormData(DesignConstants.DA_BUTTON_WIDTH, BUTTON_HEIGHT);
+               data.top = top;
+               data.right = new FormAttachment(backButton, buttonSpacing);
+               cancelButton.setLayoutData(data);
+               cancelButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+               cancelButton.setText(AnalyzerLabels.SEARCH_DLG_CANCEL_BUTTON);
+               cancelButton.addSelectionListener(new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               shell.close();
+                       }
+               });
 
-               updateCategoryDropdown();
                textBox.setFocus();
                return true;
        }
 
-       private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() {
-
-               @Override
-               public void handleClickEvent(DACustomButton button) {
-                       shell.close();
-               }
-       };
-
-       private DACustomButtonClickEventListener backButtonListener = new DACustomButtonClickEventListener() {
-
-               @Override
-               public void handleClickEvent(DACustomButton button) {
-                       findProperty.setBackward(true);
-                       findProperty.setLastSearch(textBox.getText());
-                       executeFindCommand();
-               }
-       };
-
-       private DACustomButtonClickEventListener nextButtonListener = new DACustomButtonClickEventListener() {
-
-               @Override
-               public void handleClickEvent(DACustomButton button) {
-                       findProperty.setBackward(false);
-                       findProperty.setLastSearch(textBox.getText());
-                       executeFindCommand();
-               }
-       };
+       /**
+        * Searches text from textbox in table in specified direction.
+        *
+        * @param backward whether search should be backward
+        */
+       private void search(boolean backward) {
+               findProperty.setBackward(backward);
+               findProperty.setLastSearch(textBox.getText());
+               executeFindCommand();
+       }
 
        private KeyListener keyListener = new KeyListener() {
 
                @Override
                public void keyReleased(KeyEvent e) {
                        if (null != textBox.getText() && !textBox.getText().isEmpty()) {
-                               nextButton.setButtonEnabled(true);
+                               nextButton.setEnabled(true);
 
                                if (e.keyCode == ENTER_KEY_CODE) {
                                        if ((e.stateMask & SWT.SHIFT) != 0) {
@@ -334,7 +284,7 @@ public class SearchDialog extends DAMessageBox {
                                        }
                                }
                        } else {
-                               nextButton.setButtonEnabled(false);
+                               nextButton.setEnabled(false);
                        }
                }
 
@@ -343,74 +293,11 @@ public class SearchDialog extends DAMessageBox {
                }
        };
 
-       private SelectionListener caseButtonListener = new SelectionListener() {
-
-               @Override
-               public void widgetSelected(SelectionEvent e) {
-                       findProperty.setCaseSensitive(!findProperty.isCaseSensitive());
-                       if (findProperty.isCaseSensitive())
-                               caseButton.setSelection(true);
-               }
-
-               @Override
-               public void widgetDefaultSelected(SelectionEvent e) {
-                       findProperty.setCaseSensitive(!findProperty.isCaseSensitive());
-                       if (findProperty.isCaseSensitive())
-                               caseButton.setSelection(true);
-               }
-       };
-       
-       private Listener caseButtonLabelListener = new Listener() {
-
-               @Override
-               public void handleEvent(Event event) {
-                       if (event.type == SWT.MouseUp) {
-                               findProperty.setCaseSensitive(!findProperty.isCaseSensitive());
-                               if (findProperty.isCaseSensitive())
-                                       caseButton.setSelection(true);
-                               else
-                                       caseButton.setSelection(false);
-                       }
-               }
-       };
-
-       private SelectionListener wholeWordButtonListener = new SelectionListener() {
-
-               @Override
-               public void widgetSelected(SelectionEvent e) {
-                       findProperty.setWholeWord(!findProperty.isWholeWord());
-                       if (findProperty.isWholeWord())
-                               wholeWordButton.setSelection(true);
-               }
-
-               @Override
-               public void widgetDefaultSelected(SelectionEvent e) {
-                       findProperty.setWholeWord(!findProperty.isWholeWord());
-                       if (findProperty.isWholeWord())
-                               wholeWordButton.setSelection(true);
-               }
-       };
-
-       private Listener wholeWordButtonLabelListener = new Listener() {
-
-               @Override
-               public void handleEvent(Event event) {
-                       if (event.type == SWT.MouseUp) {
-                               findProperty.setWholeWord(!findProperty.isWholeWord());
-                               if (findProperty.isWholeWord())
-                                       wholeWordButton.setSelection(true);
-                               else
-                                       wholeWordButton.setSelection(false);
-                       }
-               }
-       };
-
        private boolean executeFindCommand() {
 
                int index = findProperty.getIndex();
                GridItem[] items = table.getItems();
                int itemCount = items.length;
-               String selectedColumn = categoryDropdown.getText();
 
                if (itemCount != 0) {
                        if (findProperty.isBackward()) {
@@ -434,105 +321,4 @@ public class SearchDialog extends DAMessageBox {
                }
                return false;
        }
-
-       public DACustomDropdown getCategoryDropdown() {
-               return categoryDropdown;
-       }
-
-       private Listener dropdownListener = new Listener() {
-
-               @Override
-               public void handleEvent(Event event) {
-                       // TODO Auto-generated method stub
-                       // TODO: implement
-                       // Selected item should limit to searching area as column
-                       return;
-               }
-       };
-
-       private boolean selectCategoryDropdown(String item) {
-               // TODO: implement
-               boolean ret = false;
-
-               List<String> categoryList = categoryDropdown.getItems();
-               int size = categoryList.size();
-               for (int i = 0 ; i < size ; i++) {
-                       //ret = table.getCategory(item);
-                       if (ret) {
-                               categoryDropdown.select(i);
-                               if (!item.isEmpty()) {
-                                       categoryDropdown.setToolTipText(item);
-                               }
-                       }
-               }
-               return ret;
-       }
-
-       public boolean setCategory(final String text) {
-               // TODO: implement, At launch search dialog, possible category have to setted.
-               return true;
-       }
-
-       public boolean updateCategoryDropdown() {
-               categoryDropdown.add("All");
-               /* TODO: Add column by init or updaten
-               categoryDropdown.add("Pid");
-               categoryDropdown.add("Tid");
-               categoryDropdown.add("Tag");
-               categoryDropdown.add("Message");
-               */
-               categoryDropdown.select(0);
-               redrawDropdown(categoryDropdown);
-               return true;
-       }
-
-       private void redrawDropdown(final DACustomDropdown dropdown) {
-               Display.getDefault().asyncExec(new Runnable() {
-                       public void run() {
-                               dropdown.redraw();
-                       }
-               });
-       }
-
-       private DACustomDropdown makeDACustomDropdown(Composite parent) {
-               DACustomDropdown dropdown = new DACustomDropdown(parent, SWT.NONE);
-               dropdown.setDropdownGradation(ColorResources.WHITE,
-                               ColorResources.WHITE, ColorResources.WHITE,
-                               ColorResources.WHITE, ColorResources.WHITE,
-                               ColorResources.WHITE, ColorResources.WHITE,
-                               ColorResources.WHITE);
-               dropdown.setOutlineColors(ColorResources.GRAY_130,
-                               ColorResources.GRAY_130,
-                               ColorResources.GRAY_130,
-                               ColorResources.GRAY_130);
-               dropdown.setDropdownImages(ImageResources.DROP_ARROW_DOWN_NOR,
-                               ImageResources.DROP_ARROW_DOWN_SEL,
-                               ImageResources.DROP_ARROW_DOWN_HOVER,
-                               ImageResources.DROP_ARROW_DOWN_DIM);
-               dropdown.setDropdownImagePoint(new Point(70, 10));
-               dropdown.setDropdownButtonColor(ColorResources.WHITE,
-                               ColorResources.WHITE,
-                               ColorResources.WHITE,
-                               ColorResources.WHITE);
-               dropdown.setArrowOutlineColors(ColorResources.GRAY_220,
-                               ColorResources.GRAY_220,
-                               ColorResources.GRAY_220,
-                               ColorResources.GRAY_220);
-               dropdown.setButtonImages(ImageResources.COMBO_DROPDOWN_UP,
-                               ImageResources.COMBO_DROPDOWN_DOWN);
-               dropdown.setFontPoint(new Point(5, 5));
-               dropdown.setFont(new Font(dropdown.getDisplay(), "Arial", 10, SWT.NONE));
-               dropdown.setEnabled(true);
-               dropdown.setDropdownFont(FontResources.COMBO);
-               dropdown.setItemFont(FontResources.DROPDOWN);
-               dropdown.setButtonRenderer(new DACustomButtonRenderer());
-
-               return dropdown;
-       }
-
-       public boolean updateCategoryDropdown(String newItem) {
-               // TODO: Add item to dropdown at start dialog
-               categoryDropdown.add(newItem);
-               return true;
-       }
 }
index 6c403f1..98a68c9 100644 (file)
@@ -36,9 +36,9 @@ import org.eclipse.nebula.widgets.grid.Grid;
 import org.eclipse.nebula.widgets.grid.GridItem;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.widgets.Composite;
-import org.tizen.dynamicanalyzer.model.FilterProperty;
+import org.eclipse.swt.widgets.Event;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.model.TableInput;
 import org.tizen.dynamicanalyzer.model.TreeInput;
 import org.tizen.dynamicanalyzer.util.Logger;
@@ -194,6 +194,13 @@ public abstract class DATreeComposite extends DATableComposite {
                if (table.isFocusControl() && focusIndex > 0) {
                        table.setFocusItem(table.getItem(focusIndex));
                }
+
+               Event event = new Event();
+               event.widget = this;
+               event.data = table.getItems();
+               event.type = AnalyzerConstants.TREE_SORT_EVENT;
+
+               notifyListeners(AnalyzerConstants.TREE_SORT_EVENT, event);
        }
 
        @Override
index b04c0e8..02b5203 100644 (file)
@@ -69,22 +69,31 @@ import org.tizen.dynamicanalyzer.project.ProcessMemoryMap;
 import org.tizen.dynamicanalyzer.project.Project;
 import org.tizen.dynamicanalyzer.setting.SettingDataManager;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
 import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartView;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
-import org.tizen.dynamicanalyzer.ui.toolbar.Toolbar;
 import org.tizen.dynamicanalyzer.util.CommonUtil;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
 import org.tizen.dynamicanalyzer.widgets.da.view.DABaseComposite;
 import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
 import org.tizen.dynamicanalyzer.widgets.da.view.DATabComposite;
+import org.tizen.dynamicanalyzer.widgets.timeline.MarkerManager;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.IEventListener;
+import org.tizen.dynamicanalyzer.widgets.timeline.markers.MarkerEvent;
 
 public class AnalyzerUtil {
        // FIXME start
        private static TimelineChartView timelineComposite;
        private static Map<String, Boolean> latestTraceModeMap = new HashMap<String, Boolean>(); 
 
+       static {
+               MarkerManager.INSTANCE.addEventListener(new IEventListener() {
+                       @Override
+                       public void handleEvent(MarkerEvent event) {
+                               AnalyzerUtil.getMainTab().getTopComposite().updateView();
+                       }
+               });
+       }
+
        public static TimelineChartView getTimelineComposite() {
                return timelineComposite;
        }
@@ -95,33 +104,6 @@ public class AnalyzerUtil {
 
        // FIXME end
        
-       public static void addMarker(long markerTime) {
-               double doubleTime = markerTime / (TimelineConstants.MEGA_DOUBLE);
-               
-               RangeDataManager.getInstance().addMarkerTime(markerTime);
-               Toolbar.INSTANCE.addMarkerTime(doubleTime);
-               
-               getMainTab().getTopComposite().updateView();
-       }
-       
-       public static void removeMarker(int index, long markerTime) {
-               double doubleTime = markerTime / (TimelineConstants.MEGA_DOUBLE);
-               
-               RangeDataManager.getInstance().removeMarkerTime(markerTime);
-               Toolbar.INSTANCE.removeMarkerTime(index, doubleTime);
-               
-               getMainTab().getTopComposite().updateView();
-       }
-       
-       public static void moveMarker(int index, long markerTime) {
-               double doubleTime = markerTime / (TimelineConstants.MEGA_DOUBLE);
-               
-               RangeDataManager.getInstance().getMarerTimeList().set(index, markerTime);
-               Toolbar.INSTANCE.setMarkerTime(index, doubleTime);
-               
-               getMainTab().getTopComposite().updateView();
-       }
-
        public static boolean copyFile(String srcPath, String destPath) {
                boolean success = false;
                FileInputStream fi = null;
index 08b03ae..095c131 100644 (file)
@@ -47,7 +47,7 @@ __set_parameter()
                        ;;
        esac
 
-       build_result_path="$build_path/$archive_platform_name/$windowing/$architecture/da"
+    build_result_path="$build_path/$archive_platform_name/$windowing/$architecture/da"
        result_archive_file=${build_id}-${archive_platform_name}.${windowing}.${architecture}.zip
 
        reference_ide_path=${ROOTDIR}/eclipse-pde/eclipse
index b166a2c..138f684 100644 (file)
@@ -1,3 +1,30 @@
+* 2.3.16
+- Improve Memory Statistics table and Heap Allocation charts UX:
+ - change data model of Statistics table to tree,
+ - add agreggated data for libraries under 'Total' entry,
+ - add cross-focus from table to Heap Allocation charts and vice versa,
+ - rearrange columns in more sensible order,
+ - fixed different names for unknown libraries in charts and table,
+ - add charts sorting according to table,
+ - improve rendering of starting points on charts
+- Timeline markers are numbered now
+- Introduce new Memory Range Analysis view
+- Introduce new Persistent Memory charts
+- Add cross-focus from Persisent Allocations table to chart and vice versa
+- Adjust size of Address column in Callstack view
+- Adjust Search Dialog controls sizes and positions
+- Fix shown zeros of System memory in Memory Details table
+- Fix Screenshot feature preferences to be able to be turned off totally
+- Change dotted line border of Process sub-chart
+- Redesign DA CLI process management
+- Refactor TargetData class
+- Redesign TargetDataTest and SettingDataManagerTest to match FlatFeature functionality
+- Fix 45 FindBugs warnings
+- Fix JIRA defects:
+  SPTSDKUX-2103,
+  SPTSDKUX-2155,
+  SPTSDKUX-2167
+== Maria Guseva <m.guseva@samsung.com> September 28, 2016
 * 2.3.15
 - Add Memory Call stack feature
 - Reduce DA package size again (76MB -> 54MB)
index db575d6..3f0f6b8 100644 (file)
@@ -1,5 +1,5 @@
 Source:dynamic-analyzer
-Version:2.3.15
+Version:2.3.16
 Maintainer:Gihun Chang <gihun.chang@samsung.com>, WooJin Jung <woojin2.jung@samsung.com>, Jaewon Lim <jaewon81.lim@samsung.com>, Seokgil Kang <seokgil.kang@samsung.com>
 
 Package:dynamic-analyzer-product