this.addListener(SWT.MouseExit, buttonMouseListener);
this.addListener(SWT.MouseDown, buttonMouseListener);
this.addListener(SWT.MouseUp, buttonMouseListener);
+ this.addListener(SWT.MouseMove, buttonMouseListener);
+ this.addListener(SWT.MouseHover, buttonMouseListener);
}
/**
* Sets default state colors
*/
private void setDefaultColors() {
- attr.setColor(STATE_DISABLE,
- ColorResources.BUTTON_STATE_DISABLE);
+ attr.setColor(STATE_DISABLE, ColorResources.BUTTON_STATE_DISABLE);
attr.setColor(STATE_PUSH, ColorResources.BUTTON_STATE_PUSH);
attr.setColor(STATE_HOVER, ColorResources.BUTTON_STATE_HOVER);
attr.setColor(STATE_NORMAL, ColorResources.BUTTON_STATE_NORMAL);
} else {\r
return;\r
}\r
-\r
+ String tooltip = button.getToolTipText();\r
+ button.setToolTipText(null);\r
handleClickEvent(button);\r
+ if (!button.isDisposed()) {\r
+ button.setToolTipText(tooltip);\r
+ }\r
}\r
\r
public abstract void handleClickEvent(DACustomButton button);\r
}
public String getText() {
+ if (selection < 0) {
+ return text;
+ }
if (getItems().size() > 0) {
return getItems().get(itemIndex + selection);
}
if (event.type == SWT.MouseUp) {
changeComboState(STATE_HOVER);
if (childShell == null || childShell.isDisposed()) {
+ if (closeTimer != null) {
+ closeTimer.cancel();
+ closeTimer = null;
+ }
openChildShell();
} else {
childShell.close();
}
private void openChildShell() {
- childShell = new Shell(parent.getShell(), SWT.ON_TOP);
+ childShell = new Shell(parent.getShell(), SWT.NO_TRIM);
childShell.setLayout(new FormLayout());
Point p = combo.toDisplay(0, 0);
popup.addListener(SWT.MouseUp, popupMouseEventListener);
popup.addListener(SWT.MouseMove, popupMouseEventListener);
popup.addListener(SWT.FocusOut, popupMouseEventListener);
+ popup.addListener(SWT.FocusIn, popupMouseEventListener);
popup.addListener(SWT.MouseUp, popupSelectionListener);
popup.addListener(SWT.MouseWheel, popupMouseEventListener);
popup.addListener(SWT.MouseExit, popupMouseEventListener);
upArrowButton.addListener(SWT.MouseExit, upButtonMouseListener);
upArrowButton.addListener(SWT.MouseEnter, upButtonMouseListener);
upArrowButton.addListener(SWT.MouseUp, upButtonMouseListener);
+ upArrowButton.addListener(SWT.FocusIn, upButtonMouseListener);
+ upArrowButton.addListener(SWT.FocusOut, upButtonMouseListener);
shellHeight += height;
if (tmpItemIndex > 0) {
upArrowButton.setButtonEnabled(true);
downArrowButton
.addListener(SWT.MouseEnter, downButtonMouseListener);
downArrowButton.addListener(SWT.MouseUp, downButtonMouseListener);
+ downArrowButton.addListener(SWT.FocusIn, downButtonMouseListener);
+ downArrowButton.addListener(SWT.FocusOut, downButtonMouseListener);
shellHeight += height;
if (tmpItemIndex + MAX_SIZE < size - 1) {
downArrowButton.setButtonEnabled(true);
public void setText(String text) {
if (!setSelect(text)) {
this.text = text;
+ selection = -1;
redraw();
}
}
}
}
- if (event.type == SWT.MouseEnter) {
+ if (event.type == SWT.MouseEnter || event.type == SWT.FocusIn) {
if (null != closeTimer) {
closeTimer.cancel();
closeTimer = null;
}
}
+
+ if (event.type == SWT.FocusOut) {
+ closePopup(CLOSE_WAITING_TIME);
+ }
}
};
public void select(int index) {
selection = index;
this.text = items.get(itemIndex + selection);
+ this.setToolTipText(text);
redraw();
}
}
}
- if (event.type == SWT.MouseEnter) {
+ if (event.type == SWT.MouseEnter || event.type == SWT.FocusIn) {
if (null != closeTimer) {
closeTimer.cancel();
closeTimer = null;
}
}
+ if (event.type == SWT.FocusOut) {
+ closePopup(CLOSE_WAITING_TIME);
+ }
+
if (event.type == SWT.MouseUp) {
if (!upArrowButton.isButtonEnabled()) {
return;
}
}
- if (event.type == SWT.MouseEnter) {
+ if (event.type == SWT.MouseEnter || event.type == SWT.FocusIn) {
if (null != closeTimer) {
closeTimer.cancel();
closeTimer = null;
}
}
+ if (event.type == SWT.FocusOut) {
+ closePopup(CLOSE_WAITING_TIME);
+ }
+
if (event.type == SWT.MouseUp) {
if (!downArrowButton.isButtonEnabled()) {
return;
}
public void closePopup(int interval) {
+ if (null == childShell || childShell.isDisposed()) {
+ return;
+ }
closeTimer = new Timer();
closeTimer.schedule(new TimerTask() {
public void run() {
if (null != childShell && !childShell.isDisposed()) {
childShell.close();
childShell = null;
+ } else {
+ System.out
+ .println("combo timer bug : try close child shell ");
}
}
});
}
- }, interval, interval);
+ }, interval);
}
public void setTextAlign(int align) {
ConfigurationDialogValues.getInstance().setSettingValueFromConfigFile();
if (!ConfigurationDialogValues.getInstance().isShowInitia()) {
final Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
- WelcomeDialog dialog = new WelcomeDialog(shell, SWT.NONE); // FIXME
+ WelcomeDialog dialog = new WelcomeDialog(shell); // FIXME
dialog.open();
}
PathManager.setLogPostFix(WorkbenchUtils.getLogPostFix());
import org.tizen.dynamicanalyzer.model.LogCenter;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
import org.tizen.dynamicanalyzer.swap.callstack.BaseCallstackManager;
import org.tizen.dynamicanalyzer.swap.callstack.SWAPCallStackManager;
import org.tizen.dynamicanalyzer.theme.DATheme;
public void run() {
ToolbarArea.getInstance()
.setStartButtonEnablement(true);
- ToolbarArea.getInstance()
- .setStartButtonEnablement(true);
}
});
}
public void run() {
ToolbarArea.getInstance().setStartButtonEnablement(
true);
- ToolbarArea.getInstance().setStartButtonEnablement(
- true);
}
});
}
ToolbarArea.getInstance().setTime(p.getLastTime());\r
ToolbarArea.getInstance().setDeviceComboText(p.getDevice());\r
ToolbarArea.getInstance().setAppComboText(p.getAppName());\r
+ ToolbarArea.getInstance().checkStartButtonAndAppListEnablement();\r
ToolbarArea.getInstance().setRepalyButtonEnable(true);\r
if (AnalyzerManager.getProject().getBinaryPath().isEmpty()) {\r
ToolbarArea.getInstance().setSourceViewEnable(false);\r
count = 0;
} else {
count++;
- if (count >= WAITING_TIME) {
+ if (count >= WAITING_TIME && DACommunicator.isRunning()) {
ToolbarArea.getInstance().stopTrace();
}
}
if (event.keyCode == SWT.F1) {
System.out.println("about");
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
- AboutDialog dialog = new AboutDialog(shell, SWT.NONE); // FIXME
+ AboutDialog dialog = new AboutDialog(shell); // FIXME
dialog.open();
} else if (event.keyCode == SWT.F2) {
System.out.println("configuration");
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
- ConfigurationDialog dialog = new ConfigurationDialog(shell,
- SWT.NONE); // FIXME
+ ConfigurationDialog dialog = new ConfigurationDialog(shell); // FIXME
dialog.open();
} else if (event.keyCode == SWT.F3) {
System.out.println("view source toggle");
}
// TODO: app inst , replay info added!!
- // byte[] rear = ByteUtils.getByte(appInfo.getByteValue(),
- // rt.getByteValue(), getUserSpaceInst().getByteValue(),
- // replayEvent);
- byte[] rear = ByteUtils.getByte(appInfo.getByteValue(),
- rt.getByteValue(), 0, 0);
+ byte[] rear = ByteUtils.getByte(appInfo.getByteValue(),
+ rt.getByteValue(), getUserSpaceInst().getByteValue(),
+ replayEvent);
+// byte[] rear = ByteUtils.getByte(appInfo.getByteValue(),
+// rt.getByteValue(), 0, 0);
int length = rear.length;
byte[] ret = ByteUtils.getByte(AnalyzerConstants.MSG_START_SWAP,
// FIXME: permission denied problem
if (!targetHashCode.equals(localHashCode)) {
- String destFilePath = AnalyzerPaths.TEMP_FOLDER_PATH
- + File.separator + selectedApp.getExecFileName(appInfo.getAppType());
-
- SyncResult res = CommunicatorUtils.pull(targetPath, destFilePath);
- if (null != res && res.isOk()) {
- System.out.println("binary copy success!!");//$NON-NLS-1$
- } else {
- System.out.println("Failed to get " + targetPath + " step 2"); //$NON-NLS-1$
+ String destFilePath = AnalyzerPaths.TEMP_FOLDER_PATH;
+// + File.separator + selectedApp.getExecFileName(appInfo.getAppType());
+ try{
+ Runtime rt = Runtime.getRuntime();
+ command = "/home/casval/tizen-sdk/tools/sdb root on | /home/casval/tizen-sdk/tools/sdb pull "+ targetPath + " " + destFilePath;
+ Process process = rt.exec(new String[] {
+ "/home/casval/tizen-sdk/tools/sdb", "root", "on"});
+ process.waitFor();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(
+ process.getInputStream()));
+ BufferedReader error = new BufferedReader(new InputStreamReader(
+ process.getErrorStream()));
+ String line = reader.readLine();
+ String errorStr = error.readLine();
+ if (null == line) {
+ System.out.println("host md5sum get failed : " + errorStr);
return HostResult.ERR_BIN_INFO_GET_FAIL;
}
- String[] splitName = binaryPath.split(CommonConstants.SLASH);
- binaryPath = AnalyzerPaths.TEMP_FOLDER_PATH + File.separator
- + new String(splitName[splitName.length - 1]);
- binInfo.setPath(binaryPath);
+
+ }catch(IOException e)
+ {
+ e.printStackTrace();
+ }catch(InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+//
+// SyncResult res = CommunicatorUtils.pull(targetPath, destFilePath);
+// if (null != res && res.isOk()) {
+// System.out.println("binary copy success!!");//$NON-NLS-1$
+// } else {
+// System.out.println("Failed to get " + targetPath + " step 2"); //$NON-NLS-1$
+// return HostResult.ERR_BIN_INFO_GET_FAIL;
+// }
+// String[] splitName = binaryPath.split(CommonConstants.SLASH);
+// binaryPath = AnalyzerPaths.TEMP_FOLDER_PATH + File.separator
+// + new String(splitName[splitName.length - 1]);
+// binInfo.setPath(binaryPath);
}
binInfo.setPath(binaryPath);
break;
}
+ //LOG!
+ ByteUtils.printByteArray(header);
+
int id = ByteUtils.toInt(header, 0);
int payloadSize = ByteUtils.toInt(header,
MSG_PAYLOAD_SIZE_INDEX);
@Override
public void parseLogPackage(LogPackage logPack) {
-// Logs logs = logPack.getLogs(probeType);
-// List<LogData> logList = logs.getLogs();
-// for (LogData log : logList) {
-// double time = Double.parseDouble(Long.toString(log.getTime()));
-//
-// int size = deviceLogTimeList.size();
-// int index = (int) (time / TimelineConstants.MEGA);
-//
-// if (size <= index) {
-// for (int i = size; i <= index; i++) {
-// deviceLogTimeList.add(Double.NaN);
-// }
-// }
-// deviceLogTimeList.set(index, time);
-//
-// updateRW(time);
-// }
+ Logs logs = logPack.getLogs(probeType);
+ List<LogData> logList = logs.getLogs();
+ for (LogData log : logList) {
+ double time = Double.parseDouble(Long.toString(log.getTime()));
+
+ int size = deviceLogTimeList.size();
+ int index = (int) (time / TimelineConstants.MEGA);
+
+ if (size <= index) {
+ for (int i = size; i <= index; i++) {
+ deviceLogTimeList.add(Double.NaN);
+ }
+ }
+ deviceLogTimeList.set(index, time);
+
+ updateRW(time);
+ }
}
private void updateRW(double time) {
@Override
public void handleClickEvent(DACustomButton button) {
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
- TimelineEditItemsDialog dialog = new TimelineEditItemsDialog(shell,
- SWT.None);
+ TimelineEditItemsDialog dialog = new TimelineEditItemsDialog(shell);
if (dialog.isRunningDialog() == false) {
dialog.open();
}
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart;
import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
+import org.tizen.dynamicanalyzer.ui.widgets.DAMessageBox;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
-public class TimelineEditItemsDialog extends Dialog {
-
- private Shell parent = null;
- private Shell shell = null;
+public class TimelineEditItemsDialog extends DAMessageBox {
+
private TableViewer chartTableViewer;
private boolean chartChangeSatus = true;
private static final String strDisableChart = "selected disable"; //$NON-NLS-1$
private static boolean RunningDialog = false;
-
- public TimelineEditItemsDialog(Shell parent, int style) {
+
+ public TimelineEditItemsDialog(Shell parent) {
super(parent);
- this.parent = parent;
- setShellStyle(getShellStyle() | SWT.MAX | SWT.RESIZE);
}
- public boolean isRunningDialog(){
+
+ public boolean isRunningDialog() {
return RunningDialog;
}
} else {
showInfo.add(false);
}
-
+
order.add(Integer.parseInt(item.getText(4)));
}
-
- for(int i = tableitems.length; i < chartManager.getChartList().size(); i++) {
+
+ for (int i = tableitems.length; i < chartManager.getChartList()
+ .size(); i++) {
chartList.add(chartManager.getChartList().get(i));
selectedChartList.add(chartManager.getChartList().get(i));
}
-
+
chartManager.setChartList(chartList);
chartManager.setSelectedChartList(selectedChartList);
AnalyzerUtil.getTimelineComposite().reArrangeChart(order, showInfo);
public void handleClickEvent(DACustomButton button) {
shell.dispose();
RunningDialog = false;
- }
+ }
};
-
+
private ShellListener shellListener = new ShellListener() {
@Override
};
- @Override
- public int open() {
- shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM );
+ protected int run() {
shell.setText(TimelineChartLabels.EDIT_CHART_DLG_TITLE);
shell.setBackground(ColorResources.WINDOW_BG_COLOR);
shell.setSize(446, 450);
chartTableItems[SwapItemIndexB].setText(3, strIndexA);
chartTableItems[SwapItemIndexA].setText(3, strIndexB);
-
+
strIndexA = chartTableItems[SwapItemIndexA].getText(4);
strIndexB = chartTableItems[SwapItemIndexB].getText(4);
rect.y + 1);
}
});
-
+
// Adds listeners.
RunningDialog = true;
shell.addShellListener(shellListener);
- shell.open();
-
- return 0;
+
+ return result;
}
private MouseListener itemZoomMouseListener = new MouseAdapter() {
import java.io.IOException;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
+import org.tizen.dynamicanalyzer.ui.widgets.DAMessageBox;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
-public class AboutDialog {
+public class AboutDialog extends DAMessageBox {
private static boolean opened = false;
- private Shell parent = null;
- private Shell shell = null;
private DACustomButton licenseButton = null;
private DACustomButton okButton = null;
private File SDKAboutFile = null;
private final Image iconImage = ImageResources.ABOUT_TIZEN_SDK;
- public AboutDialog(Shell parent, int style) {
- this.parent = parent;
+ public AboutDialog(Shell parent) {
+ super(parent);
}
private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
}
};
- public int open() {
+ protected int run() {
if (opened) {
return -1;
}
- shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
shell.setSize(446, 254);
shell.setLayout(new FormLayout());
shell.setText(AnalyzerLabels.ABOUT);
+ shell.addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ opened = false;
+ ShortCutManager.getInstance().setEnabled(!opened);
+ }
+ });
Composite base = new Composite(shell, SWT.NONE);
base.setLayout(new FormLayout());
titleText.setText(AnalyzerLabels.ABOUT_DIALOG_TITLE);
Label version = new Label(base, SWT.TRANSPARENT);
- // version.setText(AnalyzerLabels.ABOUT_DIALOG_VERSION_TAB
- // + ConfigureManager.getInstance().getValue(
- // AnalyzerLabels.ABOUT_DIALOG_VERSION));
String versionString = getVersion();// FIXME
version.setText(AnalyzerLabels.ABOUT_DIALOG_VERSION_TAB + versionString);
version.setBackground(ColorResources.DIALOG_BG_UPPER);
version.setFont(FontResources.ABOUT_TEXT);
Label buildTime = new Label(base, SWT.TRANSPARENT);
-
- // buildTime.setText("Build time : "+new
- // SimpleDateFormat("MM/dd/yyyy HH:mm").format(new Date())); //FIXME :
- // time
- // buildTime.setText(AnalyzerLabels.ABOUT_DIALOG_BUILD_TIME_TAB
- // + ConfigureManager.getInstance().getValue(
- // AnalyzerLabels.ABOUT_DIALOG_BUILD_TIME)); //$NON-NLS-1$
String buildTimeString = getBuildTime();// FIXME
buildTime.setText(AnalyzerLabels.ABOUT_DIALOG_BUILD_TIME_TAB
+ buildTimeString);
compData.top = new FormAttachment(base, 0);
compData.left = new FormAttachment(0, 0);
compData.right = new FormAttachment(100, 0);
- // compData.height = 51;
compData.bottom = new FormAttachment(100, 0);
buttonComp.setLayoutData(compData);
opened = true;
ShortCutManager.getInstance().setEnabled(!opened);
- shell.open();
-
- Display display = Display.getDefault();
-
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) {
- display.sleep();
- }
- }
-
- shell.dispose();
- opened = false;
- ShortCutManager.getInstance().setEnabled(!opened);
- return 0;
+ return result;
}
private String parseBuildTime(String readData) {
public class SaveAsDialog extends DAMessageBox {
+ private int MAX_SAVE_FILE_NAME_LENGTH = 35;
+
private Text textBox = null;
private String saveFileName = null;
private DAButton okButton = null;
@Override
public void handleClickEvent(DACustomButton button) {
saveFileName = textBox.getText();
+
+ if (saveFileName.length() > MAX_SAVE_FILE_NAME_LENGTH) {
+ String old = saveFileName;
+ saveFileName = old.substring(0, MAX_SAVE_FILE_NAME_LENGTH -1);
+ }
+
if (executeSaveTrace()) {
result = AnalyzerConstants.SUCCESS;
}
public void startProcessStart(String waitMessage) {
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
- dialog = new ProgressDialog(shell, SWT.APPLICATION_MODAL);
+ dialog = new ProgressDialog(shell, SWT.ON_TOP);
if (null != dialog) {
dialog.open();
dialog.setProgressMessage(waitMessage);
return;
}
state = STOP_PROCESS_START;
-// AnalyzerUtil.setRecordState(RecordStateSourceProvider.RECORD_READY);
AnalyzerManager.setRunningState(false);
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
- dialog = new ProgressDialog(shell, SWT.APPLICATION_MODAL);
+ dialog = new ProgressDialog(shell, SWT.ON_TOP);
if (null != dialog) {
dialog.open();
dialog.setProgressMessage(EndMessage);
import org.tizen.dynamicanalyzer.common.DesignConstants;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
+import org.tizen.dynamicanalyzer.model.DeviceInfo;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.project.AppInfo;
replayButton.setButtonEnabled(false);
return;
}
- String device = deviceCombo.getText();
+ String device = DACommunicator.getSelectedDevice().getIDevice()
+ .getSerialNumber();
String deviceName = p.getDevice();
String appName = p.getAppName();
@Override
public void handleClickEvent(DACustomButton button) {
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
- ConfigurationDialog dialog = new ConfigurationDialog(shell,
- SWT.NONE); // FIXME
+ ConfigurationDialog dialog = new ConfigurationDialog(shell); // FIXME
dialog.open();
}
});
@Override
public void handleClickEvent(DACustomButton button) {
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
- AboutDialog dialog = new AboutDialog(shell, SWT.NONE); // FIXME
+ AboutDialog dialog = new AboutDialog(shell); // FIXME
dialog.open();
}
});
public void startTrace() {
ShortCutManager.getInstance().setEnabled(false);
- Display.getDefault().syncExec(new Runnable() {
-
- @Override
- public void run() {
- StartProcessManager.getInstance().startProcessStart(
- "prepare for tracing");
- }
- });
-
if (!checkValidApplication()) {
// fail message box
Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
ShortCutManager.getInstance().setEnabled(true);
return;
}
+ Display.getDefault().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ StartProcessManager.getInstance().startProcessStart(
+ "prepare for tracing");
+ }
+ });
+
AnalyzerUtil.changePage(TimelinePage.ID);
- // AnalyzerUtil.setRecordState(RecordStateSourceProvider.RECORD_RECORDING);
AnalyzerManager.setRunningState(true);
TraceStartStopThread.runStartStopThread();
}
public void stopTrace() {
ShortCutManager.getInstance().setEnabled(false);
AnalyzerManager.getProject().setStopTime(getTime());
- // AnalyzerUtil.setRecordState(RecordStateSourceProvider.RECORD_READY);
AnalyzerManager.setRunningState(false);
TraceStartStopThread.runStartStopThread();
}
return viewSourceButton.isToggled();
}
- public void setStartButtonEnablement(boolean enabled) {
+ public void setStartButtonEnablement(final boolean enabled) {
+ Display.getDefault().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (!enabled) {
+ startButton.setButtonEnabled(false);
+ return;
+ }
+
+ String text = deviceCombo.getText();
+ String device = DACommunicator.getSelectedDevice().getIDevice()
+ .getSerialNumber();
+ if (!device.equals(text)) {
+ startButton.setButtonEnabled(false);
+ return;
+ }
+ startButton.setButtonEnabled(true);
+ }
+ });
startButton.setButtonEnabled(enabled);
}
+ public void checkStartButtonAndAppListEnablement() {
+ Display.getDefault().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ String text = deviceCombo.getText();
+ String device = DACommunicator.getSelectedDevice().getIDevice()
+ .getSerialNumber();
+ if (!device.equals(text)) {
+ startButton.setButtonEnabled(false);
+ appCombo.setEnabled(false);
+ return;
+ }
+ startButton.setButtonEnabled(true);
+ appCombo.setEnabled(true);
+ }
+ });
+ }
+
public void setSettingsButtonEnablement(boolean enabled) {
settingsButton.setButtonEnabled(enabled);
}
}
private boolean checkValidApplication() {
+ List<DeviceInfo> devices = DACommunicator.getDevices();
+ if (null == devices || devices.isEmpty()) {
+ return false;
+ }
+ String selectedDevice = deviceCombo.getText();
+ deviceCombo.initCombo();
+ int size = devices.size();
+ for (int i = 0; i < size; i++) {
+ deviceCombo.add(devices.get(i).getIDevice().getSerialNumber());
+ }
+ int index = deviceCombo.getItems().indexOf(selectedDevice);
+ if (index >= 0) {
+ deviceCombo.setText(selectedDevice);
+ } else {
+ deviceCombo.setText(CommonConstants.EMPTY);
+ return false;
+ }
+
List<AppInfo> apps = DACommunicator.getAppListFromTarget();
if (null == apps || apps.isEmpty()) {
return false;
}
String selectedApp = appCombo.getText();
appCombo.initCombo();
- int size = apps.size();
+ size = apps.size();
for (int i = 0; i < size; i++) {
appCombo.add(apps.get(i).getInfo(AppInfo.LABEL_INDEX));
}
- int index = appCombo.getItems().indexOf(selectedApp);
+ index = appCombo.getItems().indexOf(selectedApp);
if (index >= 0) {
appCombo.setText(selectedApp);
return true;
return buttons.get(id);
}
+ public void setEnabled(boolean enabled) {
+ baseComposite.setEnabled(enabled);
+ }
+
public void setToolbarStartStopState(final boolean isStop) {
Display.getDefault().syncExec(new Runnable() {
@Override
}
private void recordStop() {
- // AnalyzerUtil.setRecordState(RecordStateSourceProvider.RECORD_READY);
AnalyzerManager.setRunningState(false);
Display.getDefault().syncExec(new Runnable() {
@Override
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
+import org.tizen.dynamicanalyzer.ui.widgets.DAMessageBox;
import org.tizen.dynamicanalyzer.ui.widgets.DATabComposite;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
-public class ConfigurationDialog {
+public class ConfigurationDialog extends DAMessageBox {
private static boolean opened = false;
- private Shell parent = null;
- private Shell window = null;
private DACustomButton applyButton = null;
private DACustomButton okButton = null;
private DACustomButton cancelButton = null;
DATabComposite tabView = null;
- public ConfigurationDialog(Shell parent, int style) {
- this.parent = parent;
+ public ConfigurationDialog(Shell parent) {
+ super(parent);
ConfigurationDialogValues.getInstance().setSettingValueFromConfigFile();
}
@Override
public void handleClickEvent(DACustomButton button) {
doApply();
- window.dispose();
+ shell.dispose();
}
};
private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() {
@Override
public void handleClickEvent(DACustomButton button) {
doBack();
- window.dispose();
+ shell.dispose();
}
};
ConfigurationDialogValues.getInstance().setSettingValueFromConfigFile();
}
- public int open() {
+ protected int run() {
if (opened) {
return -1;
}
- window = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
- window.setSize(608, 480);
- window.setLayout(new FormLayout());
- window.setText(AnalyzerLabels.CONFIGURATION);
+ shell.setSize(608, 480);
+ shell.setLayout(new FormLayout());
+ shell.setText(AnalyzerLabels.CONFIGURATION);
- window.addDisposeListener(new DisposeListener() {
+ shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
});
// banner
- Label banner = new Label(window, SWT.TRANSPARENT);
+ Label banner = new Label(shell, SWT.TRANSPARENT);
banner.setBackground(ColorResources.WINDOW_BG_COLOR);
banner.setImage(ImageResources.CONFIGURATION_BANNER_IMAGE);
labelData.height = 80;
banner.setLayoutData(labelData);
- Composite tabContentsComp = new Composite(window, SWT.NONE);
+ Composite tabContentsComp = new Composite(shell, SWT.NONE);
FormLayout compLayout = new FormLayout();
tabContentsComp.setLayout(compLayout);
tabContentsComp
tabView.addView(settingPage, false);
// button
- Composite buttonContentsComp = new Composite(window, SWT.NONE);
+ Composite buttonContentsComp = new Composite(shell, SWT.NONE);
buttonContentsComp.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
opened = true;
ShortCutManager.getInstance().setEnabled(!opened);
- window.open();
- return 0;
+ return result;
}
}
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
+import org.tizen.dynamicanalyzer.ui.widgets.DAMessageBox;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
import org.tizen.dynamicanalyzer.widgets.button.checkbox.DACheckBox;
import org.tizen.dynamicanalyzer.widgets.button.checkbox.DACheckboxSelectionListener;
-public class WelcomeDialog {
- private Shell parent = null;
- private Shell window = null;
+public class WelcomeDialog extends DAMessageBox{
private DACustomButton okButton = null;
private DACustomButton cancelButton = null;
private DACheckBox useAgainCheckButton = null;
- private boolean returnType = true;
- public WelcomeDialog(Shell parent, int style) {
- this.parent = parent;
+ public WelcomeDialog(Shell parent) {
+ super(parent);
ConfigurationDialogValues.getInstance().setSettingValueFromConfigFile();
}
@Override
public void handleClickEvent(DACustomButton button) {
doApply();
- window.dispose();
+ shell.dispose();
}
};
private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() {
@Override
public void handleClickEvent(DACustomButton button) {
doBack();
- window.dispose();
+ shell.dispose();
}
};
notifyAutoRun();
}
- public boolean open() {
+ protected int run(){
IDECommunicator.setOpenWelcomeDlg(true);
- window = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
- window.setSize(608, 460);
- window.setLayout(new FormLayout());
- window.setText(AnalyzerLabels.WELCOME);
+ shell.setSize(608, 460);
+ shell.setLayout(new FormLayout());
+ shell.setText(AnalyzerLabels.WELCOME);
// banner
- Label banner = new Label(window, SWT.TRANSPARENT);
+ Label banner = new Label(shell, SWT.TRANSPARENT);
banner.setBackground(ColorResources.WINDOW_BG_COLOR);
banner.setImage(ImageResources.WELCONE_BANNER_IMAGE);
labelData.height = 80;
banner.setLayoutData(labelData);
- Composite contentsComp = new Composite(window, SWT.NONE);
+ Composite contentsComp = new Composite(shell, SWT.NONE);
FormLayout compLayout = new FormLayout();
contentsComp.setLayout(compLayout);
contentsComp
new ConfigurationDialogFeaturesPage(contentsComp, SWT.NONE);
// button
- Composite buttonContentsComp = new Composite(window, SWT.NONE);
+ Composite buttonContentsComp = new Composite(shell, SWT.NONE);
buttonContentsComp.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
buttonData.width = 100;
buttonData.height = 28;
okButton.setLayoutData(buttonData);
- window.addShellListener(shellListener);
- window.open();
- return returnType;
+ shell.addShellListener(shellListener);
+ shell.open();
+ return result;
}
private DACheckboxSelectionListener useAgainCheckbuttonListener = new DACheckboxSelectionListener() {
y += fontHeight;
inputText = AnalyzerLabels.OPEN_TRACE_DLG_DETAILS_RECORDING_TIME
- + Formatter.toTimeFormat(elapsedTime);
+ + Formatter.toOpentraceTimeFormat(elapsedTime);
e.gc.drawText(inputText, x, y);
}
}
package org.tizen.dynamicanalyzer.ui.widgets;
+import javax.swing.plaf.basic.BasicInternalFrameTitlePane.CloseAction;
+
import org.eclipse.jface.window.Window.IExceptionHandler;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
public class DAMessageBox {
protected int result = 0;
+ protected Shell parentShell = null;
protected Shell shell = null;
protected boolean block = false;
private static IExceptionHandler exceptionHandler = new DefaultExceptionHandler();
public DAMessageBox(Shell parentShell) {
+ this.parentShell = parentShell;
shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
}
public int open() {
block = true;
+ parentShell.setEnabled(false);
result = run();
if (result >= 0) {
shell.open();
}
}
shell.dispose();
+ parentShell.setEnabled(true);
+ closeAction();
return result;
}
return result;
}
+ protected int closeAction() {
+ return result;
+ }
+
private void runEventLoop(Shell loopShell) {
// Use the display provided by the shell if possible
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
import org.tizen.dynamicanalyzer.widgets.helper.FontResources;
import org.tizen.dynamicanalyzer.widgets.helper.WidgetUtils;
public void open() {
shell.open();
+ ToolbarArea.getInstance().setEnabled(false);
}
public void close() {
}
shell = null;
}
+ ToolbarArea.getInstance().setEnabled(true);
}
public void setProgressMessage(String message) {
shell.setLocation(childX, childY);
}
+ public static void setCenter(Shell shell, Shell parent) {
+ Rectangle pRect = parent.getBounds();
+ Rectangle pChild = shell.getBounds();
+
+ int deltaX = pRect.width - pChild.width;
+ int deltaY = pRect.height - pChild.height;
+
+ int childX = pRect.x + deltaX / 2;
+ int childY = pRect.y + deltaY / 2;
+
+ shell.setLocation(childX, childY);
+ }
+
/** stop trace -> change page to summary **/
public static void changePage(final String pageId) {
final BaseView baseView = (BaseView) AnalyzerUtil
return output;
}
+ public static String toOpentraceTimeFormat(Object time) {
+ long longTime = -1;
+ if (time instanceof Long || time instanceof Integer) {
+ longTime = (Long) time;
+ } else if (time instanceof String) {
+ longTime = Long.parseLong((String) time);
+ } else {
+ return null;
+ }
+
+ longTime /= 1000;
+ long ms = longTime % 1000;
+ longTime /= 1000;
+ long second = longTime % 60;
+ longTime /= 60;
+ long minute = longTime % 60;
+ longTime /= 60;
+ long hour = longTime % 60;
+
+ String strHour = Long.toString(hour);
+ if (strHour.length() < 2) {
+ strHour = "0" + strHour; //$NON-NLS-1$
+ }
+
+ String strMinute = Long.toString(minute);
+ if (strMinute.length() < 2) {
+ strMinute = "0" + strMinute; //$NON-NLS-1$
+ }
+
+ String strSecond = Long.toString(second);
+ if (strSecond.length() < 2) {
+ strSecond = "0" + strSecond; //$NON-NLS-1$
+ }
+
+ String strMs = Long.toString(ms);
+ if (strMs.length() == 2) {
+ strMs = "0" + strMs; //$NON-NLS-1$
+ } else if (strMs.length() == 1) {
+ strMs = "00" + strMs; //$NON-NLS-1$
+ }
+
+ String output = strHour
+ + ":" + strMinute + ":" + strSecond + "." + strMs; //$NON-NLS-1$ //$NON-NLS-2$
+ return output;
+ }
+
public static String toTimeFormat2(Object time) {
long longTime = -1;
if (time instanceof Long || time instanceof Integer) {