From 36bb8df052ee7c9370a6ee000c319a226f4cbb96 Mon Sep 17 00:00:00 2001 From: heeyoung Date: Fri, 26 Sep 2014 13:18:09 +0900 Subject: [PATCH] Setting : prevent changing the template in setting dialog while analysis Change-Id: I9f71b9cf59484e7588b5e8cd80769e740341ceee Signed-off-by: heeyoung --- .../ui/toolbar/setting/SettingDialog.java | 46 +++++++++++++++++++++- .../toolbar/setting/SettingDialogTemplatePage.java | 21 ++++++++-- .../ui/toolbar/setting/WelcomeDialog.java | 7 ++++ 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialog.java index 202c0c8..7eb0a23 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialog.java @@ -30,6 +30,8 @@ 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.events.ShellEvent; +import org.eclipse.swt.events.ShellListener; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; @@ -59,6 +61,8 @@ public class SettingDialog extends DAMessageBox { // private DACustomButton revertButton = null; private DACustomButton closeButton = null; + private boolean isApply = false; + private SettingDialogTemplatePage templatesPage = null; private DATabComposite tabView = null; @@ -90,8 +94,9 @@ public class SettingDialog extends DAMessageBox { @Override public void handleClickEvent(DACustomButton button) { + isApply = true; doRun(); - shell.dispose(); // close dialog + shell.close(); // close dialog } }; @@ -311,6 +316,8 @@ public class SettingDialog extends DAMessageBox { opened = true; ShortCutManager.getInstance().setEnabled(!opened); + shell.addShellListener(shellListener); + shell.open(); return true; } @@ -328,5 +335,42 @@ public class SettingDialog extends DAMessageBox { closeButton.setButtonEnabled(false); } } + + private ShellListener shellListener = new ShellListener() { + + @Override + public void shellActivated(ShellEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void shellClosed(ShellEvent e) { + // TODO Auto-generated method stub + if (!isApply && !DACommunicator.isRunning()) { + // rollback setting data + SettingDataManager.getInstance().revertSettingData(); + } + } + + @Override + public void shellDeactivated(ShellEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void shellDeiconified(ShellEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void shellIconified(ShellEvent e) { + // TODO Auto-generated method stub + + } + + }; } diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogTemplatePage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogTemplatePage.java index 17f22f0..5a0047f 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogTemplatePage.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogTemplatePage.java @@ -43,6 +43,7 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Text; +import org.tizen.dynamicanalyzer.communicator.DACommunicator; import org.tizen.dynamicanalyzer.nl.AnalyzerLabels; import org.tizen.dynamicanalyzer.nl.ConfigureLabels; import org.tizen.dynamicanalyzer.nl.WidgetLabels; @@ -354,6 +355,10 @@ public class SettingDialogTemplatePage extends DAPageComposite { } } targetComp.layout(true); + + if (DACommunicator.isRunning()) { + targetComp.setEnabled(false); + } } public void createTemplateDescriptionComposite() { @@ -554,11 +559,15 @@ public class SettingDialogTemplatePage extends DAPageComposite { if(toggleButton.isToggled()) { // set select template TargetData target = SettingDataManager.getInstance().getTarget(null); - target.setSelectedTemplate(toggleButton.getText()); - target.changeAvailableFeatureListMap(toggleButton.getText()); + String preSelectedTemplate = target.getSelectedTemplate(); - // change description - createTemplateDescriptionComposite(); + if (preSelectedTemplate.equals(toggleButton.getText()) == false) { + target.setSelectedTemplate(toggleButton.getText()); + target.changeAvailableFeatureListMap(toggleButton.getText()); + + // change description + createTemplateDescriptionComposite(); + } // change button status SettingDialogManager.getInstance().updateSaveButtonStatus(null); @@ -581,5 +590,9 @@ public class SettingDialogTemplatePage extends DAPageComposite { } templateComp.layout(true); + + if (DACommunicator.isRunning()) { + templateComp.setEnabled(false); + } } } \ No newline at end of file diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/WelcomeDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/WelcomeDialog.java index 5c61853..f924acd 100644 --- a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/WelcomeDialog.java +++ b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/WelcomeDialog.java @@ -59,6 +59,8 @@ public class WelcomeDialog extends DAMessageBox { // private DACustomButton revertButton = null; private DACustomButton runButton = null; + private boolean isApply = false; + private SettingDialogTemplatePage templatesPage = null; private DACheckBox useAgainCheckButton = null; @@ -88,6 +90,7 @@ public class WelcomeDialog extends DAMessageBox { @Override public void handleClickEvent(DACustomButton button) { + isApply = true; doRun(); shell.close(); // close dialog } @@ -307,6 +310,10 @@ public class WelcomeDialog extends DAMessageBox { @Override public void shellClosed(ShellEvent e) { // TODO Auto-generated method stub + if (!isApply && !DACommunicator.isRunning()) { + // rollback setting data + SettingDataManager.getInstance().revertSettingData(); + } notifyAutoRun(); } -- 2.7.4