[Title] add singleton, aboutdlg
authorHyunjong,park <phjwithyou.park@samsung.com>
Tue, 12 Nov 2013 05:15:13 +0000 (14:15 +0900)
committerHyunjong,park <phjwithyou.park@samsung.com>
Tue, 12 Nov 2013 05:15:13 +0000 (14:15 +0900)
[Desc.] from tizen_2.2 source
[Issue] -

20 files changed:
org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/Application.java
org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/ApplicationWorkbenchWindowAdvisor.java
org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/WorkbenchSingletonFocusManager.java [new file with mode: 0644]
org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/WorkbenchUtils.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerConstants.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AnalyzerPaths.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/DASingletonFocusManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/PathManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/IDECommunicator.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/DBTableManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/sql/SqlManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/file/FileChartManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/network/NetworkChartManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/AboutDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ConfigureManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/ConfigurationDialogValues.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/opentrace/OpenTraceDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/userinterface/UIDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/userinterface/profiling/UIFunctionProfilingDataChecker.java
package/build.linux

index 124d543..8f71b96 100755 (executable)
@@ -83,6 +83,14 @@ public class Application implements IApplication {
                        checkLogs(logs.getPath());
                }
 
+               if (WorkbenchSingletonFocusManager.checkDASingleton()) {
+                       System.out.println("Already DA Running");
+                       WorkbenchSingletonFocusManager.setFocusDA();
+                       System.exit(-1);
+               } else {
+                       System.out.println("First DA Running");
+               }
+               
                String[] argv = (String[]) context.getArguments().get(
                                "application.args");//$NON-NLS-1$
                if (argv.length > 0) {
index e974954..a09460a 100755 (executable)
@@ -43,6 +43,7 @@ import org.tizen.dynamicanalyzer.common.PathManager;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.communicator.IDECommunicator;
 import org.tizen.dynamicanalyzer.handlers.ExitHandler;
+import org.tizen.dynamicanalyzer.ui.toolbar.AboutDialog;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
 import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogValues;
 import org.tizen.dynamicanalyzer.ui.toolbar.configuration.WelcomeDialog;
@@ -73,11 +74,7 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
        public void createWindowContents(Shell shell) {
                ToolbarArea.createInstance(getWindowConfigurer(), shell);
 
-               if (DASingletonFocusManager.checkDASingleton()) {
-                       System.out.print("Already DA Running \n"); //$NON-NLS-1$
-                       DASingletonFocusManager.setFocusDA();
-                       System.exit(-1);
-               }
+               AboutDialog.updateBuildInfoForMac();
        }
 
        @Override
diff --git a/org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/WorkbenchSingletonFocusManager.java b/org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/WorkbenchSingletonFocusManager.java
new file mode 100644 (file)
index 0000000..2119d02
--- /dev/null
@@ -0,0 +1,182 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Hyunjong Park <phjwithyou.park@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.workbench;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.channels.FileLock;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+
+public class WorkbenchSingletonFocusManager {
+       private static Runtime runtime;
+       private static Process process;
+       public static final String ACTIVE_DA = "active_da";//$NON-NLS-1$
+       public static final String CONFIG = "config";//$NON-NLS-1$
+       public static final String SINGLETON_FOCUS_DA_PID = "Singleton focus DA PID";//$NON-NLS-1$
+
+       private static String[] getSaveFocusPath() {
+
+               String[] returnStr = null;
+               String strPid = getPidFromConfigFile();
+               if (null == strPid) {
+                       return returnStr;
+               }
+               if (WorkbenchUtils.isWin()) {
+                       returnStr = new String[] {
+                                       WorkbenchUtils.WINDOW_ACTIVATOR_WIDOWS_PATH, strPid };
+               } else if (WorkbenchUtils.isMac()) {
+                       returnStr = new String[] {
+                                       WorkbenchUtils.WINDOW_ACTIVATOR_MACOS_PATH, strPid };
+               } else if (WorkbenchUtils.isLinux()) {
+                       returnStr = new String[] {
+                                       WorkbenchUtils.WINDOW_ACTIVATOR_LINUX_PATH, strPid };
+               } else {
+                       System.out.println("Failed - not Support OS");
+               }
+
+               return returnStr;
+       }
+
+       private static int executeCommand(String[] cmds) {
+               int retValue = 0;
+               if (null == cmds) {
+                       retValue = -1;
+               } else {
+                       try {
+                               if (cmds.length == 0) {
+                                       retValue = -1;
+                               } else {
+                                       runtime = Runtime.getRuntime();
+                                       process = runtime.exec(cmds);
+
+                                       if (process != null) {
+                                               process.waitFor();
+                                               retValue = process.exitValue();
+                                       }
+                               }
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                       } catch (InterruptedException e) {
+                               e.printStackTrace();
+                       } finally {
+                               if (process != null) {
+                                       process.destroy();
+                               }
+                       }
+               }
+               return retValue;
+       }
+
+       private static String getPidFromConfigFile() {
+               String pid = null;
+               File configFile = new File(WorkbenchUtils.DYNAMIC_ANALYZER_INSTALL_PATH
+                               + File.separator + CONFIG + File.separator + CONFIG);
+               if (!configFile.isFile()) {
+                       System.out.println("Failed get pid - exist config file");
+                       return "";//$NON-NLS-1$
+               } else {
+                       BufferedReader in = null;
+                       String content;
+                       try {
+                               in = new BufferedReader(new FileReader(configFile));
+                               while (null != (content = in.readLine())) {
+                                       pid = getPIDString(content);
+                                       if (null != pid) {
+                                               return pid;
+                                       }
+                               }
+                       } catch (FileNotFoundException e) {
+                               e.printStackTrace();
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                       } finally {
+                               try {
+                                       if (null != in) {
+                                               in.close();
+                                       }
+                               } catch (IOException e) {
+                                       // TODO Auto-generated catch block
+                                       e.printStackTrace();
+                               }
+                       }
+               }
+               return pid;
+       }
+
+       private static String getPIDString(String readData) {
+               String pid = null;
+               String[] splitData = readData.split(CommonConstants.EQUAL);
+               int size = splitData.length;
+               if (2 != size) {
+                       return pid;
+               }
+               if (splitData[0].contains(SINGLETON_FOCUS_DA_PID)) {
+                       pid = splitData[1];
+               }
+               return pid;
+
+       }
+
+       public static void setFocusDA() {
+               executeCommand(getSaveFocusPath());
+       }
+
+       public static boolean checkDASingleton() {
+               File file = null;
+               FileLock fileLock = null;
+               boolean isFileLock = false;
+
+               String saveFolderPath = WorkbenchUtils.getSavePath();
+
+               File daSaveFile = new File(saveFolderPath);
+               if (!daSaveFile.isDirectory()) {
+                       daSaveFile.mkdirs();
+               }
+               String activeFilePath = saveFolderPath + File.separator + ACTIVE_DA;
+
+               file = new File(activeFilePath);
+               try {
+                       fileLock = new RandomAccessFile(file, "rw").getChannel().tryLock();//$NON-NLS-1$
+               } catch (FileNotFoundException e1) {
+                       e1.printStackTrace();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               } finally {
+                       if (fileLock == null) {
+                               isFileLock = true;
+                       } else {
+                               isFileLock = false;
+                       }
+               }
+               return isFileLock;
+       }
+}
index 2c57590..0e36ab5 100755 (executable)
@@ -58,6 +58,13 @@ public class WorkbenchUtils {
        public static final String MAC = "mac"; //$NON-NLS-1$
        public static final String WIN = "win"; //$NON-NLS-1$
 
+       public static final String WINDOW_ACTIVATOR_LINUX_PATH = TIZEN_ROOT_PATH
+                       + "/tools/dynamic-analyzer/tool/windowactivator.sh";//$NON-NLS-1$
+       public static final String WINDOW_ACTIVATOR_WIDOWS_PATH = TIZEN_ROOT_PATH
+                       + "/tools/dynamic-analyzer/tool/windowactivator.bat";//$NON-NLS-1$
+       public static final String WINDOW_ACTIVATOR_MACOS_PATH = TIZEN_ROOT_PATH
+                       + "/tools/dynamic-analyzer/tool/macoswindowactivator.sh";//$NON-NLS-1$
+       
        private static String logPostFix = null;
 
        public static String getLogPostFix() {
index 3f50207..468bf0f 100644 (file)
@@ -59,6 +59,7 @@ public class AnalyzerConstants {
        public static final String ABOUT_IDE_FOLDER_NAME = "ide"; //$NON-NLS-1$\r
        public static final String ABOUT_PLUGINS_FOLDER_NAME = "plugins"; //$NON-NLS-1$\r
        public static final String ABOUT_BASE_PLATFORM_FOLDER_NAME = "org.tizen.base.platform"; //$NON-NLS-1$\r
+       public static final String ABOUT_WORKBENCH_FOLDER_NAME = "org.tizen.dynamicanalyzer.workbench"; //$NON-NLS-1$\r
        public static final String ABOUT_FILE_NAME = "about.mappings"; //$NON-NLS-1$\r
        public static final String LICENSE_FILE_NAME = "license"; //$NON-NLS-1$\r
        public static final String USER_INTERFACE_API_LIST_FILE_NAME = "user_interface_api_list"; //$NON-NLS-1$\r
index 81020b1..cd9c814 100644 (file)
@@ -51,6 +51,7 @@ public class AnalyzerPaths {
                        + File.separator + AnalyzerConstants.TEMP_FOLDER_NAME;
        public static final String CONFIG_FOLDER_PATH = PathManager
                        .getConfigFolderPath();
+       public static final String WORKBENCH_FOLDER_PATH = PathManager.getWorkbenchPath();
        public static final String ABOUT_FILE_PATH = PathManager.getAboutPath();
        public static final String SDB_PATH = PathManager.getSdbPath();
        public static final String READELF_PATH = DYNAMIC_ANALYZER_INSTALL_PATH
index 2280ef3..cf39c07 100644 (file)
 
 package org.tizen.dynamicanalyzer.common;
 
-import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.RandomAccessFile;
 import java.lang.management.ManagementFactory;
 import java.lang.management.RuntimeMXBean;
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileLock;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Shell;
@@ -137,28 +132,4 @@ public class DASingletonFocusManager {
                                ConfigureLabels.SINGLETON_FOCUS_DA_PID, pid);
        }
 
-       public static boolean checkDASingleton() {
-
-               File file = null;
-               FileLock fileLock = null;
-               FileChannel fchannel = null;
-
-               file = new File(AnalyzerPaths.DA_SINGLETON_FILE_PATH);
-               try {
-                       fchannel = new RandomAccessFile(file, "rw").getChannel();//$NON-NLS-1$
-               } catch (FileNotFoundException e1) {
-                       e1.printStackTrace();
-               }
-               try {
-                       fileLock = fchannel.tryLock();
-               } catch (IOException e) {
-                       e.printStackTrace();
-               }
-               if (fileLock == null) {
-                       return true;
-               }
-
-               return false;
-       }
-
 }
index 8fa4678..695ba6d 100755 (executable)
@@ -315,6 +315,39 @@ public class PathManager {
                return aboutFilePath;
        }
 
+       public static String getWorkbenchPath() {
+               String aboutFolderPath = AnalyzerPaths.TIZEN_ROOT_PATH;
+               if (null == aboutFolderPath) {
+                       return null;
+               }
+               aboutFolderPath += (File.separator
+                               + AnalyzerConstants.TOOLS_FOLDER_NAME + File.separator
+                               + AnalyzerConstants.DYNAMIC_ANALYZER_FOLDER_NAME
+                               + File.separator + AnalyzerConstants.ABOUT_PLUGINS_FOLDER_NAME);
+
+               File dir = new File(aboutFolderPath);
+               String[] files;
+               if (dir.exists()) {
+                       files = dir.list(new FilenameFilter() {
+
+                               @Override
+                               public boolean accept(File dir, String name) {
+                                       // TODO Auto-generated method stub
+                                       return name
+                                                       .contains(AnalyzerConstants.ABOUT_WORKBENCH_FOLDER_NAME);
+                               }
+                       });
+               } else {
+                       return null;
+               }
+
+               if (null == files || files.length != 1) {
+                       return null;
+               }
+               String aboutFilePath = aboutFolderPath + File.separator + files[0];
+
+               return aboutFilePath;
+       }
        public static void pathCheck() {
                if (null == AnalyzerPaths.TIZEN_ROOT_PATH) {
                        final Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
index 76b28f9..f7cccb4 100644 (file)
@@ -37,7 +37,6 @@ import java.io.OutputStreamWriter;
 import java.io.RandomAccessFile;
 import java.net.ServerSocket;
 import java.net.Socket;
-import java.nio.channels.FileChannel;
 import java.nio.channels.FileLock;
 import java.util.ArrayList;
 
@@ -77,13 +76,14 @@ public class IDECommunicator implements Runnable {
        private static Thread instance;
 
        private static Boolean openWelcomeDlg = Boolean.FALSE;
-       private static Boolean waitingWelcomeDlg = Boolean.FALSE;
-       
+
+       private static final Integer waitingWelcomeDlg = new Integer(0);
+
        private ServerSocket daServerSocket = null;
        private static Socket lastCommunicationIdeSocket = null;
        private static ArrayList<Socket> ideClientSocketArray = new ArrayList<Socket>();
        private int serverPort = 0;
-
+       private long configurationWaitingTimeMs = 60000;
 
        public void run() {
                daServerSocket = setServePort(); // Server Bind
@@ -94,7 +94,7 @@ public class IDECommunicator implements Runnable {
                                return;
                        }
 
-                       if (setReadyCommunication() != true) {
+                       if (setCheckFileLock() != true) {
                                System.out.println("failed socket File Lock");
                                errorMessageBox();
                                return;
@@ -267,7 +267,7 @@ public class IDECommunicator implements Runnable {
                        System.out.println("Start -AutoRun Waiting...");
                        synchronized (getWaitingWelcomeDlg()) {
                                try {
-                                       getWaitingWelcomeDlg().wait();
+                                       getWaitingWelcomeDlg().wait((long)configurationWaitingTimeMs);
                                } catch (InterruptedException e) {
                                        e.printStackTrace();
                                }
@@ -290,7 +290,7 @@ public class IDECommunicator implements Runnable {
                                        if (name.length() > APPNAME_LENGTH) {
                                                name = appName.substring(0, APPNAME_LENGTH - 1) + "...";//$NON-NLS-1$ 
                                        }
-                                       warning.setMessage(name + " is not supported application");
+                                       warning.setMessage(name + " is not supported application");//$NON-NLS-1$ 
                                        warning.setIcon(ImageResources.DIALOG_WARNING_ICON);
                                        warning.open();
 
@@ -323,103 +323,94 @@ public class IDECommunicator implements Runnable {
                warning.open();
        }
 
-       public static Boolean isOpenWelcomeDlg() {
+       public synchronized static Boolean isOpenWelcomeDlg() {
                return openWelcomeDlg;
        }
 
        public static void setOpenWelcomeDlg(boolean data) {
-               if(data){
+               if (data) {
                        openWelcomeDlg = Boolean.TRUE;
-               }else{
+               } else {
                        openWelcomeDlg = Boolean.FALSE;
                }
        }
 
-       public static Boolean getWaitingWelcomeDlg() {
+       public static Integer getWaitingWelcomeDlg() {
                return waitingWelcomeDlg;
        }
-       
+
        // Find Available Port, Save Current Port, Set Active DA_Plugin
-               private ServerSocket setServePort() {
-                       ServerSocket serverSocket = null;
-                       serverSocket = getServerSocket(0);
-                       if (serverSocket != null) {
-                               serverPort = serverSocket.getLocalPort();
-                               System.out.println("IDE-DA Server port " + serverPort); //$NON-NLS-1$
-
-                               return serverSocket;
-                       } else {
-                               System.out.println("failed Set Serve Socket"); //$NON-NLS-1$
-                       }
+       private ServerSocket setServePort() {
+               ServerSocket serverSocket = null;
+               serverSocket = getServerSocket(0);
+               if (serverSocket != null) {
+                       serverPort = serverSocket.getLocalPort();
+                       System.out.println("IDE-DA Server port " + serverPort); //$NON-NLS-1$
+
                        return serverSocket;
+               } else {
+                       System.out.println("failed Set Serve Socket"); //$NON-NLS-1$
                }
+               return serverSocket;
+       }
 
-               // Find Available Port
-               private ServerSocket getServerSocket(final int port) {
-                       ServerSocket serverSocket = null;
-                       try {
-                               serverSocket = new ServerSocket(0);
-                       } catch (IOException e) {
-                               serverSocket = null;
-                               e.printStackTrace();
-                       }
-                       return serverSocket;
+       // Find Available Port
+       private ServerSocket getServerSocket(final int port) {
+               ServerSocket serverSocket = null;
+               try {
+                       serverSocket = new ServerSocket(0);
+               } catch (IOException e) {
+                       serverSocket = null;
+                       e.printStackTrace();
                }
+               return serverSocket;
+       }
 
-               // Save Current Port
-               public boolean savePortToFile() {
-                       boolean bSuccess = true;
-                       FileOutputStream fos = null;
-                       DataOutputStream dos = null;
-                       try {
-                               File file = new File(AnalyzerPaths.IDE_ACTIVE_SAVE_PORT_PATH);
-                               fos = new FileOutputStream(file);
-                               dos = new DataOutputStream(fos);
-                               dos.writeInt(serverPort);
-                               dos.flush();
-                               bSuccess = true;
-                       } catch (FileNotFoundException e) {
-                               bSuccess = false;
-                               e.printStackTrace();
-                       } catch (IOException e) {
-                               bSuccess = false;
-                               e.printStackTrace();
-                       } finally{
-                               AnalyzerUtil.tryClose(fos,dos);
-                       }
-                       return bSuccess;
+       // Save Current Port
+       public boolean savePortToFile() {
+               boolean bSuccess = true;
+               FileOutputStream fos = null;
+               DataOutputStream dos = null;
+               try {
+                       File file = new File(AnalyzerPaths.IDE_ACTIVE_SAVE_PORT_PATH);
+                       fos = new FileOutputStream(file);
+                       dos = new DataOutputStream(fos);
+                       dos.writeInt(serverPort);
+                       dos.flush();
+                       bSuccess = true;
+               } catch (FileNotFoundException e) {
+                       bSuccess = false;
+                       e.printStackTrace();
+               } catch (IOException e) {
+                       bSuccess = false;
+                       e.printStackTrace();
+               } finally {
+                       AnalyzerUtil.tryClose(fos, dos);
                }
+               return bSuccess;
+       }
 
-               public boolean setReadyCommunication() {
-                       File file = null;
-                       FileLock fileLock = null;
-                       FileChannel fchannel = null;
-                       boolean setFileLock = false;
-                       try {
-                               file = new File(AnalyzerPaths.IDE_ACTIVE_PORT_PATH);
-                               fchannel = new RandomAccessFile(file, "rw").getChannel();//$NON-NLS-1$
-                               fileLock = fchannel.tryLock();
-                       } catch (FileNotFoundException e1) {
-                               e1.printStackTrace();
-                               errorMessageBox();
-                               return false;
-                       } catch (IOException e) {
-                               e.printStackTrace();
-                               errorMessageBox();
-                       } finally {
-                               if (null == fileLock) {
-                                       setFileLock = false;
-                                       if (null != fchannel) {
-                                               try {
-                                                       fchannel.close();
-                                               } catch (IOException e) {
-                                                       e.printStackTrace();
-                                               }
-                                       }
-                               } else {
-                                       setFileLock = true;
-                               }
+       public boolean setCheckFileLock() {
+               File file = null;
+               FileLock fileLock = null;
+               boolean setFileLock = false;
+               try {
+                       file = new File(AnalyzerPaths.IDE_ACTIVE_PORT_PATH);
+                       fileLock = new RandomAccessFile(file, "rw").getChannel().tryLock();
+               } catch (FileNotFoundException e1) {
+                       e1.printStackTrace();
+                       errorMessageBox();
+                       return false;
+               } catch (IOException e) {
+                       e.printStackTrace();
+                       errorMessageBox();
+               } finally {
+                       if (null == fileLock) {
+                               setFileLock = false;
+                       } else {
+                               setFileLock = true;
                        }
-                       return setFileLock;
                }
+               return setFileLock;
+       }
 }
index 6ec4505..6dac237 100644 (file)
@@ -145,7 +145,7 @@ public class DBTableManager {
                        TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT,
                        TEXT, TEXT, TEXT, TEXT };
 
-       public static DBTableManager getInstance() {
+       public synchronized static DBTableManager getInstance() {
                if (null == instance) {
                        instance = new DBTableManager();
                        instance.init();
index e2ef6e3..5151483 100755 (executable)
@@ -161,6 +161,7 @@ public class SqlManager {
                        try {
                                Statement st = replayConnection.createStatement();
                                st.execute("SHUTDOWN");
+                               AnalyzerUtil.tryClose(st);
                                replayConnection.close();
                        } catch (SQLException se) {
                                if (!se.getSQLState().equals("XJ015")) {
@@ -178,6 +179,7 @@ public class SqlManager {
                        try {
                                Statement st = connection.createStatement();
                                st.execute("SHUTDOWN");
+                               AnalyzerUtil.tryClose(st);
                                connection.close();
                        } catch (SQLException se) {
                                if (!se.getSQLState().equals("XJ015")) {
@@ -188,7 +190,7 @@ public class SqlManager {
                }
        }
 
-       public static SqlManager getInstance() {
+       public synchronized static SqlManager getInstance() {
                if (null == instance) {
                        instance = new SqlManager();
                }
index 28a6eb4..1c61900 100644 (file)
@@ -49,7 +49,7 @@ public class FileChartManager implements Runnable {
                                AnalyzerManager.getWarningChecker());
        }
 
-       public static FileChartManager getInstance() {
+       public synchronized static FileChartManager getInstance() {
                if (null == instance) {
                        instance = new FileChartManager();
                }
index 68b2f14..e18ea30 100644 (file)
@@ -175,8 +175,8 @@ public class NetworkChartManager implements Runnable {
        }
 
        public void setPacketMessage(String packetMessage) {
-               if (!packetMessage.equals(CommonConstants.EMPTY)
-                               && packetMessage != null) {
+               if (packetMessage != null
+                               && !packetMessage.equals(CommonConstants.EMPTY)) {
                        StringBuffer out = new StringBuffer();
                        StringBuffer strHex = new StringBuffer();
                        StringBuffer strAscii = new StringBuffer();
index 96651fa..d531d47 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact: 
- * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * jooyoul lee<jy.exe.lee@samsung.com>
  * Juyoung Kim <j0.kim@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
 package org.tizen.dynamicanalyzer.ui.toolbar;
 
 import java.io.BufferedReader;
+import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
+import java.io.FileWriter;
 import java.io.IOException;
+import java.io.PrintWriter;
 
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.DisposeEvent;
@@ -45,6 +48,7 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
+import org.tizen.dynamicanalyzer.common.CommonConstants;
 import org.tizen.dynamicanalyzer.common.DesignConstants;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
@@ -61,10 +65,16 @@ public class AboutDialog extends DAMessageBox {
        private static boolean opened = false;
        private DACustomButton licenseButton = null;
        private DACustomButton okButton = null;
-       private File SDKAboutFile = null;
+
+       private static String ideBuildVersionInfo = CommonConstants.EMPTY;
+       private static String daBuildVersionInfo = CommonConstants.EMPTY;
+       private static String daBuildTimeInfo = CommonConstants.EMPTY;
 
        private final Image iconImage = ImageResources.ABOUT_TIZEN_SDK;
 
+       final static String daAboutFilePath = AnalyzerPaths.WORKBENCH_FOLDER_PATH
+                       + File.separator + "about.mappings";
+
        public AboutDialog(Shell parent) {
                super(parent);
        }
@@ -95,7 +105,7 @@ public class AboutDialog extends DAMessageBox {
                shell.setLayout(new FormLayout());
                shell.setText(AnalyzerLabels.ABOUT);
                shell.addDisposeListener(new DisposeListener() {
-                       
+
                        @Override
                        public void widgetDisposed(DisposeEvent e) {
                                opened = false;
@@ -103,6 +113,8 @@ public class AboutDialog extends DAMessageBox {
                        }
                });
 
+               updateBuildInfo();
+
                Composite base = new Composite(shell, SWT.NONE);
                base.setLayout(new FormLayout());
                FormData baseData = new FormData();
@@ -127,17 +139,18 @@ public class AboutDialog extends DAMessageBox {
                titleText.setText(AnalyzerLabels.ABOUT_DIALOG_TITLE);
 
                Label version = new Label(base, SWT.TRANSPARENT);
-               String versionString = getVersion();// FIXME
-               version.setText(AnalyzerLabels.ABOUT_DIALOG_VERSION_TAB + versionString);
+               // String versionString = getVersion();// FIXME
+               version.setText(AnalyzerLabels.ABOUT_DIALOG_VERSION_TAB
+                               + ideBuildVersionInfo);
                version.setBackground(ColorResources.DIALOG_BG_UPPER);
                version.setAlignment(SWT.LEFT);
                version.setForeground(ColorResources.DEFAULT_FONT_COLOR);
                version.setFont(FontResources.ABOUT_TEXT);
 
                Label buildTime = new Label(base, SWT.TRANSPARENT);
-               String buildTimeString = getBuildTime();// FIXME
+               // String buildTimeString = getBuildTime();// FIXME
                buildTime.setText(AnalyzerLabels.ABOUT_DIALOG_BUILD_TIME_TAB
-                               + buildTimeString);
+                               + daBuildTimeInfo);
                buildTime.setBackground(ColorResources.DIALOG_BG_UPPER);
                buildTime.setAlignment(SWT.LEFT);
                buildTime.setForeground(ColorResources.DEFAULT_FONT_COLOR);
@@ -227,17 +240,48 @@ public class AboutDialog extends DAMessageBox {
                return true;
        }
 
-       private String parseBuildTime(String readData) {
-               String[] splitData = readData.split("2="); //$NON-NLS-1$
-               int size = splitData.length;
+       public static void updateBuildInfoForMac() {
+               if (AnalyzerUtil.isMac()) {
+                       updateBuildInfo();
+               }
+       }
 
-               if (2 != size) {
-                       return null;
+       public static void updateBuildInfo() {
+               if (ideBuildVersionInfo.equals(CommonConstants.EMPTY)
+                               || daBuildTimeInfo.equals(CommonConstants.EMPTY)) {
+                       daBuildTimeInfo = getDABuildTime();
+                       ideBuildVersionInfo = getIDEVersion();
+                       daBuildVersionInfo = getDAVersion();
+                       if (null != daBuildVersionInfo && daBuildVersionInfo.contains("RC")) {//$NON-NLS-1$
+                               return;
+                       }
+                       writeBuildInfoToAboutFile();
                }
-               return splitData[1];
        }
 
-       private String parseVersion(String readData) {
+       private static void writeBuildInfoToAboutFile() {
+               File DAAboutFile = new File(daAboutFilePath);
+               FileWriter fileWriter = null;
+               BufferedWriter buffWriter = null;
+               PrintWriter printWriter = null;
+               try {
+                       fileWriter = new FileWriter(DAAboutFile);
+                       buffWriter = new BufferedWriter(fileWriter);
+                       printWriter = new PrintWriter(buffWriter);
+
+                       printWriter
+                                       .println("0" + CommonConstants.EQUAL + ideBuildVersionInfo);//$NON-NLS-1$
+                       printWriter.println("1" + CommonConstants.EQUAL + daBuildTimeInfo);//$NON-NLS-1$
+                       printWriter.checkError();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               } finally {
+                       AnalyzerUtil.tryClose(fileWriter, buffWriter, printWriter);
+               }
+
+       }
+
+       private static String parseBuildTime(String readData) {
                String[] splitData = readData.split("1="); //$NON-NLS-1$
                int size = splitData.length;
 
@@ -247,11 +291,9 @@ public class AboutDialog extends DAMessageBox {
                return splitData[1];
        }
 
-       private String getBuildTime() {
+       private static String getDABuildTime() {
                String buildTime;
-               if (null == SDKAboutFile) {
-                       SDKAboutFile = new File(AnalyzerPaths.ABOUT_FILE_PATH);
-               }
+               File SDKAboutFile = new File(daAboutFilePath);
 
                BufferedReader in = null;
                String content;
@@ -275,21 +317,40 @@ public class AboutDialog extends DAMessageBox {
                return null;
        }
 
-       private String getVersion() {
-               String version;
-               if (null == SDKAboutFile) {
-                       SDKAboutFile = new File(AnalyzerPaths.ABOUT_FILE_PATH);
+       private static String getIDEVersion() {
+               File SDKAboutFile = new File(AnalyzerPaths.ABOUT_FILE_PATH);
+               BufferedReader in = null;
+               String content;
+               try {
+                       in = new BufferedReader(new FileReader(SDKAboutFile));
+                       while (null != (content = in.readLine())) {
+                               String[] splitData = content.split("1="); //$NON-NLS-1$
+                               int size = splitData.length;
+                               if (2 == size) {
+                                       return splitData[1];
+                               }
+                       }
+               } catch (FileNotFoundException e) {
+                       e.printStackTrace();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               } finally {
+                       AnalyzerUtil.tryClose(in);
                }
+               return null;
+       }
 
+       private static String getDAVersion() {
+               File SDKAboutFile = new File(daAboutFilePath);
                BufferedReader in = null;
                String content;
                try {
                        in = new BufferedReader(new FileReader(SDKAboutFile));
                        while (null != (content = in.readLine())) {
-                               version = parseVersion(content);
-                               if (version != null) {
-                                       AnalyzerUtil.tryClose(in);
-                                       return version;
+                               String[] splitData = content.split("0="); //$NON-NLS-1$
+                               int size = splitData.length;
+                               if (2 == size) {
+                                       return splitData[1];
                                }
                        }
                } catch (FileNotFoundException e) {
@@ -299,7 +360,6 @@ public class AboutDialog extends DAMessageBox {
                } finally {
                        AnalyzerUtil.tryClose(in);
                }
-
                return null;
        }
 }
index 7d4a2cf..87f73cb 100644 (file)
@@ -87,7 +87,7 @@ public class ConfigureManager {
                initConfigDataFromFile();
        }
 
-       public static ConfigureManager getInstance() {
+       public synchronized static ConfigureManager getInstance() {
                if (instance == null) {
                        instance = new ConfigureManager();
                }
index 5e75da9..8b71f11 100644 (file)
@@ -84,7 +84,7 @@ public class ConfigurationDialogValues {
        private static final String ON = ConfigureLabels.ON;
        private static final String OFF = ConfigureLabels.OFF;
 
-       public static ConfigurationDialogValues getInstance() {
+       public synchronized static ConfigurationDialogValues getInstance() {
                if (null == instance) {
                        instance = new ConfigurationDialogValues();
                        featuresName = new String[] {
index aac3f27..50b6528 100644 (file)
@@ -49,7 +49,10 @@ 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.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.ScrollBar;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
@@ -89,6 +92,9 @@ public class OpenTraceDialog extends DAMessageBox {
        private Grid selectedTable = null;
        private DACustomButton okButton = null;
        private DACustomButton cancelButton = null;
+       
+       ScrollBar detailViewHBar = null;
+       int detailViewHSelectionIndex = 0;
 
        /* for details */
        private String createTime = CommonConstants.EMPTY;
@@ -184,9 +190,18 @@ public class OpenTraceDialog extends DAMessageBox {
                detailLabel.setForeground(ColorResources.OPEN_TRACE_LABEL_COLOR);
                detailLabel.setFont(FontResources.OPEN_TRACE_INNER_TITLE);
 
-               detail = new Canvas(tableComp, SWT.NONE);
+               detail = new Canvas(tableComp, SWT.NO_REDRAW_RESIZE | SWT.H_SCROLL);
                detail.addPaintListener(detailPaintListener);
 
+               detailViewHBar = detail.getHorizontalBar();
+
+               detailViewHBar.addListener(SWT.Selection, new Listener() {
+                       public void handleEvent(Event e) {
+                               detailViewHSelectionIndex = detailViewHBar.getSelection();
+                               detail.redraw();
+                       }
+               });
+
                data = new FormData();
                data.top = new FormAttachment(0, 5);
                data.left = new FormAttachment(0, 7);
@@ -277,6 +292,9 @@ public class OpenTraceDialog extends DAMessageBox {
 
                saveTable.updateTable();
                tempTable.updateTable();
+               
+               updateOKButtonStatus();
+               updateDetailViewHScroll(0);
                opened = true;
                ShortCutManager.getInstance().setEnabled(!opened);
                return true;
@@ -308,6 +326,43 @@ public class OpenTraceDialog extends DAMessageBox {
                        }
                }
        };
+       
+       private void updateOKButtonStatus() {
+               boolean isButtonStatus = false;
+               if (null == selectedTable) {
+                       isButtonStatus = false;
+               } else {
+                       GridItem[] items = selectedTable.getSelection();
+                       if (items.length == 0) {
+                               isButtonStatus = false;
+                       } else {
+                               isButtonStatus = true;
+                       }
+               }
+               okButton.setButtonEnabled(isButtonStatus);
+       }
+       
+       private void updateDetailViewHScroll(int textLenght) {
+               int hScrollWidth = textLenght - detail.getBounds().width;
+               if (application.equals(CommonConstants.EMPTY) || hScrollWidth < 0) {
+                       detailViewHBar.setMaximum(10);
+               } else {
+                       if (hScrollWidth < 15) {
+                               hScrollWidth = 15;
+                       }
+                       detailViewHBar.setMaximum(hScrollWidth);
+               }
+               detailViewHBar.setMinimum(0);
+       }
+
+       private String getDrawTextByScroll(String text) {
+               String drawTest = CommonConstants.EMPTY;
+               if (text.length() >= detailViewHSelectionIndex) {
+                       drawTest = (String) text.subSequence(detailViewHSelectionIndex,
+                                       text.length());
+               }
+               return drawTest;
+       }
 
        private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() {
 
@@ -325,6 +380,8 @@ public class OpenTraceDialog extends DAMessageBox {
                        int[] sel = new int[0];
                        tempTable.getTable().setSelection(sel);
                        updateDetails();
+                       updateOKButtonStatus();
+                       updateDetailViewHScroll(0);
                }
 
                @Override
@@ -341,6 +398,8 @@ public class OpenTraceDialog extends DAMessageBox {
                        int[] sel = new int[0];
                        saveTable.getTable().setSelection(sel);
                        updateDetails();
+                       updateOKButtonStatus();
+                       updateDetailViewHScroll(0);
                }
 
                @Override
@@ -422,6 +481,9 @@ public class OpenTraceDialog extends DAMessageBox {
                                        // log for debug
                                        System.out.println("delete save file failed..."); //$NON-NLS-1$
                                }
+                               updateDetails();
+                               updateOKButtonStatus();
+                               updateDetailViewHScroll(0);
                        }
 
                }
@@ -443,36 +505,39 @@ public class OpenTraceDialog extends DAMessageBox {
                        e.gc.setBackground(ColorResources.WHITE);
                        e.gc.fillRectangle(rect);
                        e.gc.setForeground(ColorResources.OPEN_TRACE_TABLE_OUTLINE_COLOR);
-                       e.gc.drawRectangle(rect.x, rect.y, rect.width - 1, rect.height - 1);
+                       e.gc.drawRectangle(rect.x, rect.y, rect.width, rect.height - 1);
 
                        if (!application.isEmpty() && !device.isEmpty()) {
+
                                e.gc.setFont(FontResources.TABLE_CELL_FONT);
                                String inputText = AnalyzerLabels.OPEN_TRACE_DLG_DETAILS_APPLICATION
                                                + application;
                                Point textSize = e.gc.textExtent(inputText, SWT.DRAW_MNEMONIC);
                                int fontHeight = textSize.y + 3;
-                               
                                int x = rect.x + 7;
                                int y = rect.y + 4;
-                               
+
                                e.gc.setForeground(ColorResources.OPEN_TRACE_SAVE_CONTENTS_COLOR);
-                               e.gc.drawText(inputText, x, y);
+
+                               e.gc.drawText(getDrawTextByScroll(inputText), x, y);
                                y += fontHeight;
-                               
+
                                inputText = AnalyzerLabels.OPEN_TRACE_DLG_DETAILS_DEVICE
                                                + device;
-                               e.gc.drawText(inputText, x, y);
+                               e.gc.drawText(getDrawTextByScroll(inputText), x, y);
                                y += fontHeight;
 
                                inputText = AnalyzerLabels.OPEN_TRACE_DLG_DETAILS_CREATE_TIME
                                                + createTime;
-                               e.gc.drawText(inputText, x, y);
+                               e.gc.drawText(getDrawTextByScroll(inputText), x, y);
                                y += fontHeight;
 
                                inputText = AnalyzerLabels.OPEN_TRACE_DLG_DETAILS_RECORDING_TIME
                                                + Formatter.toOpentraceTimeFormat(elapsedTime);
-                               e.gc.drawText(inputText, x, y);
+                               e.gc.drawText(getDrawTextByScroll(inputText), x, y);
+                               updateDetailViewHScroll(textSize.x);
                        }
+
                }
        };
 
index ca411b6..a521e17 100644 (file)
@@ -56,7 +56,7 @@ public class UIDataManager implements Runnable {
        private String strTableSeleteClassName = null;
        private LogListQueue logListQueue = null;
 
-       public static UIDataManager getInstance() {
+       public synchronized static UIDataManager getInstance() {
                if (null == instance) {
                        instance = new UIDataManager();
                }
index 43f7826..09c9b3c 100644 (file)
@@ -151,10 +151,6 @@ public class UIFunctionProfilingDataChecker {
                List<ProfilingData> children = profiler.getAppBin().getChildList()
                                .get(0).getChildList();
                int size = children.size();
-               if (nUserProfilingDataCount == size) {
-       //              return;
-               }
-               nUserProfilingDataCount = size;
                getUIApiListFile();
                for (int i = 0; i < size; i++) {
                        if (i >= isUiApiCheckList.size()) {
index d642a2b..289c76e 100755 (executable)
@@ -177,6 +177,16 @@ __set_product_version() {
        mv ${about_mapping_path}.mod ${about_mapping_path}
 }
 
+__set_product_about_info() {
+        about_mapping_path="${build_path}/plugins/${branding_path}/about.mappings"
+        about_version_parameter="0"
+        about_build_time_parameter="1"
+        sed -e "s;\(^${about_version_parameter}=\).*;\1${product_version};g" \
+                -e "s;\(^${about_build_time_parameter}=\).*;\1${build_time};g" \
+                < ${about_mapping_path} > ${about_mapping_path}.mod
+        mv ${about_mapping_path}.mod ${about_mapping_path}
+}
+
 __make_ant_build_properties_file()
 {
        builder_path="${SRCDIR}/builder"
@@ -253,6 +263,7 @@ build_plugins()
        __copy_build_sources
        __copy_dependency_plugins
        __set_product_version
+       __set_product_about_info
        __make_ant_build_properties_file
        __execute_pde_build
        __unzip_plugin_pack