Setting : apply new design 86/27286/3
authorheeyoung <heeyoung1008.hwang@samsung.com>
Wed, 10 Sep 2014 07:44:05 +0000 (16:44 +0900)
committerheeyoung <heeyoung1008.hwang@samsung.com>
Fri, 12 Sep 2014 05:34:17 +0000 (14:34 +0900)
Change-Id: I2564da730cff1e3792e15907e5ad1230fbde039f
Signed-off-by: heeyoung <heeyoung1008.hwang@samsung.com>
21 files changed:
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/PostWindowOpenCallback.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/shortcut/ShortCutKeyBindingHandler.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinarySettingProcessor.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/ToolbarArea.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureData.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialog.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialogFeaturesTable.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialogFeaturesTreeTableCellRenderer.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialogFeaturesTreeTableToggleRenderer.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDataManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialog.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogBinarySettingsPage.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogManager.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogOptionPage.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogTemplatePage.java [new file with mode: 0644]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/TargetData.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/WelcomeDialog.java [new file with mode: 0644]

index c459405..35868b5 100644 (file)
@@ -27,15 +27,15 @@ package org.tizen.dynamicanalyzer.common;
 
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.dynamicanalyzer.callback.IExecutionCallback;
-import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogDataManager;
-import org.tizen.dynamicanalyzer.ui.toolbar.configuration.WelcomeDialog;
+import org.tizen.dynamicanalyzer.ui.toolbar.setting.SettingDataManager;
+import org.tizen.dynamicanalyzer.ui.toolbar.setting.WelcomeDialog;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
 
 public class PostWindowOpenCallback implements IExecutionCallback {
        @Override
        public void execute() {
-               if (!ConfigurationDialogDataManager.getInstance().isShowInital()) {
+               if (!SettingDataManager.getInstance().isShowInitial()) {
                        final Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
                        WelcomeDialog dialog = new WelcomeDialog(shell); // FIXME
                        Logger.performance("TEST", "DA Start", "Welcome Dialog");
index 5ddeaa3..2a0f2d6 100755 (executable)
@@ -131,6 +131,7 @@ public class AnalyzerLabels extends NLS {
 
        public static String COOLBAR_AREA_CONFIGURATION_FEATURES;
        public static String COOLBAR_AREA_CONFIGURATION_SETTING;
+       public static String COOLBAR_AREA_CONFIGURATION_OPTION;
 
        public static String LICENSE_DIALOG_NOT_FOUND;
 
index bcbde21..c3fcc0c 100755 (executable)
@@ -96,6 +96,7 @@ COOLBAR_AREA_KERNEL_TOOLTIP_MAC=Kernel [Command + 7]
 
 COOLBAR_AREA_CONFIGURATION_FEATURES=Features
 COOLBAR_AREA_CONFIGURATION_SETTING=Configuration
+COOLBAR_AREA_CONFIGURATION_OPTION=Option
 
 LICENSE_DIALOG_NOT_FOUND=License file not found
 
index 1852058..56ae47b 100644 (file)
@@ -84,7 +84,7 @@ SYSTEM_INFOMATION_SAMPLING_PERIODIC=System information sampling periodic
 SNAPSHOT_PERIODIC_AUTO=On scene transition
 MS=ms
 SECOND=s
-AUTO=auto
+AUTO=auto : 
 SAMPLING=sampling period :
 PERIODIC=periodically
 VALUE_IS_EMPTY=value is empty
index 8a7d31e..17bab03 100644 (file)
@@ -46,9 +46,9 @@ import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
 import org.tizen.dynamicanalyzer.ui.toolbar.AboutDialog;
 import org.tizen.dynamicanalyzer.ui.toolbar.SaveAsDialog;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialog;
 import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceDialog;
 import org.tizen.dynamicanalyzer.ui.toolbar.replayEditor.ReplayEditDialog;
+import org.tizen.dynamicanalyzer.ui.toolbar.setting.SettingDialog;
 import org.tizen.dynamicanalyzer.ui.userinterface.UIPage;
 import org.tizen.dynamicanalyzer.util.CommonUtil;
 import org.tizen.dynamicanalyzer.util.Logger;
@@ -91,7 +91,7 @@ public class ShortCutKeyBindingHandler extends AbstractHandler {
                } else if (e.keyCode == SWT.F2) {
                        Logger.debug("configuration");
                        Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
-                       ConfigurationDialog dialog = new ConfigurationDialog(shell); 
+                       SettingDialog dialog = new SettingDialog(shell); 
                        dialog.open();
                } else if (e.keyCode == SWT.F3) {
                        Logger.debug("view source toggle");
index fb90924..018ecc4 100644 (file)
@@ -8,7 +8,7 @@ import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
-import org.tizen.dynamicanalyzer.ui.toolbar.configuration.BinarySettingsPage;
+import org.tizen.dynamicanalyzer.ui.toolbar.setting.SettingDialogBinarySettingsPage;
 import org.tizen.sdblib.service.FileEntry;
 
 public class BinarySettingProcessor implements Runnable {
@@ -19,11 +19,11 @@ public class BinarySettingProcessor implements Runnable {
        private static Thread binaryThread = null;
 
        private static Object result = null;
-       private static BinarySettingsPage page = null;
+       private static SettingDialogBinarySettingsPage page = null;
 
        private static int type = TYPE_ADD;
 
-       public static void runAddThread(Object input, BinarySettingsPage inputPage) {
+       public static void runAddThread(Object input, SettingDialogBinarySettingsPage inputPage) {
                page = inputPage;
                result = input;
                type = TYPE_ADD;
@@ -32,7 +32,7 @@ public class BinarySettingProcessor implements Runnable {
                binaryThread.start();
        }
 
-       public static void runLoadingThread(BinarySettingsPage inputPage) {
+       public static void runLoadingThread(SettingDialogBinarySettingsPage inputPage) {
                page = inputPage;
                type = TYPE_LOAD;
                binaryThread = new Thread(null, new BinarySettingProcessor(),
@@ -40,7 +40,7 @@ public class BinarySettingProcessor implements Runnable {
                binaryThread.start();
        }
 
-       public static void runUpdateDebugRoot(BinarySettingsPage inputPage) {
+       public static void runUpdateDebugRoot(SettingDialogBinarySettingsPage inputPage) {
                page = inputPage;
                type = TYPE_UPDATE;
                binaryThread = new Thread(null, new BinarySettingProcessor(),
index 54ebfda..20e0e8e 100755 (executable)
@@ -64,9 +64,9 @@ import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
 import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
-import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialog;
 import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceDialog;
 import org.tizen.dynamicanalyzer.ui.toolbar.replayEditor.ReplayEditDialog;
+import org.tizen.dynamicanalyzer.ui.toolbar.setting.SettingDialog;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
@@ -413,7 +413,7 @@ public class ToolbarArea {
                        @Override
                        public void handleClickEvent(DACustomButton button) {
                                Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
-                               ConfigurationDialog dialog = new ConfigurationDialog(shell); // FIXME
+                               SettingDialog dialog = new SettingDialog(shell); // FIXME
                                dialog.open();
                        }
                });
index e10c9eb..ac7a9c7 100644 (file)
@@ -104,7 +104,7 @@ public class BinarySettingsPage extends DAPageComposite {
                        if (result != null) {
                                BinarySettingProgressManager.getInstance().startProcessStart(
                                                "Wait for add binaries...");
-                               BinarySettingProcessor.runAddThread(result, me);
+//                             BinarySettingProcessor.runAddThread(result, me); // TODO : temp
                        }
                }
        };
@@ -149,7 +149,7 @@ public class BinarySettingsPage extends DAPageComposite {
                                                binarySettings);
                                BinarySettingProgressManager.getInstance().startProcessStart(
                                                "now loading binaries...");
-                               BinarySettingProcessor.runLoadingThread(me);
+//                             BinarySettingProcessor.runLoadingThread(me);    // TODO : remove class
                        } catch (FileNotFoundException e) {
                                e.printStackTrace();
                        } catch (IOException e) {
@@ -181,7 +181,7 @@ public class BinarySettingsPage extends DAPageComposite {
                                if (null != rootPath) {
                                        BinarySettingProgressManager.getInstance()
                                                        .startProcessStart("Wait for update debug path");
-                                       BinarySettingProcessor.runUpdateDebugRoot(me);
+//                                     BinarySettingProcessor.runUpdateDebugRoot(me);                                  // TODO : remove class
                                        BinarySettingManager.getInstance().setDebugRoot(rootPath);
                                }
                        }
@@ -240,7 +240,7 @@ public class BinarySettingsPage extends DAPageComposite {
        public BinarySettingsPage(Composite parent, int style) {
                super(parent, style);
                me = this;
-               setTitle("Binary Settings"); // TODO nl
+               setTitle("Binary Settings"); // TODO : remove class
                rootPath = PathManager
                                .getRootstrapsPath(ConfigureManager.getPlatform());
                inputRowHash = BinarySettingManager.getInstance().getInputRowHash();
index 2e66259..b4ef753 100644 (file)
@@ -48,6 +48,7 @@ public class FeatureData {
 
        private int minValue = 0;
        private int maxValue = 0;
+       private int defaultValue = 0;
        private long swapValue = AnalyzerConstants.FEATURE_OFF; // 0x0000
        private long overheadValue = AnalyzerConstants.FEATURE_OFF; // 0x0000
        
@@ -116,6 +117,16 @@ public class FeatureData {
                }
        }
 
+       public int getDefaultValue() {
+               return defaultValue;
+       }
+
+       public void setDefaultValue(String defaultValue) {
+               if (isValidValue(defaultValue)) {
+                       this.defaultValue = Integer.parseInt(defaultValue);
+               }
+       }
+
        public long getSwapValue() {
                return swapValue;
        }
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialog.java
new file mode 100644 (file)
index 0000000..43aafb6
--- /dev/null
@@ -0,0 +1,296 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+package org.tizen.dynamicanalyzer.ui.toolbar.setting;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.nl.WidgetLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAMessageBox;
+
+public class FeatureDialog extends DAMessageBox {
+
+       public static final String ITEM_PARENT_FEATURE_NAME_ITEM = ", parent_feature_name_";//$NON-NLS-1$
+       public static final String ITEM_ALL_CHECKED = ", item_all_checked ";//$NON-NLS-1$
+       public static final String ITEM_PART_CHECKED = ", item_part_checked ";//$NON-NLS-1$
+       public static final String FEATURE_OPTION_VALUE = ", feature_option_value ";//$NON-NLS-1$
+
+       private DATableComposite featuresTable = null;
+       private SettingDialogTemplatePage templatePage = null;
+       
+       int[] sortTypes = { AnalyzerConstants.SORT_TYPE_GRID };
+       private String[] columnNames = { ConfigureLabels.FEATURES };
+       private int[] columnSizes = { 571 };
+       private boolean[] columnVisibility = { true };
+
+       private DAButton okButton = null;
+       private DAButton cancelButton = null;
+       
+       public FeatureDialog(Shell parentShell) {
+               super(parentShell);
+       }
+
+       private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       // check feature change
+                       if (SettingDialogManager.getInstance().changedFeaturesFromTableItemsList(
+                                       ((FeatureDialogFeaturesTable)featuresTable).getTable()) == true) {
+                               // set custom template
+                               SettingDataManager.getInstance().getTarget(null).
+                                       setSelectedTemplate(ConfigureLabels.TEMPLATE_NAME_CUSTOM);
+
+                               // apply selected feature
+                               ((FeatureDialogFeaturesTable)featuresTable).setConfigurationDialogDataManager();
+
+                               // update template view
+                               templatePage.createTemplateTitleComposite();
+                               templatePage.createTemplateDescriptionComposite();
+                               
+                               // update setting dialog button
+                               SettingDialogManager.getInstance().updateSaveButtonStatus(null);
+                       }
+                       shell.dispose();        // close dialog
+               }
+       };
+       
+       public void setTemplatePage(SettingDialogTemplatePage templatePage) {
+               this.templatePage = templatePage;
+       }
+       private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       shell.dispose();        // close dialog
+               }
+       };
+       
+       private SelectionListener featureTableSelectionListener = new SelectionListener() {
+
+               @Override
+               public void widgetSelected(SelectionEvent e) {
+                       // do nothing
+               }
+
+               @Override
+               public void widgetDefaultSelected(SelectionEvent e) {
+                       // do nothing
+               }
+       };
+
+       private MouseListener mouseListener = new MouseListener() {
+
+               @Override
+               public void mouseUp(MouseEvent e) {
+                       // do nothing
+               }
+
+               @Override
+               public void mouseDown(MouseEvent e) {
+                       // check feature change
+                       if (SettingDialogManager.getInstance().changedFeaturesFromTableItemsList(
+                                       ((FeatureDialogFeaturesTable)featuresTable).getTable()) == true) {
+                               okButton.setButtonEnabled(true);
+                       } else {
+                               okButton.setButtonEnabled(false);
+                       }
+               }
+
+               @Override
+               public void mouseDoubleClick(MouseEvent e) {
+                       // do nothing
+               }
+       };
+       
+       public void enableButteon() {
+               okButton.setButtonEnabled(true);
+               cancelButton.setButtonEnabled(true);
+       }
+       
+       public void diableButteon() {
+               okButton.setButtonEnabled(false);
+               cancelButton.setButtonEnabled(true);
+       }
+       
+       protected boolean run() {
+               shell.setSize(446, 424);
+               shell.setLayout(new FormLayout());
+               shell.setText(ConfigureLabels.FEATURE_DETAIL_SETTING_TITLE);
+               shell.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+               
+               Composite tableComp = new Composite(shell, SWT.NONE);
+               FormLayout compLayout = new FormLayout();
+               tableComp.setLayout(compLayout);
+               tableComp.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+
+               FormData compData = new FormData();
+               compData.top = new FormAttachment(0, 0);
+               compData.left = new FormAttachment(0, 0);
+               compData.right = new FormAttachment(100, 0);
+               compData.bottom = new FormAttachment(100, -51);
+               tableComp.setLayoutData(compData);
+               
+               tableComp.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               Rectangle r = new Rectangle(6, 35, 432, 294);
+                               e.gc.setForeground(ColorResources.SETTING_STROKE);
+                               e.gc.drawRectangle(r);
+                       }
+               });
+               
+               // Title
+               Label tableTitle = new Label(tableComp, SWT.TRANSPARENT);
+               tableTitle.setText(ConfigureLabels.FEATURE_TABLE_TITLE);
+               tableTitle
+                               .setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+               tableTitle.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+               tableTitle.setFont(FontResources.SETTING_TITLE_FONT);
+
+               FormData data = new FormData();
+               data.top = new FormAttachment(0, 17);
+               data.left = new FormAttachment(0, 8);
+               data.width = 432;
+               data.height = 18;
+               tableTitle.setLayoutData(data);
+               
+               // Table
+               featuresTable = new FeatureDialogFeaturesTable(tableComp,
+                               SWT.BORDER | SWT.V_SCROLL | SWT.SINGLE);
+               featuresTable.setTree(true);
+               featuresTable.setItemHeightSize(22);
+               featuresTable.setTableName(ConfigureLabels.FEATURE_TABLE_TITLE);
+               featuresTable.setSortTypes(sortTypes);
+               featuresTable.setColumns(columnNames);
+               featuresTable.setColumnSize(columnSizes);
+               featuresTable.setColumnVisibility(columnVisibility);
+               featuresTable.setTableToolTipEnable(false);
+               featuresTable.getTable().addSelectionListener(
+                               featureTableSelectionListener);
+               featuresTable.getTable().addMouseListener(mouseListener);
+               data = new FormData();
+               data.top = new FormAttachment(0, 36);
+               data.left = new FormAttachment(0, 7);
+               data.right = new FormAttachment(100, -6);
+               data.bottom = new FormAttachment(100, -14);
+               featuresTable.setLayoutData(data);
+
+               featuresTable.addControlListener(new ControlListener() {
+                       @Override
+                       public void controlResized(ControlEvent e) {
+                               Rectangle r = featuresTable.getClientArea();
+                               int size = r.width;
+                               columnSizes[0] = size;
+                               featuresTable.setColumnSize(columnSizes);
+                               featuresTable.redraw();
+                       }
+
+                       @Override
+                       public void controlMoved(ControlEvent e) {
+                       }
+               });
+
+               // button
+               Composite buttonContentsComp = new Composite(shell, SWT.NONE);
+               compLayout = new FormLayout();
+               buttonContentsComp.setLayout(compLayout);
+               buttonContentsComp.setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
+               compData = new FormData();
+               compData.top = new FormAttachment(tableComp, 0);
+               compData.left = new FormAttachment(0, 0);
+               compData.right = new FormAttachment(100, 0);
+               compData.bottom = new FormAttachment(100, 0);
+               buttonContentsComp.setLayoutData(compData);             
+               SettingDialogManager.getInstance().setFeatureDlg(this);
+               buttonContentsComp.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               Composite comp = (Composite) e.widget;
+                               Rectangle rect = comp.getClientArea();
+                               e.gc.setForeground(ColorResources.SETTING_SUNKEN_LINE_1);
+                               e.gc.drawLine(0, 0, rect.width-1, 0);
+                               e.gc.setForeground(ColorResources.SETTING_SUNKEN_LINE_2);
+                               e.gc.drawLine(0, 1, rect.width-1, 1);
+                       }
+               });
+               
+               cancelButton = new DAButton(buttonContentsComp, SWT.NONE);
+               cancelButton.addClickListener(cancelButtonListener);
+               cancelButton.setText(WidgetLabels.CANCEL);
+               cancelButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+               FormData buttonData = new FormData();
+               buttonData.right = new FormAttachment(100, -119);
+               buttonData.top = new FormAttachment(0, 13);
+               buttonData.width = 100;
+               buttonData.height = 28;
+               cancelButton.setLayoutData(buttonData);
+               
+               okButton = new DAButton(buttonContentsComp, SWT.NONE);
+               okButton.addClickListener(okButtonListener);
+               okButton.setText(WidgetLabels.OK);
+               okButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+               buttonData = new FormData();
+               buttonData.right = new FormAttachment(cancelButton, -8);
+               buttonData.top = new FormAttachment(0, 13);
+               buttonData.width = 100;
+               buttonData.height = 28;
+               okButton.setLayoutData(buttonData);
+               okButton.setButtonEnabled(false);
+               
+               featuresTable.updateTable();
+               shell.open();
+               return true;
+       }
+       
+       public DATableComposite getFeatureTable() {
+               return this.featuresTable;
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialogFeaturesTable.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialogFeaturesTable.java
new file mode 100644 (file)
index 0000000..937565d
--- /dev/null
@@ -0,0 +1,563 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
+ * HyunJong Park <phjwithyou.park@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+package org.tizen.dynamicanalyzer.ui.toolbar.setting;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.nebula.widgets.grid.GridColumn;
+import org.eclipse.nebula.widgets.grid.GridItem;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.model.TreeInput;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableHeaderRenderer;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATreeComposite;
+import org.tizen.dynamicanalyzer.util.Logger;
+
+public class FeatureDialogFeaturesTable extends DATreeComposite {
+       private final int tableTextOptionColumnIndex = 1;
+
+       public FeatureDialogFeaturesTable(Composite parent, int style) {
+               super(parent, style);
+
+               table.addListener(SWT.Dispose, tableMouseListener);
+               table.addListener(SWT.MouseEnter, tableMouseListener);
+               table.addListener(SWT.MouseExit, tableMouseListener);
+               table.addListener(SWT.MouseMove, tableMouseListener);
+               table.addListener(SWT.MouseHover, tableMouseListener);
+               table.addListener(SWT.MouseUp, tableMouseListener);
+               table.addListener(SWT.MouseDown, tableMouseListener);
+               table.addListener(SWT.MouseDoubleClick, tableMouseListener);
+       }
+
+       @Override
+       public void setColumns(String[] columnNames) {
+               int size = columnNames.length;
+               for (int i = 0; i < size; i++) {
+                       GridColumn column = new GridColumn(table, SWT.NONE);
+                       column.setText(columnNames[i]);
+                       column.setCellRenderer(new FeatureDialogFeaturesTreeTableCellRenderer(table));
+                       DATableHeaderRenderer header = new DATableHeaderRenderer(SWT.LEFT);
+                       header.setBgColor(ColorResources.SETTING_TABLE_HEADER_BG);
+                       header.setFontColor(ColorResources.SETTING_TABLE_HEADER_FONT_COLOR);
+                       column.setHeaderRenderer(header);
+
+                       if (i == 0) {
+                               column.setTree(true);
+                       }
+                       column.pack();
+               }
+       }
+
+       /**
+        * Creates an TreeInput Object for the feature.
+        * 
+        * @param featureName   featureName
+        * 
+        * @return The resulting TreeInput object
+        */
+       private TreeInput makeInput(String featureName) {
+               DATableDataFormat tableData = new DATableDataFormat(0);
+               List<String> text = new ArrayList<String>();
+               text.add(featureName);
+
+               TargetData target = SettingDataManager.getInstance().getTarget(null);
+               FeatureData feature = target.getAvailableFeature(featureName);
+               StringBuffer optionColumn = new StringBuffer(); 
+       
+               // check selected feature : , item_all_checked 
+               if (target.isSelectedFeature(featureName) == true) {
+                       optionColumn.append(FeatureDialog.ITEM_ALL_CHECKED);
+               } else {
+                       optionColumn.append(CommonConstants.EMPTY);
+               }
+
+               // check parent feature : , parent_feature_name_xxx
+               if ((feature.getParentName() != null) && 
+                               (feature.getParentName().equals(CommonConstants.EMPTY) == false)) {
+                       optionColumn.append(FeatureDialog.ITEM_PARENT_FEATURE_NAME_ITEM + feature.getParentName()); 
+               }
+
+               // check option feature : , feature_option_value "xxx"
+               if (feature.getFeatureType() == FeatureData.FEATURE_TYPE_DETAIL) {
+                       String optionText = getDetailFeatureOptionText(featureName);
+                       if (optionText != null) {
+                               optionColumn.append(FeatureDialog.FEATURE_OPTION_VALUE + optionText);
+                       }
+               }
+               
+               text.add(optionColumn.toString());
+               TreeInput outPut = new TreeInput();
+               outPut.setText(text);
+               outPut.setData(tableData);
+               return outPut;
+       }
+
+       @Override
+       public List<TreeInput> makeTreeInput() {
+               List<TreeInput> output = new ArrayList<TreeInput>();
+               TargetData target = SettingDataManager.getInstance().getTarget(null);
+               
+               Map<String, FeatureData> map = target.getAvailableFeatureListMap();
+               for (Map.Entry<String, FeatureData> entry : map.entrySet()) {
+                       
+                       FeatureData feature = entry.getValue();         
+                       if (feature.getFeatureName().equals(ConfigureLabels.PERIODIC)) {
+                               continue;
+                       }
+                       
+                       // check exist current feature node
+                       if (existTreeInput(output, feature.getFeatureName()) == false) {
+                               // create current feature node
+                               TreeInput currentNode = makeInput(feature.getFeatureName());
+                               
+                               // check exist parent feature
+                               if (null == feature.getParentName()) {
+                                       output.add(currentNode);
+                               } else {
+                                       
+                                       // check exist parent feature node
+                                       if (existTreeInput(output, feature.getParentName()) == false) {
+                                               // create parent feature node                                           
+                                               TreeInput parentNode = makeInput(feature.getParentName());
+                                               output.add(parentNode);
+                                               parentNode.getChildren().add(currentNode);
+                                               
+                                       } else {
+                                               TreeInput parentTreeInput = getTreeInput(output, feature.getParentName());
+                                               parentTreeInput.getChildren().add(currentNode);
+                                       }
+                               }
+                       }                       
+               }
+
+               updateParentFeatureCheckStatus(output);
+               return output;
+       }
+       
+       private boolean existTreeInput(List<TreeInput> list, String featureName) {
+               for (int j = 0; j < list.size(); j++) {
+                       String name = (String) list.get(j).getText().get(0);
+                       if (name.equals(featureName)) {
+                               return true;
+                       }
+               }
+               return false;
+       }
+
+       private TreeInput getTreeInput(List<TreeInput> list, String featureName) {
+               for (int j = 0; j < list.size(); j++) {
+                       String name = (String) list.get(j).getText().get(0);
+                       if (name.equals(featureName)) {
+                               return list.get(j);
+                       }
+               }
+               return null;
+       }
+       
+       private String getDetailFeatureOptionText(String featureName) { 
+               if (featureName.equals(ConfigureLabels.SNAPSHOT_PERIODIC_AUTO)) {
+                       return getScreenShotOptionText(featureName);
+               } else if (featureName.equals(ConfigureLabels.SYSTEM_INFOMATION_SAMPLING_PERIODIC)
+                               || featureName.equals(ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC)) {                  
+                       return getSystemOptionText(featureName);
+               } else {
+                       Logger.debug("the feature is not an option. " + featureName);
+               }
+
+               return null;
+       }
+
+       private String getSystemOptionText(String featureName) {
+               StringBuffer optionValue = new StringBuffer();
+               TargetData target = SettingDataManager.getInstance().getTarget(null);
+               
+               FeatureData feature = target.getAvailableFeature(featureName);
+               int selectedValue = target.getSelectedFeatureValue(featureName);
+               int defaultValue = feature.getDefaultValue();
+
+               if (selectedValue > 0) {
+                       optionValue.append(ConfigureLabels.SAMPLING + Integer.toString(selectedValue));
+               } else {
+                       optionValue.append(ConfigureLabels.SAMPLING + Integer.toString(defaultValue));
+               }
+               return optionValue.toString();
+       }
+       
+       private String getScreenShotOptionText(String featureName) {
+               StringBuffer optionValue = new StringBuffer();
+               TargetData target = SettingDataManager.getInstance().getTarget(null);
+               boolean auto = target.isSelectedFeature(ConfigureLabels.SNAPSHOT_PERIODIC_AUTO);
+               boolean period = target.isSelectedFeature(ConfigureLabels.SNAPSHOT_PERIODIC);
+               
+               if (auto) {     // select : auto radio button
+                       FeatureData periodFeature = target.getAvailableFeature(ConfigureLabels.PERIODIC);                       
+                       optionValue.append(ConfigureLabels.AUTO + "1,");
+                       optionValue.append(ConfigureLabels.SAMPLING + periodFeature.getDefaultValue());
+               } else if (auto == false) {     // select : periodic radio button
+                       if (period) {   
+                               optionValue.append(ConfigureLabels.AUTO + "0,");
+                               optionValue.append(ConfigureLabels.SAMPLING + target.getSelectedFeatureValue(ConfigureLabels.SNAPSHOT_PERIODIC));
+                       } else {
+                               FeatureData autoFeature = target.getAvailableFeature(ConfigureLabels.SNAPSHOT_PERIODIC_AUTO);   
+                               FeatureData periodFeature = target.getAvailableFeature(ConfigureLabels.PERIODIC);       
+                               optionValue.append(ConfigureLabels.AUTO + autoFeature.getDefaultValue() + ",");
+                               optionValue.append(ConfigureLabels.SAMPLING + periodFeature.getDefaultValue());
+                       }
+               }
+               return optionValue.toString();
+       }
+       
+       private Listener tableMouseListener = new Listener() {
+               @Override
+               public void handleEvent(Event event) {
+                       final int MOUSE_LEFT = 1;
+                       final int MOUSE_RIGHT = 3;
+                       GridItem item = table.getItem(new Point(event.x, event.y));
+                       if (null == item) {
+                               return;
+                       }
+                       switch (event.type) {
+                       case SWT.Dispose:
+                               break;
+                       case SWT.MouseEnter:
+                               break;
+                       case SWT.MouseExit:
+                               break;
+                       case SWT.MouseMove:
+                               break;
+                       case SWT.MouseDoubleClick:
+                               break;
+                       case SWT.MouseHover:            
+                               table.redraw();
+                               break;
+                       case SWT.MouseUp:
+                               break;
+                       case SWT.MouseDown:
+                               switch (event.button) {
+                               case MOUSE_LEFT: {
+                                       if (!DACommunicator.isRunning()) {
+                                               if (isClickCheckBox(item, event)) {
+                                                       updateCheckBox(item, event);
+                                                       updateChildCheckBoxByParent(item, event);
+                                                       updateParentCheckBoxByChild(item, event);
+                                               }
+                                       }
+                                       break;
+                               }
+                               case MOUSE_RIGHT: {
+                                       break;
+                               }
+                               default: {
+                                       break;
+                               }
+                               }
+                               break;
+                       default:
+                               break;
+                       }
+               }
+       };
+
+       // TODO:refactoring about the legacy code.
+       private void updateParentFeatureCheckStatus(List<TreeInput> output) {
+               for (int i = 0; i < output.size(); i++) {
+                       TreeInput treeData = output.get(i);
+
+                       String featureName = treeData.getText().get(0);
+                       if (featureName.equals(ConfigureLabels.FEATURE_MEMORY_ALLOCATION)) {
+                               continue;
+                       } else if (featureName.equals(ConfigureLabels.FEATURE_THREAD)) {
+                               continue;
+                       } else if (featureName.equals(ConfigureLabels.FEATURE_FILE)) {
+                               continue;
+                       } else if (featureName.equals(ConfigureLabels.FEATURE_NETWORK)) {
+                               continue;
+                       } else if (featureName
+                                       .equals(ConfigureLabels.FEATURE_USERINTERFACE)) {
+                               continue;
+                       } else if (featureName.equals(ConfigureLabels.FEATURE_OPENGL)) {
+                               continue;
+                       }
+
+                       if (treeData.getChildren().size() > 0) {
+                               int childCheckedCount = 0;
+                               int childUnCheckedCount = 0;
+                               for (int j = 0; j < treeData.getChildren().size(); j++) {
+                                       if (treeData
+                                                       .getChildren()
+                                                       .get(j)
+                                                       .getText()
+                                                       .get(1)
+                                                       .contains(
+                                                                       FeatureDialog.ITEM_ALL_CHECKED)) {
+                                               childCheckedCount++;
+                                       } else {
+                                               childUnCheckedCount++;
+                                       }
+                               }
+
+                               if (childCheckedCount > 0 && childUnCheckedCount == 0) {
+                                       setCheckStatus(treeData,
+                                                       FeatureDialog.ITEM_ALL_CHECKED);
+                               } else if (childCheckedCount > 0 && childUnCheckedCount > 0) {
+                                       setCheckStatus(treeData,
+                                                       FeatureDialog.ITEM_PART_CHECKED);
+                               } else if (childCheckedCount == 0 && childUnCheckedCount > 0) {
+                                       setCheckStatus(treeData, CommonConstants.EMPTY);
+                               }
+                       }
+
+               }
+       }
+       // TODO:refactoring about the legacy code.
+       private boolean isClickCheckBox(GridItem item, Event event) {
+               String optionText = item.getText(tableTextOptionColumnIndex);
+               int checkImgX = 0;
+               if (!optionText
+                               .contains(FeatureDialog.ITEM_PARENT_FEATURE_NAME_ITEM)) {
+                       checkImgX = 20;
+               } else {
+                       checkImgX = 40;
+               }
+               int checkImgWidth = ImageResources.CHECKBOX_SELECTED.getBounds().width;
+               if ((checkImgX <= event.x)
+                               && (event.x <= checkImgX + checkImgWidth + 10)) {
+                       return true;
+               }
+               return false;
+       }
+       // TODO:refactoring about the legacy code.
+       private void updateCheckBox(GridItem item, Event event) {
+               String optionText = item.getText(tableTextOptionColumnIndex);
+               if (optionText
+                               .contains(FeatureDialog.ITEM_PART_CHECKED)) {
+                       optionText = item.getText(tableTextOptionColumnIndex).replace(
+                                       FeatureDialog.ITEM_PART_CHECKED,
+                                       CommonConstants.EMPTY);
+               }
+               if (optionText
+                               .contains(FeatureDialog.ITEM_ALL_CHECKED)) {
+                       optionText = item.getText(tableTextOptionColumnIndex).replace(
+                                       FeatureDialog.ITEM_ALL_CHECKED,
+                                       CommonConstants.EMPTY);
+               } else {
+                       optionText += FeatureDialog.ITEM_ALL_CHECKED;
+               }
+               item.setText(tableTextOptionColumnIndex, optionText);
+       }
+
+       public void setConfigurationDialogDataManager() {
+               SettingDialogManager.getInstance()
+                               .setFeaturesValueFromTableItemsList(table);
+       }
+       // TODO:refactoring about the legacy code.
+       private void updateChildCheckBoxByParent(GridItem item, Event event) {
+               String featureName = item.getText(0);
+
+               String optionText = item.getText(tableTextOptionColumnIndex);
+               if (!optionText
+                               .contains(FeatureDialog.ITEM_PARENT_FEATURE_NAME_ITEM)) {
+                       for (int i = 0; i < table.getItemCount(); i++) {
+                               TargetData target = SettingDataManager.getInstance().getTarget(null);           
+                               String parentFeatureName = target.getParentFeatureName(table.getItem(i).getText(0));
+                               if (featureName.equals(parentFeatureName)) {
+                                       if (optionText
+                                                       .contains(FeatureDialog.ITEM_ALL_CHECKED)) {
+                                               if (featureName
+                                                               .equals(ConfigureLabels.FEATURE_MEMORY_ALLOCATION)) {
+                                                       return;
+                                               } else if (featureName
+                                                               .equals(ConfigureLabels.FEATURE_THREAD)) {
+                                                       return;
+                                               } else if (featureName
+                                                               .equals(ConfigureLabels.FEATURE_FILE)) {
+                                                       return;
+                                               } else if (featureName
+                                                               .equals(ConfigureLabels.FEATURE_NETWORK)) {
+                                                       return;
+                                               } else if (featureName
+                                                               .equals(ConfigureLabels.FEATURE_USERINTERFACE)) {
+                                                       return;
+                                               } else if (featureName
+                                                               .equals(ConfigureLabels.FEATURE_OPENGL)) {
+                                                       return;
+                                               }
+                                               setCheckStatus(
+                                                               table.getItem(i),
+                                                               FeatureDialog.ITEM_ALL_CHECKED);
+                                       } else {
+                                               setCheckStatus(table.getItem(i), CommonConstants.EMPTY);
+                                       }
+                               }
+                       }
+               }
+       }
+       // TODO:refactoring about the legacy code.
+       private void updateParentCheckBoxByChild(GridItem item, Event event) {
+
+               String featureName = item.getText(0);
+               if (featureName.equals(ConfigureLabels.INCLUDE_INSIDE_CALL_MEMORY)) {
+                       if (table.getItem(table.getSelectionIndex() - 1)
+                                       .getText(tableTextOptionColumnIndex)
+                                       .contains(FeatureDialog.ITEM_ALL_CHECKED)) {
+                               return;
+                       }
+               } else if (featureName
+                               .equals(ConfigureLabels.INCLUDE_INSIDE_CALL_THREAD)) {
+                       if (table.getItem(table.getSelectionIndex() - 1)
+                                       .getText(tableTextOptionColumnIndex)
+                                       .contains(FeatureDialog.ITEM_ALL_CHECKED)) {
+                               return;
+                       }
+               } else if (featureName.equals(ConfigureLabels.INCLUDE_INSIDE_CALL_FILE)) {
+                       if (table.getItem(table.getSelectionIndex() - 1)
+                                       .getText(tableTextOptionColumnIndex)
+                                       .contains(FeatureDialog.ITEM_ALL_CHECKED)) {
+                               return;
+                       }
+               } else if (featureName
+                               .equals(ConfigureLabels.INCLUDE_INSIDE_CALL_NETWORK)) {
+                       if (table.getItem(table.getSelectionIndex() - 1)
+                                       .getText(tableTextOptionColumnIndex)
+                                       .contains(FeatureDialog.ITEM_ALL_CHECKED)) {
+                               return;
+                       }
+               } else if (featureName.equals(ConfigureLabels.INCLUDE_INSIDE_CALL_UI)) {
+                       if (table.getItem(table.getSelectionIndex() - 1)
+                                       .getText(tableTextOptionColumnIndex)
+                                       .contains(FeatureDialog.ITEM_ALL_CHECKED)) {
+                               return;
+                       }
+               } else if (featureName.equals(ConfigureLabels.INCLUDE_INSIDE_OPENGL)) {
+                       if (table.getItem(table.getSelectionIndex() - 1)
+                                       .getText(tableTextOptionColumnIndex)
+                                       .contains(FeatureDialog.ITEM_ALL_CHECKED)) {
+                               return;
+                       }
+               }
+
+               TargetData target = SettingDataManager.getInstance().getTarget(null);           
+               String parentFeatureName = target.getParentFeatureName(item.getText(0));
+
+               int parentIndex = -1;
+               int childCheckedCount = 0;
+               int childUnCheckedCount = 0;
+               for (int i = 0; i < table.getItemCount(); i++) {
+                       featureName = table.getItem(i).getText(0);
+                       if (featureName.equals(parentFeatureName)) {
+                               parentIndex = i;
+                               continue;
+                       }
+                       if (parentIndex > -1) {
+                               String feature = target.getParentFeatureName(table.getItem(i).getText(0));
+                               if ((feature != null) && (feature.equals(parentFeatureName))) {
+                                       if (table
+                                                       .getItem(i)
+                                                       .getText(1)
+                                                       .contains(
+                                                                       FeatureDialog.ITEM_ALL_CHECKED)) {
+                                               childCheckedCount++;
+                                       } else {
+                                               childUnCheckedCount++;
+                                       }
+                               }
+                       }
+               }
+               if (childCheckedCount > 0 && childUnCheckedCount == 0) {
+                       setCheckStatus(table.getItem(parentIndex),
+                                       FeatureDialog.ITEM_ALL_CHECKED);
+               } else if (childCheckedCount > 0 && childUnCheckedCount > 0) {
+                       setCheckStatus(table.getItem(parentIndex),
+                                       FeatureDialog.ITEM_PART_CHECKED);
+               } else if (childCheckedCount == 0 && childUnCheckedCount > 0) {
+                       setCheckStatus(table.getItem(parentIndex), CommonConstants.EMPTY);
+               }
+       }
+       // TODO:refactoring about the legacy code.
+       private void setCheckStatus(TreeInput item, String status) {
+               String optionText = item.getText().get(tableTextOptionColumnIndex);
+               if (optionText
+                               .contains(FeatureDialog.ITEM_ALL_CHECKED)) {
+                       optionText = item
+                                       .getText()
+                                       .get(tableTextOptionColumnIndex)
+                                       .replace(FeatureDialog.ITEM_ALL_CHECKED,
+                                                       CommonConstants.EMPTY);
+               } else if (optionText
+                               .contains(FeatureDialog.ITEM_PART_CHECKED)) {
+                       optionText = item
+                                       .getText()
+                                       .get(tableTextOptionColumnIndex)
+                                       .replace(FeatureDialog.ITEM_PART_CHECKED,
+                                                       CommonConstants.EMPTY);
+               }
+
+               if (status.contains(FeatureDialog.ITEM_ALL_CHECKED)) {
+                       optionText += FeatureDialog.ITEM_ALL_CHECKED;
+               } else if (status
+                               .contains(FeatureDialog.ITEM_PART_CHECKED)) {
+                       optionText += FeatureDialog.ITEM_PART_CHECKED;
+               }
+               item.getText().set(tableTextOptionColumnIndex, optionText);
+       }
+       // TODO:refactoring about the legacy code.
+       private void setCheckStatus(GridItem item, String status) {
+               String optionText = item.getText(tableTextOptionColumnIndex);
+               if (optionText
+                               .contains(FeatureDialog.ITEM_ALL_CHECKED)) {
+                       optionText = item.getText(tableTextOptionColumnIndex).replace(
+                                       FeatureDialog.ITEM_ALL_CHECKED,
+                                       CommonConstants.EMPTY);
+               } else if (optionText
+                               .contains(FeatureDialog.ITEM_PART_CHECKED)) {
+                       optionText = item.getText(tableTextOptionColumnIndex).replace(
+                                       FeatureDialog.ITEM_PART_CHECKED,
+                                       CommonConstants.EMPTY);
+               }
+
+               if (status.contains(FeatureDialog.ITEM_ALL_CHECKED)) {
+                       optionText += FeatureDialog.ITEM_ALL_CHECKED;
+               } else if (status
+                               .contains(FeatureDialog.ITEM_PART_CHECKED)) {
+                       optionText += FeatureDialog.ITEM_PART_CHECKED;
+               }
+
+               item.setText(tableTextOptionColumnIndex, optionText);
+       }
+       
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialogFeaturesTreeTableCellRenderer.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialogFeaturesTreeTableCellRenderer.java
new file mode 100644 (file)
index 0000000..f8f5163
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.toolbar.setting;
+
+import org.eclipse.nebula.widgets.grid.Grid;
+import org.eclipse.nebula.widgets.grid.GridItem;
+import org.eclipse.nebula.widgets.grid.internal.DefaultCellRenderer;
+import org.eclipse.swt.graphics.GC;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+
+public class FeatureDialogFeaturesTreeTableCellRenderer extends DefaultCellRenderer {
+       
+       private static final int LEFT_MARGIN = 4;
+       protected FeatureDialogFeaturesTreeTableToggleRenderer toggleRenderer;
+       private Grid table = null;
+
+       public FeatureDialogFeaturesTreeTableCellRenderer(Grid table) {
+               this.table = table;
+       }
+
+       public void setTree(boolean tree) {
+               super.setTree(tree);
+               if (tree) {
+                       toggleRenderer = new FeatureDialogFeaturesTreeTableToggleRenderer(table);
+                       toggleRenderer.setDisplay(getDisplay());
+               }
+       }
+
+       @Override
+       public void paint(GC gc, Object value) {
+               GridItem item = (GridItem) value;
+               gc.setFont(item.getFont(getColumn()));
+
+               // paint background
+               paintBackground(gc, item);
+
+               // draw table row
+               int x = LEFT_MARGIN;
+               x += item.getLevel() * 20;
+               toggleRenderer.setLocation(getBounds().x + x,
+                               (getBounds().height - toggleRenderer.getBounds().height) / 2 + getBounds().y);
+               toggleRenderer.paint(gc, item);
+
+       }
+       
+       private void paintBackground(GC gc, GridItem item) {
+               // background color
+               if (isSelected()) {
+                       gc.setBackground(ColorResources.SETTING_TABLE_CONTENTS_SELECTED);
+               } else if (isRowHover()){
+                       gc.setBackground(ColorResources.SETTING_TABLE_CONTENTS_HOVER);
+               } else {                        
+                       if (getRow() % 2 == 0) {
+                               gc.setBackground(ColorResources.SETTING_TABLE_CONTENTS_NORMAL_EVEN);
+                       } else {
+                               gc.setBackground(ColorResources.SETTING_TABLE_CONTENTS_NORMAL_ODD);
+                       }
+               }
+               gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width, getBounds().height);
+       
+               // font color
+               gc.setForeground(ColorResources.SETTING_TABLE_CONTENTS_FONT_COLOR);
+       }
+}
\ No newline at end of file
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialogFeaturesTreeTableToggleRenderer.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/FeatureDialogFeaturesTreeTableToggleRenderer.java
new file mode 100644 (file)
index 0000000..2643108
--- /dev/null
@@ -0,0 +1,741 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.toolbar.setting;
+
+import org.eclipse.nebula.widgets.grid.AbstractRenderer;
+import org.eclipse.nebula.widgets.grid.Grid;
+import org.eclipse.nebula.widgets.grid.GridEditor;
+import org.eclipse.nebula.widgets.grid.GridItem;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.widgets.button.radio.DARadioButton;
+import org.tizen.dynamicanalyzer.widgets.button.radio.DARadioGroup;
+import org.tizen.dynamicanalyzer.widgets.button.radio.DARadioSelectionListener;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAText;
+
+public class FeatureDialogFeaturesTreeTableToggleRenderer extends AbstractRenderer {
+       static final int intevalSize = 15;
+       private Grid table = null;
+
+       // System detail widget
+       private Composite detailSystemComposit = null;
+       private Label systemTitle = null;
+       private DAText systemTextBox = null;
+       private Label systemTextBoxLabel = null;
+       private Label systemInfo = null;
+       private GridEditor systemEditor = null;
+       
+       // Sampling detail widget
+       private Composite detailSamplingComposit = null;
+       private Label samplingTitle = null;
+       private DAText samplingTextBox = null;
+       private Label samplingTextBoxLabel = null;
+       private Label samplingInfo = null;
+       private GridEditor samplingEditor = null;
+       
+       // ScreenShot detail widget
+       private Composite detailScreenShotComposit = null;
+       private DARadioGroup radioGroup = null;
+       private DARadioButton auto = null;
+       private DARadioButton period = null;
+       private DAText screenShotTextBox = null;
+       private Label screenShotTextBoxLabel = null;
+       private Label screenShotInfo = null;
+       private GridEditor screenShotEditor = null;
+       
+       public FeatureDialogFeaturesTreeTableToggleRenderer(Grid table) {
+               super();
+               setSize(11, 9);
+               this.table = table;
+       }
+
+       // TODO:refactoring about the legacy code.
+       public void paint(GC gc, Object value) {
+               GridItem item = (GridItem) value;
+
+               Font font = item.getFont(0);
+               if (null == font) {
+                       gc.setFont(FontResources.TABLE_CELL_FONT);
+               } else {
+                       gc.setFont(font);
+               }
+
+               // parent feature
+               if (item.hasChildren()) {
+                       // draw tree image
+                       Image treeFoldImg = null;
+                       if (item.isExpanded()) {
+                               treeFoldImg = ImageResources.TREE_OPEN;
+                       } else {
+                               treeFoldImg = ImageResources.TREE_FOLD;
+                       }
+                       
+                       int foldImgOffset = (getBounds().width - ImageResources.TREE_OPEN
+                                       .getBounds().width) / 2;
+                       int x = getBounds().x + foldImgOffset;
+                       gc.drawImage(treeFoldImg, 5, getBounds().y);
+
+                       // draw checkBox image
+                       Image checkImg = null;
+                       if (item.getText(1).contains(
+                                       FeatureDialog.ITEM_ALL_CHECKED)) {
+                               checkImg = ImageResources.CHECKBOX_SELECTED;
+                       } else if (item.getText(1).contains(
+                                       FeatureDialog.ITEM_PART_CHECKED)) {
+                               checkImg = ImageResources.CHECKBOX_SELECTED_PART;
+                       } else {
+                               checkImg = ImageResources.CHECKBOX_UNSELECTED;
+                       }
+
+                       Rectangle checkImgRect = ImageResources.CHECKBOX_SELECTED
+                                       .getBounds();
+                       x += intevalSize;
+                       gc.drawImage(checkImg, x, getBounds().y - 3);
+                       x += checkImgRect.width + intevalSize;
+
+                       // draw text : feature name
+                       gc.drawText(item.getText(), x, getBounds().y - 2, true);
+                       
+               } else {
+                       Rectangle r = ImageResources.TREE_OPEN.getBounds();
+                       int offset = (getBounds().width - r.width) / 2;
+                       int x = getBounds().x + offset;
+
+                       // detail feature
+                       if (isDetailFeature(item) == true) {
+                               updateDetails(gc, item);                        
+                               
+                       } else {        // sub feature
+                               // draw checkBox image
+                               Image checkImg = null;
+                               if (item.getText(1).contains(
+                                               FeatureDialog.ITEM_ALL_CHECKED)) {
+                                       checkImg = ImageResources.CHECKBOX_SELECTED;
+                               } else if (item.getText(1).contains(
+                                               FeatureDialog.ITEM_PART_CHECKED)) {
+                                       checkImg = ImageResources.CHECKBOX_SELECTED_PART;
+                               } else {
+                                       checkImg = ImageResources.CHECKBOX_UNSELECTED;
+                               }
+                               Rectangle checkImgRect = ImageResources.CHECKBOX_SELECTED
+                                               .getBounds();
+                               x += intevalSize;
+                               gc.drawImage(checkImg, x, getBounds().y - 3);
+                               x += checkImgRect.width + intevalSize;
+
+                               // draw text : feature name
+                               gc.drawText(item.getText(), x, getBounds().y - 2, true);
+                       }
+               }
+       }
+
+       private boolean isDetailFeature(GridItem item) {
+               SettingDataManager setting = SettingDataManager.getInstance();
+               TargetData target = setting.getTarget(null);
+               FeatureData feature = target.getAvailableFeature(item.getText());
+               if (FeatureData.FEATURE_TYPE_DETAIL == feature.getFeatureType()) {
+                       return true;
+               }
+               return false;
+       }
+       
+       private void updateDetails(GC gc, GridItem item) {
+               if (ConfigureLabels.SYSTEM_INFOMATION_SAMPLING_PERIODIC.equals(item.getText())) {
+                       updateSystemDetails(gc, item);
+               } else  if (ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC.equals(item.getText())) {
+                       updateSamplingDetails(gc, item);        
+               } else if (ConfigureLabels.SNAPSHOT_PERIODIC_AUTO.equals(item.getText())) {
+                       updateScreenShotDetails(gc, item);
+               }
+               
+               // check is running
+               checkRunningState();
+       }
+
+       private void initSystemDetailWidget() {
+               if (null != systemTitle) {
+                       systemTitle.dispose();
+                       systemTitle = null;
+               }
+               if (null != systemTextBox) {
+                       systemTextBox.getControl().dispose();
+                       systemTextBox = null;
+               }
+               if (null != systemTextBoxLabel) {
+                       systemTextBoxLabel.dispose();
+                       systemTextBoxLabel = null;
+               }
+               if (null != systemInfo) {
+                       systemInfo.dispose();
+                       systemInfo = null;
+               }
+               if (null != systemEditor) {
+                       systemEditor.dispose();
+                       systemEditor = null;
+               }
+       }
+       
+       private void initSamplingDetailWidget() {
+               if (null != samplingTitle) {
+                       samplingTitle.dispose();
+                       samplingTitle = null;
+               }
+               if (null != samplingTextBox) {
+                       samplingTextBox.getControl().dispose();
+                       samplingTextBox = null;
+               }
+               if (null != samplingTextBoxLabel) {
+                       samplingTextBoxLabel.dispose();
+                       samplingTextBoxLabel = null;
+               }
+               if (null != samplingInfo) {
+                       samplingInfo.dispose();
+                       samplingInfo = null;
+               }
+               if (null != samplingEditor) {
+                       samplingEditor.dispose();
+                       samplingEditor = null;
+               }
+       }
+       
+       private void initSnapshotDetailWidget() {
+               if (null != radioGroup) {
+                       radioGroup = null;
+               }
+               if (null != auto) {
+                       auto.dispose();
+                       auto = null;
+               }
+               if (null != period) {
+                       period.dispose();
+                       period = null;
+               }
+
+               if (null != screenShotTextBox) {
+                       screenShotTextBox.getControl().dispose();
+                       screenShotTextBox = null;
+               }
+               
+               if (null != screenShotTextBoxLabel) {
+                       screenShotTextBoxLabel.dispose();
+                       screenShotTextBoxLabel = null;
+               }
+               if (null != screenShotInfo) {
+                       screenShotInfo.dispose();
+                       screenShotInfo = null;
+               }
+
+               if (null != screenShotEditor) {
+                       screenShotEditor.dispose();
+                       screenShotEditor = null;
+               }
+       }
+       
+       private void updateSystemDetails(GC gc, GridItem item) {
+               initSystemDetailWidget();
+               
+               if (detailSystemComposit == null) {
+                       detailSystemComposit = new Composite(table, SWT.NONE);
+                       detailSystemComposit.setLayout(new FormLayout());
+                       // TODO : location
+               }
+
+               // label
+               systemTitle = new Label(detailSystemComposit, SWT.TRANSPARENT);
+               systemTitle.setText(ConfigureLabels.SAMPLING);
+               FormData data = new FormData();
+               data.top = new FormAttachment(0, 5);
+               data.left = new FormAttachment(0, 0);
+               data.width = 100;
+               data.height = 16;
+               systemTitle.setLayoutData(data);
+               systemTitle.setForeground(ColorResources.SETTING_COLOR);
+               systemTitle.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+
+               // text box
+               systemTextBox = new DAText(detailSystemComposit, SWT.SINGLE);
+               data = new FormData();
+               data.top = new FormAttachment(0, 3);
+               data.left = new FormAttachment(systemTitle, 5);
+               data.width = 50;
+               data.height = 13;
+               systemTextBox.setLayoutData(data);
+               
+               systemTextBox.setForeground(ColorResources.SETTING_COLOR);
+               systemTextBox.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+               systemTextBox.setText(getOptionText(item, ConfigureLabels.SAMPLING));
+               
+               if (isTableSelectedFeature(item.getParentItem().getText()) == true) {
+                       systemTextBox.getControl().setEnabled(true);
+               } else {
+                       systemTextBox.getControl().setEnabled(false);
+               }
+               systemTextBox.getControl().addKeyListener(systemKeyListener);
+
+               // label
+               systemTextBoxLabel = new Label(detailSystemComposit, SWT.TRANSPARENT); 
+               systemTextBoxLabel.setText(ConfigureLabels.MS);
+               data = new FormData();
+               data.top = new FormAttachment(0, 5);
+               data.left = new FormAttachment(systemTextBox.getControl(), 5);
+               data.width = 15;
+               data.height = 16;
+               systemTextBoxLabel.setLayoutData(data);
+               systemTextBoxLabel.setForeground(ColorResources.SETTING_COLOR);
+               systemTextBoxLabel.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+               
+               // waring label
+               systemInfo = new Label(detailSystemComposit, SWT.TRANSPARENT);
+               data = new FormData();
+               data.top = new FormAttachment(0, 5);
+               data.left = new FormAttachment(systemTextBoxLabel, 5);
+               data.width = 200;
+               data.height = 16;
+               systemInfo.setLayoutData(data);
+               systemInfo.setForeground(ColorResources.RED);
+               systemInfo.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+
+               systemEditor = new GridEditor(table);
+               systemEditor.horizontalAlignment = SWT.LEFT;
+               systemEditor.grabHorizontal = true;
+               systemEditor.setEditor(detailSystemComposit, item, 0);
+               detailSystemComposit.layout(true);
+       }
+       
+       private void updateSamplingDetails(GC gc, GridItem item) {
+               initSamplingDetailWidget();
+
+               if (detailSamplingComposit == null) {
+                       detailSamplingComposit = new Composite(table, SWT.NONE);
+                       detailSamplingComposit.setLayout(new FormLayout());
+                       // TODO : location
+               }
+
+               // label
+               samplingTitle = new Label(detailSamplingComposit, SWT.TRANSPARENT);
+               samplingTitle.setText(ConfigureLabels.SAMPLING);
+               FormData data = new FormData();
+               data.top = new FormAttachment(0, 5);
+               data.left = new FormAttachment(0, 0);
+               data.width = 100;
+               data.height = 16;
+               samplingTitle.setLayoutData(data);
+               samplingTitle.setForeground(ColorResources.SETTING_COLOR);
+               samplingTitle.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+
+               // text box
+               samplingTextBox = new DAText(detailSamplingComposit, SWT.SINGLE);
+               data = new FormData();
+               data.top = new FormAttachment(0, 3);
+               data.left = new FormAttachment(samplingTitle, 5);
+               data.width = 50;
+               data.height = 13;
+               samplingTextBox.setLayoutData(data);
+               
+               samplingTextBox.setForeground(ColorResources.SETTING_COLOR);
+               samplingTextBox.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+               samplingTextBox.setText(getOptionText(item, ConfigureLabels.SAMPLING));
+               
+               if (isTableSelectedFeature(item.getParentItem().getText()) == true) {
+                       samplingTextBox.getControl().setEnabled(true);
+               } else {
+                       samplingTextBox.getControl().setEnabled(false);
+               }
+               samplingTextBox.getControl().addKeyListener(samplingKeyListener);
+               
+               if (AnalyzerManager.isRunning()) {
+                       samplingTextBox.getControl().setEnabled(false);
+               }
+               
+               // label
+               samplingTextBoxLabel = new Label(detailSamplingComposit, SWT.TRANSPARENT);
+               samplingTextBoxLabel.setText(ConfigureLabels.MS);
+               data = new FormData();
+               data.top = new FormAttachment(0, 5);
+               data.left = new FormAttachment(samplingTextBox.getControl(), 5);
+               data.width = 15;
+               data.height = 16;
+               samplingTextBoxLabel.setLayoutData(data);
+               samplingTextBoxLabel.setForeground(ColorResources.SETTING_COLOR);
+               samplingTextBoxLabel.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+               
+               // waring label
+               samplingInfo = new Label(detailSamplingComposit, SWT.TRANSPARENT);
+               data = new FormData();
+               data.top = new FormAttachment(0, 5);
+               data.left = new FormAttachment(samplingTextBoxLabel, 5);
+               data.width = 200;
+               data.height = 16;
+               samplingInfo.setLayoutData(data);
+               samplingInfo.setForeground(ColorResources.RED);
+               samplingInfo.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+
+               samplingEditor = new GridEditor(table);
+               samplingEditor.horizontalAlignment = SWT.LEFT;
+               samplingEditor.grabHorizontal = true;
+               samplingEditor.setEditor(detailSamplingComposit, item, 0);
+               detailSamplingComposit.layout(true);
+       }
+       
+       private void updateScreenShotDetails(GC gc, GridItem item) {
+               initSnapshotDetailWidget();
+               
+               if (detailScreenShotComposit == null) {
+                       detailScreenShotComposit = new Composite(table, SWT.NONE);
+                       detailScreenShotComposit.setLayout(new FormLayout());
+                       // TODO : location
+               }
+
+               radioGroup = new DARadioGroup();
+               auto = new DARadioButton(detailScreenShotComposit, SWT.NONE);
+               FormData data = new FormData();
+               data.top = new FormAttachment(0, 3);
+               data.left = new FormAttachment(0, 0);
+               data.width = 130;
+               data.height = 16;
+               auto.setLayoutData(data);
+               auto.setForeground(ColorResources.SETTING_COLOR);
+               auto.setBackground(ColorResources.DIALOG_BG_UPPER);
+               auto.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+               auto.setText(ConfigureLabels.SNAPSHOT_PERIODIC_AUTO);
+               auto.addSelectionListener(autoScreenShotButtonListener);
+               radioGroup.addChild(auto);
+
+               period = new DARadioButton(detailScreenShotComposit, SWT.NONE);
+               data = new FormData();
+               data.top = new FormAttachment(0, 3);
+               data.left = new FormAttachment(auto, 1);
+               data.width = 90;
+               data.height = 16;
+               period.setLayoutData(data);
+               period.setForeground(ColorResources.SETTING_COLOR);
+               period.setBackground(ColorResources.DIALOG_BG_UPPER);
+               period.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+               period.setText(ConfigureLabels.PERIODIC);
+               period.addSelectionListener(periodScreenShotButtonListener);
+               radioGroup.addChild(period);
+
+               boolean value = (getOptionText(item, ConfigureLabels.AUTO).equals("1")? true : false);
+               if (value == true) {
+                       radioGroup.setSelection(auto);
+               } else {
+                       radioGroup.setSelection(period);
+               }
+                       
+               // text box
+               screenShotTextBox = new DAText(detailScreenShotComposit, SWT.SINGLE);
+               data = new FormData();
+               data.top = new FormAttachment(0, 3);
+               data.left = new FormAttachment(period, 5);
+               data.width = 50;
+               data.height = 13;
+               screenShotTextBox.setLayoutData(data);
+               
+               screenShotTextBox.setForeground(ColorResources.SETTING_COLOR);
+               screenShotTextBox.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+               
+               // set value
+               screenShotTextBox.setText(getOptionText(item, ConfigureLabels.SAMPLING));
+               
+               // check radio button
+               if (period.isSelected() == true) {
+                       screenShotTextBox.getControl().setEnabled(true);
+               } else {
+                       screenShotTextBox.getControl().setEnabled(false);
+               }
+               screenShotTextBox.getControl().addKeyListener(screenShotKeyListener);
+
+               // label
+               screenShotTextBoxLabel = new Label(detailScreenShotComposit, SWT.TRANSPARENT);
+               screenShotTextBoxLabel.setText(ConfigureLabels.SECOND);
+               data = new FormData();
+               data.top = new FormAttachment(0, 5);
+               data.left = new FormAttachment(screenShotTextBox.getControl(), 5);
+               data.width = 15;
+               data.height = 16;
+               screenShotTextBoxLabel.setLayoutData(data);
+               screenShotTextBoxLabel.setForeground(ColorResources.SETTING_COLOR);
+               screenShotTextBoxLabel.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+               
+               // waring label
+               screenShotInfo = new Label(detailScreenShotComposit, SWT.TRANSPARENT);
+               data = new FormData();
+               data.top = new FormAttachment(0, 5);
+               data.left = new FormAttachment(screenShotTextBoxLabel, 5);
+               data.width = 200;
+               data.height = 16;
+               screenShotInfo.setLayoutData(data);
+               screenShotInfo.setForeground(ColorResources.RED);
+               screenShotInfo.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+               
+               if (isTableSelectedFeature(item.getParentItem().getText()) == true) {
+                       detailScreenShotComposit.setEnabled(true);
+               } else {
+                       detailScreenShotComposit.setEnabled(false);
+                       screenShotTextBox.getControl().setEnabled(false);
+               }
+               
+               screenShotEditor = new GridEditor(table);
+               screenShotEditor.horizontalAlignment = SWT.LEFT;
+               screenShotEditor.grabHorizontal = true;
+               screenShotEditor.setEditor(detailScreenShotComposit, item, 0);
+               detailScreenShotComposit.layout(true);
+       }
+       
+       private void checkRunningState() {
+               if (DACommunicator.isRunning()) {
+                       if (null != detailSystemComposit) {
+                               detailSystemComposit.setEnabled(false);
+                       }
+                       if (null != detailSamplingComposit) {
+                               detailSamplingComposit.setEnabled(false);
+                       }
+
+                       if (null != detailScreenShotComposit) {
+                               detailScreenShotComposit.setEnabled(false);
+                       }
+               }
+       }
+       
+       private boolean isTableSelectedFeature(String featureName) {
+               GridItem[] list = table.getItems();
+               for (int i = 0; i < list.length; i++) {
+                       if (featureName.equals(list[i].getText(0))) {
+                               String optionText = list[i].getText(1);
+                               if (optionText.contains(FeatureDialog.ITEM_ALL_CHECKED) 
+                                               || optionText.contains(FeatureDialog.ITEM_PART_CHECKED)) {
+                                       return true;
+                               } else {
+                                       return false;
+                               }
+                       }
+               }
+               return false;
+       }
+       
+       private GridItem getGridItem(String featureName) {
+               GridItem[] list = table.getItems();
+               for (int i = 0; i < list.length; i++) {
+                       if (featureName.equals(list[i].getText(0))) {
+                               return list[i];
+                       }
+               }
+               return null;
+       }
+       
+       // TODO:refactoring about the legacy code.
+       private boolean checkValidInputText(String featuresName, DAText textBox, Label info) {
+               if (textBox.getText().isEmpty()) {
+                       info.setText(ConfigureLabels.VALUE_IS_EMPTY);
+                       SettingDialogManager.getInstance().updateFeatureButtonStatus(false, table);
+                       return false;
+               } else if (!AnalyzerUtil.isInteger(textBox.getText())) {
+                       info.setText(ConfigureLabels.YOU_HAVE_TO_SET_CHARACTER);
+                       removeInputValue(textBox);
+                       return false;
+               }
+               int value = Integer.parseInt(textBox.getText());
+               if (featuresName.equals(ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC)) {
+                       if (value < 0 || 100 < value) {
+                               info.setText(ConfigureLabels.VALUE_SHOULD_BE_IN_RANGE_FROM_1_TO_100);
+                               return false;
+                       }
+               }
+       
+               if (featuresName.equals(ConfigureLabels.SYSTEM_INFOMATION_SAMPLING_PERIODIC)
+                               || featuresName.equals(ConfigureLabels.PERIODIC)) {
+                       if (value < 0 || 1000 < value) {
+                               info.setText(ConfigureLabels.VALUE_SHOULD_BE_IN_RANGE_FROM_1_TO_100);
+                               return false;
+                       }
+               }
+       
+               if (featuresName.equals(ConfigureLabels.SYSTEM_INFOMATION_SAMPLING_PERIODIC)) {
+                       if (value % 10 != 0) {
+                               info.setText(ConfigureLabels.YOU_HAVE_TO_SET_MULTIPLE_OF_10MS);
+                               SettingDialogManager.getInstance().updateFeatureButtonStatus(false, table);
+                               return false;
+                       }
+               }
+       
+               info.setText(CommonConstants.EMPTY);
+               return true;
+       }
+       
+       private void removeInputValue(DAText textBox) {
+               if (textBox.getText().length() > 0) {
+                       StringBuffer textBuffer = new StringBuffer(textBox.getText());
+                       textBuffer.deleteCharAt(textBuffer.length() - 1);
+                       textBox.setText(textBuffer.toString());
+                       textBox.getControl().setSelection(textBuffer.length());
+               }
+       }
+
+       private String getOptionText(GridItem item, String optionName) {
+               String value = null;
+               if (item.getText(1).contains(optionName)) {
+                       String[] optionList = item.getText(1).split(optionName);
+                       if (optionList.length > 1) {
+                               if (optionList[1].contains(CommonConstants.COMMA)) {
+                                       String[] optionList2 = optionList[1]
+                                                       .split(CommonConstants.COMMA);
+                                       value = optionList2[0];
+                               } else {
+                                       value = optionList[1];
+                               }
+                       }
+               }
+               return value;
+       }
+
+       private void setOptionText(GridItem item, String optionName, String value) {
+               StringBuffer buffer = new StringBuffer();
+               String optionText = item.getText(1);
+               if (optionText.contains(optionName)) {
+                       String[] optionList = item.getText(1).split(optionName);
+                       if (optionList.length > 1) {
+                               buffer.append(optionList[0] + optionName + value);
+                                                               
+                               if (optionList[1].contains(CommonConstants.COMMA)) {
+                                       String[] optionList2 = optionList[1].split(CommonConstants.COMMA);
+                                       for (int i = 1; i < optionList2.length; i++) {
+                                               buffer.append(CommonConstants.COMMA + optionList2[i]);
+                                       }
+                               }
+                       }
+               }
+               item.setText(1, buffer.toString());
+       }
+       
+       private DARadioSelectionListener autoScreenShotButtonListener = new DARadioSelectionListener() {
+
+               @Override
+               public void handleSelectionEvent(DARadioButton radio) {
+                       if (auto.isSelected()) {
+                               screenShotTextBox.getControl().setEnabled(false);
+                               setOptionText(getGridItem(ConfigureLabels.SNAPSHOT_PERIODIC_AUTO), 
+                                               ConfigureLabels.AUTO, "1");
+                       }
+                       auto.setEnabled(true);
+                       SettingDialogManager.getInstance().updateFeatureButtonStatus(null, table);
+               }
+       };
+
+       private DARadioSelectionListener periodScreenShotButtonListener = new DARadioSelectionListener() {
+
+               @Override
+               public void handleSelectionEvent(DARadioButton radio) {
+                       if (period.isSelected()) {
+                               screenShotTextBox.getControl().setEnabled(true);
+                               setOptionText(getGridItem(ConfigureLabels.SNAPSHOT_PERIODIC_AUTO), 
+                                               ConfigureLabels.AUTO, "0");
+                       }
+                       auto.setEnabled(false);
+                       SettingDialogManager.getInstance().updateFeatureButtonStatus(null, table);
+               }
+       };
+       
+       private KeyListener systemKeyListener = new KeyListener() {
+
+               @Override
+               public void keyReleased(KeyEvent e) {
+                       if (checkValidInputText(ConfigureLabels.SYSTEM_INFOMATION_SAMPLING_PERIODIC, 
+                                       systemTextBox, systemInfo) == true) {
+                               setOptionText(getGridItem(ConfigureLabels.SYSTEM_INFOMATION_SAMPLING_PERIODIC), 
+                                               ConfigureLabels.SAMPLING, systemTextBox.getText());
+                               SettingDialogManager.getInstance().updateFeatureButtonStatus(null, table);
+                       }
+               }
+
+               @Override
+               public void keyPressed(KeyEvent e) {
+               }
+       };
+
+       private KeyListener samplingKeyListener = new KeyListener() {
+
+               @Override
+               public void keyReleased(KeyEvent e) {
+                       if (checkValidInputText(ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC, 
+                                       samplingTextBox, samplingInfo) == true) {
+                               setOptionText(getGridItem(ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC),        
+                                               ConfigureLabels.SAMPLING, samplingTextBox.getText());
+                               SettingDialogManager.getInstance().updateFeatureButtonStatus(null, table);
+                       }
+               }
+
+               @Override
+               public void keyPressed(KeyEvent e) {
+               }
+       };
+       
+       private KeyListener screenShotKeyListener = new KeyListener() {
+
+               @Override
+               public void keyReleased(KeyEvent e) {
+                       if (checkValidInputText(ConfigureLabels.PERIODIC, 
+                                       screenShotTextBox, screenShotInfo) == true) {
+                               setOptionText(getGridItem(ConfigureLabels.SNAPSHOT_PERIODIC_AUTO),      
+                                               ConfigureLabels.SAMPLING, screenShotTextBox.getText());
+                               SettingDialogManager.getInstance().updateFeatureButtonStatus(null, table);
+                       }
+               }
+
+               @Override
+               public void keyPressed(KeyEvent e) {
+               }
+       };
+
+       
+       /**
+        * {@inheritDoc}
+        */
+       public Point computeSize(GC gc, int wHint, int hHint, Object value) {
+               return new Point(11, 9);
+       }
+
+}
\ No newline at end of file
index a412615..61f0a15 100644 (file)
  */
 package org.tizen.dynamicanalyzer.ui.toolbar.setting;
 
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.tizen.dynamicanalyzer.common.path.PathManager;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.model.DeviceInfo;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
+import org.tizen.dynamicanalyzer.util.Logger;
+
 public class SettingDataManager {
        
+       private static SettingDataManager instance = null;
+       
+       public static final String SETTING_FILE_NAME = "setting.csv";
+       public static final String FEATUER_FILE_NAME = "feature.csv";
+       public static final String TEMPLATE_FILE_NAME = "template.csv";
+       
        // key name in setting file
        public static final String KEY_TARGET_LIST = "Target List";
        public static final String KEY_SELECTED_TARGET = "Selected Target";
@@ -34,6 +63,491 @@ public class SettingDataManager {
        public static final String KEY_SELECTED_FEATURE_LIST = "Selected FeatureList";
        public static final String KEY_AVAILABLE_CHART_LIST = "Available Chart List";
        public static final String KEY_SELECTED_CHART_LIST = "Selected Chart List";
-       public static final String KEY_SHOW_INITIAL = "Show initial";
+       public static final String KEY_SHOW_INITIAL = "Show Initial";
        public static final String AUTO_STOP = "Auto Stop";
+       
+       // init selected information : for revert button
+       private String initTarget = null;
+       private boolean initShowInitial = false;
+       private boolean initAutoStop = false;
+       
+       // setting information
+       private String selectedTarget = null;
+       private List<String> selectedChartList = null;          // TODO : remove?
+       private boolean showInitial = false;
+       private boolean autoStop = false;
+       
+       // available target list
+       private Map<String, TargetData> targetListMap = null;
+       
+       // TODO : check additional property
+       private String platform = null;
+       private long internalLogLevel = 0;
+
+       private SettingDataManager() {
+               parseSettingData(FEATUER_FILE_NAME);
+               parseSettingData(TEMPLATE_FILE_NAME);
+               parseSettingData(SETTING_FILE_NAME);
+       }
+
+       public synchronized static SettingDataManager getInstance() {
+               if (instance == null) {
+                       instance = new SettingDataManager();
+               }
+               return instance;
+       }
+       
+       private void parseSettingData(String fileName) {
+               File csv = new File(PathManager.DA_CONFIG_FOLDER_PATH + File.separator + fileName);
+               BufferedReader in = null;
+               String content = null;
+               try {
+                       in = new BufferedReader(new FileReader(csv));
+                       while (null != (content = in.readLine())) {
+                               if (SETTING_FILE_NAME.equals(fileName)) {
+                                       initSettingData(content);
+                               } else if (FEATUER_FILE_NAME.equals(fileName)) {
+                                       initFeatureData(content);
+                               } else if (TEMPLATE_FILE_NAME.equals(fileName)) {
+                                       initTemplateData(content);                                      
+                               } else {
+                                       Logger.debug("unknown setting file : " + fileName);
+                               }
+                       }
+               } catch (FileNotFoundException e) {
+                       e.printStackTrace();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               } finally {
+                       CommonUtil.tryClose(in);
+               }
+       }
+       
+       private void initSettingData(String readData) {
+               String list[] = readData.split(CommonConstants.COMMA);
+               if (list[0].equals(KEY_TARGET_LIST)) {
+                       makeTargetData(list);
+               } else if (list[0].equals(KEY_SELECTED_TARGET)) {
+                       selectedTarget = list[1];
+                       initTarget = new String(list[1]);
+               } else if (list[0].equals(KEY_SELECTED_TEMPLATE)) {
+                       setSelectedTemplate(list);
+               } else if (list[0].equals(KEY_SELECTED_FEATURE_LIST)) {
+                       makeSelectedFeatureList(list);
+               } else if (list[0].equals(KEY_AVAILABLE_CHART_LIST)) {
+                       makeAvailableChartList(list);
+               } else if (list[0].equals(KEY_SELECTED_CHART_LIST)) {
+                       makeChartList(getSelectedChartList(), list);
+               } else if (list[0].equals(KEY_SHOW_INITIAL)) {
+                       showInitial = Boolean.parseBoolean(list[1]);
+                       initShowInitial = Boolean.parseBoolean(list[1]);
+               } else if (list[0].equals(AUTO_STOP)) {
+                       autoStop = Boolean.parseBoolean(list[1]);
+                       initAutoStop = Boolean.parseBoolean(list[1]);
+               } else {
+                       if (null != list[0]) {
+                               Logger.debug("unknown setting key : " + list[0]);
+                       }
+               }
+       }
+       
+       private void makeTargetData(String list[]) {
+               if (list != null) {
+                       Map<String, TargetData> map = getTargetListMap();               
+                       for (int i = 1; i < list.length; i++) {
+                               if (isTarget(list[i]) == false) {
+                                       map.put(list[i], new TargetData(list[i]));
+                               } // else do nothing
+                       }
+               } // else do nothing
+       }
+       
+       private void setSelectedTemplate(String list[]) {
+               if (list != null) {
+                       TargetData target = getAndCreateTarget(list[1]);
+                       target.setSelectedTemplate(list[2]);
+               } // else do nothing
+       }
+       
+       private void makeSelectedFeatureList(String list[]) {
+               if (list != null) {
+                       TargetData target = getAndCreateTarget(list[1]);
+                       target.makeSelectedFeatureList(list);
+               } // else do nothing
+       }
+               
+       private void makeAvailableChartList(String list[]) {
+               if (list != null) {
+                       TargetData target = getAndCreateTarget(list[1]);
+                       target.makeAvailableChartList(list);
+               } // else do nothing
+       }
+       
+       private void makeChartList(List<String> chartList, String list[]) {
+               if (list != null) {
+                       for (int i = 1; i < list.length; i++) {
+                               chartList.add(list[i]);
+                       }
+               } // else do nothing
+       }
+               
+       private void initFeatureData(String readData) {         
+               String list[] = readData.split(CommonConstants.COMMA, -1);
+               if (list != null) {
+                       TargetData target = getAndCreateTarget(list[0]);
+                       target.makeAvailableFeatureListMap(list);
+               }
+       }
+       
+       private void initTemplateData(String readData) {
+               String list[] = readData.split(CommonConstants.COMMA, -1);
+               if (list != null) {
+                       TargetData target = getAndCreateTarget(list[0]);
+                       target.makeAvailableTemplateListMap(list);
+               } // else do nothing
+       }
+
+       /**
+        * Write the setting information in the setting file.
+        */
+       private void writeSettingDataToFile() {
+               File csv = new File(PathManager.DA_CONFIG_FOLDER_PATH + File.separator + SETTING_FILE_NAME);
+               
+               FileWriter fileWriter = null;
+               BufferedWriter buffWriter = null;
+               PrintWriter printWriter = null;
+               try {
+                       fileWriter = new FileWriter(csv);
+                       buffWriter = new BufferedWriter(fileWriter);
+                       printWriter = new PrintWriter(buffWriter);
+
+                       printWriter.println(writeTargetData());
+                       printWriter.println(KEY_SELECTED_TARGET + CommonConstants.COMMA + selectedTarget);
+                       printWriter.println(writeChartList(getSelectedChartList(), KEY_SELECTED_CHART_LIST));
+                       printWriter.println(KEY_SHOW_INITIAL + CommonConstants.COMMA + String.valueOf(showInitial));                    
+                       printWriter.println(AUTO_STOP + CommonConstants.COMMA + String.valueOf(autoStop));
+                                               
+                       // target : selected Template, selected feature, available chart list
+                       Map<String, TargetData> map = getTargetListMap();       
+                       for (Map.Entry<String, TargetData> entry : map.entrySet()) {
+                               TargetData target = entry.getValue();
+                               target.writeSelectedData(printWriter);
+                       }
+
+                       printWriter.checkError();                       
+               } catch (IOException e) {
+                       e.printStackTrace();
+               } finally {
+                       CommonUtil.tryClose(fileWriter, buffWriter, printWriter);
+               }
+       }
+               
+       private String writeTargetData() {
+               Map<String, TargetData> map = getTargetListMap();
+               Set<String> targetNameList = map.keySet();
+               StringBuffer buffer = new StringBuffer();
+               buffer.append(KEY_TARGET_LIST); 
+               
+               Iterator<String> iter = targetNameList.iterator();
+               while(iter.hasNext()) {
+                       buffer.append(CommonConstants.COMMA + iter.next());
+               }
+               return buffer.toString();
+       }
+       
+       private String writeChartList(List<String> list, String key) {
+               StringBuffer buffer = new StringBuffer();
+               buffer.append(key + CommonConstants.COMMA); 
+               
+               for (int i = 0; i < list.size(); i++) {
+                       if (i < list.size() -1) {
+                               buffer.append(list.get(i) + CommonConstants.COMMA);
+                       } else {
+                               buffer.append(list.get(i));
+                       }
+               }
+               return buffer.toString();
+       }
+       
+       public String getSelectedTarget() {
+               return selectedTarget;
+       }
+       
+       public void setSelectedTarget(String selectedTarget) {
+               this.selectedTarget = selectedTarget;
+       }
+
+       public boolean isShowInitial() {
+               return showInitial;
+       }
+
+       public void setShowInitial(boolean showInitial) {
+               this.showInitial = showInitial;
+       }
+
+       public boolean isAutoStop() {
+               return autoStop;
+       }
+
+       public void setAutoStop(boolean autoStop) {
+               this.autoStop = autoStop;
+       }
+
+       public List<String> getSelectedChartList() {
+               if (selectedChartList == null) {
+                       selectedChartList = new ArrayList<String>();
+               }
+               return selectedChartList;
+       }
+       
+       public void setSelectedChartList(List<String> selectedChartList) {
+               if (this.selectedChartList != null) {
+                       selectedChartList.clear();
+               }
+               this.selectedChartList = selectedChartList;
+       }
+
+       public Map<String, TargetData> getTargetListMap() {
+               if (targetListMap == null) {
+                       targetListMap = new LinkedHashMap<String, TargetData>();
+               }
+               return targetListMap;
+       }
+       
+       public TargetData getTarget(String targetName) {
+               Map<String, TargetData> map = getTargetListMap();
+               if (targetName == null) {
+                       return map.get(selectedTarget);
+               } else if (isTarget(targetName) == true) {
+                       return map.get(targetName);
+               } // else : return null         
+               return null;
+       }
+       
+       public boolean isTarget(String targetName) {
+               Map<String, TargetData> map = getTargetListMap();               
+               if (map.get(targetName) == null) {
+                       return false;
+               }
+               return true;
+       }
+
+       private TargetData getAndCreateTarget(String targetName) {
+               Map<String, TargetData> map = getTargetListMap();               
+               TargetData target = null;
+               
+               if (isTarget(targetName) == false) {
+                       target = new TargetData(targetName);
+                       map.put(targetName, target);                            
+               } else {
+                       target = map.get(targetName);
+               }
+               return target;
+       }
+       
+       /**
+        * Get page information shown on the screen.
+        * 
+        * @param targetName            targetName
+        * 
+        * @return      The page name list to be shown on the screen.
+        */
+       public Set<String> getSelectedPageList(String targetName) {
+               String searchTargetName = validateTargetName(targetName);
+               if (isTarget(searchTargetName) == true) {
+                       Map<String, TargetData> map = getTargetListMap();               
+                       TargetData target = map.get(searchTargetName);
+                       return target.getSelectedPageList();
+               } else {
+                       Logger.debug("Does not exist targetName : " + searchTargetName);
+               }
+               return null;
+       }
+
+       /**
+        * Get chart information shown on the screen.
+        * 
+        * @param targetName            targetName
+        * 
+        * @return      The chart name list to be shown on the screen.
+        */
+       public Set<String> getSelectedChartList(String targetName) {
+               String searchTargetName = validateTargetName(targetName);
+               if (isTarget(searchTargetName) == true) {
+                       Map<String, TargetData> map = getTargetListMap();               
+                       TargetData target = map.get(searchTargetName);
+                       return target.getSelectedChartList();
+               } else {
+                       Logger.debug("Does not exist targetName : " + searchTargetName);
+               }
+               return null;
+       }
+
+       private String validateTargetName(String targetName) {
+               if (targetName == null) {
+                       return selectedTarget;
+               } else {
+                       return targetName;
+               }
+       }
+       
+       public boolean changedFeatures() {
+               // check target
+               if (initTarget.equals(selectedTarget) == false) {
+                       return true;
+               }
+
+               // check showInitial
+               if (initShowInitial != showInitial) {
+                       return true;
+               }
+               
+               // check autoStop
+               if (initAutoStop != autoStop) {
+                       return true;
+               }
+
+               // check template, feature
+               Map<String, TargetData> map = getTargetListMap();       
+               for (Map.Entry<String, TargetData> entry : map.entrySet()) {
+                       TargetData target = entry.getValue();
+                       if (target.changedFeatures() == true) {
+                               return true;
+                       }
+               }
+               return false;
+       }
+       
+       public void applySettingData() {
+               // write setting file
+               writeSettingDataToFile();
+               
+               // update init setting data
+               initTarget = selectedTarget;
+               initShowInitial = showInitial;
+               initAutoStop = autoStop;
+               
+               // update init template, feature
+               Map<String, TargetData> map = getTargetListMap();       
+               for (Map.Entry<String, TargetData> entry : map.entrySet()) {
+                       TargetData target = entry.getValue();
+                       target.applySettingData();
+               }
+       }
+
+       public void revertSettingData() {
+               // revert setting data
+               selectedTarget = initTarget;
+               showInitial = initShowInitial;
+               autoStop = initAutoStop;
+               
+               // revert template, feature
+               Map<String, TargetData> map = getTargetListMap();       
+               for (Map.Entry<String, TargetData> entry : map.entrySet()) {
+                       TargetData target = entry.getValue();
+                       target.revertSettingData();
+               }
+       }
+
+       public String getPlatform() {
+               if (null == platform || platform.isEmpty()
+                               || platform.equals(ConfigureLabels.PLATFORM_ETC)) {
+                       return null;
+               } else {
+                       return platform;
+               }
+       }
+
+       public long getInternalLogLevel() {
+               return internalLogLevel;
+       }
+
+       public void writeSelectedChartList(List<String> selectedChartList) {
+               setSelectedChartList(selectedChartList);
+               
+               // write setting file
+               writeSettingDataToFile();               
+       }
+
+       public void writeAvailableChartList(String targetName, List<String> availableChartList) {
+               String searchTargetName = validateTargetName(targetName);
+               if (isTarget(searchTargetName) == true) {
+                       Map<String, TargetData> map = getTargetListMap();               
+                       TargetData target = map.get(searchTargetName);
+                       target.setAvailableChartList(availableChartList);
+               } else {
+                       Logger.debug("Does not exist targetName : " + searchTargetName);
+               }
+               
+               // write setting file
+               writeSettingDataToFile();               
+       }
+
+       public long getSelectedFeatureSwapValue() {
+               long state = 0;
+               TargetData target = SettingDataManager.getInstance().getTarget(null);
+               List<FeatureValueData> featureList = target.getSelectedFeatureList();
+               
+               for (int i = 0; i < featureList.size(); i++) {
+                       state |= target.getSelectedFeatureSwapValue(featureList.get(i).getFeatureName());
+               }
+               return state;
+       }
+       
+       public long getConfiguration(DeviceInfo devInfo) {
+               // TODO : check connected target 
+               TargetData target = SettingDataManager.getInstance().getTarget(null);
+               long state = 0;
+
+               state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_FUNCTION_PROFILING);
+//             if (target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_FUNCTION_PROFILING) > 0) {
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_FUNCTION_SAMPLING);
+//             }
+               state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_MEMORY_ALLOCATION);
+               state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_FILE);
+               state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_THREAD);
+               state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_USERINTERFACE);
+               state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SCREENSHOT);
+
+               state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_USER_EVENT);
+               state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_RECORDING);
+
+               if (DACommunicator.isSWAPVersion(devInfo)) {
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSCALL_FILE);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSCALL_IPC);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSCALL_PROCESS);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSCALL_SIGNAL);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSCALL_NETWORK);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSCALL_DESC);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_CONTEXT_SWITCH);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_NETWORK);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_OPENGL);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.INCLUDE_INSIDE_CALL_MEMORY);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.INCLUDE_INSIDE_CALL_THREAD);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.INCLUDE_INSIDE_CALL_FILE);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.INCLUDE_INSIDE_CALL_UI);
+               }
+               return state;
+       }
+       
+       public long getPreConfiguration(DeviceInfo devInfo) {
+               // TODO : check connected target 
+               TargetData target = SettingDataManager.getInstance().getTarget(null);
+               long state = 0;
+               if (DACommunicator.isSWAPVersion(devInfo)) {
+                       // TODO: check FEATURE_SYSTEM_THREAD
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.INCLUDE_INSIDE_CALL_NETWORK);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.INCLUDE_INSIDE_OPENGL);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSTEM_CPU);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSTEM_PROCESSES);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSTEM_MEMORY);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSTEM_DISK);
+//                     state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSTEM_FD);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSTEM_THREAD);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSTEM_NETWORK);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSTEM_DEVICE);
+                       state |= target.getSelectedFeatureSwapValue(ConfigureLabels.FEATURE_SYSTEM_ENERGY);
+               }
+               return state;
+       }
 }
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
new file mode 100644 (file)
index 0000000..f213279
--- /dev/null
@@ -0,0 +1,305 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+package org.tizen.dynamicanalyzer.ui.toolbar.setting;
+
+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.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.nl.WidgetLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
+import org.tizen.dynamicanalyzer.util.Logger;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAMessageBox;
+import org.tizen.dynamicanalyzer.widgets.da.view.DABaseComposite;
+import org.tizen.dynamicanalyzer.widgets.da.view.DATabComposite;
+
+public class SettingDialog extends DAMessageBox {
+       private static boolean opened = false;
+       private DACustomButton applyButton = null;
+       private DACustomButton revertButton = null;
+       private DACustomButton closeButton = null;
+       
+       private SettingDialogTemplatePage templatesPage = null;
+       
+       private DATabComposite tabView = null;
+       private Composite buttonContentsComp = null;
+       
+       public SettingDialog(Shell parentShell) {
+               super(parentShell);
+               SettingDataManager.getInstance();       // read setting information file
+       }
+
+       private DACustomButtonClickEventListener applyButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       doApply();
+                       applicableButteon();
+               }
+       };
+       private DACustomButtonClickEventListener revertButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       doRevert();
+                       applicableButteon();
+               }
+       };
+       
+       private DACustomButtonClickEventListener closeButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       doRun();
+                       shell.dispose();        // close dialog
+               }
+       };
+       
+       private void doApply() {
+               Composite selectedComposite = tabView.getTopComposite();
+               if (!(selectedComposite instanceof SettingDialogBinarySettingsPage)) {
+                       // write setting data
+                       SettingDataManager.getInstance().applySettingData();
+                       
+                       // add & remove tab view page
+                       SettingDialogManager.getInstance().createTabViewPage();
+                       
+                       // add & remove (timeline) chart
+                       SettingDialogManager.getInstance().updateChartList();
+               } else {
+                       // binary setting page
+                       SettingDialogBinarySettingsPage page = (SettingDialogBinarySettingsPage) selectedComposite;
+                       page.doApply();
+               }
+
+       }
+
+       private void doRevert() {
+               Composite selectedComposite = tabView.getTopComposite();
+               if (!(selectedComposite instanceof SettingDialogBinarySettingsPage)) {
+                       // rollback setting data
+                       SettingDataManager.getInstance().revertSettingData();
+                       
+                       // update template view
+                       templatesPage.createTemplateTitleComposite();
+                       templatesPage.createTemplateDescriptionComposite();
+                       templatesPage.createTargetComposite();
+               }
+       }
+
+       private void doRun() {
+               Composite selectedComposite = tabView.getTopComposite();
+               if (!(selectedComposite instanceof SettingDialogBinarySettingsPage)) {
+                       SettingDialogManager.getInstance().applySwapValue();    
+               } else {                        
+                       // binary setting page
+                       SettingDialogBinarySettingsPage page = (SettingDialogBinarySettingsPage) selectedComposite;
+                       page.doClose();
+               }
+       }
+
+       protected boolean run() {
+               if (opened) {
+                       return false;
+               }
+               
+               shell.setSize(611, 500);
+               shell.setLayout(new FormLayout());
+               shell.setText(AnalyzerLabels.SETTING_TITLE);
+               shell.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+               
+               // content composite
+               Composite contentsComp = new Composite(shell, SWT.NONE);
+               FormLayout compLayout = new FormLayout();
+               contentsComp.setLayout(compLayout);
+               contentsComp.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+
+               FormData compData = new FormData();
+               compData.top = new FormAttachment(0, 0);
+               compData.left = new FormAttachment(0, 0);
+               compData.right = new FormAttachment(100, 0);
+               compData.bottom = new FormAttachment(100, -49);
+               contentsComp.setLayoutData(compData);
+               
+               // tab view
+               tabView = new DATabComposite(contentsComp, SWT.DOUBLE_BUFFERED);
+               tabView.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+               tabView.setTabWidth(120);
+               compData = new FormData();
+               compData = new FormData();
+               compData.top = new FormAttachment(0, 0);
+               compData.left = new FormAttachment(0, 0);
+               compData.right = new FormAttachment(100, 0);
+               compData.bottom = new FormAttachment(100, 0);
+               tabView.setLayoutData(compData);
+
+               SettingDialogTemplatePage templatesPage = new SettingDialogTemplatePage(
+                               tabView.getContentComposite(), SWT.NONE);
+               tabView.addView(templatesPage, false);
+
+               SettingDialogManager.getInstance().setConfigDlg(this);
+
+               SettingDialogOptionPage settingPage = new SettingDialogOptionPage(
+                               tabView.getContentComposite(), SWT.NONE);
+               tabView.addView(settingPage, false);
+
+               DABaseComposite binarySettings = new SettingDialogBinarySettingsPage(
+                               tabView.getContentComposite(), SWT.NONE);
+               tabView.addView(binarySettings, false);
+               
+               // button composite
+               buttonContentsComp = new Composite(shell, SWT.NONE);
+               compLayout = new FormLayout();
+               buttonContentsComp.setLayout(compLayout);
+               buttonContentsComp.setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
+               compData = new FormData();
+               compData.top = new FormAttachment(contentsComp, 0);
+               compData.left = new FormAttachment(0, 0);
+               compData.right = new FormAttachment(100, 0);
+               compData.bottom = new FormAttachment(100, 0);
+               buttonContentsComp.setLayoutData(compData);             
+               buttonContentsComp.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               Composite comp = (Composite) e.widget;
+                               Rectangle rect = comp.getClientArea();
+                               e.gc.setForeground(ColorResources.SETTING_SUNKEN_LINE_1);
+                               e.gc.drawLine(0, 0, rect.width-1, 0);
+                               e.gc.setForeground(ColorResources.SETTING_SUNKEN_LINE_2);
+                               e.gc.drawLine(0, 1, rect.width-1, 1);
+                       }
+               });
+       
+               binarySettings.addListener(SWT.Show, new Listener() {
+
+                       @Override
+                       public void handleEvent(Event event) {
+                               Logger.debug("binary settings show");
+                               FormData data = (FormData) applyButton.getLayoutData();
+                               data.width = 0;
+
+                               data = (FormData) revertButton.getLayoutData();
+                               data.width = 0;
+
+                               buttonContentsComp.layout();
+                       }
+               });
+
+               binarySettings.addListener(SWT.Hide, new Listener() {
+
+                       @Override
+                       public void handleEvent(Event event) {
+                               Logger.debug("binary settings hide");
+                               FormData data = (FormData) applyButton.getLayoutData();
+                               data.width = 100;
+
+                               data = (FormData) revertButton.getLayoutData();
+                               data.width = 100;
+
+                               buttonContentsComp.layout();
+                       }
+               });
+
+               
+               closeButton = new DAButton(buttonContentsComp, SWT.NONE);
+               closeButton.addClickListener(closeButtonListener);
+               closeButton.setText(WidgetLabels.CLOSE);
+               closeButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+               FormData buttonData = new FormData();
+               buttonData.right = new FormAttachment(100, -9);
+               buttonData.top = new FormAttachment(0, 11);
+               buttonData.width = 100;
+               buttonData.height = 28;
+               closeButton.setLayoutData(buttonData);
+               
+               revertButton = new DAButton(buttonContentsComp, SWT.NONE);
+               revertButton.addClickListener(revertButtonListener);
+               revertButton.setText(WidgetLabels.REVERT);
+               revertButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+               buttonData = new FormData();
+               buttonData.right = new FormAttachment(closeButton, -8);
+               buttonData.top = new FormAttachment(0, 11);
+               buttonData.width = 100;
+               buttonData.height = 28;
+               revertButton.setLayoutData(buttonData);
+               
+               applyButton = new DAButton(buttonContentsComp, SWT.NONE);
+               applyButton.addClickListener(applyButtonListener);
+               applyButton.setText(WidgetLabels.APPLY);
+               applyButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+               buttonData = new FormData();
+               buttonData.right = new FormAttachment(revertButton, -8);
+               buttonData.top = new FormAttachment(0, 11);
+               buttonData.width = 100;
+               buttonData.height = 28;
+               applyButton.setLayoutData(buttonData);
+               
+               applicableButteon();
+               shell.addDisposeListener(new DisposeListener() {
+
+                       @Override
+                       public void widgetDisposed(DisposeEvent e) {
+                               Logger.debug("shell disposed!"); //$NON-NLS-1$
+                               opened = false;
+                               ShortCutManager.getInstance().setEnabled(!opened);
+                       }
+               });             
+               opened = true;
+               ShortCutManager.getInstance().setEnabled(!opened);
+               
+               shell.open();
+               return true;
+       }
+       
+       public void applicableButteon() {
+               applyButton.setButtonEnabled(false);
+               revertButton.setButtonEnabled(false);
+               closeButton.setButtonEnabled(true);
+       }
+       
+       public void editableButteon() {
+               applyButton.setButtonEnabled(true);
+               revertButton.setButtonEnabled(true);
+               closeButton.setButtonEnabled(false);
+       }
+
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogBinarySettingsPage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogBinarySettingsPage.java
new file mode 100644 (file)
index 0000000..0bfc965
--- /dev/null
@@ -0,0 +1,476 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Jaewon Lim <jaewon81.lim@samsung.com>
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.toolbar.setting;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.path.PathManager;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
+import org.tizen.dynamicanalyzer.swap.platform.ui.BinarySettingProcessor;
+import org.tizen.dynamicanalyzer.swap.platform.ui.BinarySettingProgressManager;
+import org.tizen.dynamicanalyzer.swap.platform.ui.InputRow;
+import org.tizen.dynamicanalyzer.swap.platform.ui.LoadSettingDialog;
+import org.tizen.dynamicanalyzer.swap.platform.ui.SaveSettingDialog;
+import org.tizen.dynamicanalyzer.swap.platform.ui.DeviceExplorer.DeviceExplorerDilaog;
+import org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer.FileExplorerDialog;
+import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
+import org.tizen.dynamicanalyzer.util.Logger;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
+import org.tizen.dynamicanalyzer.widgets.da.base.WarningDialog;
+import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
+
+public class SettingDialogBinarySettingsPage extends DAPageComposite {
+       public static final String ID = SettingDialogBinarySettingsPage.class.getName();
+
+       public static final int RADIO_CURRENT = 1;
+       public static final int RADIO_ADD = 2;
+       public static final int RADIO_REMOVE = 3;
+
+       private HashMap<String, InputRow> inputRowHash = null;
+       private List<InputRow> inputRowList = null;
+
+       private ScrolledComposite scrolledComposite = null;
+       private Composite inputComposite = null;
+
+       private DAButton clearButton = null;
+       private DAButton addButton = null;
+       private DAButton saveButton = null;
+       private DAButton loadButton = null;
+       private DAButton debugRootButton = null;
+       private Label librariesLabel = null;
+
+       private String rootPath = null;
+       private SettingDialogBinarySettingsPage me = null;
+
+       private DACustomButtonClickEventListener addButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       DeviceExplorerDilaog dialog = new DeviceExplorerDilaog(getShell());
+//                     dialog.setFilter(".so");
+                       Object result = dialog.open();
+                       if (result != null) {
+                               BinarySettingProgressManager.getInstance().startProcessStart(
+                                               "Wait for add binaries...");
+                               BinarySettingProcessor.runAddThread(result, me);
+                       }
+               }
+       };
+
+       private DACustomButtonClickEventListener loadButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       LoadSettingDialog dialog = new LoadSettingDialog(button.getParent()
+                                       .getShell());
+                       Object result = dialog.open();
+                       if (result == null) {
+                               return;
+                       }
+
+                       // swap remove message send and inputrow dispose
+                       cleanButtonListener.handleClickEvent(null);
+
+                       String path = (String) result;
+                       File saveFile = new File(path);
+                       BufferedReader br = null;
+                       String content = null;
+                       try {
+                               List<BinarySettingData> binarySettings = new ArrayList<BinarySettingData>();
+                               br = new BufferedReader(new FileReader(saveFile));
+                               while (null != (content = br.readLine())) {
+                                       InputRow inputRow = new InputRow(inputComposite);
+                                       String[] splitContent = content
+                                                       .split(CommonConstants.COMMA);
+                                       inputRow.setBinaryText(new String(splitContent[0]));
+                                       inputRow.setDebugText(new String(splitContent[3]));
+                                       inputRow.setSourceText(new String(splitContent[4]));
+                                       inputRowList.add(inputRow);
+                                       inputRowHash.put(inputRow.getBinaryText(), inputRow);
+
+                                       BinarySettingData binaryData = new BinarySettingData();
+                                       binaryData.loadSaveData(content);
+                                       binarySettings.add(binaryData);
+                               }
+
+                               BinarySettingManager.getInstance().putRealBinarySettingData(
+                                               binarySettings);
+                               BinarySettingProgressManager.getInstance().startProcessStart(
+                                               "now loading binaries...");
+                               BinarySettingProcessor.runLoadingThread(me);
+                       } catch (FileNotFoundException e) {
+                               e.printStackTrace();
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                       } finally {
+                               CommonUtil.tryClose(br);
+                       }
+               }
+       };
+
+       private DACustomButtonClickEventListener debugRootButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       FileExplorerDialog dialog = new FileExplorerDialog(getShell());
+                       dialog.getExplorer().setRoot(CommonUtil.getHomeDirectory());
+                       Object result = dialog.open();
+                       if (result != null) {
+                               @SuppressWarnings("unchecked")
+                               List<File> files = (List<File>) result;
+                               if (!files.isEmpty()) {
+                                       File file = files.get(0);
+                                       if (!file.isDirectory()) {
+                                               file = file.getParentFile();
+                                       }
+                                       rootPath = file.getAbsolutePath();
+                               }
+
+                               if (null != rootPath) {
+                                       BinarySettingProgressManager.getInstance()
+                                                       .startProcessStart("Wait for update debug path");
+                                       BinarySettingProcessor.runUpdateDebugRoot(me);
+                                       BinarySettingManager.getInstance().setDebugRoot(rootPath);
+                               }
+                       }
+               }
+       };
+       private DACustomButtonClickEventListener saveButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       SaveSettingDialog dialog = new SaveSettingDialog(button.getParent()
+                                       .getShell(), inputRowList);
+                       dialog.open();
+               }
+       };
+
+       private DACustomButtonClickEventListener cleanButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       if (null != button) {
+                               WarningDialog dialog = new WarningDialog(getShell(), SWT.NONE);
+                               dialog.setMessage("Clear binary settings?\nIf you click 'Ok', All settings will be deleted");
+                               boolean result = dialog.open();
+                               if (!result) {
+                                       return;
+                               }
+                       }
+                       List<BinarySettingData> binaries = BinarySettingManager
+                                       .getInstance().getRealBinarySettings();
+                       if (!binaries.isEmpty()) {
+                               DACommunicator.sendSWAPMessage(
+                                               AnalyzerConstants.MSG_SWAP_INST_REMOVE, binaries);
+
+                               for (int i = 0; i < inputRowList.size(); i++) {
+                                       BinarySettingManager.getInstance()
+                                                       .removeRealBinarySettingData(
+                                                                       inputRowList.get(i).getBinaryText());
+                                       inputRowList.get(i).dispose();
+                               }
+                               inputRowList.clear();
+                               inputRowHash.clear();
+                       }
+
+                       updateLayout();
+               }
+       };
+
+       private void clearLayout() {
+               for (int i = 0; i < inputRowList.size(); i++) {
+                       inputRowList.get(i).dispose();
+               }
+               inputRowList.clear();
+               inputRowHash.clear();
+       }
+
+       public SettingDialogBinarySettingsPage(Composite parent, int style) {
+               super(parent, style);
+               me = this;
+               setTitle("Binary Settings"); // TODO nl
+               rootPath = PathManager
+                               .getRootstrapsPath(ConfigureManager.getPlatform());
+               inputRowHash = BinarySettingManager.getInstance().getInputRowHash();
+               inputRowList = BinarySettingManager.getInstance().getInputRowList();
+
+               String settingPath = PathManager.DA_SETTING_PATH;
+               File settingFolder = new File(settingPath);
+               if (!settingFolder.exists() || !settingFolder.isDirectory()) {
+                       if (!settingFolder.mkdirs()) {
+                               Logger.debug("setting directory create failed...");
+                       }
+               }
+
+               this.setLayout(new FormLayout());
+               this.setBackground(ColorResources.DIALOG_BG_UPPER);
+
+               int libCount = BinarySettingManager.getInstance()
+                               .getRealBinarySettings().size();
+               librariesLabel = new Label(this, SWT.TRANSPARENT);
+               FormData data = new FormData();
+               data.top = new FormAttachment(0, 15);
+               data.left = new FormAttachment(0, 16);
+               data.height = 16;
+               data.width = 100;
+               librariesLabel.setLayoutData(data);
+               librariesLabel.setText("Libraies (" + libCount + ")");
+               librariesLabel.setBackground(ColorResources.DIALOG_BG_UPPER);
+               librariesLabel.setFont(FontResources.getDADefaultFont());
+
+               scrolledComposite = new ScrolledComposite(this, SWT.BORDER
+                               | SWT.V_SCROLL | SWT.H_SCROLL);
+               data = new FormData();
+               data.top = new FormAttachment(librariesLabel, 4);
+               data.left = new FormAttachment(0, 6);
+               data.right = new FormAttachment(100, -6);
+               data.height = 310;
+               // data.width = 590;
+               scrolledComposite.setLayoutData(data);
+               scrolledComposite.setLayout(new FormLayout());
+               scrolledComposite.setExpandHorizontal(true);
+               scrolledComposite.setExpandVertical(true);
+               scrolledComposite
+                               .setBackground(ColorResources.BINARY_SETTINGS_INPUT_BOX_COLOR);
+
+               inputComposite = new Composite(scrolledComposite, SWT.NONE);
+               scrolledComposite.setContent(inputComposite);
+               scrolledComposite.setMinSize(inputComposite.computeSize(SWT.DEFAULT,
+                               SWT.DEFAULT));
+               scrolledComposite.setShowFocusedControl(true);
+               data = new FormData();
+               data.top = new FormAttachment(0, 5);
+               data.left = new FormAttachment(0, 0);
+               data.right = new FormAttachment(100, 0);
+               data.bottom = new FormAttachment(100, -5);
+               inputComposite.setLayoutData(data);
+               inputComposite.setLayout(new FormLayout());
+               inputComposite
+                               .setBackground(ColorResources.BINARY_SETTINGS_INPUT_BOX_COLOR);
+
+               loadButton = new DAButton(this, SWT.NONE);
+               data = new FormData();
+               data.top = new FormAttachment(scrolledComposite, 17);
+               data.left = new FormAttachment(0, 6);
+               data.height = 22;
+               data.width = 78;
+               loadButton.setLayoutData(data);
+               loadButton.setText("Load");
+               loadButton.addClickListener(loadButtonListener);
+
+               saveButton = new DAButton(this, SWT.NONE);
+               data = new FormData();
+               data.top = new FormAttachment(scrolledComposite, 17);
+               data.left = new FormAttachment(loadButton, 6);
+               data.height = 22;
+               data.width = 78;
+               saveButton.setLayoutData(data);
+               saveButton.setText("Save");
+               saveButton.addClickListener(saveButtonListener);
+
+               debugRootButton = new DAButton(this, SWT.NONE);
+               data = new FormData();
+               data.top = new FormAttachment(scrolledComposite, 17);
+               data.left = new FormAttachment(saveButton, 32);
+               data.height = 22;
+               data.width = 112;
+               debugRootButton.setLayoutData(data);
+               debugRootButton.setText("Set DebugRoot");
+               debugRootButton.addClickListener(debugRootButtonListener);
+
+               clearButton = new DAButton(this, SWT.NONE);
+               data = new FormData();
+               data.top = new FormAttachment(scrolledComposite, 17);
+               data.right = new FormAttachment(100, -6);
+               data.height = 22;
+               data.width = 78;
+               clearButton.setLayoutData(data);
+               clearButton.setText("Clear");
+               clearButton.addClickListener(cleanButtonListener);
+
+               addButton = new DAButton(this, SWT.NONE);
+               data = new FormData();
+               data.top = new FormAttachment(scrolledComposite, 17);
+               data.right = new FormAttachment(clearButton, -6);
+               data.height = 22;
+               data.width = 78;
+               addButton.setLayoutData(data);
+               addButton.setText("Add");
+               addButton.addClickListener(addButtonListener);
+
+               inputRowList.clear();
+               inputRowHash.clear();
+
+               this.addListener(SWT.Show, new Listener() {
+
+                       @Override
+                       public void handleEvent(Event event) {
+                               initInputRows();
+                       }
+               });
+
+               this.addListener(SWT.Dispose, new Listener() {
+
+                       @Override
+                       public void handleEvent(Event event) {
+                       }
+               });
+       }
+
+       public void doApply() {
+               // dirty check and update path
+               for (InputRow inputRow : inputRowList) {
+                       String binary = inputRow.getBinaryText();
+                       String debug = inputRow.getDebugText();
+                       String source = inputRow.getSourceText();
+                       BinarySettingData binData = BinarySettingManager.getInstance()
+                                       .getRealBinarySetting(binary);
+                       if (binData != null) {
+                               binData.setDebugRpmPath(debug);
+                               binData.setUserSourcePath(source);
+                       } else {
+                               Logger.debug("binary data is null");
+                       }
+               }
+
+               Logger.debug("update complete!");
+       }
+
+       public void doClose() {
+               String targetPath = PathManager.DA_BINARY_AUTO_SAVE_FILE;
+
+               File saveFile = new File(targetPath);
+               FileWriter fileWriter = null;
+               BufferedWriter bufWriter = null;
+
+               List<BinarySettingData> saveData = BinarySettingManager.getInstance()
+                               .getRealBinarySettings();
+
+               boolean success = false;
+               try {
+                       fileWriter = new FileWriter(saveFile);
+                       bufWriter = new BufferedWriter(fileWriter);
+                       for (int i = 0; i < saveData.size(); i++) {
+                               bufWriter.write(saveData.get(i).getSaveData());
+                               bufWriter.newLine();
+                       }
+                       success = true;
+               } catch (IOException e) {
+                       e.printStackTrace();
+               } finally {
+                       CommonUtil.tryClose(bufWriter, fileWriter);
+               }
+
+               if (success) {
+                       // add snapshot model update
+                       Logger.debug("binary settings auto save success!!"); //$NON-NLS-1$
+
+               } else {
+                       Logger.debug("binary settings auto save fail..."); //$NON-NLS-1$
+               }
+       }
+
+       public void initInputRows() {
+               List<BinarySettingData> binData = null;
+               binData = BinarySettingManager.getInstance().getRealBinarySettings();
+               clearLayout();
+               for (int i = 0; i < binData.size(); i++) {
+                       InputRow inputRow = new InputRow(inputComposite);
+                       inputRow.setBinaryText(binData.get(i).getBinaryPath());
+                       // String debug = binData.get(i).getDebugFilePath();
+                       String debug = binData.get(i).getDebugRpmPath();
+                       if (null != debug && !debug.isEmpty()) {
+                               inputRow.setDebugText(debug);
+                       } else {
+                               inputRow.setDebugText(CommonConstants.EMPTY);
+                       }
+
+                       String source = binData.get(i).getUserSourcePath();
+                       if (null != source && !source.isEmpty()) {
+                               inputRow.setSourceText(source);
+                       } else {
+                               source = binData.get(i).getDebugSourcePath();
+                               if (null != source && !source.isEmpty()) {
+                                       inputRow.setSourceText(source);
+                               } else {
+                                       inputRow.setSourceText(CommonConstants.EMPTY);
+                               }
+                       }
+                       inputRowHash.put(binData.get(i).getBinaryPath(), inputRow);
+                       inputRowList.add(inputRow);
+               }
+               updateLayout();
+       }
+
+       public void updateLayout() {
+               int count = BinarySettingManager.getInstance().getRealBinarySettings()
+                               .size();
+               librariesLabel.setText("Libraries (" + count + ")");
+               inputComposite.layout();
+               scrolledComposite.setMinSize(inputComposite.computeSize(SWT.DEFAULT,
+                               SWT.DEFAULT));
+               if (count == 0) {
+                       saveButton.setButtonEnabled(false);
+                       clearButton.setButtonEnabled(false);
+               } else {
+                       saveButton.setButtonEnabled(true);
+                       clearButton.setButtonEnabled(true);
+               }
+       }
+
+       public String getDebugRootPath() {
+               return rootPath;
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogManager.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogManager.java
new file mode 100644 (file)
index 0000000..8f76ea8
--- /dev/null
@@ -0,0 +1,325 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+package org.tizen.dynamicanalyzer.ui.toolbar.setting;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.nebula.widgets.grid.Grid;
+import org.eclipse.nebula.widgets.grid.GridItem;
+import org.tizen.dynamicanalyzer.common.GlobalInformation;
+import org.tizen.dynamicanalyzer.common.HostResult;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.ui.page.BaseView;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
+import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogFeaturesPage;
+import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAMessageBox;
+
+public class SettingDialogManager {
+
+       private static SettingDialogManager instance = null;
+
+       private DAMessageBox configDlg = null;
+       private FeatureDialog featureDlg = null;
+       
+       public synchronized static SettingDialogManager getInstance() {
+               if (instance == null) {
+                       instance = new SettingDialogManager();
+               }
+               return instance;
+       }
+       
+       public void setConfigDlg(DAMessageBox configDlg) {
+               this.configDlg = configDlg;
+       }
+       
+       public DAMessageBox getConfigDlg() {
+               return configDlg;
+       }
+       
+       public FeatureDialog getFeatureDlg() {
+               return featureDlg;
+       }
+
+       public void setFeatureDlg(FeatureDialog featureDlg) {
+               this.featureDlg = featureDlg;
+       }
+
+       public void applySwapValue() {
+               
+               if (null != GlobalInformation.getCurrentDeviceInfo()) {
+                       HostResult result = DACommunicator.sendRuntimeMessage(
+                                       DACommunicator.MSG_TYPE_CONFIG, null);
+// TODO : check result
+//                     if (!result.equals(HostResult.SUCCESS)) {
+//                             applyFailedSwapValue(featuresTable);
+//                     } else if (!GlobalInformation.getCurrentDeviceInfo()
+//                                     .isConfigSuccess()) {
+//                             GlobalInformation.getCurrentDeviceInfo().setConfigSuccess(true);
+//                             ToolbarArea.getInstance().setStartButtonEnablement(true);
+//                     } else {
+//                             updateFeaturesValueFromConfigureManager();
+//                             featuresTable.updateTable();
+//                     }
+               }
+       }
+               
+       public void updateFeatureButtonStatus(Boolean enable, Grid table) {     
+               if (changedFeaturesFromTableItemsList(table) == true) {
+                       featureDlg.enableButteon();
+               } else {
+                       featureDlg.diableButteon();
+               }
+               
+               if (null != enable) {
+                       if (enable) {
+                               featureDlg.enableButteon();
+                       } else {
+                               featureDlg.diableButteon();
+                       }
+               }
+       }
+       
+       public void updateSaveButtonStatus(Boolean enable) {
+                       // change button status
+               if (SettingDataManager.getInstance().changedFeatures() == true) {
+                       if (getConfigDlg() instanceof SettingDialog) {
+                               SettingDialog dlg = (SettingDialog) getConfigDlg();
+                               dlg.editableButteon();
+                       } else {
+                               WelcomeDialog dlg = (WelcomeDialog) getConfigDlg();
+                               dlg.editableButteon();
+                               }
+               } else {
+                       if (getConfigDlg() instanceof SettingDialog) {
+                               SettingDialog dlg = (SettingDialog) getConfigDlg();
+                               dlg.applicableButteon();
+                       } else {
+                               WelcomeDialog dlg = (WelcomeDialog) getConfigDlg();
+                               dlg.applicableButteon();
+                       }
+               }
+       }
+               
+       public void setFeaturesValueFromTableItemsList(Grid table) {
+               TargetData target = SettingDataManager.getInstance().getTarget(null);
+               List<FeatureValueData> list = new ArrayList<FeatureValueData>();
+               FeatureValueData featureValue = null;
+               
+               // TODO: check setFeaturesSwapValue() (Thread feature)
+               for (int i = 0; i < table.getItemCount(); i++) {
+                       String featureName = table.getItem(i).getText(0);
+                       String optionText = table.getItem(i).getText(1);
+                       
+                       FeatureData feature = target.getAvailableFeature(featureName);
+                       if ((optionText.contains(ConfigurationDialogFeaturesPage.ITEM_ALL_CHECKED))
+                               || (optionText.contains(ConfigurationDialogFeaturesPage.ITEM_PART_CHECKED))) {
+                               
+                               // check detail feature
+                               if (feature.getFeatureType() == FeatureData.FEATURE_TYPE_DETAIL) {
+                                       featureValue = addDetailFeature(table.getItem(i), target);
+                               } else {        // main, sub fearue
+                                       featureValue = new FeatureValueData();
+                                       featureValue.setFeatureName(featureName);
+                               }
+                               list.add(featureValue);
+                       }
+               }
+               target.setSelectedFeatureList(list);
+       }
+               
+       /**
+        * Make sure that the feature has changed in the table.
+        * 
+        * @param table feature table
+        * 
+        * @return              Whether the change of feature 
+        */
+       public boolean changedFeaturesFromTableItemsList(Grid table) {
+               TargetData target = SettingDataManager.getInstance().getTarget(null);
+               int count = 0;
+               
+               for (int i = 0; i < table.getItemCount(); i++) {
+                       String featureName = table.getItem(i).getText(0);
+                       String optionText = table.getItem(i).getText(1);
+
+                       FeatureData feature = target.getAvailableFeature(featureName);
+                       if ((optionText.contains(ConfigurationDialogFeaturesPage.ITEM_ALL_CHECKED))
+                               || (optionText.contains(ConfigurationDialogFeaturesPage.ITEM_PART_CHECKED))) {
+                               count++;
+                               
+                               // check detail feature
+                               if (feature.getFeatureType() == FeatureData.FEATURE_TYPE_DETAIL) {
+                                       if (changedDetailFeature(table.getItem(i), target) == true) {
+                                               return true;
+                                       }       
+                               } else {        // main, sub fearue
+                                       if (target.isSelectedFeature(featureName) == false) {
+                                               return true;
+                                       }
+                               }
+                       }
+               }
+               
+               if (target.getSelectedFeatureList().size() != count) {
+                       return true;
+               }
+               return false;
+       }
+       
+       private FeatureValueData addDetailFeature(GridItem item, TargetData target) {
+               FeatureValueData featureValue = null;
+               String featureName = item.getText(0);   
+                       
+               if ((ConfigureLabels.SYSTEM_INFOMATION_SAMPLING_PERIODIC.equals(featureName)) 
+                               || (ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC.equals(featureName))) {
+                       int tableValue = Integer.parseInt(getOptionText(item, ConfigureLabels.SAMPLING));
+                       featureValue = new FeatureValueData();
+                       featureValue.setFeatureName(featureName);
+                       featureValue.setValue(tableValue);
+               } else if (ConfigureLabels.SNAPSHOT_PERIODIC_AUTO.equals(featureName)) {
+                       int tableAutoValue = Integer.parseInt(getOptionText(item, ConfigureLabels.AUTO));
+                       if (tableAutoValue == 1) {
+                               featureValue = new FeatureValueData();
+                               featureValue.setFeatureName(featureName);
+                               featureValue.setValue(1);                               
+                       } else {
+                               int tableValue = Integer.parseInt(getOptionText(item, ConfigureLabels.SAMPLING));
+                               featureValue = new FeatureValueData();
+                               featureValue.setFeatureName(ConfigureLabels.PERIODIC);
+                               featureValue.setValue(tableValue);                              
+                       }
+               }
+               return featureValue;
+       }
+       
+       private boolean changedDetailFeature(GridItem item, TargetData target) {
+               String featureName = item.getText(0);   
+                       
+               if ((ConfigureLabels.SYSTEM_INFOMATION_SAMPLING_PERIODIC.equals(featureName)) 
+                               || (ConfigureLabels.FUNCTION_PROFILING_SAMPLING_PERIODIC.equals(featureName))) {
+                       int value = target.getSelectedFeatureValue(featureName);
+                       int tableValue = Integer.parseInt(getOptionText(item, ConfigureLabels.SAMPLING));
+                       if (value != tableValue) {
+                               return true;
+                       }
+               } else if (ConfigureLabels.SNAPSHOT_PERIODIC_AUTO.equals(featureName)) {
+                       int tableAutoValue = Integer.parseInt(getOptionText(item, ConfigureLabels.AUTO));
+                       if (tableAutoValue == 1) {
+                               if (target.isSelectedFeature(ConfigureLabels.SNAPSHOT_PERIODIC_AUTO) == false) {
+                                       return true;
+                               }
+                       } else {
+                               if (target.isSelectedFeature(ConfigureLabels.PERIODIC) == false) {
+                                       return true;
+                               } else {
+                                       int value = target.getSelectedFeatureValue(ConfigureLabels.PERIODIC);
+                                       int tableSamplingValue = Integer.parseInt(getOptionText(item, ConfigureLabels.SAMPLING));
+                                       if (value != tableSamplingValue) {
+                                               return true;
+                                       }
+                               }
+                       }
+               }
+               return false;
+       }
+       
+       private String getOptionText(GridItem item, String optionName) {
+               String value = null;
+               if (item.getText(1).contains(optionName)) {
+                       String[] optionList = item.getText(1).split(optionName);
+                       if (optionList.length > 1) {
+                               if (optionList[1].contains(CommonConstants.COMMA)) {
+                                       String[] optionList2 = optionList[1]
+                                                       .split(CommonConstants.COMMA);
+                                       value = optionList2[0];
+                               } else {
+                                       value = optionList[1];
+                               }
+                       }
+               }
+               return value;
+       }
+       
+       /**
+        * create tab pages
+        */
+       public void createTabViewPage() {
+               // TODO : check connected target 
+               Set<String> selectedPageList = SettingDataManager.getInstance().getSelectedPageList(null);
+               List<Integer> tabViewList = new ArrayList<Integer>();
+               tabViewList.add(CommonConstants.PAGE_TIME_LINE);        // default : timeline tab
+               
+               // thread tab
+               if (selectedPageList.contains(ConfigureLabels.PAGE_NAME_THREAD)) {
+                       tabViewList.add(CommonConstants.PAGE_THREAD);
+               } // else nothing
+
+               // network tab
+               if (selectedPageList.contains(ConfigureLabels.PAGE_NAME_NETWORK)) {
+                       tabViewList.add(CommonConstants.PAGE_NETWORK);
+               } // else nothing
+
+               // file tab
+               if (selectedPageList.contains(ConfigureLabels.PAGE_NAME_FILE)) {
+                       tabViewList.add(CommonConstants.PAGE_FILE);
+               } // else nothing
+               
+               // openGL tab
+               if (selectedPageList.contains(ConfigureLabels.PAGE_NAME_OPENGL)) {
+                       tabViewList.add(CommonConstants.PAGE_GRAPHICS);
+               } // else nothing
+
+               // kernel tab
+               if (selectedPageList.contains(ConfigureLabels.PAGE_NAME_KERNEL)) {
+                       tabViewList.add(CommonConstants.PAGE_KERNEL);
+               } // else nothing
+
+               tabViewList.add(CommonConstants.PAGE_SUMMARY); // default : summary tab
+
+               BaseView bv = (BaseView) WorkbenchUtil.getViewPart(BaseView.ID);
+               bv.addTabViewPage(tabViewList);
+       }
+
+       /**
+        * update chart list
+        */
+       public void updateChartList() {
+               // TODO : check connected target 
+               Set<String> selectedChartList = SettingDataManager.getInstance().getSelectedChartList(null);
+               TimelineChartManager.getInstance().loadSelectedChartList(selectedChartList);
+               
+               // TODO : selectedChartList remove?
+               if (selectedChartList.size() > 0) {
+                       List<String> list = SettingDataManager.getInstance().getSelectedChartList();
+                       list.addAll(selectedChartList);
+               }
+       }
+}
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogOptionPage.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialogOptionPage.java
new file mode 100644 (file)
index 0000000..e66b995
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
+ * Hyunjong Park <phjwithyou.park@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+
+package org.tizen.dynamicanalyzer.ui.toolbar.setting;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.widgets.button.checkbox.DACheckBox;
+import org.tizen.dynamicanalyzer.widgets.button.checkbox.DACheckboxSelectionListener;
+import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
+
+public class SettingDialogOptionPage extends DAPageComposite {
+       public static final String ID = SettingDialogOptionPage.class
+                       .getName();
+
+       private DACheckBox showInitialCheckBox = null;
+       private DACheckBox autoStopCheckBox = null;
+
+       public SettingDialogOptionPage(Composite parent, int style) {
+
+               super(parent, style);
+               setTitle(AnalyzerLabels.COOLBAR_AREA_CONFIGURATION_OPTION);
+               this.setLayout(new FormLayout());
+               this.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+
+               // Configuration Setting
+               Label settingLabel = new Label(this, SWT.TRANSPARENT);
+               settingLabel.setText(ConfigureLabels.SETTING_CONFIGURATION_TITLE);
+               settingLabel
+                               .setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+               settingLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+               settingLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT);
+               FormData data = new FormData();
+               data.top = new FormAttachment(0, 14);
+               data.left = new FormAttachment(0, 8);
+               settingLabel.setLayoutData(data);
+
+               // SHOW_INITIAL_FEATURE_SETTING
+               showInitialCheckBox = new DACheckBox(this, SWT.NONE);
+               data = new FormData();
+               data.top = new FormAttachment(settingLabel, 15);
+               data.left = new FormAttachment(0, 22);
+               data.height = 20;
+               data.width = 20;
+               showInitialCheckBox.setLayoutData(data);
+               showInitialCheckBox.setForeground(ColorResources.BLACK);
+               showInitialCheckBox.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+               showInitialCheckBox.setText(ConfigureLabels.SHOW_INITIAL);
+               showInitialCheckBox.addSelectionListener(showInitiaRadioButtonListener);
+               showInitialCheckBox.setChecked(SettingDataManager.getInstance().isShowInitial());
+
+               Label showInitalLabel = new Label(this, SWT.TRANSPARENT);
+               showInitalLabel.setText(ConfigureLabels.SHOW_INITIAL);
+               showInitalLabel.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+               showInitalLabel.setForeground(ColorResources.BLACK);
+               showInitalLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT);
+               data = new FormData();
+               data.top = new FormAttachment(settingLabel, 17);
+               data.left = new FormAttachment(0, 42);
+               showInitalLabel.setLayoutData(data);
+
+               // SHOW_INITIAL_FEATURE_SETTING
+               autoStopCheckBox = new DACheckBox(this, SWT.NONE);
+               data = new FormData();
+               data.top = new FormAttachment(settingLabel, 42);
+               data.left = new FormAttachment(0, 22);
+               data.height = 20; // 20
+               data.width = 20;
+               autoStopCheckBox.setLayoutData(data);
+               autoStopCheckBox.setForeground(ColorResources.BLACK);
+               autoStopCheckBox.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+               autoStopCheckBox.setText(ConfigureLabels.AUTO_STOP);
+               autoStopCheckBox.addSelectionListener(autoStopRadioButtonListener);             
+               autoStopCheckBox.setChecked(SettingDataManager.getInstance().isAutoStop());
+               
+               Label autoStopLabel = new Label(this, SWT.TRANSPARENT);
+               autoStopLabel.setText(ConfigureLabels.AUTO_STOP);
+               autoStopLabel.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+               autoStopLabel.setForeground(ColorResources.BLACK);
+               autoStopLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT);
+               data = new FormData();
+               data.top = new FormAttachment(settingLabel, 44);
+               data.left = new FormAttachment(0, 42);
+               autoStopLabel.setLayoutData(data);
+       }
+
+       private DACheckboxSelectionListener showInitiaRadioButtonListener = new DACheckboxSelectionListener() {
+               @Override
+               public void handleSelectionEvent(DACheckBox checkbox) {
+                       if (SettingDataManager.getInstance().isShowInitial()) {
+                               SettingDataManager.getInstance().setShowInitial(false);
+                               showInitialCheckBox.setChecked(false);                  
+                       } else {
+                               SettingDataManager.getInstance().setShowInitial(true);
+                               showInitialCheckBox.setChecked(true);                                   
+                       }
+
+                       // change button status
+                       SettingDialogManager.getInstance().updateSaveButtonStatus(null);
+               }
+       };
+
+       private DACheckboxSelectionListener autoStopRadioButtonListener = new DACheckboxSelectionListener() {
+               @Override
+               public void handleSelectionEvent(DACheckBox checkbox) {
+                       if (SettingDataManager.getInstance().isAutoStop()) {
+                               SettingDataManager.getInstance().setAutoStop(false);
+                               autoStopCheckBox.setChecked(false);                     
+                       } else {
+                               SettingDataManager.getInstance().setAutoStop(true);
+                               autoStopCheckBox.setChecked(true);                                      
+                       }
+
+                       // change button status
+                       SettingDialogManager.getInstance().updateSaveButtonStatus(null);
+               }
+       };
+}
\ No newline at end of file
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
new file mode 100644 (file)
index 0000000..e0d8ef5
--- /dev/null
@@ -0,0 +1,581 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+package org.tizen.dynamicanalyzer.ui.toolbar.setting;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.nl.WidgetLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButton;
+import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButtonGroup;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
+import org.tizen.dynamicanalyzer.widgets.da.view.DAPageComposite;
+
+public class SettingDialogTemplatePage extends DAPageComposite {
+
+       private Map<String, Image> targetHashMap = null;
+       private Map<String, Image> templateHashMap = null;
+       
+       // target widget
+       private Composite targetComp = null;
+       private Label targetLabel = null;
+       private ScrolledComposite targetScrolledComposite = null;
+       private Composite targetInputComposite = null;
+
+       // template title widget
+       private Composite templateComp = null;
+       private Label templateLabel = null;
+       private ScrolledComposite scrolledComposite = null;
+       private Composite inputComposite = null;
+
+       // template description widget
+       private Composite descriptionComp = null;
+       private Label icon = null;
+       private Label targetNameLabel = null;
+       private Label targetDescriptionLabel = null;
+       private Label overheadLabel = null;
+       private DACustomButton detailButton = null;
+       
+       private SettingDialogTemplatePage me = null;
+       
+       private DACustomButtonClickEventListener detailButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       // show feature dialog
+                       FeatureDialog dialog = new FeatureDialog(me.getShell());
+                       dialog.setTemplatePage(me);
+                       dialog.open();
+               }
+       };
+       
+       public SettingDialogTemplatePage(Composite parent, int style) {
+               super(parent, style);
+               me = this;
+               setTitle(AnalyzerLabels.COOLBAR_AREA_CONFIGURATION_FEATURES);
+               this.setLayout(new FormLayout());
+               this.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+
+               // Title
+               Label title = new Label(this, SWT.TRANSPARENT);
+               title.setText(ConfigureLabels.TARGET_TITLE);
+               title.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+               title.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+               title.setFont(FontResources.SETTING_TITLE_FONT);
+
+               FormData data = new FormData();
+               data.top = new FormAttachment(0, 14);
+               data.left = new FormAttachment(0, 8);
+               title.setLayoutData(data);
+               
+               initDataList();
+               createTargetComposite();
+               createTemplateDescriptionComposite();           
+               createTemplateTitleComposite();
+       }
+
+       private void initDataList() {
+               targetHashMap = new HashMap<String, Image>();
+               targetHashMap.put(ConfigureLabels.TARGET_NAME_MOBILE_2_3, ImageResources.TARGET_MOBILE_2_3);
+               targetHashMap.put(ConfigureLabels.TARGET_NAME_TV, ImageResources.TARGET_TV);            
+               
+               templateHashMap = new HashMap<String, Image>();
+               templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_BOTTLENECK, ImageResources.TEMPLATE_BOTTLENECK_ANALYSIS);
+               templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_MEMORY_LEAKS, ImageResources.TEMPLATE_MEMORY_LEAK);
+               templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_PROCESS_ACTIVITY, ImageResources.TEMPLATE_PROCESS_ACTIVITY);
+               templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_FILE, ImageResources.TEMPLATE_FILE_ANALYSIS);
+               templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_THREAD_ACTIVITY, ImageResources.TEMPLATE_THREAD_ACTIVITY_ANALYSIS);
+               templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_WAIT_STATUS, ImageResources.TEMPLATE_WAIT_STATUS_ANALYSIS);
+               templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_NETWORK, ImageResources.TEMPLATE_NETWORK_ANALYSIS);
+               templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_OPEN_GL, ImageResources.TEMPLATE_OPEN_GL_ANALYSIS);
+               templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_ENERGY, ImageResources.TEMPLATE_ENERGY);
+               templateHashMap.put(ConfigureLabels.TEMPLATE_NAME_CUSTOM, ImageResources.TEMPLATE_CUSTOM);
+       }
+
+       private void initTargetCompositeWidget() {
+               if (null != targetLabel) {
+                       targetLabel.dispose();
+                       targetLabel = null;
+               }
+
+               if (null != targetScrolledComposite) {
+                       targetScrolledComposite.dispose();
+                       targetScrolledComposite = null;
+               }
+
+               if (null != targetInputComposite) {
+                       targetInputComposite.dispose();
+                       targetInputComposite = null;
+               }
+       }
+       
+       private void initTemplateTitleWidget() {
+               if (null != templateLabel) {
+                       templateLabel.dispose();
+                       templateLabel = null;
+               }
+
+               if (null != scrolledComposite) {
+                       scrolledComposite.dispose();
+                       scrolledComposite = null;
+               }
+
+               if (null != inputComposite) {
+                       inputComposite.dispose();
+                       inputComposite = null;
+               }
+       }
+       
+       private void initTemplateDescriptionWidget() {
+               if (null != icon) {
+                       icon.dispose();
+                       icon = null;
+               }
+
+               if (null != targetNameLabel) {
+                       targetNameLabel.dispose();
+                       targetNameLabel = null;
+               }
+
+               if (null != targetDescriptionLabel) {
+                       targetDescriptionLabel.dispose();
+                       targetDescriptionLabel = null;
+               }
+
+               if (null != overheadLabel) {
+                       overheadLabel.dispose();
+                       overheadLabel = null;
+               }
+               
+               if (null != detailButton) {
+                       detailButton.dispose();
+                       detailButton = null;
+               }
+       }
+       
+       private DACustomToggleButton createToggleButton(Composite composit, Image image, Point imagePoint,
+                       String title, Point fontPoint, int width, int height, int topPosition, int leftPosition) {
+
+               DACustomToggleButton toggle = new DACustomToggleButton(composit, SWT.NONE);
+               // color and image
+               toggle.setColors(ColorResources.SETTING_BUTTON_NORMAL_COLOR, 
+                               ColorResources.SETTING_BUTTON_PUSH_COLOR, 
+                               ColorResources.SETTING_BUTTON_HOVER_COLOR, 
+                               ColorResources.SETTING_BUTTON_DISABLE_COLOR,
+                               ColorResources.SETTING_BUTTON_TOGGLE_NORMAL_COLOR, 
+                               ColorResources.SETTING_BUTTON_TOGGLE_HOVER_COLOR,
+                               ColorResources.SETTING_BUTTON_TOGGLE_PUSH_COLOR);
+               toggle.setButtonImages(image, image, image,
+                               image, image, image, image);
+               toggle.setButtonImagePoint(imagePoint);
+
+               // font
+               toggle.setTitle(title);
+               toggle.setFontPoint(fontPoint); 
+               toggle.setFontColors(ColorResources.SETTING_COLOR,
+                               ColorResources.SETTING_COLOR,
+                               ColorResources.SETTING_COLOR,
+                               ColorResources.SETTING_COLOR);
+               toggle.setButtonFont(FontResources.SETTING_BUTTON_FONT);
+               
+               // layout
+               FormData data = new FormData();
+               data.top = new FormAttachment(0, topPosition);
+               data.left = new FormAttachment(0, leftPosition);
+               data.width = width;
+               data.height = height;
+               toggle.setLayoutData(data);
+
+               return toggle;
+       }
+       
+       public void createTargetComposite() {
+               initTargetCompositeWidget();
+               
+               // Composite
+               if (null == targetComp) {
+                       targetComp = new Composite(this, SWT.NONE);
+                       targetComp.setLayout(new FormLayout());
+                       FormData compData = new FormData();
+                       compData.top = new FormAttachment(0, 41);
+                       compData.left = new FormAttachment(0, 6);
+                       compData.width = 86;
+                       compData.height = 353;
+                       targetComp.setLayoutData(compData);
+                       targetComp.setBackground(ColorResources.WHITE);
+                       
+                       targetComp.addPaintListener(new PaintListener() {
+       
+                               @Override
+                               public void paintControl(PaintEvent e) {
+                                       Composite comp = (Composite) e.widget;
+                                       Rectangle rect = comp.getClientArea();
+                                       Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1);
+                                       e.gc.setForeground(ColorResources.SETTING_STROKE);
+                                       e.gc.drawRectangle(r);
+                                       e.gc.drawLine(0, 22, rect.width-1, 22);
+                               }
+                       });
+               }
+               // label
+               targetLabel = new Label(targetComp, SWT.TRANSPARENT);
+               FormData data = new FormData();
+               data.top = new FormAttachment(0, 1);
+               data.left = new FormAttachment(0, 1);
+               data.height = 21;
+               data.width = 84;                
+               targetLabel.setLayoutData(data);
+               targetLabel.setText(ConfigureLabels.TARGETS);
+               targetLabel.setBackground(ColorResources.SETTING_TITLE_BACKGROUND);
+               targetLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+               targetLabel.setFont(FontResources.SETTING_TITLE_FONT);
+               targetLabel.setAlignment(SWT.CENTER);
+
+               // scrolledComposite
+               targetScrolledComposite = new ScrolledComposite(targetComp, SWT.BORDER
+                               | SWT.V_SCROLL | SWT.H_SCROLL);
+               targetScrolledComposite.setLayout(new FormLayout());
+               data = new FormData();
+               data.top = new FormAttachment(targetLabel, 1);
+               data.left = new FormAttachment(0, 1);
+               data.right = new FormAttachment(100, -1);
+               data.bottom = new FormAttachment(100, -1);
+               targetScrolledComposite.setLayoutData(data);
+               targetScrolledComposite.setExpandHorizontal(true);
+               targetScrolledComposite.setExpandVertical(true);
+               targetScrolledComposite.setBackground(ColorResources.WHITE);
+
+               // composite : input
+               targetInputComposite = new Composite(targetScrolledComposite, SWT.NONE);
+               targetScrolledComposite.setContent(targetInputComposite);
+               targetScrolledComposite.setMinSize(targetInputComposite.computeSize(SWT.DEFAULT,
+                               SWT.DEFAULT));
+               targetScrolledComposite.setShowFocusedControl(true);
+               targetInputComposite.setLayout(new FormLayout());
+               data = new FormData();
+               data.top = new FormAttachment(0, 1);
+               data.left = new FormAttachment(0, 1);
+               data.right = new FormAttachment(100, -1);
+               data.bottom = new FormAttachment(100, -1);
+               targetInputComposite.setLayoutData(data);
+               targetInputComposite.setBackground(ColorResources.WHITE);
+               
+               // ToogleButtonGroup
+               Map<String, TargetData> targetList = SettingDataManager.getInstance().getTargetListMap();
+               String selectedTarget = SettingDataManager.getInstance().getSelectedTarget();
+               DACustomToggleButtonGroup targetGroup = new DACustomToggleButtonGroup();
+               Point imagePoint = new Point(18, 8);
+               Point fontPoint = new Point(-1, 60);
+               int topPosition = 4;
+               int leftPosition = 4;
+               
+               for (Map.Entry<String, TargetData> entry : targetList.entrySet()) {
+                       TargetData target = entry.getValue();
+                       
+                       DACustomToggleButton toggle = createToggleButton(targetInputComposite, 
+                                       targetHashMap.get(target.getTargetName()), 
+                                       imagePoint, target.getTargetName(), fontPoint, 76, 76, topPosition, leftPosition);
+                       targetGroup.addToggleButton(toggle);    
+                       
+                       // listener
+                       toggle.addListener(SWT.MouseUp, new Listener() {
+                               
+                               @Override
+                               public void handleEvent(Event event) {
+                                       DACustomToggleButton toggleButton = (DACustomToggleButton) event.widget;                                
+                                       if(toggleButton.isToggled()) {
+                                               
+                                               // set selected target
+                                               SettingDataManager.getInstance().setSelectedTarget(toggleButton.getText());
+                                               
+                                               // update template view
+                                               createTemplateTitleComposite();
+                                               createTemplateDescriptionComposite();
+                                               
+                                               // change button status
+                                               SettingDialogManager.getInstance().updateSaveButtonStatus(null);
+                                       }
+                               }
+                       });                     
+
+                       // set next position
+                       topPosition += 80;
+                       
+                       // set selection target 
+                       if (selectedTarget.equals(entry.getKey()) == true) {
+                               targetGroup.setSelection(toggle);
+                       }
+               }
+               targetComp.layout(true);
+       }
+       
+       public void createTemplateDescriptionComposite() {
+               initTemplateDescriptionWidget();
+               
+               if (null == descriptionComp) {
+                       // Composite
+                       descriptionComp = new Composite(this, SWT.NONE);
+                       descriptionComp.setLayout(new FormLayout());
+                       FormData compData = new FormData();
+                       compData.top = new FormAttachment(0, 235);
+                       compData.left = new FormAttachment(0, 98);
+                       compData.width = 504;
+                       compData.height = 159;  
+                       descriptionComp.setLayoutData(compData);
+                       descriptionComp.setBackground(ColorResources.WHITE);
+                       
+                       descriptionComp.addPaintListener(new PaintListener() {
+       
+                               @Override
+                               public void paintControl(PaintEvent e) {
+                                       Composite comp = (Composite) e.widget;
+                                       Rectangle rect = comp.getClientArea();
+                                       Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1);
+                                       e.gc.setForeground(ColorResources.SETTING_STROKE);
+                                       e.gc.drawRectangle(r);
+                                       e.gc.drawLine(0, 117, rect.width-1, 117);
+                               }
+                       });
+               }
+               
+               TargetData target = SettingDataManager.getInstance().getTarget(null);
+               String selectedTemplate = target.getSelectedTemplate();
+               TemplateData template = target.getAvailableTemplate(selectedTemplate);
+               
+               // image
+               icon = new Label(descriptionComp, SWT.TRANSPARENT);
+               icon.setImage(templateHashMap.get(selectedTemplate));
+               FormData data = new FormData();
+               data.left = new FormAttachment(0, 21);
+               data.top = new FormAttachment(0, 21);
+               data.width = 40;
+               data.height = 40;
+               icon.setLayoutData(data);
+
+               // label : targetName
+               targetNameLabel = new Label(descriptionComp, SWT.TRANSPARENT);
+               data = new FormData();
+               data.top = new FormAttachment(0, 21);
+               data.left = new FormAttachment(0, 81);
+               data.width = 401;
+               data.height = 15;       
+               targetNameLabel.setLayoutData(data);
+               targetNameLabel.setText(selectedTemplate);
+               targetNameLabel.setBackground(ColorResources.WHITE);
+               targetNameLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+               targetNameLabel.setFont(FontResources.SETTING_TITLE_FONT);
+               
+               // label : description
+               targetDescriptionLabel = new Label(descriptionComp, SWT.TRANSPARENT);
+               data = new FormData();
+               data.top = new FormAttachment(0, 54);
+               data.left = new FormAttachment(0, 81);
+               data.width = 401;
+               data.height = 57;       
+               targetDescriptionLabel.setLayoutData(data);
+               targetDescriptionLabel.setText(template.getDescription());
+               targetDescriptionLabel.setBackground(ColorResources.WHITE);
+               targetDescriptionLabel.setForeground(ColorResources.SETTING_COLOR);
+               targetDescriptionLabel.setFont(FontResources.SETTING_DESCRIPTION_FONT);
+               
+               // label : overhead
+               overheadLabel = new Label(descriptionComp, SWT.TRANSPARENT);
+               data = new FormData();
+               data.top = new FormAttachment(0, 130);
+               data.left = new FormAttachment(0, 81);
+               data.width = 300;
+               data.height = 20;       
+               overheadLabel.setLayoutData(data);
+               // TODO : get overhead value
+               overheadLabel.setText(ConfigureLabels.OVERHEAD_FIRST + "1.75 " + ConfigureLabels.OVERHEAD_LAST);
+               overheadLabel.setBackground(ColorResources.WHITE);
+               overheadLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+               overheadLabel.setFont(FontResources.SETTING_TITLE_FONT);
+               
+               detailButton = new DAButton(descriptionComp, SWT.NONE);
+               detailButton.addClickListener(detailButtonListener);
+               detailButton.setText(WidgetLabels.DETAIL);
+               detailButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+               data = new FormData();
+               data.top = new FormAttachment(0, 130);
+               data.right = new FormAttachment(100, -9);
+               data.width = 100;
+               data.height = 22;
+               detailButton.setLayoutData(data);
+               
+               descriptionComp.layout(true);
+       }
+       
+       public void createTemplateTitleComposite() {
+               initTemplateTitleWidget();
+               
+               // Composite
+               if (null == templateComp) {
+                       templateComp = new Composite(this, SWT.NONE);
+                       templateComp.setLayout(new FormLayout());
+                       FormData compData = new FormData();
+                       compData.top = new FormAttachment(0, 41);
+                       compData.left = new FormAttachment(0, 98);
+                       compData.width = 504;
+                       compData.height = 188;
+                       templateComp.setLayoutData(compData);
+                       templateComp.setBackground(ColorResources.WHITE);
+                       
+                       templateComp.addPaintListener(new PaintListener() {
+       
+                               @Override
+                               public void paintControl(PaintEvent e) {
+                                       Composite comp = (Composite) e.widget;
+                                       Rectangle rect = comp.getClientArea();
+                                       Rectangle r = new Rectangle(0, 0, rect.width - 1, rect.height - 1);
+                                       e.gc.setForeground(ColorResources.SETTING_STROKE);
+                                       e.gc.drawRectangle(r);
+                                       e.gc.drawLine(0, 22, rect.width-1, 22);
+                               }
+                       });
+               }
+
+               // label : template
+               templateLabel = new Label(templateComp, SWT.TRANSPARENT);
+               FormData data = new FormData();
+               data.top = new FormAttachment(0, 1);
+               data.left = new FormAttachment(0, 1);
+               data.height = 21;
+               data.width = 502;               
+               templateLabel.setLayoutData(data);
+               templateLabel.setText(ConfigureLabels.TEMPLATE);
+               templateLabel.setBackground(ColorResources.SETTING_TITLE_BACKGROUND);
+               templateLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR);
+               templateLabel.setFont(FontResources.SETTING_TITLE_FONT);
+               templateLabel.setAlignment(SWT.CENTER);
+               
+               // scrolledComposite
+               scrolledComposite = new ScrolledComposite(templateComp, SWT.BORDER
+                               | SWT.V_SCROLL | SWT.H_SCROLL);
+               scrolledComposite.setLayout(new FormLayout());
+               data = new FormData();
+               data.top = new FormAttachment(templateLabel, 1);
+               data.left = new FormAttachment(0, 1);
+               data.right = new FormAttachment(100, -1);
+               data.bottom = new FormAttachment(100, -1);
+               scrolledComposite.setLayoutData(data);
+               scrolledComposite.setExpandHorizontal(true);
+               scrolledComposite.setExpandVertical(true);
+               scrolledComposite.setBackground(ColorResources.WHITE);
+
+               // composite : input
+               inputComposite = new Composite(scrolledComposite, SWT.NONE);
+               scrolledComposite.setContent(inputComposite);
+               scrolledComposite.setMinSize(inputComposite.computeSize(SWT.DEFAULT,
+                               SWT.DEFAULT));
+               scrolledComposite.setShowFocusedControl(true);
+               inputComposite.setLayout(new FormLayout());
+               data = new FormData();
+               data.top = new FormAttachment(0, 1);
+               data.left = new FormAttachment(0, 1);
+               data.right = new FormAttachment(100, -1);
+               data.bottom = new FormAttachment(100, -1);
+               inputComposite.setLayoutData(data);
+               inputComposite.setBackground(ColorResources.WHITE);
+               
+               // ToogleButtonGroup
+               String selectedTarget = SettingDataManager.getInstance().getSelectedTarget();
+               DACustomToggleButtonGroup targetGroup = new DACustomToggleButtonGroup();
+               Point imagePoint = new Point(23, 8);
+               Point fontPoint = new Point(-1, 60);
+               int topPosition = 4;
+               int leftPosition = 13;
+               
+               TargetData target = SettingDataManager.getInstance().getTarget(selectedTarget);
+               Map<String, TemplateData> templateList = target.getAvailableTemplateListMap();
+               String selectedTemplate = target.getSelectedTemplate();
+
+               for (Map.Entry<String, TemplateData> entry : templateList.entrySet()) {
+                       TemplateData template = entry.getValue();
+                       DACustomToggleButton toggle = createToggleButton(inputComposite, 
+                                       templateHashMap.get(template.getTemplateName()), imagePoint, template.getTemplateName(), fontPoint, 
+                                       92, 76, topPosition, leftPosition);                             
+                       targetGroup.addToggleButton(toggle);                            
+
+                       // listener
+                       toggle.addListener(SWT.MouseUp, new Listener() {
+                               
+                               @Override
+                               public void handleEvent(Event event) {
+                                       DACustomToggleButton toggleButton = (DACustomToggleButton) event.widget;                                
+                                       if(toggleButton.isToggled()) {
+                                               // set select template
+                                               TargetData target = SettingDataManager.getInstance().getTarget(null);
+                                               target.setSelectedTemplate(toggleButton.getText());
+                                               target.changeAvailableFeatureListMap(toggleButton.getText());
+                                               
+                                               // change description
+                                               createTemplateDescriptionComposite();
+                                               
+                                               // change button status
+                                               SettingDialogManager.getInstance().updateSaveButtonStatus(null);
+                                       }
+                               }
+                       });             
+                       
+                       // set next position
+                       if (leftPosition + 96 < 480) {
+                               leftPosition += 96;
+                       } else {
+                               leftPosition = 13;
+                               topPosition += 80;
+                       }
+                       
+                       // set selection template 
+                       if (selectedTemplate.equals(entry.getKey()) == true) {
+                               targetGroup.setSelection(toggle);
+                       }
+               }
+               
+               templateComp.layout(true);
+       }
+}
\ No newline at end of file
index fd05560..7d2d47f 100644 (file)
@@ -28,10 +28,10 @@ package org.tizen.dynamicanalyzer.ui.toolbar.setting;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
@@ -52,8 +52,9 @@ public class TargetData {
        public static final int FEATURE_KEY_CHART_LIST = 6;
        public static final int FEATURE_KEY_MIN_VALUE = 7;
        public static final int FEATURE_KEY_MAX_VALUE = 8;
-       public static final int FEATURE_KEY_SWAP_VALUE = 9;
-       public static final int FEATURE_KEY_OVERHEAD_VALUE = 10;
+       public static final int FEATURE_KEY_DEFAULT_VALUE = 9;
+       public static final int FEATURE_KEY_SWAP_VALUE = 10;
+       public static final int FEATURE_KEY_OVERHEAD_VALUE = 11;
        
        // template key index
        public static final int TEMPLATE_KEY_TARGET_NAME = 0;
@@ -61,8 +62,9 @@ public class TargetData {
        public static final int TEMPLAT_KEY_DESCRIPTION = 2;
        
        // available information
-       private HashMap<String, TemplateData> availableTemplateListMap = null;
-       private HashMap<String, FeatureData> availableFeatureListMap = null;
+       private Map<String, TemplateData> availableTemplateListMap = null;
+       private Map<String, FeatureData> availableFeatureListMap = null;
+       private List<String> availableChartList = null;
        
        // dialog selected information
        private String selectedTemplate = null;
@@ -71,7 +73,6 @@ public class TargetData {
        // init selected information : for revert button 
        private String initTemplate = null;
        private List<FeatureValueData> initFeatureList = null;
-
        
        public TargetData(String targetName) {
                this.targetName = targetName;
@@ -96,15 +97,15 @@ public class TargetData {
                this.selectedTemplate = selectedTemplate;
        }
        
-       public HashMap<String, TemplateData> getAvailableTemplateListMap() {
+       public Map<String, TemplateData> getAvailableTemplateListMap() {
                if (availableTemplateListMap == null) {
-                       availableTemplateListMap = new HashMap<String, TemplateData>();
+                       availableTemplateListMap = new LinkedHashMap<String, TemplateData>();
                }
                return availableTemplateListMap;
        }
        
        public boolean isAvailableTemplate(String templateName) {
-               HashMap<String, TemplateData> map = getAvailableTemplateListMap();              
+               Map<String, TemplateData> map = getAvailableTemplateListMap();          
                if (map.get(templateName) == null) {
                        return false;
                }
@@ -112,19 +113,33 @@ public class TargetData {
        }
        
        public TemplateData getAvailableTemplate(String templateName) {
-               HashMap<String, TemplateData> map = getAvailableTemplateListMap();              
+               Map<String, TemplateData> map = getAvailableTemplateListMap();          
                return map.get(templateName);
        }
 
-       public HashMap<String, FeatureData> getAvailableFeatureListMap() {
+       public Map<String, FeatureData> getAvailableFeatureListMap() {
                if (availableFeatureListMap == null) {
-                       availableFeatureListMap = new HashMap<String, FeatureData>();
+                       availableFeatureListMap = new LinkedHashMap<String, FeatureData>();
                }
                return availableFeatureListMap;
        }
        
+       public List<String> getAvailableChartList() {
+               if (availableChartList == null) {
+                       availableChartList = new ArrayList<String>();
+               }
+               return availableChartList;
+       }
+
+       public void setAvailableChartList(List<String> availableChartList) {
+               if (this.availableChartList != null) {
+                       this.availableChartList.clear();
+               }
+               this.availableChartList = availableChartList;
+       }
+
        private boolean isAvailableFeature(String featureName) {
-               HashMap<String, FeatureData> map = getAvailableFeatureListMap();                
+               Map<String, FeatureData> map = getAvailableFeatureListMap();            
                if (map.get(featureName) == null) {
                        return false;
                }
@@ -132,13 +147,13 @@ public class TargetData {
        }
 
        public FeatureData getAvailableFeature(String featureName) {
-               HashMap<String, FeatureData> map = getAvailableFeatureListMap();
+               Map<String, FeatureData> map = getAvailableFeatureListMap();
                return map.get(featureName);
        }
        
        public String getParentFeatureName(String featureName) {
                if (isAvailableFeature(featureName) == true) {
-                       HashMap<String, FeatureData> map = getAvailableFeatureListMap();                
+                       Map<String, FeatureData> map = getAvailableFeatureListMap();            
                        FeatureData feature = map.get(featureName);
                        return feature.getParentName();
                } else {
@@ -147,22 +162,32 @@ public class TargetData {
                return null;
        }
        
-       public String getOptionFeatureName(String featureName) {
+       public List<String> getOptionFeatureNameList(String featureName) {
+               List<String> optionFeatureList = new ArrayList<String>();
+               
                if (isAvailableFeature(featureName) == true) {
-                       HashMap<String, FeatureData> map = getAvailableFeatureListMap();        
+                       Map<String, FeatureData> map = getAvailableFeatureListMap();    
                        for (Map.Entry<String, FeatureData> entry : map.entrySet()) {
                                FeatureData feature = entry.getValue();
                                if ((feature.getFeatureType() == FeatureData.FEATURE_TYPE_DETAIL) && 
                                         (featureName.equals(feature.getParentName()) == true)) {
-                                       return feature.getFeatureName();
+                                       optionFeatureList.add(feature.getFeatureName());
                                } // else : do nothing
                        }
                } else {
                        Logger.debug("does not exist featureName : " + featureName);
                }
-               return null;
+               return optionFeatureList;
        }
        
+       
+       public void setSelectedFeatureList(List<FeatureValueData> selectedFeatureList) {
+               if (this.selectedFeatureList != null) {
+                       this.selectedFeatureList.clear();
+               }
+               this.selectedFeatureList = selectedFeatureList;
+       }
+
        public List<FeatureValueData> getSelectedFeatureList() {
                if (selectedFeatureList == null) {
                        selectedFeatureList = new ArrayList<FeatureValueData>();
@@ -194,6 +219,24 @@ public class TargetData {
        }
        
        /**
+        * Change the selected feature list.
+        * 
+        * @param selectedTemplate      selected templateName
+        */
+       public void changeAvailableFeatureListMap(String selectedTemplate) {
+               if (this.selectedTemplate.equals(selectedTemplate)) {
+                       TemplateData template = getAvailableTemplate(selectedTemplate);
+                       List<FeatureValueData> newFeatureList = template.getFeatureList();
+                       
+                       List<FeatureValueData> featureList = getSelectedFeatureList();
+                       featureList.clear();
+                       featureList.addAll(newFeatureList);
+               } else {
+                       Logger.debug("The template is not selected.");
+               }
+       }
+       
+       /**
         * Add the selected feature.
         * 
         * @param featureName   featureName
@@ -251,7 +294,7 @@ public class TargetData {
         */
        public long getSelectedFeatureSwapValue(String featureName) {
                if (isSelectedFeature(featureName) == true) {
-                       HashMap<String, FeatureData> map = getAvailableFeatureListMap();
+                       Map<String, FeatureData> map = getAvailableFeatureListMap();
                        FeatureData feature = map.get(featureName);
                        return feature.getSwapValue();
                }
@@ -264,9 +307,9 @@ public class TargetData {
         * @param list  Template information list
         */
        public void makeAvailableTemplateListMap(String list[]) {
-               HashMap<String, TemplateData> map = getAvailableTemplateListMap();      
+               Map<String, TemplateData> map = getAvailableTemplateListMap();  
                TemplateData template = null;
-               
+
                // search template
                if (isAvailableTemplate(list[TEMPLAT_KEY_TEMPLAT_NAME]) == false) {
                        template = new TemplateData(list[TEMPLATE_KEY_TARGET_NAME], list[TEMPLAT_KEY_TEMPLAT_NAME]);
@@ -289,7 +332,7 @@ public class TargetData {
         * @param list  Feature information list
         */
        public void makeAvailableFeatureListMap(String list[]) {
-               HashMap<String, FeatureData> map = getAvailableFeatureListMap();                
+               Map<String, FeatureData> map = getAvailableFeatureListMap();            
                FeatureData feature = null;
                
                // search feature
@@ -315,6 +358,7 @@ public class TargetData {
                feature.makeChartList(list[FEATURE_KEY_CHART_LIST]);
                feature.setMinValue(list[FEATURE_KEY_MIN_VALUE]);
                feature.setMaxValue(list[FEATURE_KEY_MAX_VALUE]);
+               feature.setDefaultValue(list[FEATURE_KEY_DEFAULT_VALUE]);
                feature.setSwapValue(list[FEATURE_KEY_SWAP_VALUE]);
                feature.setOverheadValue(list[FEATURE_KEY_OVERHEAD_VALUE]);             
        }
@@ -350,6 +394,20 @@ public class TargetData {
        }
        
        /**
+        * Generates a list of available chart.
+        * 
+        * @param list  Chart information list
+        */
+       public void makeAvailableChartList(String list[]) {
+               List<String> chartList = getAvailableChartList();
+               if (list != null) {
+                       for (int i = 2; i < list.length; i++) {
+                               chartList.add(list[i]);
+                       }
+               } // else do nothing
+       }
+
+       /**
         * Write the selected template/feature information in the setting file.
         * 
         * @param writer                setting file Writer
@@ -361,6 +419,8 @@ public class TargetData {
                                targetName + CommonConstants.COMMA + selectedTemplate);
                writer.println(SettingDataManager.KEY_SELECTED_FEATURE_LIST + CommonConstants.COMMA + 
                                targetName + CommonConstants.COMMA + writeSelectedFeatureListData());
+               writer.println(SettingDataManager.KEY_AVAILABLE_CHART_LIST + CommonConstants.COMMA + 
+                               targetName + CommonConstants.COMMA + writeAvailableChartListData());
                writer.checkError();
        }
        
@@ -382,6 +442,20 @@ public class TargetData {
                return buffer.toString();
        }
        
+       private String writeAvailableChartListData() {
+               List<String> chartList = getAvailableChartList();
+               StringBuffer buffer = new StringBuffer();
+       
+               for (int i = 0; i < chartList.size(); i++) {
+                       if (i < chartList.size() -1) {
+                               buffer.append(chartList.get(i) + CommonConstants.COMMA);
+                       } else {
+                               buffer.append(chartList.get(i));
+                       }
+               }
+               return buffer.toString();
+       }
+               
        public boolean changedFeatures() {
                // check template
                if (initTemplate.equals(selectedTemplate) == false) {
@@ -419,8 +493,39 @@ public class TargetData {
                for (int i = 0; i < featureList.size(); i++) {
                        FeatureData feature = getAvailableFeature(featureList.get(i).getFeatureName());
                        selectedPageList.addAll(feature.getPageList());
-               }       
-               
+               }
                return selectedPageList;
        }
+       
+       public Set<String> getSelectedChartList() {
+               Set<String> selectedChartList = new HashSet<String>();
+               List<FeatureValueData> featureList = getSelectedFeatureList();
+               for (int i = 0; i < featureList.size(); i++) {
+                       FeatureData feature = getAvailableFeature(featureList.get(i).getFeatureName());
+                       selectedChartList.addAll(feature.getChartList());
+               }
+               return selectedChartList;
+       }
+       
+       public void applySettingData() {
+               // set template
+               initTemplate = selectedTemplate;
+               
+               // set feature
+               if (initFeatureList != null) {
+                       initFeatureList.clear();
+               }
+               initFeatureList.addAll(selectedFeatureList);
+       }
+       
+       public void revertSettingData() {
+               // set template
+               selectedTemplate = initTemplate;
+               
+               // set feature
+               if (selectedFeatureList != null) {
+                       selectedFeatureList.clear();
+               }
+               selectedFeatureList.addAll(initFeatureList);
+       }
 }
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
new file mode 100644 (file)
index 0000000..a3f77a6
--- /dev/null
@@ -0,0 +1,308 @@
+/*
+ *  Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: 
+ * Heeyoung Hwang <heeyoung1008.hwang@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * Contributors:
+ * - S-Core Co., Ltd
+ * 
+ */
+package org.tizen.dynamicanalyzer.ui.toolbar.setting;
+
+import org.eclipse.swt.SWT;
+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;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.communicator.IDECommunicator;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.nl.WidgetLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+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;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
+import org.tizen.dynamicanalyzer.widgets.da.base.DAMessageBox;
+
+public class WelcomeDialog extends DAMessageBox {
+       
+       private DACustomButton applyButton = null;
+       private DACustomButton revertButton = null;
+       private DACustomButton runButton = null;
+       
+       private SettingDialogTemplatePage templatesPage = null;
+       private DACheckBox useAgainCheckButton = null;
+       
+       public WelcomeDialog(Shell parentShell) {
+               super(parentShell);
+               SettingDataManager.getInstance();       // read setting information file
+       }
+
+       private DACustomButtonClickEventListener applyButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       doApply();
+                       applicableButteon();
+               }
+       };
+       private DACustomButtonClickEventListener revertButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       doRevert();
+                       applicableButteon();
+               }
+       };
+       
+       private DACustomButtonClickEventListener runButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       doRun();
+                       shell.dispose();        // close dialog
+               }
+       };
+       
+       private void doApply() {
+               // write setting data
+               SettingDataManager.getInstance().applySettingData();
+               
+               // add & remove tab view page
+               SettingDialogManager.getInstance().createTabViewPage();
+               
+               // add & remove (timeline) chart
+               SettingDialogManager.getInstance().updateChartList();
+
+       }
+
+       private void doRevert() {
+               // rollback setting data
+               SettingDataManager.getInstance().revertSettingData();
+               
+               // update template view
+               templatesPage.createTemplateTitleComposite();
+               templatesPage.createTemplateDescriptionComposite();
+               templatesPage.createTargetComposite();
+       }
+
+       private void doRun() {
+               SettingDialogManager.getInstance().applySwapValue();    
+       }
+
+       private DACheckboxSelectionListener useAgainCheckbuttonListener = new DACheckboxSelectionListener() {
+               @Override
+               public void handleSelectionEvent(DACheckBox checkbox) {
+                       if (SettingDataManager.getInstance().isShowInitial()) {
+                               SettingDataManager.getInstance().setShowInitial(false);
+                               useAgainCheckButton.setChecked(false);                  
+                       } else {
+                               SettingDataManager.getInstance().setShowInitial(true);
+                               useAgainCheckButton.setChecked(true);                                   
+                       }
+
+                       // change button status
+                       SettingDialogManager.getInstance().updateSaveButtonStatus(null);
+               }
+       };
+       
+       protected boolean run() {
+               IDECommunicator.setOpenWelcomeDlg(true);
+               shell.setSize(611, 582);
+               shell.setLayout(new FormLayout());
+               shell.setText(AnalyzerLabels.SETTING_TITLE);
+               shell.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+               
+               // banner
+               Label banner = new Label(shell, SWT.TRANSPARENT);
+               banner.setBackground(ColorResources.WINDOW_BG_COLOR);
+               banner.setImage(ImageResources.WELCONE_BANNER_IMAGE);
+
+               FormData labelData = new FormData();
+               labelData.top = new FormAttachment(0, 0);
+               labelData.left = new FormAttachment(0, 0);
+               labelData.right = new FormAttachment(100, 0);
+               labelData.height = 80;
+               banner.setLayoutData(labelData);
+
+               // content composite
+               Composite contentsComp = new Composite(shell, SWT.NONE);
+               FormLayout compLayout = new FormLayout();
+               contentsComp.setLayout(compLayout);
+               contentsComp.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+
+               FormData compData = new FormData();
+               compData.top = new FormAttachment(banner, 0);
+               compData.left = new FormAttachment(0, 0);
+               compData.right = new FormAttachment(100, 0);
+               compData.bottom = new FormAttachment(100, -71);
+               contentsComp.setLayoutData(compData);
+               
+               templatesPage = new SettingDialogTemplatePage(
+                               contentsComp, SWT.NONE);
+               compData = new FormData();
+               compData.top = new FormAttachment(0, 0);
+               compData.left = new FormAttachment(0, 0);
+               compData.right = new FormAttachment(100, 0);
+               compData.bottom = new FormAttachment(100, 0);
+               templatesPage.setLayoutData(compData);
+               SettingDialogManager.getInstance().setConfigDlg(this);
+               
+               // button composite
+               Composite buttonContentsComp = new Composite(shell, SWT.NONE);
+               compLayout = new FormLayout();
+               buttonContentsComp.setLayout(compLayout);
+               buttonContentsComp.setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
+               compData = new FormData();
+               compData.top = new FormAttachment(contentsComp, 0);
+               compData.left = new FormAttachment(0, 0);
+               compData.right = new FormAttachment(100, 0);
+               compData.bottom = new FormAttachment(100, 0);
+               buttonContentsComp.setLayoutData(compData);             
+               buttonContentsComp.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               Composite comp = (Composite) e.widget;
+                               Rectangle rect = comp.getClientArea();
+                               e.gc.setForeground(ColorResources.SETTING_SUNKEN_LINE_1);
+                               e.gc.drawLine(0, 0, rect.width-1, 0);
+                               e.gc.setForeground(ColorResources.SETTING_SUNKEN_LINE_2);
+                               e.gc.drawLine(0, 1, rect.width-1, 1);
+                       }
+               });
+       
+               // ask use again image
+               useAgainCheckButton = new DACheckBox(buttonContentsComp, SWT.NONE);
+               FormData data = new FormData();
+               data.top = new FormAttachment(0, 13);
+               data.left = new FormAttachment(0, 12);
+               data.height = 16;
+               data.width = 312;
+               useAgainCheckButton.setLayoutData(data);
+               useAgainCheckButton.setForeground(ColorResources.BLACK);
+               useAgainCheckButton
+                               .setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
+               useAgainCheckButton.setText(ConfigureLabels.WELCONE_ASK_USE_AGAIN);
+               useAgainCheckButton.addSelectionListener(useAgainCheckbuttonListener);
+               useAgainCheckButton.setChecked(SettingDataManager.getInstance().isShowInitial());
+               
+               runButton = new DAButton(buttonContentsComp, SWT.NONE);
+               runButton.addClickListener(runButtonListener);
+               runButton.setText(WidgetLabels.RUN);
+               runButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+               FormData buttonData = new FormData();
+               buttonData.right = new FormAttachment(100, -9);
+               buttonData.top = new FormAttachment(useAgainCheckButton, 6);
+               buttonData.width = 100;
+               buttonData.height = 28;
+               runButton.setLayoutData(buttonData);
+               
+               revertButton = new DAButton(buttonContentsComp, SWT.NONE);
+               revertButton.addClickListener(revertButtonListener);
+               revertButton.setText(WidgetLabels.REVERT);
+               revertButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+               buttonData = new FormData();
+               buttonData.right = new FormAttachment(runButton, -8);
+               buttonData.top = new FormAttachment(useAgainCheckButton, 6);
+               buttonData.width = 100;
+               buttonData.height = 28;
+               revertButton.setLayoutData(buttonData);
+               
+               applyButton = new DAButton(buttonContentsComp, SWT.NONE);
+               applyButton.addClickListener(applyButtonListener);
+               applyButton.setText(WidgetLabels.APPLY);
+               applyButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
+               buttonData = new FormData();
+               buttonData.right = new FormAttachment(revertButton, -8);
+               buttonData.top = new FormAttachment(useAgainCheckButton, 6);
+               buttonData.width = 100;
+               buttonData.height = 28;
+               applyButton.setLayoutData(buttonData);
+               
+               applicableButteon();
+               shell.addShellListener(shellListener);
+               shell.open();
+               return true;
+       }
+       
+       public void applicableButteon() {
+               applyButton.setButtonEnabled(false);
+               revertButton.setButtonEnabled(false);
+               runButton.setButtonEnabled(true);
+       }
+       
+       public void editableButteon() {
+               applyButton.setButtonEnabled(true);
+               revertButton.setButtonEnabled(true);
+               runButton.setButtonEnabled(false);
+       }
+       
+       private void notifyAutoRun() {
+               synchronized (IDECommunicator.getWaitingWelcomeDlg()) {
+                       IDECommunicator.setOpenWelcomeDlg(false);
+                       IDECommunicator.getWaitingWelcomeDlg().notifyAll();
+               }
+       }
+       
+       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
+                       notifyAutoRun();
+               }
+
+               @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
+
+               }
+
+       };
+}