Setting : prevent changing the template in setting dialog while analysis 92/28092/2
authorheeyoung <heeyoung1008.hwang@samsung.com>
Fri, 26 Sep 2014 04:18:09 +0000 (13:18 +0900)
committerheeyoung hwang <heeyoung1008.hwang@samsung.com>
Fri, 26 Sep 2014 04:50:10 +0000 (21:50 -0700)
Change-Id: I9f71b9cf59484e7588b5e8cd80769e740341ceee
Signed-off-by: heeyoung <heeyoung1008.hwang@samsung.com>
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogTemplatePage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/WelcomeDialog.java

index 202c0c8..7eb0a23 100644 (file)
@@ -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
+
+               }
+
+       };
 
 }
index 17f22f0..5a0047f 100644 (file)
@@ -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
index 5c61853..f924acd 100644 (file)
@@ -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();
                }