}
DeviceInfo device = GlobalInformation.getCurrentDeviceInfo();
- if (null != device
- && device.getIDevice().getSerialNumber()
- .startsWith(CommonConstants.EMULATOR)) {
+ if (device == null) {
+ return HostResult.ERR_DEVICE_IS_NULL;
+ }
+
+ if (device.getIDevice().getSerialNumber()
+ .startsWith(CommonConstants.EMULATOR)) {
isEmul = 1;
}
- if (null == GlobalInformation.getCurrentApplication()) {
+ AppInfo app = GlobalInformation.getCurrentApplication();
+ if (null == app) {
return HostResult.ERR_SELECTED_APP_IS_NULL;
}
- String rearMessage = CommonConstants.EMPTY
- + res
- + isEmul
- + isArm
+ String rearMessage = CommonConstants.EMPTY + res + isEmul + isArm
+ CommonConstants.CMD_SPLIT
+ ConfigureManager.getInstance().getConfiguration(device)
+ CommonConstants.CMD_SPLIT
- + GlobalInformation.getCurrentApplication().getInfo(
- AppInfo.PROPERTY.EXEC.index);
+ + app.getInfo(AppInfo.PROPERTY.EXEC.index);
String message = AnalyzerConstants.MSG_START
+ CommonConstants.CMD_SPLIT + rearMessage.length()
import org.tizen.dynamicanalyzer.common.path.PathManager;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.model.DeviceInfo;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.IShellOutputReceiver;
Logger.debug("file open failed...");
return null;
}
+
+ FileInputStream fis = null;
+ InputStreamReader isr = null;
+ BufferedReader reader = null;
try {
- FileInputStream fis = new FileInputStream(file);
- InputStreamReader isr = new InputStreamReader(fis);
- BufferedReader reader = new BufferedReader(isr);
+ fis = new FileInputStream(file);
+ isr = new InputStreamReader(fis);
+ reader = new BufferedReader(isr);
String input = null;
while (null != (input = reader.readLine())) {
return null;
} catch (ArrayIndexOutOfBoundsException e) {
e.printStackTrace();
+ } finally {
+ CommonUtil.tryClose(reader, isr, fis);
}
return apiMap;
}
// return null;
// }
- public static boolean isWaitControlMessage() {
+ public static boolean isWaitToReceive() {
return GlobalInformation.getCurrentDeviceInfo().getCommunicator().isBlocked();
}
private void addBufferToList() {
lock.lock();
- if (null == buffer || 0 == buffer.size()) {
+ try {
+ if (null != buffer && 0 != buffer.size()) {
+ LogParser.getLogQueue().putLog(buffer);
+ buffer = new ArrayList<String>();
+ }
+ } finally {
lock.unlock();
- return;
}
- LogParser.getLogQueue().putLog(buffer);
- buffer = new ArrayList<String>();
- lock.unlock();
}
public void processMessage(String message) {
}
private void processAppInfo(String message) {
-// String[] data = message.split(AnalyzerConstants.DATA_PARSING_TOKEN);
-//
-// Project project = AnalyzerManager.getProject();
-// TargetInfo tInfo = project.getTargetInfo();
-// ProcessInfo pInfo = project.getProcessInfo();
-//
-// tInfo.setSystemMemorySize(Integer
-// .parseInt(data[AnalyzerConstants.APP_INFO_SYSTEM_MEMORY_SIZE]));
-// tInfo.setStorageSize(Integer
-// .parseInt(data[AnalyzerConstants.APP_INFO_STORAGE_SIZE]));
-// tInfo.setBluetoothSupport(Integer
-// .parseInt(data[AnalyzerConstants.APP_INFO_BLUETOOTH_SUPPORT]));
-// tInfo.setGpsSupport(Integer
-// .parseInt(data[AnalyzerConstants.APP_INFO_GPS_SUPPORT]));
-// tInfo.setWifiSupport(Integer
-// .parseInt(data[AnalyzerConstants.APP_INFO_WIFI_SUPPORT]));
-// tInfo.setCameraCount(Integer
-// .parseInt(data[AnalyzerConstants.APP_INFO_CAMERA_COUNT]));
-// tInfo.setNetworkType(data[AnalyzerConstants.APP_INFO_NETWORK_TYPE]);
-// tInfo.setMaxBrightness(Integer
-// .parseInt(data[AnalyzerConstants.APP_INFO_MAX_BRIGHTNESS]));
-//
-// pInfo.setPid(Integer.parseInt(data[AnalyzerConstants.APP_INFO_PID]));
-// // pInfo.setTime(Integer
-// // .parseInt(data[AnalyzerConstants.APP_INFO_START_TIME]) * 100);
-// pInfo.setBinaryType(Integer
-// .parseInt(data[AnalyzerConstants.APP_INFO_PIE_BUILD]));
-// pInfo.setLowestAddress(Long
-// .parseLong(data[AnalyzerConstants.APP_INFO_BASE_ADDRESS]));
-// pInfo.setAppType(Integer
-// .parseInt(data[AnalyzerConstants.APP_INFO_APP_TYPE]));
-// pInfo.setBinaryPath(data[AnalyzerConstants.APP_INFO_BINARY_PATH]);
-//
-// if (null == pInfo.getBinaryPath() || pInfo.getBinaryPath().isEmpty()) {
-// ToolbarArea.getInstance().setSourceViewEnable(false);
-// ToolbarArea.getInstance().setSourceViewTooltip(
-// AnalyzerLabels.MESSAGE_PROCESS_PG_WARNING);
-// } else {
-// ToolbarArea.getInstance().setSourceViewEnable(true);
-// ToolbarArea.getInstance().setSourceViewTooltip(
-// AnalyzerLabels.MESSAGE_PROCESS_VIEW_SOURCE);
-// }
-//
-// // User Call Trace : App is Tizen C++ or Tizen native
-// if (pInfo.getAppType() == AnalyzerConstants.APP_TYPE_OSP) {
-// LogParser.setDropCallTraceLog(true);
-// }
+ // String[] data = message.split(AnalyzerConstants.DATA_PARSING_TOKEN);
+ //
+ // Project project = AnalyzerManager.getProject();
+ // TargetInfo tInfo = project.getTargetInfo();
+ // ProcessInfo pInfo = project.getProcessInfo();
+ //
+ // tInfo.setSystemMemorySize(Integer
+ // .parseInt(data[AnalyzerConstants.APP_INFO_SYSTEM_MEMORY_SIZE]));
+ // tInfo.setStorageSize(Integer
+ // .parseInt(data[AnalyzerConstants.APP_INFO_STORAGE_SIZE]));
+ // tInfo.setBluetoothSupport(Integer
+ // .parseInt(data[AnalyzerConstants.APP_INFO_BLUETOOTH_SUPPORT]));
+ // tInfo.setGpsSupport(Integer
+ // .parseInt(data[AnalyzerConstants.APP_INFO_GPS_SUPPORT]));
+ // tInfo.setWifiSupport(Integer
+ // .parseInt(data[AnalyzerConstants.APP_INFO_WIFI_SUPPORT]));
+ // tInfo.setCameraCount(Integer
+ // .parseInt(data[AnalyzerConstants.APP_INFO_CAMERA_COUNT]));
+ // tInfo.setNetworkType(data[AnalyzerConstants.APP_INFO_NETWORK_TYPE]);
+ // tInfo.setMaxBrightness(Integer
+ // .parseInt(data[AnalyzerConstants.APP_INFO_MAX_BRIGHTNESS]));
+ //
+ // pInfo.setPid(Integer.parseInt(data[AnalyzerConstants.APP_INFO_PID]));
+ // // pInfo.setTime(Integer
+ // // .parseInt(data[AnalyzerConstants.APP_INFO_START_TIME]) * 100);
+ // pInfo.setBinaryType(Integer
+ // .parseInt(data[AnalyzerConstants.APP_INFO_PIE_BUILD]));
+ // pInfo.setLowestAddress(Long
+ // .parseLong(data[AnalyzerConstants.APP_INFO_BASE_ADDRESS]));
+ // pInfo.setAppType(Integer
+ // .parseInt(data[AnalyzerConstants.APP_INFO_APP_TYPE]));
+ // pInfo.setBinaryPath(data[AnalyzerConstants.APP_INFO_BINARY_PATH]);
+ //
+ // if (null == pInfo.getBinaryPath() || pInfo.getBinaryPath().isEmpty())
+ // {
+ // ToolbarArea.getInstance().setSourceViewEnable(false);
+ // ToolbarArea.getInstance().setSourceViewTooltip(
+ // AnalyzerLabels.MESSAGE_PROCESS_PG_WARNING);
+ // } else {
+ // ToolbarArea.getInstance().setSourceViewEnable(true);
+ // ToolbarArea.getInstance().setSourceViewTooltip(
+ // AnalyzerLabels.MESSAGE_PROCESS_VIEW_SOURCE);
+ // }
+ //
+ // // User Call Trace : App is Tizen C++ or Tizen native
+ // if (pInfo.getAppType() == AnalyzerConstants.APP_TYPE_OSP) {
+ // LogParser.setDropCallTraceLog(true);
+ // }
}
// private String getImageName(String fullPath) {
// return name;
// }
-
// private void processImage(final String from) {
// final String fileName = getImageName(from);
// final String to = AnalyzerManager.getProject().getSavePath()
Logger.debug("Ending steps!");
message = null;
DACommunicator.setRunning(false);
-// AnalyzerUtil.setRecordState(RecordStateSourceProvider.RECORD_READY);
+ // AnalyzerUtil.setRecordState(RecordStateSourceProvider.RECORD_READY);
AnalyzerManager.setRunningState(false);
Display.getDefault().syncExec(new Runnable() {
@Override
public class Communicator30 extends BaseCommunicator {
static final boolean PRINT_CONTROL_LOG_TOFILE = true;
+
+ private static final int CONTROL_HEADER_SIZE = 8;
+
private PrintWriter printWriter = null;
@Override
replayData = ByteUtil.getByte(ReplayTraceHandler.REPLAY_OFF);
}
- byte[] rear = ByteUtil.getByte(userSpaceInst.toByteStream(), replayData);
+ byte[] rear = ByteUtil
+ .getByte(userSpaceInst.toByteStream(), replayData);
int length = rear.length;
- byte[] ret = ByteUtil.getByte(AnalyzerConstants.MSG_START_SWAP, length, rear);
+ byte[] ret = ByteUtil.getByte(AnalyzerConstants.MSG_START_SWAP, length,
+ rear);
Logger.debug("print start message");
// ByteUtils.printByteArrayForStart(ret);
if (PRINT_CONTROL_LOG_TOFILE) {
- File logPath = new File(PathManager.DA_DEBUG_CONTROL_CHANNEL_LOG_FILE);
+ File logPath = new File(
+ PathManager.DA_DEBUG_CONTROL_CHANNEL_LOG_FILE);
if (logPath.exists()) {
logPath.delete();
}
try {
- printWriter = new PrintWriter(
- new BufferedWriter(new FileWriter(logPath)), true);
+ printWriter = new PrintWriter(new BufferedWriter(
+ new FileWriter(logPath)), true);
} catch (IOException e) {
e.printStackTrace();
}
if (result.isSuccess()) {
if (!isCorrectAck(MSG_START_ACK, result)) {
HostResult failResult = HostResult.ERR_MSG_START_FAIL;
- failResult.setMessage(ErrorCode.getError(getReturnId(result.getRet()))
- .toString());
+ failResult.setMessage(ErrorCode.getError(
+ getReturnId(result.getRet())).toString());
DACommunicator.setRunning(false);
dataThread = null;
return failResult;
index += INT_SIZE;
int nano = ByteUtil.toInt(data, index);
- AnalyzerManager.getProject().setProfilingStartTime(new DATime(sec, nano));
+ AnalyzerManager.getProject().setProfilingStartTime(
+ new DATime(sec, nano));
}
} else {
DACommunicator.setRunning(false);
ToolbarArea.getInstance().startTimer();
Logger.performance("TEST", "Start Trace", "Start Timer");
SWAPLogParser.startLogParser();
- Logger.performance("TEST", "Start Trace", "Start SWAP log parser thread");
+ Logger.performance("TEST", "Start Trace",
+ "Start SWAP log parser thread");
// start registered data manager thread
DataManagerRegistry.startThreads();
Logger.performance("TEST", "Start Trace", "Start DataManager threads");
if (pkgInfo.getPackageId().equals(AnalyzerConstants.RUNNING_PROCESS)) {
// if running process is selected for tracing
- Map<Integer, String> selectedProcess = apps.get(0).getRunningProcesses();
+ Map<Integer, String> selectedProcess = apps.get(0)
+ .getRunningProcesses();
if (selectedProcess != null && selectedProcess.size() > 0) {
- for (Map.Entry<Integer, String> entry : selectedProcess.entrySet()) {
+ for (Map.Entry<Integer, String> entry : selectedProcess
+ .entrySet()) {
BinaryInfo binInfo = AnalyzerManager.getProject()
- .getDeviceStatusInfo().getBinaryInfo(entry.getValue());
+ .getDeviceStatusInfo()
+ .getBinaryInfo(entry.getValue());
String temppath = binInfo.getTempBinaryPath();
if (temppath == null) {
// this means the app binary does not exist in device
output.getAppInstList().add(appInst);
}
}
- } else if (pkgInfo.getPackageId().equals(AnalyzerConstants.WITHOUT_EXECUTABLE)) {
+ } else if (pkgInfo.getPackageId().equals(
+ AnalyzerConstants.WITHOUT_EXECUTABLE)) {
// TODO : if no executable is selected for tracing (system wide
// tracing)
return null;
continue;
}
- BinaryInfo binInfo = AnalyzerManager.getProject().getDeviceStatusInfo()
- .getBinaryInfo(app.getExecPath());
+ BinaryInfo binInfo = AnalyzerManager.getProject()
+ .getDeviceStatusInfo().getBinaryInfo(app.getExecPath());
String temppath = binInfo.getTempBinaryPath();
if (temppath == null) {
// this means the app binary does not exist in device
appInst.setExecutablePath(app.getExecPath());
Logger.debug("Set execute path : " + app.getExecPath());
- List<FunctionInst> functionInstList = getFunctionInstList(app, temppath);
+ List<FunctionInst> functionInstList = getFunctionInstList(app,
+ temppath);
appInst.getFunctionInstList().addAll(functionInstList);
appInst.setFunctionCount(functionInstList.size());
output.getAppInstList().add(appInst);
paths.add(entry.getValue());
preMsg = ByteUtil.getByte(preMsg, entry.getValue());
}
- } else if (AnalyzerConstants.WITHOUT_EXECUTABLE.equals(selectedApp.getAppId())) {
+ } else if (AnalyzerConstants.WITHOUT_EXECUTABLE.equals(selectedApp
+ .getAppId())) {
// do not send message for system wide trace
return HostResult.SUCCESS;
} else {
private HostResult pullTheFile(String from, String to) {
try {
- GlobalInformation.getCurrentDeviceInfo().getIDevice().becomeSuperUser(true);
+ GlobalInformation.getCurrentDeviceInfo().getIDevice()
+ .becomeSuperUser(true);
} catch (TimeoutException e) {
e.printStackTrace();
} catch (SdbCommandRejectedException e) {
// send config message
byte[] config = ByteUtil.toBytes(AnalyzerConstants.MSG_CONFIG);
RunTimeConfiguration rt = new RunTimeConfiguration();
- rt.setFeatures(ConfigureManager.getInstance().getConfiguration(devInfo),
+ rt.setFeatures(
+ ConfigureManager.getInstance().getConfiguration(devInfo),
ConfigureManager.getInstance().getPreConfiguration(devInfo));
- rt.setSystemTracePeriod(ConfigureManager.getInstance().getSystemPeriod());
+ rt.setSystemTracePeriod(ConfigureManager.getInstance()
+ .getSystemPeriod());
rt.setSamplingPeriod(ConfigureManager.getInstance().getSamplingPeriod());
byte[] rtByte = rt.toByteStream();
int length = rtByte.length;
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+ final Shell shell = WorkbenchUtil.getWorkbenchWindow()
+ .getShell();
DADialog dialog = new DADialog(shell, SWT.NONE, 550, 153);
dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
dialog.setMessage("Configuration failed..");
printWriter.printf("\n");
}
controlSock.getOutputStream().write(message);
- }
-
- int msgId = ByteUtil.toInt(message);
- Logger.debug("wait for ack... [send message : " + msgId + " ]");
-
- int readsize = -1;
- // read buffer size is sufficient??
- byte[] cbuf = new byte[DACommunicator.READ_BUFFER_SIZE * 2];
- blocked = true;
- Logger.debug("blocked");
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- do {
- readsize = controlSock.getInputStream().read(cbuf);
- baos.write(cbuf, 0, readsize);
- } while (readsize == DACommunicator.READ_BUFFER_SIZE * 2);
- blocked = false;
-
- readsize = baos.size();
- cbuf = baos.toByteArray();
- if (PRINT_CONTROL_LOG_TOFILE && printWriter != null) {
- printWriter.printf("recv :");
- for (int k = 0; k < readsize; k++)
- printWriter.printf("%02x ", cbuf[k]);
- printWriter.printf("\n");
- }
+ Logger.debug("wait for ack... [send message : "
+ + ByteUtil.toInt(message) + " ]");
+
+ int readsize = -1;
+ byte[] cbuf = new byte[DACommunicator.READ_BUFFER_SIZE];
+
+ Logger.debug("blocked");
+ blocked = true;
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ readsize = controlSock.getInputStream().read(cbuf, 0, CONTROL_HEADER_SIZE);
+ if (readsize == CONTROL_HEADER_SIZE) {
+ baos.write(cbuf, 0, readsize);
+ int payloadsize = ByteUtil.toInt(cbuf, INT_SIZE);
+
+ do {
+ readsize = controlSock.getInputStream().read(cbuf);
+ baos.write(cbuf, 0, readsize);
+
+ payloadsize -= readsize;
+ } while (payloadsize > 0);
+ blocked = false;
+
+ readsize = baos.size();
+ cbuf = baos.toByteArray();
+ if (PRINT_CONTROL_LOG_TOFILE && printWriter != null) {
+ printWriter.printf("recv :");
+ for (int k = 0; k < readsize; k++)
+ printWriter.printf("%02x ", cbuf[k]);
+ printWriter.printf("\n");
+ }
+ Logger.debug("unblocked");
- Logger.debug("unblocked");
- if (readsize > 0) {
- byte[] buf = new byte[readsize];
- System.arraycopy(cbuf, 0, buf, 0, readsize);
- result = HostResult.SUCCESS;
- int ackId = ByteUtil.toInt(buf);
+ if (readsize > 0) {
+ byte[] buf = new byte[readsize];
+ System.arraycopy(cbuf, 0, buf, 0, readsize);
+ result = HostResult.SUCCESS;
+ int ackId = ByteUtil.toInt(buf);
- // for debug
- System.out.print("ack id : ");
- AnalyzerUtil.printHexdecimal(ackId);
- Logger.debug();
+ // for debug
+ System.out.print("ack id : ");
+ AnalyzerUtil.printHexdecimal(ackId);
+ Logger.debug();
- result.setRet(buf);
- } else {
- result = HostResult.ERR_CONTROL_SOCKET_CONNECTION_CLOSED;
- result.setMessage(result.getMessage());
+ result.setRet(buf);
+ } else {
+ result = HostResult.ERR_CONTROL_SOCKET_CONNECTION_CLOSED;
+ result.setMessage(result.getMessage());
+ }
+ } else {
+ blocked = false;
+ result = HostResult.ERR_EXCEPTION_OCCURRED;
+ result.setMessage("Failed to read Ack Header");
+ }
}
} catch (SocketException e) {
result = HostResult.ERR_EXCEPTION_OCCURRED;
index += INT_SIZE;
if (ackType == msgId) {
- if (paylen != INT_SIZE || retId == ErrorCode.SUCCESS.getErrorNumber()) {
+ if (paylen != INT_SIZE
+ || retId == ErrorCode.SUCCESS.getErrorNumber()) {
return true;
}
}
return GlobalInformation.getCurrentDeviceInfo().getDataSock();
}
- private void processTargetInfo(byte[] payload, int index, DeviceStatusInfo tInfo) {
+ private void processTargetInfo(byte[] payload, int index,
+ DeviceStatusInfo tInfo) {
long systemMemorySize = 0;
long storageSize = 0;
int bluetoothSupport = 0;
public HostResult sendScreenShotRequest() {
byte[] msg = ByteUtil.getByte(AnalyzerConstants.MSG_GET_SCREENSHOT, 0);
HostResult result = HostResult.SUCCESS;
- Socket controlSock = GlobalInformation.getCurrentDeviceInfo().getControlSock();
+ Socket controlSock = GlobalInformation.getCurrentDeviceInfo()
+ .getControlSock();
try {
if (null != controlSock && !controlSock.isClosed()) {
return result;
}
- public HostResult sendSWAPMessage(int messageId, List<BinarySettingData> settings) {
- HashMap<String, BinaryInfo> targetBinInfoMap = BinarySettingManager.getInstance()
- .getTargetBinInfoMap();
+ public HostResult sendSWAPMessage(int messageId,
+ List<BinarySettingData> settings) {
+ HashMap<String, BinaryInfo> targetBinInfoMap = BinarySettingManager
+ .getInstance().getTargetBinInfoMap();
byte[] msg = new byte[0];
int count = settings.size();
int failedCount = 0;
}
int length = sendbin.length;
- byte[] msg = ByteUtil.getByte(AnalyzerConstants.MSG_GET_PROCESS_ADD_INFO,
- length, sendbin);
+ byte[] msg = ByteUtil
+ .getByte(AnalyzerConstants.MSG_GET_PROCESS_ADD_INFO,
+ length, sendbin);
HostResult result = handleControlMessage(
GlobalInformation.getCurrentDeviceInfo(), msg);
if (result.isSuccess()
- && isCorrectAck(AnalyzerConstants.MSG_GET_PROCESS_ADD_INFO_ACK,
+ && isCorrectAck(
+ AnalyzerConstants.MSG_GET_PROCESS_ADD_INFO_ACK,
result)) {
// parse binary info
byte[] payload = getMessagePayload(result.getRet());
if (count > 0) {
infoMap = new HashMap<Integer, String>();
-
+
for (int i = 0; i < count; i++) {
int pid = ByteUtil.toInt(payload, index);
index += INT_SIZE;
String cmdname = ByteUtil.getString(payload, index);
index += ByteUtil.getStringLength(payload, index);
-
+
infoMap.put(Integer.valueOf(pid), cmdname);
}
}
return infoMap;
}
- public HostResult sendBinaryInfoMessageForLib(List<BinarySettingData> binaryData) {
+ public HostResult sendBinaryInfoMessageForLib(
+ List<BinarySettingData> binaryData) {
List<String> binPaths = new ArrayList<String>();
for (BinarySettingData data : binaryData) {
}
int length = sendBin.length;
- byte[] msg = ByteUtil.getByte(AnalyzerConstants.MSG_BINARY_INFO, length, sendBin);
+ byte[] msg = ByteUtil.getByte(AnalyzerConstants.MSG_BINARY_INFO,
+ length, sendBin);
HostResult result = handleControlMessage(
GlobalInformation.getCurrentDeviceInfo(), msg);
for (int i = 0; i < count; i++) {
String targetPath = targetPaths.get(i);
- BinaryInfo binInfo = curDevice.getDeviceStatusInfo()
- .getBinaryInfo(targetPath);
+ BinaryInfo binInfo = curDevice.getDeviceStatusInfo().getBinaryInfo(
+ targetPath);
int binaryType = ByteUtil.toInt(payload, index);
index += INT_SIZE;
return md5value;
}
-}
\ No newline at end of file
+}
import org.tizen.dynamicanalyzer.ui.toolbar.StopProcessManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.util.ByteUtil;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public void startTimer() {
timer = new Timer();
- timer.scheduleAtFixedRate(new AddBufferTimerTask(), MSG_BUFFER_TIMER_DELAY,
- MSG_BUFFER_TIMER_PERIOD);
+ timer.scheduleAtFixedRate(new AddBufferTimerTask(),
+ MSG_BUFFER_TIMER_DELAY, MSG_BUFFER_TIMER_PERIOD);
}
public void stopTimer() {
private void addBufferToList() {
lock.lock();
- if (null == buffer || 0 == buffer.size()) {
- lock.unlock();
- return;
- }
try {
- SWAPLogParser.getLogQueue().putLog(buffer);
+ if (null != buffer && 0 != buffer.size()) {
+ SWAPLogParser.getLogQueue().putLog(buffer);
+ }
} catch (UnsupportedOperationException e) {
e.printStackTrace();
} catch (ClassCastException e) {
index += LONG_SIZE;
String libPath = ByteUtil.getString(data, index);
- LibraryObject libObj = new LibraryObject(project.getDeviceStatusInfo()
- .getBinaryInfo(libPath).getID(), lowestAddr, highestAddr);
+ LibraryObject libObj = new LibraryObject(project
+ .getDeviceStatusInfo().getBinaryInfo(libPath).getID(),
+ lowestAddr, highestAddr);
index += ByteUtil.getStringLength(data, index);
pMap.addLibraryMap(libObj);
}
- Logger.debug("process info start time : " + capturedTime.getSec() + " "
- + capturedTime.getNano());
+ Logger.debug("process info start time : " + capturedTime.getSec()
+ + " " + capturedTime.getNano());
pMap.setMainBinary(new LibraryObject(project.getDeviceStatusInfo()
.getBinaryInfo(targetBinaryPath).getID(), lowAddr, highAddr));
AnalyzerManager.setProcessInfoArrived(true);
- ThreadChartManager.getInstance().getThreadDataManager().createMainThreadItem(pid);
+ ThreadChartManager.getInstance().getThreadDataManager()
+ .createMainThreadItem(pid);
}
private void memoryMapChanged(byte[] data) {
String libPath = LogDataUtils.getString(index, data);
index += LogDataUtils.getStringLength(index, data);
- BinaryInfo bininfo = project.getDeviceStatusInfo().getBinaryInfo(libPath);
- LibraryObject libObj = new LibraryObject(bininfo.getID(), lowAddr, highAddr);
+ BinaryInfo bininfo = project.getDeviceStatusInfo().getBinaryInfo(
+ libPath);
+ LibraryObject libObj = new LibraryObject(bininfo.getID(), lowAddr,
+ highAddr);
newMap.addLibraryMap(libObj);
} else {
newMap.removeLibrary(lowAddr, highAddr);
InputStream inputStream = null;
PrintWriter printWriter = null;
- try {
- inputStream = dataSocket.getInputStream();
- } catch (IOException e1) {
- e1.printStackTrace();
- }
-
if (PRINT_DATA_LOG_TOFILE) {
File logPath = new File(PathManager.DA_DEBUG_DATA_CHANNEL_LOG_FILE);
if (logPath.exists()) {
}
try {
- printWriter = new PrintWriter(
- new BufferedWriter(new FileWriter(logPath)), true);
+ printWriter = new PrintWriter(new BufferedWriter(
+ new FileWriter(logPath)), true);
} catch (IOException e) {
e.printStackTrace();
}
try {
byte[] header = new byte[MSG_HEADER_SIZE];
+ inputStream = dataSocket.getInputStream();
+
while (true) {
int readSize = 0;
int toRead = MSG_HEADER_SIZE;
while (toRead > 0) {
- readSize = inputStream.read(header, MSG_HEADER_SIZE - toRead, toRead);
+ readSize = inputStream.read(header, MSG_HEADER_SIZE
+ - toRead, toRead);
toRead -= readSize;
if (!DACommunicator.isRunning() && readSize == -1) {
// manager socket closed!!
// AnalyzerUtil.printHexdecimal(id);
// System.out.println();
- int payloadSize = ByteUtil.toInt(header, MSG_PAYLOAD_SIZE_INDEX);
+ int payloadSize = ByteUtil
+ .toInt(header, MSG_PAYLOAD_SIZE_INDEX);
byte[] payload = null;
try {
toRead = payloadSize;
while (toRead > 0) {
- readSize = inputStream.read(payload, payloadSize - toRead, toRead);
+ readSize = inputStream.read(payload, payloadSize - toRead,
+ toRead);
toRead -= readSize;
if (!DACommunicator.isRunning() && readSize == -1) {
// manager socket closed!!
byte[] buffer = new byte[MSG_HEADER_SIZE + payloadSize];
System.arraycopy(header, 0, buffer, 0, MSG_HEADER_SIZE);
- System.arraycopy(payload, 0, buffer, MSG_HEADER_SIZE, payloadSize);
+ System.arraycopy(payload, 0, buffer, MSG_HEADER_SIZE,
+ payloadSize);
if (PRINT_DATA_LOG_TOFILE && printWriter != null) {
- printWriter.printf("%d %d %d %d %d :", id, ByteUtil.toInt(header, 4),
- ByteUtil.toInt(header, 8), ByteUtil.toInt(header, 12),
- payloadSize);
+ printWriter.printf("%d %d %d %d %d :", id,
+ ByteUtil.toInt(header, 4),
+ ByteUtil.toInt(header, 8),
+ ByteUtil.toInt(header, 12), payloadSize);
for (int k = 0; k < payloadSize; k++)
printWriter.printf("%02x ", payload[k]);
printWriter.printf("\n");
processMessage(buffer);
if (id == DataChannelConstants.MSG_DATA_TERMINATE) {
Logger.debug("message data terminate arrived!!!");
- Logger.performance("TEST", "While tracing", "Terminate Application");
+ Logger.performance("TEST", "While tracing",
+ "Terminate Application");
if (AnalyzerManager.getProcessCount() == 0) {
break;
}
}
} // end while()
+
Logger.debug("Receive thread end!!");
Logger.performance("TEST", "DA end", "End receive thread");
if (!StartProcessManager.getInstance().isCancelled()) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- StopProcessManager.getInstance().stopProcessStart(
- AnalyzerLabels.STOP_PROCESS_DLG_SUMMARIZING_DATA); // socket
+ StopProcessManager
+ .getInstance()
+ .stopProcessStart(
+ AnalyzerLabels.STOP_PROCESS_DLG_SUMMARIZING_DATA); // socket
// timeout
}
});
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- StopProcessManager.getInstance().stopProcessStart(
- AnalyzerLabels.STOP_PROCESS_DLG_DEVICE_DISCONNECTED); // socket
+ StopProcessManager
+ .getInstance()
+ .stopProcessStart(
+ AnalyzerLabels.STOP_PROCESS_DLG_DEVICE_DISCONNECTED); // socket
// timeout
}
});
endingSteps();
+ } finally {
+ if (printWriter != null) {
+ CommonUtil.tryClose(printWriter);
+ }
}
}
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
- ToolbarArea.getInstance()
- .setToolbarState(ToolbarArea.TOOLBAR_STATE_READY);
+ ToolbarArea.getInstance().setToolbarState(
+ ToolbarArea.TOOLBAR_STATE_READY);
}
});
stopTimer();
case DataChannelConstants.MSG_DATA_SYSTEM:
Runtime runtime = Runtime.getRuntime();
- if ((runtime.totalMemory() - runtime.freeMemory()) >= runtime.maxMemory() * 0.8) {
+ if ((runtime.totalMemory() - runtime.freeMemory()) >= runtime
+ .maxMemory() * 0.8) {
ToolbarArea.getInstance().stopTrace();
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
- DADialog dialog = new DADialog(shell, SWT.NONE, 550, 153);
+ final Shell shell = WorkbenchUtil.getWorkbenchWindow()
+ .getShell();
+ DADialog dialog = new DADialog(shell, SWT.NONE, 550,
+ 153);
dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
dialog.setMessage(AnalyzerLabels.HEAP_MEMORY_WARNING_PRE
+ PathManager.DA_INSTALL_PATH
}
break;
default: // MSG_PROBE
- if (AnalyzerManager.isProcessInfoArrived() && id > 0x0100 && id < 0x0200) {
+ if (AnalyzerManager.isProcessInfoArrived() && id > 0x0100
+ && id < 0x0200) {
log = LogDataFactory.createInstance(data);
if (null != log) {
buffer.add(log);
@Override
public void handleClickEvent(DACustomButton button) {
- String path = inputText.getText();
- if (null == path || path.isEmpty()) {
- Logger.debug("path must not empty");
- // inputText.setBackground(ColorResources.RED);
- // info.setText("Empty path");
- inputText.setText(current.getFullPath());
- return;
- }
-
- if (!path.contains(root.getFullPath())) {
- Logger.debug("Out of root range");
- // inputText.setBackground(ColorResources.RED);
- // info.setText("Out of root range");
- inputText.setText(current.getFullPath());
- return;
- }
-
- int ret = setCurrent(path);
- if (ret != FAIL) {
- inputText.setBackground(ColorResources.WHITE);
- } else {
- // inputText.setBackground(ColorResources.RED);
- // info.setText("Invalid path");
- inputText.setText(current.getFullPath());
- }
+ adjustInput();
}
};
@Override
public void keyReleased(KeyEvent e) {
if (e.keyCode == 13) {
- goButtonClickListener.handleClickEvent(null);
+ adjustInput();
inputText.getControl().setSelection(
inputText.getText().length());
- }
- else
- {
-
+ } else {
+
}
}
this.device = dev;
}
- public int setCurrent(String path) {
+ private int setCurrent(String path) {
int result = FAIL;
if (null != path && !path.isEmpty()) {
FileEntry file = device.getFileEntry(path);
return result;
}
+ private void adjustInput() {
+ String path = inputText.getText();
+ if (null == path || path.isEmpty()) {
+ Logger.debug("path must not empty");
+ // inputText.setBackground(ColorResources.RED);
+ // info.setText("Empty path");
+ inputText.setText(current.getFullPath());
+ return;
+ }
+
+ if (!path.contains(root.getFullPath())) {
+ Logger.debug("Out of root range");
+ // inputText.setBackground(ColorResources.RED);
+ // info.setText("Out of root range");
+ inputText.setText(current.getFullPath());
+ return;
+ }
+
+ int ret = setCurrent(path);
+ if (ret != FAIL) {
+ inputText.setBackground(ColorResources.WHITE);
+ } else {
+ // inputText.setBackground(ColorResources.RED);
+ // info.setText("Invalid path");
+ inputText.setText(current.getFullPath());
+ }
+ }
+
public void setFilterString(String filter) {
this.filter = filter;
}
@Override
public void handleClickEvent(DACustomButton button) {
- String path = inputText.getText();
- if (null == path || path.isEmpty()) {
- Logger.debug("path must not empty");
- // inputText.setBackground(ColorResources.RED);
- // info.setText("Empty path");
- inputText.setText(current.getAbsolutePath());
- return;
- }
-// TODO: Are users allowed to select files outside user home directory?
-// if (!path.contains(root.getAbsolutePath())) {
-// Logger.debug("Out of root range");
- // inputText.setBackground(ColorResources.RED);
- // info.setText("Out of root range");
-// inputText.setText(current.getAbsolutePath());
-// return;
-// }
-
- int ret = setCurrent(path);
- if (ret != FAIL) {
- inputText.setBackground(ColorResources.WHITE);
- } else {
- // inputText.setBackground(ColorResources.RED);
- inputText.setText(current.getAbsolutePath());
- // info.setText("Invalid path");
- }
+ adjustInput();
}
};
@Override
public void keyReleased(KeyEvent e) {
if (e.keyCode == 13) {
- goButtonClickListener.handleClickEvent(null);
+ adjustInput();
inputText.getControl().setSelection(
inputText.getText().length());
}
return files;
}
- public int setCurrent(String path) {
+ private int setCurrent(String path) {
int result = FAIL;
if (null != path && !path.isEmpty()) {
File file = new File(path);
return result;
}
+ private void adjustInput() {
+ String path = inputText.getText();
+ if (null == path || path.isEmpty()) {
+ Logger.debug("path must not empty");
+ // inputText.setBackground(ColorResources.RED);
+ // info.setText("Empty path");
+ inputText.setText(current.getAbsolutePath());
+ return;
+ }
+
+ // TODO: Are users allowed to select files outside user home directory?
+// if (!path.contains(root.getAbsolutePath())) {
+// Logger.debug("Out of root range");
+ // inputText.setBackground(ColorResources.RED);
+ // info.setText("Out of root range");
+// inputText.setText(current.getAbsolutePath());
+// return;
+// }
+
+ int ret = setCurrent(path);
+ if (ret != FAIL) {
+ inputText.setBackground(ColorResources.WHITE);
+ } else {
+ // inputText.setBackground(ColorResources.RED);
+ inputText.setText(current.getAbsolutePath());
+ // info.setText("Invalid path");
+ }
+ }
+
public void setFilterString(String filter) {
this.filter = filter;
}
switch (top.getId()) {
case DataChannelConstants.MSG_CONTEXT_SWITCH_ENTRY:
- if (centryiter.hasNext())
+ if (centryiter != null && centryiter.hasNext())
pqueue.offer(centryiter.next());
break;
case DataChannelConstants.MSG_CONTEXT_SWITCH_EXIT:
- if (cexititer.hasNext())
+ if (cexititer != null && cexititer.hasNext())
pqueue.offer(cexititer.next());
break;
case DataChannelConstants.MSG_FUNCTION_ENTRY:
- if (fentryiter.hasNext())
+ if (fentryiter != null && fentryiter.hasNext())
pqueue.offer(fentryiter.next());
break;
case DataChannelConstants.MSG_FUNCTION_EXIT:
- if (fexititer.hasNext())
+ if (fexititer != null && fexititer.hasNext())
pqueue.offer(fexititer.next());
break;
default:
int percent = 0;
int exitCount = 0;
- while (DACommunicator.isWaitControlMessage() && exitCount < 1000) {
+ while (DACommunicator.isWaitToReceive() && exitCount < 1000) {
// System.out.println("wait for STOP ACK message...");
try {
Thread.sleep(10);
public static final int REPLAY_EDIT_BUTTON = 9;
public static final String ALL_PROCESS = "All Processes";
- public static final String PROCESS_SPLITER = CommonConstants.SPACE + CommonConstants.COLON
- + CommonConstants.SPACE;
+ public static final String PROCESS_SPLITER = CommonConstants.SPACE
+ + CommonConstants.COLON + CommonConstants.SPACE;
private static ToolbarArea coolbarArea;
String text = appCombo.getText();
if ((null != pDeviceName && !pDeviceName.isEmpty() && pDeviceName
.equals(sDeviceName))
- && (null != appName && !appName.isEmpty() && appName.equals(text))) {
+ && (null != appName && !appName.isEmpty() && appName
+ .equals(text))) {
replayButton.setButtonEnabled(true);
replayEditButton.setButtonEnabled(false);
// disable button until complete TV SDK
@Override
public void selectionEvent(DACustomCombo combo) {
String oldDeviceName = null;
- DeviceInfo oldDevInfo = GlobalInformation.getCurrentDeviceInfo();
+ DeviceInfo oldDevInfo = GlobalInformation
+ .getCurrentDeviceInfo();
if (oldDevInfo != null)
oldDeviceName = oldDevInfo.getIDevice().getSerialNumber();
String serial = combo.getText();
- if (!serial.equals(oldDeviceName)) {
+
+ if (serial != null && !serial.equals(oldDeviceName)) {
GlobalInformation.setCurrentDeviceInfo(DACommunicator
.setSelectedDeviceBySerial(serial));
if (null != serial && !serial.isEmpty()) {
if (null != idevices) {
for (int i = 0; i < idevices.length; i++) {
- int index = serials.indexOf(idevices[i].getSerialNumber());
+ int index = serials.indexOf(idevices[i]
+ .getSerialNumber());
if (index < 0) {
diffList.add(idevices[i]);
}
if (null != appName && !appName.isEmpty()) {
boolean enablestart = true;
- AppInfo selectedApp = DACommunicator.getPkgInfoByName(appName);
+ AppInfo selectedApp = DACommunicator
+ .getPkgInfoByName(appName);
if (null != selectedApp) {
if (appName.equals(AnalyzerConstants.RUNNING_PROCESS)) {
- Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
- ProcessExplorerDialog pdialog = new ProcessExplorerDialog(shell);
- pdialog.setProcessList(selectedApp.getRunningProcesses());
+ Shell shell = WorkbenchUtil.getWorkbenchWindow()
+ .getShell();
+ ProcessExplorerDialog pdialog = new ProcessExplorerDialog(
+ shell);
+ pdialog.setProcessList(selectedApp
+ .getRunningProcesses());
Object result = pdialog.open();
if (result != null) {
@SuppressWarnings("unchecked")
}
GlobalInformation.setCurrentApplication(selectedApp);
- GlobalInformation.getCurrentDeviceInfo().getCommunicator()
- .onAppSelected(selectedApp);
- GlobalInformation.getCurrentDeviceInfo().setSelectedAppName(
- selectedApp.getInfo(AppInfo.PROPERTY.LABEL.index));
+ GlobalInformation.getCurrentDeviceInfo()
+ .getCommunicator().onAppSelected(selectedApp);
+ GlobalInformation
+ .getCurrentDeviceInfo()
+ .setSelectedAppName(
+ selectedApp
+ .getInfo(AppInfo.PROPERTY.LABEL.index));
} else {
enablestart = false;
}
- if (enablestart && null != GlobalInformation.getCurrentDeviceInfo()) {
+ if (enablestart
+ && null != GlobalInformation.getCurrentDeviceInfo()) {
// AnalyzerUtil
// .setRecordState(RecordStateSourceProvider.RECORD_READY);
AnalyzerManager.setRunningState(false);
@Override
public void selectionEvent(DACustomCombo combo) {
- BaseView baseView = (BaseView) WorkbenchUtil.getViewPart(BaseView.ID);
+ BaseView baseView = (BaseView) WorkbenchUtil
+ .getViewPart(BaseView.ID);
baseView.getTopComposite().updateView();
}
});
int pcount = pids.length;
for (int i = 0; i < pcount; i++) {
- ProcessInformation process = project.getProcessInformation(pids[i]);
+ ProcessInformation process = project
+ .getProcessInformation(pids[i]);
String binName = process.getProcessName();
if (binName == null || binName.isEmpty()) {
- int bid = process.getLastProcessMemoryMap().getMainbinary().getBinaryID();
- String binPath = project.getDeviceStatusInfo().getBinaryInfo(bid)
- .getTargetBinaryPath();
+ int bid = process.getLastProcessMemoryMap()
+ .getMainbinary().getBinaryID();
+ String binPath = project.getDeviceStatusInfo()
+ .getBinaryInfo(bid).getTargetBinaryPath();
if (null != binPath && !binPath.isEmpty()) {
- int index = binPath.lastIndexOf(CommonConstants.SLASH);
- binName = binPath.substring(index + 1, binPath.length());
+ int index = binPath
+ .lastIndexOf(CommonConstants.SLASH);
+ binName = binPath.substring(index + 1,
+ binPath.length());
}
}
}
});
- saveTraceButton.addClickListener(new DACustomButtonClickEventListener() {
-
- @Override
- public void handleClickEvent(DACustomButton button) {
- Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
- SaveAsDialog dialog = new SaveAsDialog(shell);
- Object result = dialog.open();
- if (null != result) {
- button.setButtonEnabled(false);
- }
- }
- });
+ saveTraceButton
+ .addClickListener(new DACustomButtonClickEventListener() {
+
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ Shell shell = WorkbenchUtil.getWorkbenchWindow()
+ .getShell();
+ SaveAsDialog dialog = new SaveAsDialog(shell);
+ Object result = dialog.open();
+ if (null != result) {
+ button.setButtonEnabled(false);
+ }
+ }
+ });
- openTraceButton.addClickListener(new DACustomButtonClickEventListener() {
+ openTraceButton
+ .addClickListener(new DACustomButtonClickEventListener() {
- @Override
- public void handleClickEvent(DACustomButton button) {
- Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
- OpenTraceDialog dialog = new OpenTraceDialog(shell);
- dialog.open();
- }
- });
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ Shell shell = WorkbenchUtil.getWorkbenchWindow()
+ .getShell();
+ OpenTraceDialog dialog = new OpenTraceDialog(shell);
+ dialog.open();
+ }
+ });
replayButton.addClickListener(new DACustomButtonClickEventListener() {
}
});
- replayEditButton.addClickListener(new DACustomButtonClickEventListener() {
+ replayEditButton
+ .addClickListener(new DACustomButtonClickEventListener() {
- @Override
- public void handleClickEvent(DACustomButton button) {
- Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
- ReplayEditDialog dialog = new ReplayEditDialog(shell);
- dialog.open();
- }
- });
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ Shell shell = WorkbenchUtil.getWorkbenchWindow()
+ .getShell();
+ ReplayEditDialog dialog = new ReplayEditDialog(shell);
+ dialog.open();
+ }
+ });
configButton.addClickListener(new DACustomButtonClickEventListener() {
}
});
- screenshotButton.addClickListener(new DACustomButtonClickEventListener() {
+ screenshotButton
+ .addClickListener(new DACustomButtonClickEventListener() {
- @Override
- public void handleClickEvent(DACustomButton button) {
- DACommunicator.sendScreenShotMessage();
- }
- });
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ DACommunicator.sendScreenShotMessage();
+ }
+ });
aboutButton.addClickListener(new DACustomButtonClickEventListener() {
}
});
- viewSourceButton.addClickListener(new DACustomButtonClickEventListener() {
- @Override
- public void handleClickEvent(DACustomButton button) {
+ viewSourceButton
+ .addClickListener(new DACustomButtonClickEventListener() {
+ @Override
+ public void handleClickEvent(DACustomButton button) {
- // TODO : use for test code...
+ // TODO : use for test code...
- }
- });
+ }
+ });
}
public void setStartButtonToolTipText(final String text) {
setToolbarStartStopState(true);
- if (null == DACommunicator.getDevices() || DACommunicator.getDevices().isEmpty()) {
+ if (null == DACommunicator.getDevices()
+ || DACommunicator.getDevices().isEmpty()) {
deviceCombo.setEnabled(false);
}
- if (!deviceCombo.isEnabled() || null == GlobalInformation.getCurrentDeviceInfo()) {
+ if (!deviceCombo.isEnabled()
+ || null == GlobalInformation.getCurrentDeviceInfo()) {
appCombo.setEnabled(false);
}
- if (!appCombo.isEnabled() || null == GlobalInformation.getCurrentApplication()) {
+ if (!appCombo.isEnabled()
+ || null == GlobalInformation.getCurrentApplication()) {
setStartButtonEnablement(false);
}
@Override
public void run() {
- StartProcessManager.getInstance().startProcessStart("prepare for tracing");
+ StartProcessManager.getInstance().startProcessStart(
+ "prepare for tracing");
}
});
/** which contains start, TimerClock, save, open and replay buttons. */
// Creates start button.
- startButton = new DACustomButton(parent, ImageResources.START, ImageResources.START_PUSH,
- ImageResources.START_HOVER, ImageResources.START_DISABLE);
+ startButton = new DACustomButton(parent, ImageResources.START,
+ ImageResources.START_PUSH, ImageResources.START_HOVER,
+ ImageResources.START_DISABLE);
// startButton.setButtonEnabled(false);
setStartButtonState(false);
startButton.setToolTipText(ShortCutManager.START_TRACE);
timerClock.setClockFont(FontResources.TIMER);
// // Creates save trace button.
- saveTraceButton = new DACustomButton(parent, ImageResources.SAVE, ImageResources.SAVE_PUSH,
- ImageResources.SAVE_HOVER, ImageResources.SAVE_DISABLE);
+ saveTraceButton = new DACustomButton(parent, ImageResources.SAVE,
+ ImageResources.SAVE_PUSH, ImageResources.SAVE_HOVER,
+ ImageResources.SAVE_DISABLE);
saveTraceButton.setButtonEnabled(false);
saveTraceButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
saveTraceButton.setToolTipText(ShortCutManager.SAVE_TRACE);
buttons.put(SAVE_BUTTON, saveTraceButton);
// // Creates open trace button.
- openTraceButton = new DACustomButton(parent, ImageResources.OPEN, ImageResources.OPEN_PUSH,
- ImageResources.OPEN_HOVER, ImageResources.OPEN_DISABLE);
+ openTraceButton = new DACustomButton(parent, ImageResources.OPEN,
+ ImageResources.OPEN_PUSH, ImageResources.OPEN_HOVER,
+ ImageResources.OPEN_DISABLE);
openTraceButton.setToolTipText(ShortCutManager.OPEN_TRACE);
openTraceButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
buttons.put(OPEN_BUTTON, openTraceButton);
buttons.put(REPLAY_BUTTON, replayButton);
// Creates replayEdit button.
- replayEditButton = new DACustomButton(parent, ImageResources.REPLAY_EDIT,
- ImageResources.REPLAY_EDIT_PUSH, ImageResources.REPLAY_EDIT_HOVER,
+ replayEditButton = new DACustomButton(parent,
+ ImageResources.REPLAY_EDIT, ImageResources.REPLAY_EDIT_PUSH,
+ ImageResources.REPLAY_EDIT_HOVER,
ImageResources.REPLAY_EDIT_DISABLE);
replayEditButton.setToolTipText(ShortCutManager.REPLAY_EDIT);
replayEditButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
buttons.put(REPLAY_EDIT_BUTTON, replayEditButton);
// Creates config button
- configButton = new DACustomButton(parent, ImageResources.SETTINGS_NORMAL,
- ImageResources.SETTINGS_PUSH, ImageResources.SETTINGS_HOVER,
- ImageResources.SETTINGS_DISABLE);
+ configButton = new DACustomButton(parent,
+ ImageResources.SETTINGS_NORMAL, ImageResources.SETTINGS_PUSH,
+ ImageResources.SETTINGS_HOVER, ImageResources.SETTINGS_DISABLE);
configButton.setToolTipText(ShortCutManager.COOLBAR_AREA_SETTING);
configButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
buttons.put(CONFIG_BUTTON, configButton);
// Creates screenshot button
- screenshotButton = new DACustomButton(parent, ImageResources.SCREEN_SHOT_NORMAL,
- ImageResources.SCREEN_SHOT_PUSH, ImageResources.SCREEN_SHOT_HOVER,
+ screenshotButton = new DACustomButton(parent,
+ ImageResources.SCREEN_SHOT_NORMAL,
+ ImageResources.SCREEN_SHOT_PUSH,
+ ImageResources.SCREEN_SHOT_HOVER,
ImageResources.SCREEN_SHOT_DISABLE);
screenshotButton.setToolTipText("Capture screen");
screenshotButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
buttons.put(SCREENSHOT_BUTTON, screenshotButton);
// Creates about button.
- aboutButton = new DACustomButton(parent, ImageResources.ABOUT, ImageResources.ABOUT_PUSH,
- ImageResources.ABOUT_HOVER, ImageResources.ABOUT_DISABLE);
+ aboutButton = new DACustomButton(parent, ImageResources.ABOUT,
+ ImageResources.ABOUT_PUSH, ImageResources.ABOUT_HOVER,
+ ImageResources.ABOUT_DISABLE);
aboutButton.setToolTipText(ShortCutManager.COOLBAR_AREA_ABOUT);
aboutButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
buttons.put(ABOUT_BUTTON, aboutButton);
// Creates view source button.
- viewSourceButton = new DACustomToggleButton(parent, ImageResources.VIEW_SOURCE_NORMAL,
- ImageResources.VIEW_SOURCE_PUSH, ImageResources.VIEW_SOURCE_HOVER,
- ImageResources.VIEW_SOURCE_DISABLE, ImageResources.VIEW_SOURCE_TOGGLE,
- ImageResources.VIEW_SOURCE_TOGGLE_HOVER, ImageResources.VIEW_SOURCE_TOGGLE_PUSH);
- viewSourceButton.setToolTipText(ShortCutManager.COOLBAR_AREA_VIEW_SOURCE);
+ viewSourceButton = new DACustomToggleButton(parent,
+ ImageResources.VIEW_SOURCE_NORMAL,
+ ImageResources.VIEW_SOURCE_PUSH,
+ ImageResources.VIEW_SOURCE_HOVER,
+ ImageResources.VIEW_SOURCE_DISABLE,
+ ImageResources.VIEW_SOURCE_TOGGLE,
+ ImageResources.VIEW_SOURCE_TOGGLE_HOVER,
+ ImageResources.VIEW_SOURCE_TOGGLE_PUSH);
+ viewSourceButton
+ .setToolTipText(ShortCutManager.COOLBAR_AREA_VIEW_SOURCE);
viewSourceButton.setBackground(ColorResources.COOLBAR_BG_COLOR);
buttons.put(SOURCE_BUTTON, viewSourceButton);
private DACustomCombo makeDACustomCombo(Composite parent) {
DACustomCombo returnCombo = new DACustomCombo(parent, SWT.NONE);
- returnCombo.setComboGradation(ColorResources.TOOLBAR_COMBO_NORMAL_START,
- ColorResources.TOOLBAR_COMBO_NORMAL_END, ColorResources.TOOLBAR_COMBO_PUSH_START,
- ColorResources.TOOLBAR_COMBO_PUSH_END, ColorResources.TOOLBAR_COMBO_HOVER_START,
- ColorResources.TOOLBAR_COMBO_HOVER_END, ColorResources.TOOLBAR_COMBO_DISABLE_START,
+ returnCombo.setComboGradation(
+ ColorResources.TOOLBAR_COMBO_NORMAL_START,
+ ColorResources.TOOLBAR_COMBO_NORMAL_END,
+ ColorResources.TOOLBAR_COMBO_PUSH_START,
+ ColorResources.TOOLBAR_COMBO_PUSH_END,
+ ColorResources.TOOLBAR_COMBO_HOVER_START,
+ ColorResources.TOOLBAR_COMBO_HOVER_END,
+ ColorResources.TOOLBAR_COMBO_DISABLE_START,
ColorResources.TOOLBAR_COMBO_DISABLE_END);
- returnCombo.setOutlineColors(ColorResources.TOOLBAR_COMBO_OUTLINE_NORMAL_IN_COLOR,
+ returnCombo.setOutlineColors(
+ ColorResources.TOOLBAR_COMBO_OUTLINE_NORMAL_IN_COLOR,
ColorResources.TOOLBAR_COMBO_OUTLINE_PUSH_IN_COLOR,
ColorResources.TOOLBAR_COMBO_OUTLINE_HOVER_IN_COLOR,
ColorResources.TOOLBAR_COMBO_OUTLINE_DISABLE_IN_COLOR);
ImageResources.TOOLBAR_COMBO_BUTTON_NORMAL,
ImageResources.TOOLBAR_COMBO_BUTTON_DISABLE);
returnCombo.setComboImagePoint(new Point(130, 9));
- returnCombo.setComboButtonColor(ColorResources.TOOLBAR_COMBO_BUTTON_NORMAL_COLOR,
+ returnCombo.setComboButtonColor(
+ ColorResources.TOOLBAR_COMBO_BUTTON_NORMAL_COLOR,
ColorResources.TOOLBAR_COMBO_BUTTON_PUSH_COLOR,
ColorResources.TOOLBAR_COMBO_BUTTON_HOVER_COLOR,
ColorResources.TOOLBAR_COMBO_BUTTON_DISABLE_COLOR);
- returnCombo.setArrowOutlineColors(ColorResources.TOOLBAR_COMBO_ARROW_OUTLINE_COLOR,
+ returnCombo.setArrowOutlineColors(
+ ColorResources.TOOLBAR_COMBO_ARROW_OUTLINE_COLOR,
ColorResources.TOOLBAR_COMBO_ARROW_OUTLINE_COLOR,
ColorResources.TOOLBAR_COMBO_ARROW_OUTLINE_COLOR,
ColorResources.TOOLBAR_COMBO_ARROW_OUTLINE_COLOR);
returnCombo.setEnabled(true);
returnCombo.setComboFont(FontResources.COMBO);
returnCombo.setItemFont(FontResources.DROPDOWN);
- returnCombo.setFontColors(ColorResources.TOOLBAR_COMBO_FONT_NORMAL_COLOR,
+ returnCombo.setFontColors(
+ ColorResources.TOOLBAR_COMBO_FONT_NORMAL_COLOR,
ColorResources.TOOLBAR_COMBO_FONT_NORMAL_COLOR,
ColorResources.TOOLBAR_COMBO_FONT_NORMAL_COLOR,
ColorResources.TOOLBAR_COMBO_FONT_DISABLE_COLOR);
List<AppInfo> apps = addToAppComboFromTarget();
if (apps != null && apps.size() > 0) {
- String appName = GlobalInformation.getCurrentDeviceInfo().getSelectedAppName();
+ String appName = GlobalInformation.getCurrentDeviceInfo()
+ .getSelectedAppName();
if (null == appName) {
appCombo.select(0);
GlobalInformation.setCurrentApplication(apps.get(0));
GlobalInformation.setCurrentApplication(appInfo);
GlobalInformation.getCurrentDeviceInfo().getCommunicator()
.onAppSelected(appInfo);
- GlobalInformation.getCurrentDeviceInfo().setSelectedAppName(
- appInfo.getInfo(AppInfo.PROPERTY.LABEL.index));
+ GlobalInformation
+ .getCurrentDeviceInfo()
+ .setSelectedAppName(
+ appInfo.getInfo(AppInfo.PROPERTY.LABEL.index));
// startButton.setButtonEnabled(true);
setStartButtonState(true);
} else {
} else {
int size = items.size();
int selIndex = 0;
- String selDevice = GlobalInformation.getCurrentDeviceInfo().getIDevice()
- .getSerialNumber();
+ String selDevice = GlobalInformation.getCurrentDeviceInfo()
+ .getIDevice().getSerialNumber();
for (int i = 0; i < size; i++) {
deviceCombo.add(items.get(i));
if (items.get(i).equals(selDevice)) {
}
deviceCombo.select(selIndex);
- GlobalInformation.setCurrentDeviceInfo(DACommunicator.getDeviceByName(items
- .get(selIndex)));
+ GlobalInformation.setCurrentDeviceInfo(DACommunicator
+ .getDeviceByName(items.get(selIndex)));
deviceCombo.setToolTipText(items.get(selIndex));
if (null == oldDevice || !oldDevice.equals(selDevice)) {
for (AppInfo app : apps) {
String appid = app.getInfo(AppInfo.PROPERTY.APPID.index);
String pkgid = app.getInfo(AppInfo.PROPERTY.PACKAGE.index);
- if (appid.startsWith(pkgid) && !appid.contains(AnalyzerConstants.APPCONTROL)) {
+ if (appid.startsWith(pkgid)
+ && !appid.contains(AnalyzerConstants.APPCONTROL)) {
appcomboList.add(app);
}
}
AppInfo appInfo = DACommunicator.getPkgInfoByName(text);
if (null != appInfo) {
GlobalInformation.setCurrentApplication(appInfo);
- GlobalInformation.getCurrentDeviceInfo().getCommunicator().onAppSelected(appInfo);
+ GlobalInformation.getCurrentDeviceInfo().getCommunicator()
+ .onAppSelected(appInfo);
GlobalInformation.getCurrentDeviceInfo().setSelectedAppName(
appInfo.getInfo(AppInfo.PROPERTY.LABEL.index));
Display.getDefault().syncExec(new Runnable() {
AppInfo appInfo = DACommunicator.getPkgInfoByAppPkgId(id);
if (null != appInfo) {
GlobalInformation.setCurrentApplication(appInfo);
- GlobalInformation.getCurrentDeviceInfo().getCommunicator().onAppSelected(appInfo);
+ GlobalInformation.getCurrentDeviceInfo().getCommunicator()
+ .onAppSelected(appInfo);
GlobalInformation.getCurrentDeviceInfo().setSelectedAppName(
appInfo.getInfo(AppInfo.PROPERTY.LABEL.index));
appCombo.setText(appInfo.getInfo(AppInfo.PROPERTY.LABEL.index));
}
String text = deviceCombo.getText();
- String device = GlobalInformation.getCurrentDeviceInfo().getIDevice()
- .getSerialNumber();
+ String device = GlobalInformation.getCurrentDeviceInfo()
+ .getIDevice().getSerialNumber();
if (!device.equals(text)) {
// startButton.setButtonEnabled(false);
setStartButtonState(false);
private void setStartButtonImagesToStop(boolean isStarted) {
if (isStarted) {
- startButton.setImages(ImageResources.STOP, ImageResources.STOP_PUSH,
- ImageResources.STOP_HOVER, ImageResources.START_DISABLE);
+ startButton.setImages(ImageResources.STOP,
+ ImageResources.STOP_PUSH, ImageResources.STOP_HOVER,
+ ImageResources.START_DISABLE);
startButton.setToolTipText(ShortCutManager.STOP_TRACE);
} else {
- startButton.setImages(ImageResources.START, ImageResources.START_PUSH,
- ImageResources.START_HOVER, ImageResources.START_DISABLE);
+ startButton.setImages(ImageResources.START,
+ ImageResources.START_PUSH, ImageResources.START_HOVER,
+ ImageResources.START_DISABLE);
startButton.setToolTipText(ShortCutManager.START_TRACE);
}
}