public class MessageParser {
private static final DALogger DA_LOG = DALogger.getInstance();
- static final boolean PRINT_DATA_LOG_TOFILE = true;
+ static final boolean PRINT_DATA_LOG_TOFILE = false;
static final int MSG_ID_INDEX = 0;
static final int MSG_LENGTH_INDEX = 1;
if (0 == startSec && 0 == startNano) {
// original code (before webapp support)
-// startTime.setSec(sec);
-// startTime.setNano(nano);
+ startTime.setSec(sec);
+ startTime.setNano(nano);
// for webapp support
- startTime.setSec(ByteUtils.toInt(data, 8));
- startTime.setNano(ByteUtils.toInt(data, 12));
+// startTime.setSec(ByteUtils.toInt(data, 8));
+// startTime.setNano(ByteUtils.toInt(data, 12));
AnalyzerManager.getProject().setProfileStartTime(startTime);
}
public class SaveAsDialog extends DAMessageBox {
private static final DALogger DA_LOG = DALogger.getInstance();
-
+
private int MAX_SAVE_FILE_NAME_LENGTH = 35;
private DAText textBox = null;
textBox.setBackground(ColorResources.VIEW_BG_COLOR);
textBox.getControl().addKeyListener(keyListener);
- info = new Label(shell, SWT.TRANSPARENT);
+ info = new Label(shell, SWT.TRANSPARENT);
data = new FormData();
data.top = new FormAttachment(textBox.getControl(), 5);
data.left = new FormAttachment(0, 9);
info.setBackground(ColorResources.DIALOG_BG_UPPER);
info.setForeground(ColorResources.RED);
info.setFont(FontResources.COMBO);
-
+
Composite buttonComp = new Composite(shell, SWT.NONE);
buttonComp.setLayout(new FormLayout());
buttonComp.setBackground(ColorResources.DIALOG_BG_LOWER);
private boolean executeSaveTrace() {
Project project = AnalyzerManager.getProject();
String sourcePath = project.getSavePath();
- String targetPath = PathManager.DA_SAVE_PATH
- + File.separator + saveFileName;
+ String targetPath = PathManager.DA_SAVE_PATH + File.separator
+ + saveFileName;
SqlManager.getInstance().closeConnection();
SqlConnectionManager.closeConnection();
- project.setSavePath(targetPath);
File sourceFolder = new File(sourcePath);
if (!sourceFolder.isDirectory()) {
}
}
AnalyzerUtil.copyDirectory(sourceFolder, targetFolder);
+ project.setSavePath(targetPath);
boolean success = AnalyzerUtil.deleteFile(new File(sourcePath));
if (success) {
// add snapshot model update
DA_LOG.debug("save complete!!"); //$NON-NLS-1$
-
} else {
DA_LOG.debug("save fail..."); //$NON-NLS-1$
- return false;
}
- return true;
+
+ // establish db connection with new path
+ SqlConnectionManager.establishConnection(project.getSavePath()
+ + File.separator + AnalyzerConstants.DATABASE_NAME);
+
+ return success;
}
private boolean checkValidFileName(String str) {
|| str.contains(CommonConstants.CMD_SPLIT)) {
info.setText("name contains invalid character");
return false;
- }
- else if(str.isEmpty())
- {
+ } else if (str.isEmpty()) {
info.setText("file name is not empty");
return false;
- }
- else if (str.length() > MAX_SAVE_FILE_NAME_LENGTH)
- {
+ } else if (str.length() > MAX_SAVE_FILE_NAME_LENGTH) {
info.setText("file name is too long");
return false;
}