From: jy.exe.lee Date: Wed, 9 Nov 2011 04:34:53 +0000 (+0900) Subject: [Title] button status added X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5119d9b83e6e327ed1c54e2cc5f1114fb6bc11e0;p=sdk%2Ftools%2Fdynamic-analyzer.git [Title] button status added [Type] [Module] [Priority] [CQ#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] --- diff --git a/com.samsung.dynamicanalyzer.workbench/src/com/samsung/dynamicanalyzer/workbench/CoolbarArea.java b/com.samsung.dynamicanalyzer.workbench/src/com/samsung/dynamicanalyzer/workbench/CoolbarArea.java index 4d82604..e3b5809 100644 --- a/com.samsung.dynamicanalyzer.workbench/src/com/samsung/dynamicanalyzer/workbench/CoolbarArea.java +++ b/com.samsung.dynamicanalyzer.workbench/src/com/samsung/dynamicanalyzer/workbench/CoolbarArea.java @@ -43,6 +43,8 @@ public class CoolbarArea { private Combo deviceCombo; private Combo appCombo; private Button startButton; + private Button saveTraceButton; + private Button openTraceButton; private Button pickaxeButton; private Label resourceLifecycleLabel; private Label memoryLabel; @@ -269,7 +271,7 @@ public class CoolbarArea { public void widgetSelected(SelectionEvent e) { // Sets device name. SDBManager.setSerial(deviceCombo.getText()); - + appCombo.setEnabled(true); appCombo.removeAll(); // Gets application name list. @@ -296,17 +298,27 @@ public class CoolbarArea { appComboLayout.marginWidth = 0; appComboLayout.marginHeight = 0; appCombo.setLayout(appComboLayout); + appCombo.setEnabled(false); appCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // Sets application name. SDBManager.setAppName(appCombo.getText()); + + // status check and set start button enable + if (null != SDBManager.getSerial() + && null != SDBManager.getAppName()) { + AnalyzerUtil + .setRecordState(RecordStateSourceProvider.RECORD_READY); + startButton.setEnabled(true); + } } }); startButton = new Button(composite, SWT.FLAT | SWT.NO_FOCUS); startButton.setImage(startImage); + startButton.setEnabled(false); startButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -316,10 +328,20 @@ public class CoolbarArea { AnalyzerUtil .setRecordState(RecordStateSourceProvider.RECORD_RECORDING); startButton.setImage(stopImage); + deviceCombo.setEnabled(false); + appCombo.setEnabled(false); + saveTraceButton.setEnabled(false); + openTraceButton.setEnabled(false); + pickaxeButton.setEnabled(false); } else { AnalyzerUtil .setRecordState(RecordStateSourceProvider.RECORD_READY); startButton.setImage(startImage); + deviceCombo.setEnabled(true); + appCombo.setEnabled(true); + saveTraceButton.setEnabled(true); + openTraceButton.setEnabled(true); + pickaxeButton.setEnabled(true); } } }); @@ -339,12 +361,17 @@ public class CoolbarArea { data.height = 32; timeArea.setLayoutData(data); - Button saveTraceButton = new Button(composite, SWT.FLAT | SWT.NO_FOCUS); + saveTraceButton = new Button(composite, SWT.FLAT | SWT.NO_FOCUS); saveTraceButton.setImage(saveImage); + saveTraceButton.setEnabled(false); saveTraceButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - AnalyzerUtil.executeCommand(SaveTraceHandler.ID); + int result = AnalyzerUtil.executeCommand(SaveTraceHandler.ID); + if (result == AnalyzerConstants.SUCCESS) + { + saveTraceButton.setEnabled(false); + } } }); saveTraceButton.setBackground(blackColor); @@ -354,7 +381,7 @@ public class CoolbarArea { data.height = 32; saveTraceButton.setLayoutData(data); - Button openTraceButton = new Button(composite, SWT.FLAT | SWT.NO_FOCUS); + openTraceButton = new Button(composite, SWT.FLAT | SWT.NO_FOCUS); openTraceButton.setImage(openImage); openTraceButton.addSelectionListener(new SelectionAdapter() { @Override diff --git a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/AnalyzerConstants.java b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/AnalyzerConstants.java index ab61cbb..3b22a1c 100644 --- a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/AnalyzerConstants.java +++ b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/AnalyzerConstants.java @@ -81,6 +81,10 @@ public class AnalyzerConstants { public static final String EXTENSION_PNG_IMAGE = ".png";//$NON-NLS-1$ public static final String DATABASE_NAME = "da.trace"; //$NON-NLS-1$ + public static final int ERROR_EXTENSION_FAIL = -1; + public static final int SUCCESS = 0; + public static final int ERROR_SAVE_FAIL = 1; + private AnalyzerConstants() { } diff --git a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/SaveTraceHandler.java b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/SaveTraceHandler.java index 76b88f2..e34b079 100644 --- a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/SaveTraceHandler.java +++ b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/SaveTraceHandler.java @@ -58,9 +58,10 @@ public class SaveTraceHandler extends AbstractHandler { } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); + return 1; } - return null; + return 0; } } diff --git a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/StartStopTraceHandler.java b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/StartStopTraceHandler.java index 6526c94..9f368e8 100644 --- a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/StartStopTraceHandler.java +++ b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/StartStopTraceHandler.java @@ -32,8 +32,6 @@ public class StartStopTraceHandler extends AbstractHandler { neo.init(old); AnalyzerManager.setNew(true); - SDBManager.setSerial("emulator-26100"); - SDBManager.setAppName("com.samsung.calculator"); SDBManager.runApplication(); SDBManager.forward(); SDBManager.createSocket(); diff --git a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/utils/AnalyzerUtil.java b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/utils/AnalyzerUtil.java index db7f79e..a635aa9 100644 --- a/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/utils/AnalyzerUtil.java +++ b/com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/utils/AnalyzerUtil.java @@ -50,11 +50,11 @@ public class AnalyzerUtil { return window; } - public static void executeCommand(String commandId) { + public static Integer executeCommand(String commandId) { IHandlerService handlerService = (IHandlerService) PlatformUI .getWorkbench().getService(IHandlerService.class); try { - handlerService.executeCommand(commandId, new Event()); + return (Integer)handlerService.executeCommand(commandId, new Event()); } catch (ExecutionException e) { e.printStackTrace(); } catch (NotEnabledException e) { @@ -64,6 +64,7 @@ public class AnalyzerUtil { } catch (NotDefinedException e) { e.printStackTrace(); } + return -1; } public static String getRecordState() {