+ AnalyzerConstants.CMD_SPLIT + 0
+ AnalyzerConstants.CMD_SPLIT);
}
-
- ResourceCommunicator.startUITimer();
}
public static List<LogCenter> getLogCenters() {
public static void runStopLogProcessThread() {
if (StopLogProcessThread.count == 0) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StateManager.getInstance().StopProcessStart(
+ "unknown error(2)");
+ }
+ });
StopLogProcessThread.count++;
stopLogProcessThread = new Thread(null, new StopLogProcessThread(),
AnalyzerConstants.STOP_LOG_THREAD);
}
}
}
-
+
public static void unfoward(int local, int remote) {
- if(null != currentDevice && currentDevice.isOnline()) {
+ if (null != currentDevice && currentDevice.isOnline()) {
try {
currentDevice.removeForward(local, remote);
Thread.sleep(AnalyzerConstants.SOCKET_FORWARD_INTERVAL);
}
});
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StateManager.getInstance().StopProcessStart(
+ "device disconnected");
+ }
+ });
System.out
.println("stop log process thread call by device disconnected");//$NON-NLS-1$
AnalyzerManager.runStopLogProcessThread();
public void processMessage(String message) {
// DO NOT DELETE : for debugging
-// System.out.println("count " + messageCount + ": " + message);
+ // System.out.println("count " + messageCount + ": " + message);
try {
String[] messages = message.split(AnalyzerConstants.CMD_SPLIT_READ,
2);
if (!ResourceCommunicator.isCalledStop()) {
syncStopTrace();
}
-
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StateManager.getInstance().StopProcessStart(
+ "application terminated");
+ }
+ });
System.out
.println("stop log process thread call by process terminated"); //$NON-NLS-1$
AnalyzerManager.runStopLogProcessThread();
UIRecorderTool.getInstance().stop();
syncStopTrace();
-
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StateManager.getInstance().StopProcessStart(
+ "socket time out");
+ }
+ });
System.out
.println("stop log process thread call by socket time out"); //$NON-NLS-1$
AnalyzerManager.runStopLogProcessThread();
stopTimer();
DACommunicator.closeSocket();
- DACommunicator.unfoward(AnalyzerConstants.LOCAL_PORT, AnalyzerConstants.REMOTE_PORT);
+ DACommunicator.unfoward(AnalyzerConstants.LOCAL_PORT,
+ AnalyzerConstants.REMOTE_PORT);
// FIXME: unexpceted terminated - popup window?
UIRecorderTool.getInstance().stop();
syncStopTrace();
-
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StateManager.getInstance().StopProcessStart(
+ "unknown error(1)");
+ }
+ });
AnalyzerManager.runStopLogProcessThread();
}
}
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
-import java.util.TimerTask;
import org.eclipse.swt.widgets.Display;
import org.tizen.dynamicanalyzer.constants.AnalyzerConstants;
private static Timer recordTimer = null;
/** stop trace -> change page to summary **/
- public static void startUITimer() {
- recordTimer = new Timer();
- recordTimer.schedule(new TimerTask() {
+ public static void changePage(final int nPage) {
+ final BaseView baseView = (BaseView) AnalyzerUtil.getView(BaseView.ID);
+ final DAEffectFrame mainView = baseView.getMainView();
+ Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- BaseView baseView = (BaseView) AnalyzerUtil
- .getView(BaseView.ID);
-
- DAEffectFrame mainView = baseView.getMainView();
- mainView.setTopComposite(1);
- CoolbarArea.getInstance().setSelectionTab(1);
- }
- });
+ mainView.setTopComposite(nPage);
+ CoolbarArea.getInstance().setSelectionTab(nPage);
}
- }, 5000);
+ });
}
public static void stopUITimer() {
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
-import org.tizen.dynamicanalyzer.ui.widgets.ConfigurationDialog;
import org.tizen.dynamicanalyzer.ui.widgets.StopProgressDialog;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class StateManager {
private static final int INIT = 0;
private static final int STOP_PROCESS_START = 1;
+ private static final int STOP_PROCESS_END = 2;
private int state = INIT;
private StopProgressDialog dialog = null;
-
+
private static StateManager instance = new StateManager();
-
+
private StateManager() {
}
-
+
public static StateManager getInstance() {
return instance;
}
-
- public void StopProcessStart(){
+
+ public void StopProcessStart(String EndMessage) {
+ if (state == STOP_PROCESS_START)
+ return;
state = STOP_PROCESS_START;
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
- dialog = new StopProgressDialog(shell,
- SWT.NO_TRIM | SWT.APPLICATION_MODAL); // FIXME
+ dialog = new StopProgressDialog(shell, SWT.NO_TRIM
+ | SWT.APPLICATION_MODAL);
dialog.open();
+ if (null != dialog)
+ dialog.setProcessMessage(EndMessage);
}
-
- public void SaveProjectAndOthers(){
- if(null != dialog){
- dialog.setProcessInfomation("save project and others...");
- dialog.setProcessSelection(20);
+
+ public void WaitForLogParsing(int nSelect) {
+
+ if (null != dialog) {
+ dialog.setProcessSelection(nSelect);
}
}
-
- public void LogQueueObserverThreadEnd(){
- if(null != dialog){
- dialog.setProcessInfomation("Log queue observer thread end");
- dialog.setProcessSelection(50);
+
+ public void SaveProjectAndOthers() {
+ if (null != dialog) {
+ dialog.setProcessSelection(60);
}
}
-
- public void StopTrace(){
- if(null != dialog){
- dialog.setProcessInfomation("stop trace");
+
+ public void LogQueueObserverThreadEnd() {
+ if (null != dialog) {
+ dialog.setProcessSelection(70);
+ }
+ }
+
+ public void UpdateTimerStop() {
+ if (null != dialog) {
+ dialog.setProcessSelection(80);
+ }
+ }
+
+ public void InsertToDBComplete() {
+ if (null != dialog) {
+ dialog.setProcessSelection(90);
+ }
+ }
+
+ public void StopTrace() {
+ if (null != dialog) {
dialog.setProcessSelection(100);
+ ResourceCommunicator.changePage(1);
dialog.close();
+ state = STOP_PROCESS_END;
}
}
}
public static String OPEN_TRACE_DLG_TEMP_FILE;
public static String OPEN_TRACE_DLG_TEMP_FILE_NAME;
public static String OPEN_TRACE_DLG_TRACE_FILE_NAME;
+
+ public static String STOP_PROCESS_DLG_PLEASE_WAIT;
static {
NLS.initializeMessages(BUNDLE_NAME, AnalyzerLabels.class);
OPEN_TRACE_DLG_TEMP_FILE=Temporary file
OPEN_TRACE_DLG_TEMP_FILE_NAME=Trace file name
OPEN_TRACE_DLG_TRACE_FILE_NAME=Trace file name
+
+STOP_PROCESS_DLG_PLEASE_WAIT=please wait...
import java.util.List;
+import org.eclipse.swt.widgets.Display;
import org.tizen.dynamicanalyzer.LogSpliter;
import org.tizen.dynamicanalyzer.StateManager;
import org.tizen.dynamicanalyzer.constants.AnalyzerConstants;
import org.tizen.dynamicanalyzer.model.LogQueue;
import org.tizen.dynamicanalyzer.ui.views.CoolbarArea;
-
public class LogQueueObservingThread implements Runnable {
@Override
while (true) {
try {
if (!logQueue.isEmpty()) {
- List<String> logs = logQueue.getFirst();
- LogSpliter.logSlicing(logs);
+ List<String> logs = logQueue.getFirst();
+ LogSpliter.logSlicing(logs);
} else {
Thread.sleep(AnalyzerConstants.LOG_CHECK_INTERVAL);
}
- }catch (InterruptedException e)
- {
+ } catch (InterruptedException e) {
// interrupt log omitted
break;
} catch (Exception e) {
e.printStackTrace();
}
}
- //FIXME : delete !
+ // FIXME : delete !
System.out.println("log Queue observer thread end!!"); //$NON-NLS-1$
- StateManager.getInstance().LogQueueObserverThreadEnd();
+
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StateManager.getInstance().LogQueueObserverThreadEnd();
+ }
+ });
CoolbarArea.getInstance().stopTimer();
}
LogSpliter.stopLogQueueObservingThread();
System.out.println(" save project and others..."); //$NON-NLS-1$
- StateManager.getInstance().SaveProjectAndOthers();
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StateManager.getInstance().SaveProjectAndOthers();
+ }
+ });
/****** recording stop and log parsing / operations end!! *****/
/* 1. save Project */
if (!project.isValid()) {
UpdateViewTimer.stop();
}
});
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StateManager.getInstance().InsertToDBComplete();
+ }
+ });
System.out.println("insert to db complete..."); //$NON-NLS-1$
break;
} else {
LogSpliter.getLogQueue().clear();
AnalyzerManager.stopLogQueueObservingThread();
}
+
+ final int nSeclect = repeatCount * 10;
+
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StateManager.getInstance().WaitForLogParsing(
+ nSeclect);
+ }
+ });
}
Thread.sleep(AnalyzerConstants.LOG_CHECK_INTERVAL);
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StateManager.getInstance().WaitForLogParsing(50);
+ }
+ });
System.out.println("wait for log parsing..."); //$NON-NLS-1$
}
} catch (InterruptedException e) {
CoolbarArea.getInstance().stopTimer();
System.out.println(" stop trace "); //$NON-NLS-1$
- StateManager.getInstance().StopTrace();
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StateManager.getInstance().StopTrace();
+ }
+ });
Display.getDefault().syncExec(new Runnable() {
@Override
import org.tizen.dynamicanalyzer.DACommunicator;
import org.tizen.dynamicanalyzer.FontResources;
import org.tizen.dynamicanalyzer.ImageResources;
+import org.tizen.dynamicanalyzer.ResourceCommunicator;
import org.tizen.dynamicanalyzer.StateManager;
import org.tizen.dynamicanalyzer.constants.AnalyzerConstants;
import org.tizen.dynamicanalyzer.constants.DesignConstants;
setStartToolbarState(true);
// timerClock.start();
setToolbarEnablement(false);
+ ResourceCommunicator.changePage(0);
} else {
AnalyzerUtil
.setRecordState(RecordStateSourceProvider.RECORD_READY);
setStartToolbarState(false);
// timerClock.stop();
setToolbarEnablement(true);
- StateManager.getInstance().StopProcessStart();
+ StateManager.getInstance().StopProcessStart(
+ "stop button pressed");
}
startButton.setEnabled(false);
AnalyzerUtil.executeCommand(StartStopTraceHandler.ID);
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.ColorResources;
import org.tizen.dynamicanalyzer.FontResources;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-
-public class StopProgressDialog{
+public class StopProgressDialog {
private Shell parent = null;
private Shell shell = null;
- private long excuteTime = 10000; //max process time(default 10000 MiliSeconds)
+ private long excuteTime = 10000; // max process time(default 10000
+ // MiliSeconds)
private Label processMessage = null;
private Label processInfo = null;
private ProgressBar progressbar = null;
- private String message = "please wait....";
- private String infomation = "start";
- private int selection = 0;
- private boolean isClose = false;
+ private String message = "";
+ private String infomation = AnalyzerLabels.STOP_PROCESS_DLG_PLEASE_WAIT;
private static final int DEFAULT_WIDTH = 300;
private static final int DEFAULT_HEIGHT = 100;
private static final int DEFAULT_MAXIMUM = 100;
- private static final int TIMER_PERIOD = 10;
- boolean isChange = false;
+ private static final int TIMER_PERIOD = 1000;
Timer timer = null;
long startTime = 0;
long time;
-
-
- public StopProgressDialog(Shell parent, int style){
+
+ public StopProgressDialog(Shell parent, int style) {
shell = new Shell(parent, style);
this.parent = parent;
createContents();
}
-
- public StopProgressDialog(Shell parent, int style, long excuteTime){
+
+ public StopProgressDialog(Shell parent, int style, long excuteTime) {
this(parent, style);
this.excuteTime = excuteTime;
}
-
- public void setSize(int width, int height){
+
+ public void setSize(int width, int height) {
shell.setSize(width, height);
}
-
- public void setBounds(Rectangle rect){
+
+ public void setBounds(Rectangle rect) {
shell.setBounds(rect);
}
-
- public void setLocation(int width, int height){
+
+ public void setLocation(int width, int height) {
shell.setLocation(width, height);
}
-
- private void setDefaultSize(Rectangle rect){
- Rectangle size = new Rectangle((rect.x+rect.width)/2 - DEFAULT_WIDTH/2, (rect.y+rect.height)/2 - DEFAULT_HEIGHT/2, DEFAULT_WIDTH, DEFAULT_HEIGHT);
+
+ private void setDefaultSize(Rectangle rect) {
+ Rectangle size = new Rectangle((rect.x + rect.width) / 2
+ - DEFAULT_WIDTH / 2, (rect.y + rect.height) / 2
+ - DEFAULT_HEIGHT / 2, DEFAULT_WIDTH, DEFAULT_HEIGHT);
shell.setBounds(size);
}
-
- public void setProcessMessage(String message){
- this.message = message;
- isChange = true;
-// if(null != processMessage)
-// processMessage.setText(message);
+
+ public void setProcessMessage(String message) {
+ if (null != processMessage)
+ processMessage.setText(message);
}
-
- public void setProcessInfomation(String infomation){
- this.infomation = infomation;
- isChange = true;
-// if(null != processInfo)
-// processInfo.setText(infomation);
+
+ public void setProcessInfomation(String infomation) {
+ if (null != processInfo)
+ processInfo.setText(infomation);
}
-
- public void setProcessMaximum(int value){
+
+ public void setProcessMaximum(int value) {
progressbar.setMaximum(value);
}
-
- public void setProcessSelection(int value){
- selection = value;
- isChange = true;
-// progressbar.setSelection(value);
+
+ public void setProcessSelection(int value) {
+ if (null != progressbar)
+ progressbar.setSelection(value);
}
-
- protected void createContents(){
+
+ protected void createContents() {
setDefaultSize(parent.getBounds());
FormLayout dialogLayout = new FormLayout();
shell.setLayout(dialogLayout);
- shell.setBackground(ColorResources.WINDOW_BG_COLOR);
-
- //Process Message
- processMessage = new Label(shell, SWT.NONE);
+ shell.setBackground(ColorResources.NORMAL_VIEW_LAYOUT_OUTER);
+
+ Composite base = new Composite(shell, SWT.NONE);
+ base.setLayout(new FormLayout());
+ base.setBackground(ColorResources.WINDOW_BG_COLOR);
+
+ FormData baseData = new FormData();
+ baseData.top = new FormAttachment(0, 1);
+ baseData.left = new FormAttachment(0, 1);
+ baseData.right = new FormAttachment(100, -1);
+ baseData.bottom = new FormAttachment(100, -1);
+ base.setLayoutData(baseData);
+ // base.setVisible(true);
+
+ // Process Message
+ processMessage = new Label(base, SWT.NONE);
processMessage.setText(message);
processMessage.setBackground(ColorResources.WINDOW_BG_COLOR);
processMessage.setAlignment(SWT.LEFT);
processMessage.setForeground(ColorResources.WHITE);
processMessage.setFont(FontResources.ABOUT_TEXT);
-
- //Process Infomation
- processInfo = new Label(shell, SWT.NONE);
+
+ // Process Infomation
+ processInfo = new Label(base, SWT.NONE);
processInfo.setText(infomation);
processInfo.setBackground(ColorResources.WINDOW_BG_COLOR);
processInfo.setAlignment(SWT.LEFT);
processInfo.setForeground(ColorResources.WHITE);
processInfo.setFont(FontResources.ABOUT_TEXT);
-
- //Process Bar
- progressbar = new ProgressBar(shell, SWT.SMOOTH);
+
+ // Process Bar
+ progressbar = new ProgressBar(base, SWT.SMOOTH);
progressbar.setMaximum(DEFAULT_MAXIMUM);
-
- //Process Message
+
+ // Process Message
FormData formData = new FormData();
formData.left = new FormAttachment(0, 10);
formData.top = new FormAttachment(0, 15);
formData.width = 280;
formData.height = 22;
processMessage.setLayoutData(formData);
-
- //Process Bar
+
+ // Process Bar
formData = new FormData();
formData.left = new FormAttachment(0, 10);
formData.top = new FormAttachment(processMessage, 10);
formData.width = 280;
formData.height = 20;
progressbar.setLayoutData(formData);
-
- //Process Infomation
+
+ // Process Infomation
formData = new FormData();
formData.left = new FormAttachment(0, 10);
formData.top = new FormAttachment(progressbar, 10);
formData.height = 22;
processInfo.setLayoutData(formData);
}
-
- public void open(){
+
+ public void open() {
shell.open();
startTimer();
}
- public void close(){
- isClose = true;
+ public void close() {
+ stopTimer();
+ if (null != progressbar) {
+ progressbar.dispose();
+ progressbar = null;
+ }
+ if (null != processMessage) {
+ processMessage.dispose();
+ processMessage = null;
+ }
+ if (null != processInfo) {
+ processInfo.dispose();
+ processInfo = null;
+ }
+ shell.dispose();
}
-
- public void startTimer(){
- if(null != timer)
+
+ public void startTimer() {
+ if (null != timer)
stopTimer();
-
+
startTime = System.currentTimeMillis();
timer = new Timer();
-
+
timer.schedule(new TimerTask() {
@Override
public void run() {
@Override
public void run() {
time = System.currentTimeMillis() - startTime;
- if (time > excuteTime || true == isClose) {
- stopTimer();
- shell.close();
- }
- else if(true == isChange){
- processMessage.setText(message);
- processInfo.setText(infomation);
- progressbar.setSelection(selection);
+ if (time > excuteTime) {
+ close();
}
}
});
}
}, new Date(), TIMER_PERIOD);
}
-
- public void stopTimer(){
- if(null != timer){
+
+ public void stopTimer() {
+ if (null != timer) {
timer.cancel();
timer = null;
}
import java.util.Timer;
+import org.eclipse.swt.widgets.Display;
+import org.tizen.dynamicanalyzer.StateManager;
import org.tizen.dynamicanalyzer.constants.AnalyzerConstants;
import org.tizen.dynamicanalyzer.threads.UpdateTimerTask;
-
public class UpdateViewTimer {
private static Timer timer = null;
timer.cancel();
timer = null;
System.out.println("update timer stop"); //$NON-NLS-1$
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ StateManager.getInstance().UpdateTimerStop();
+ }
+ });
}
}
}
\ No newline at end of file