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) {
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;
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
--- /dev/null
+/*
+ * 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;
+ }
+}
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() {
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
+ 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
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;
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;
- }
-
}
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();
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;
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
return;
}
- if (setReadyCommunication() != true) {
+ if (setCheckFileLock() != true) {
System.out.println("failed socket File Lock");
errorMessageBox();
return;
System.out.println("Start -AutoRun Waiting...");
synchronized (getWaitingWelcomeDlg()) {
try {
- getWaitingWelcomeDlg().wait();
+ getWaitingWelcomeDlg().wait((long)configurationWaitingTimeMs);
} catch (InterruptedException e) {
e.printStackTrace();
}
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();
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;
+ }
}
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();
try {
Statement st = replayConnection.createStatement();
st.execute("SHUTDOWN");
+ AnalyzerUtil.tryClose(st);
replayConnection.close();
} catch (SQLException se) {
if (!se.getSQLState().equals("XJ015")) {
try {
Statement st = connection.createStatement();
st.execute("SHUTDOWN");
+ AnalyzerUtil.tryClose(st);
connection.close();
} catch (SQLException se) {
if (!se.getSQLState().equals("XJ015")) {
}
}
- public static SqlManager getInstance() {
+ public synchronized static SqlManager getInstance() {
if (null == instance) {
instance = new SqlManager();
}
AnalyzerManager.getWarningChecker());
}
- public static FileChartManager getInstance() {
+ public synchronized static FileChartManager getInstance() {
if (null == instance) {
instance = new FileChartManager();
}
}
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();
* 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;
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;
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);
}
shell.setLayout(new FormLayout());
shell.setText(AnalyzerLabels.ABOUT);
shell.addDisposeListener(new DisposeListener() {
-
+
@Override
public void widgetDisposed(DisposeEvent e) {
opened = false;
}
});
+ updateBuildInfo();
+
Composite base = new Composite(shell, SWT.NONE);
base.setLayout(new FormLayout());
FormData baseData = new FormData();
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);
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;
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;
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) {
} finally {
AnalyzerUtil.tryClose(in);
}
-
return null;
}
}
initConfigDataFromFile();
}
- public static ConfigureManager getInstance() {
+ public synchronized static ConfigureManager getInstance() {
if (instance == null) {
instance = new ConfigureManager();
}
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[] {
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;
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;
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);
saveTable.updateTable();
tempTable.updateTable();
+
+ updateOKButtonStatus();
+ updateDetailViewHScroll(0);
opened = true;
ShortCutManager.getInstance().setEnabled(!opened);
return true;
}
}
};
+
+ 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() {
int[] sel = new int[0];
tempTable.getTable().setSelection(sel);
updateDetails();
+ updateOKButtonStatus();
+ updateDetailViewHScroll(0);
}
@Override
int[] sel = new int[0];
saveTable.getTable().setSelection(sel);
updateDetails();
+ updateOKButtonStatus();
+ updateDetailViewHScroll(0);
}
@Override
// log for debug
System.out.println("delete save file failed..."); //$NON-NLS-1$
}
+ updateDetails();
+ updateOKButtonStatus();
+ updateDetailViewHScroll(0);
}
}
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);
}
+
}
};
private String strTableSeleteClassName = null;
private LogListQueue logListQueue = null;
- public static UIDataManager getInstance() {
+ public synchronized static UIDataManager getInstance() {
if (null == instance) {
instance = new UIDataManager();
}
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()) {
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"
__copy_build_sources
__copy_dependency_plugins
__set_product_version
+ __set_product_about_info
__make_ant_build_properties_file
__execute_pde_build
__unzip_plugin_pack