+++ /dev/null
-/*\r
- * Dynamic Analyzer\r
- *\r
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
- *\r
- * Contact: \r
- * Jooyoul Lee <jy.exe.lee@samsung.com>\r
- * Juyoung Kim <j0.kim@samsung.com>\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * \r
- * Contributors:\r
- * - S-Core Co., Ltd\r
- * \r
- */\r
-\r
-package org.tizen.dynamicanalyzer.handlers;\r
-\r
-import java.io.File;\r
-\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;\r
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;\r
-import org.tizen.dynamicanalyzer.common.AnalyzerPaths;\r
-import org.tizen.dynamicanalyzer.project.Project;\r
-import org.tizen.dynamicanalyzer.uirecorder.RecorderXml;\r
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;\r
-\r
-public class SaveTraceHandler extends AbstractHandler {\r
-\r
- public static final String ID = SaveTraceHandler.class.getName();\r
-\r
- @Override\r
- public Object execute(ExecutionEvent event) throws ExecutionException {\r
- // copy temp save file to save folder\r
- // renaming folder name to app name + date time\r
- Project project = AnalyzerManager.getProject();\r
- String sourcePath = project.getSavePath();\r
- String[] splitSourcePath = null;\r
- if (AnalyzerUtil.isWin()) {\r
- splitSourcePath = sourcePath.split("\\\\"); //$NON-NLS-1$\r
- } else if (AnalyzerUtil.isMac()) {\r
- splitSourcePath = sourcePath.split("\\/"); //$NON-NLS-1$\r
- } else {\r
- splitSourcePath = sourcePath.split("\\/"); //$NON-NLS-1$\r
- }\r
-\r
- String saveName = new String(\r
- splitSourcePath[splitSourcePath.length - 1]);\r
- String targetPath = AnalyzerPaths.DYNAMIC_ANALYZER_SAVE_PATH\r
- + File.separator + saveName;\r
- String targetImagePath = targetPath + File.separator\r
- + AnalyzerConstants.IMAGE_FOLDER_NAME;\r
-\r
- File targetFolder = new File(targetImagePath);\r
- if (!targetFolder.isDirectory()) {\r
- targetFolder.mkdirs();\r
- }\r
- String targetFilePath = targetPath + File.separator\r
- + AnalyzerConstants.DATABASE_NAME;\r
- String sourceFilePath = sourcePath + File.separator\r
- + AnalyzerConstants.DATABASE_NAME;\r
- AnalyzerUtil.copyFile(sourceFilePath, targetFilePath);\r
-\r
- String sourceUIRecorderPath = sourcePath + File.separator\r
- + RecorderXml.xmlFileName;\r
- String targetUIRecorderPath = targetPath + File.separator\r
- + RecorderXml.xmlFileName;\r
- if (new File(sourceUIRecorderPath).exists()) {\r
- AnalyzerUtil.copyFile(sourceUIRecorderPath, targetUIRecorderPath);\r
- }\r
-\r
- project.setSavePath(targetPath);\r
-\r
- // delete source file and folder\r
- // save trace callstack\r
- String sourceImgFolder = sourcePath\r
- + AnalyzerConstants.IMAGE_FOLDER_NAME;\r
- AnalyzerUtil.saveTraceImage(sourceImgFolder, targetImagePath);\r
- try {\r
- project.closeConnection();\r
- boolean success = AnalyzerUtil.deleteFile(new File(sourcePath));\r
- AnalyzerManager.removeFromProjectList(sourcePath);\r
- if (success) {\r
- // add snapshot model update\r
-// SnapshotData.getInstance().update();\r
- System.out.println("save complete!!"); //$NON-NLS-1$\r
- } else {\r
- System.out.println("save fail..."); //$NON-NLS-1$\r
- }\r
- } catch (Exception e) {\r
- e.printStackTrace();\r
- return 1;\r
- }\r
-\r
- return 0;\r
- }\r
-\r
-}\r
// delete source file and folder
// save trace callstack
- String sourceImgFolder = sourcePath
+ String sourceImgFolder = sourcePath + File.separator
+ AnalyzerConstants.IMAGE_FOLDER_NAME;
AnalyzerUtil.saveTraceImage(sourceImgFolder, targetImagePath);
+ // small images
+ File smallFolder = new File(targetImagePath + File.separator
+ + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME);
+ if (!smallFolder.isDirectory()) {
+ smallFolder.mkdirs();
+ }
+ AnalyzerUtil.saveTraceImage(sourceImgFolder + File.separator
+ + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME, targetImagePath
+ + File.separator + AnalyzerConstants.SMALL_IMAGE_FOLDER_NAME);
try {
project.closeConnection();
boolean success = AnalyzerUtil.deleteFile(new File(sourcePath));
AnalyzerManager.removeFromProjectList(sourcePath);
if (success) {
// add snapshot model update
-// SnapshotData.getInstance().update();
+ // SnapshotData.getInstance().update();
System.out.println("save complete!!"); //$NON-NLS-1$
} else {
System.out.println("save fail..."); //$NON-NLS-1$