[Title] Binary Analysis fixed
authorjooyoul_lee <jy.exe.lee@samsung.com>
Fri, 8 Nov 2013 04:55:44 +0000 (13:55 +0900)
committerjooyoul_lee <jy.exe.lee@samsung.com>
Fri, 8 Nov 2013 04:55:44 +0000 (13:55 +0900)
[Desc.]
[Issue]

15 files changed:
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/radio/DARadioButton.java
org.tizen.dynamicanalyzer.widgets/src/org/tizen/dynamicanalyzer/widgets/button/radio/DARadioGroup.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/ElfSymbolExtracter.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/DACommunicator.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/communicator/Communicator30.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAddDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAnalyzingConfigDialog.java [deleted file]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/InputRow.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/LoadSettingDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/SaveSettingDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/SaveAsDialog.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/configuration/ConfigurationDialog.java

index 810b7f1..a3eb0c6 100644 (file)
@@ -41,6 +41,8 @@ import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
 import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
 
 public class DARadioButton extends Canvas {
+       private static int radioSeq = 0;
+
        public static final int RADIO_UNSELECTED = 0;
        public static final int RADIO_SELECTED = 1;
        public static final int RADIO_UNSELECTED_HOVER = 2;
@@ -52,6 +54,8 @@ public class DARadioButton extends Canvas {
        private Color bgColor = null;
        private Color fgColor = null;
 
+       private int id = 0;
+
        public DARadioButton(Composite parent, int style) {
                super(parent, style);
                this.addPaintListener(radioPaintListener);
@@ -59,6 +63,18 @@ public class DARadioButton extends Canvas {
                this.addListener(SWT.MouseExit, mouseListener);
                this.addListener(SWT.MouseUp, mouseListener);
                text = DAWidgetConstants.EMPTY_STRING;
+               id = radioSeq;
+               radioSeq++;
+       }
+
+       public DARadioButton(Composite parent, int style, int radioID) {
+               this(parent, style);
+               this.addPaintListener(radioPaintListener);
+               this.addListener(SWT.MouseEnter, mouseListener);
+               this.addListener(SWT.MouseExit, mouseListener);
+               this.addListener(SWT.MouseUp, mouseListener);
+               text = DAWidgetConstants.EMPTY_STRING;
+               id = radioID;
        }
 
        public void setForeground(Color color) {
@@ -77,7 +93,7 @@ public class DARadioButton extends Canvas {
                return text;
        }
 
-       public void setParent(DARadioGroup parent) {
+       public void setGroup(DARadioGroup parent) {
                this.parent = parent;
        }
 
@@ -163,4 +179,19 @@ public class DARadioButton extends Canvas {
        public void addSelectionListener(DARadioSelectionListener listener) {
                addListener(SWT.MouseUp, listener);
        }
+
+       public boolean isSelected() {
+               if (state == RADIO_SELECTED) {
+                       return true;
+               }
+               return false;
+       }
+
+       public int getRadioId() {
+               return id;
+       }
+
+       public String getGroup() {
+               return parent.getGroupID();
+       }
 }
index c0689df..87faf9b 100644 (file)
@@ -30,12 +30,19 @@ import java.util.ArrayList;
 import java.util.List;
 
 public class DARadioGroup {
+       private static int groupNum = 0;
+       private String ID = null;
        private int selection = 0;
        private List<DARadioButton> children = null;
 
+       public DARadioGroup() {
+               ID = "RADIO_" + groupNum;
+               groupNum++;
+       }
+
        public void addChild(DARadioButton child) {
                getChildren().add(child);
-               child.setParent(this);
+               child.setGroup(this);
                if (getChildren().size() == 1) {
                        setSelection(child);
                }
@@ -66,4 +73,8 @@ public class DARadioGroup {
        public DARadioButton getSelection() {
                return getChildren().get(selection);
        }
+
+       public String getGroupID() {
+               return ID;
+       }
 }
index 8c32978..6b53fff 100644 (file)
@@ -48,6 +48,7 @@ import org.tizen.dynamicanalyzer.common.PathManager;
 import org.tizen.dynamicanalyzer.model.DeviceInfo;
 import org.tizen.dynamicanalyzer.project.PackageInfo;
 import org.tizen.dynamicanalyzer.swap.communicator.Communicator30;
+import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
 import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
 import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
@@ -582,7 +583,8 @@ public class DACommunicator {
                                } else {
                                        clearDeviceAppInfo();
                                }
-                               ToolbarArea.getInstance().setDeviceComboItems(selectedDevice, deviceSerials);
+                               ToolbarArea.getInstance().setDeviceComboItems(selectedDevice,
+                                               deviceSerials);
                        }
                });
        }
@@ -671,18 +673,20 @@ public class DACommunicator {
                return currentDevice.getCommunicator().handleControlMessage(msg);
        }
 
-       public static HostResult sendBinaryInfoMessageForLib() {
+       public static HostResult sendBinaryInfoMessageForLib(
+                       List<BinarySettingData> input) {
                if (isSWAPVersion()) {
                        return ((Communicator30) currentDevice.getCommunicator())
-                                       .sendBinaryInfoMessageForLib();
+                                       .sendBinaryInfoMessageForLib(input);
                }
                return null;
        }
 
-       public static HostResult sendSWAPMessage(int messageId) {
+       public static HostResult sendSWAPMessage(int messageId,
+                       List<BinarySettingData> input) {
                if (isSWAPVersion()) {
                        return ((Communicator30) currentDevice.getCommunicator())
-                                       .sendSWAPMessage(messageId);
+                                       .sendSWAPMessage(messageId, input);
                }
                return null;
        }
index 7c5b5f2..95841a7 100755 (executable)
@@ -805,9 +805,8 @@ public class Communicator30 extends BaseCommunicator {
                }
        }
 
-       public HostResult sendSWAPMessage(int messageId) {
-               List<BinarySettingData> settings = BinarySettingManager.getInstance()
-                               .getBinarySettings();
+       public HostResult sendSWAPMessage(int messageId,
+                       List<BinarySettingData> settings) {
                HashMap<String, BinaryInfo> targetBinInfoMap = BinarySettingManager
                                .getInstance().getTargetBinInfoMap();
                byte[] msg = new byte[0];
@@ -818,6 +817,9 @@ public class Communicator30 extends BaseCommunicator {
                for (int a = 0; a < count; a++) {
                        String binaryPath = settings.get(a).getBinaryPath();
                        BinaryInfo binInfo = targetBinInfoMap.get(binaryPath);
+                       if (null == binInfo) {
+                               continue;
+                       }
                        String localPath = binInfo.getSourceBinaryPath();
 
                        ElfSymbolExtracter symbolExtractor = new ElfSymbolExtracter();
@@ -879,9 +881,11 @@ public class Communicator30 extends BaseCommunicator {
                return HostResult.SUCCESS;
        }
 
-       public HostResult sendBinaryInfoMessageForLib() {
-               List<BinarySettingData> binaryData = BinarySettingManager.getInstance()
-                               .getBinarySettings();
+       public HostResult sendBinaryInfoMessageForLib(
+                       List<BinarySettingData> binaryData) {
+               // List<BinarySettingData> binaryData =
+               // BinarySettingManager.getInstance()
+               // .getBinarySettings();
                List<String> binPaths = new ArrayList<String>();
                List<BinaryInfo> binInfoList = new ArrayList<BinaryInfo>();
 
index 56f82aa..3d84fc4 100644 (file)
@@ -52,7 +52,10 @@ public class BinarySettingManager {
        // temporary list
        private HashMap<String, InputRow> inputRowHash = new HashMap<String, InputRow>();
        private List<InputRow> inputRowList = new ArrayList<InputRow>();
-       private List<BinarySettingData> tempBinarySettings = new ArrayList<BinarySettingData>();
+
+       private List<BinarySettingData> realBinarySettings = new ArrayList<BinarySettingData>();
+       private List<BinarySettingData> addBinarySettings = new ArrayList<BinarySettingData>();
+       private List<BinarySettingData> removeBinarySettings = new ArrayList<BinarySettingData>();
 
        public static synchronized BinarySettingManager getInstance() {
                if (null == instance) {
@@ -62,9 +65,9 @@ public class BinarySettingManager {
        }
 
        public void removeRealBinarySettingData(String binPath) {
-               for (int i = 0; i < binarySettings.size(); i++) {
-                       if (binPath.equals(binarySettings.get(i).getBinaryPath())) {
-                               binarySettings.remove(i);
+               for (int i = 0; i < realBinarySettings.size(); i++) {
+                       if (binPath.equals(realBinarySettings.get(i).getBinaryPath())) {
+                               realBinarySettings.remove(i);
                                break;
                        }
                }
@@ -78,15 +81,23 @@ public class BinarySettingManager {
                binarySettings.clear();
        }
 
-       public void putBinarySettingData(List<BinarySettingData> data) {
-               binarySettings.clear();
-               binarySettings.addAll(data);
+       public void putRealBinarySettingData(List<BinarySettingData> data) {
+               for (BinarySettingData binData : data) {
+                       for (int i = 0; i < realBinarySettings.size(); i++) {
+                               String realBinary = realBinarySettings.get(i).getBinaryPath();
+                               if (realBinary.equals(binData.getBinaryPath())) {
+                                       realBinarySettings.remove(i);
+                                       break;
+                               }
+                       }
+                       realBinarySettings.add(binData);
+               }
        }
 
-       public void checkSourcePath() {
-               int size = binarySettings.size();
+       public void checkSourcePath(List<BinarySettingData> input) {
+               int size = input.size();
                for (int i = 0; i < size; i++) {
-                       BinarySettingData binData = binarySettings.get(i);
+                       BinarySettingData binData = input.get(i);
                        if (null != binData.getDebugPath()
                                        && !binData.getDebugPath().isEmpty()) {
                                // check dir exists.
@@ -147,6 +158,8 @@ public class BinarySettingManager {
                                String debugRpmSourcePath = null;
                                if (AnalyzerUtil.copyFile(from, to)) {
                                        debugRpmPath = to;
+                               } else {
+                                       continue;
                                }
 
                                if (null != debugInfoSourceRpmName
@@ -276,9 +289,9 @@ public class BinarySettingManager {
                return inputRowList;
        }
 
-       public List<BinarySettingData> getTempBinarySettings() {
-               return tempBinarySettings;
-       }
+       // public List<BinarySettingData> getTempBinarySettings() {
+       // return tempBinarySettings;
+       // }
 
        public void removeInputRow(String path) {
                InputRow inputRow = inputRowHash.get(path);
@@ -301,24 +314,22 @@ public class BinarySettingManager {
                }
                inputRowHash.remove(path);
                inputRowList.remove(index);
-               removeBinarySettingData(path);
+               // removeBinarySettingData(path);
        }
 
-       public void removeBinarySettingData(String binPath) {
-               for (int i = 0; i < tempBinarySettings.size(); i++) {
-                       if (binPath.equals(tempBinarySettings.get(i).getBinaryPath())) {
-                               tempBinarySettings.remove(i);
+       public void removeAddBinarySettingData(String binPath) {
+               for (int i = 0; i < addBinarySettings.size(); i++) {
+                       if (binPath.equals(addBinarySettings.get(i).getBinaryPath())) {
+                               addBinarySettings.remove(i);
                                break;
                        }
                }
        }
 
-       public void updateInputRow(String binPath, String sourcePath) {
-               int size = tempBinarySettings.size();
-               for (int i = 0; i < size; i++) {
-                       BinarySettingData data = tempBinarySettings.get(i);
-                       if (data.getBinaryPath().equals(binPath)) {
-                               data.setSourcePath(sourcePath);
+       public void removeRemoveBinarySettingData(String binPath) {
+               for (int i = 0; i < removeBinarySettings.size(); i++) {
+                       if (binPath.equals(removeBinarySettings.get(i).getBinaryPath())) {
+                               removeBinarySettings.remove(i);
                                break;
                        }
                }
@@ -371,4 +382,21 @@ public class BinarySettingManager {
                }
                return binData;
        }
+
+       public List<BinarySettingData> getRealBinarySettings() {
+               return realBinarySettings;
+       }
+
+       public List<BinarySettingData> getAddBinarySettings() {
+               return addBinarySettings;
+       }
+
+       public List<BinarySettingData> getRemoveBinarySettings() {
+               return removeBinarySettings;
+       }
+
+       public void syncData() {
+               realBinarySettings.clear();
+               realBinarySettings.addAll(binarySettings);
+       }
 }
index b200a58..e2200cc 100644 (file)
@@ -6,8 +6,6 @@ import java.util.List;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.KeyEvent;
 import org.eclipse.swt.events.KeyListener;
-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.graphics.Rectangle;
@@ -24,6 +22,7 @@ import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
 import org.tizen.dynamicanalyzer.ui.widgets.DAMessageBox;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
 import org.tizen.sdblib.service.FileEntry;
@@ -61,6 +60,7 @@ public class BinaryAddDialog extends DAMessageBox {
                        if (result != null) {
                                FileEntry entry = (FileEntry) result;
                                binary.setText(entry.getFullPath());
+                               okButton.setButtonEnabled(true);
                        }
                }
        };
@@ -104,9 +104,10 @@ public class BinaryAddDialog extends DAMessageBox {
 
        protected boolean run() {
                shell.setLayout(new FormLayout());
-               shell.setSize(446, 240);
+               shell.setSize(446, 225);
                shell.setBackground(ColorResources.DIALOG_BG_UPPER);
                shell.setText("Add Binary Setting");
+               AnalyzerUtil.setCenter(shell);
 
                Label label = new Label(shell, SWT.TRANSPARENT);
                FormData data = new FormData();
@@ -121,7 +122,7 @@ public class BinaryAddDialog extends DAMessageBox {
 
                binary = new Text(shell, SWT.SINGLE);
                data = new FormData();
-               data.top = new FormAttachment(label, 10);
+               data.top = new FormAttachment(label, 5);
                data.left = new FormAttachment(0, 12);
                data.height = 24;
                data.width = 350;
@@ -133,17 +134,19 @@ public class BinaryAddDialog extends DAMessageBox {
 
                        @Override
                        public void paintControl(PaintEvent e) {
-                               e.gc.setForeground(ColorResources.BLUE);
+                               e.gc.setForeground(ColorResources.BUTTON_OUTLINE_HOVER_IN_COLOR);
                                Text text = (Text) e.widget;
                                Rectangle rect = text.getClientArea();
-                               e.gc.drawRectangle(rect.x, rect.y, rect.width -1, rect.height - 1);
-                               e.gc.drawRectangle(rect.x+1, rect.y+1, rect.width -3, rect.height - 3);
+                               e.gc.drawRectangle(rect.x, rect.y, rect.width - 1,
+                                               rect.height - 1);
+                               // e.gc.drawRectangle(rect.x+1, rect.y+1, rect.width -3,
+                               // rect.height - 3);
                        }
                });
-               
+
                findButton = new DAButton(shell, SWT.NONE);
                data = new FormData();
-               data.top = new FormAttachment(label, 9);
+               data.top = new FormAttachment(label, 4);
                data.left = new FormAttachment(binary, 5);
                data.height = 30;
                data.width = 50;
@@ -184,7 +187,7 @@ public class BinaryAddDialog extends DAMessageBox {
 
                debugPackage = new Text(shell, SWT.SINGLE);
                data = new FormData();
-               data.top = new FormAttachment(debugLabel, 10);
+               data.top = new FormAttachment(debugLabel, 5);
                data.left = new FormAttachment(0, 12);
                data.height = 26;
                data.width = 350;
@@ -196,14 +199,16 @@ public class BinaryAddDialog extends DAMessageBox {
 
                        @Override
                        public void paintControl(PaintEvent e) {
-                               e.gc.setForeground(ColorResources.BLUE);
+                               e.gc.setForeground(ColorResources.BUTTON_OUTLINE_HOVER_IN_COLOR);
                                Text text = (Text) e.widget;
                                Rectangle rect = text.getClientArea();
-                               e.gc.drawRectangle(rect.x, rect.y, rect.width -1, rect.height - 1);
-                               e.gc.drawRectangle(rect.x+1, rect.y+1, rect.width -3, rect.height - 3);
+                               e.gc.drawRectangle(rect.x, rect.y, rect.width - 1,
+                                               rect.height - 1);
+                               // e.gc.drawRectangle(rect.x+1, rect.y+1, rect.width -3,
+                               // rect.height - 3);
                        }
                });
-               
+
                Composite buttonComp = new Composite(shell, SWT.NONE);
                buttonComp.setLayout(new FormLayout());
                buttonComp.setBackground(ColorResources.DIALOG_BG_LOWER);
diff --git a/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAnalyzingConfigDialog.java b/org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/BinaryAnalyzingConfigDialog.java
deleted file mode 100644 (file)
index adb3c47..0000000
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- *  Dynamic Analyzer
- *
- * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: 
- * 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.swap.platform.ui;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-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.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
-import org.tizen.dynamicanalyzer.common.CommonConstants;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
-import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
-import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
-import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
-import org.tizen.dynamicanalyzer.ui.widgets.DAMessageBox;
-import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
-import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
-import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButton;
-
-public class BinaryAnalyzingConfigDialog extends DAMessageBox {
-       private static final int WIDTH = 800;
-       private static final int HEIGHT = 600;
-
-       private HashMap<String, InputRow> inputRowHash = null;
-       private List<InputRow> inputRowList = null;
-
-       private ScrolledComposite scrolledComposite = null;
-       private Composite inputComposite = null;
-       private DACustomToggleButton enableButton = null;
-       private DAButton cleanButton = null;
-       private DAButton addButton = null;
-       private DAButton saveButton = null;
-       private DAButton loadButton = null;
-
-       private boolean isLoaded = false;
-
-       private Composite bottomComp = null;
-
-       private DAButton okButton = null;
-       private DAButton cancelButton = null;
-
-//     private BinaryAnalyzingConfigDialog me = null;
-
-       public BinaryAnalyzingConfigDialog(Shell parentShell) {
-               super(parentShell);
-//             me = this;
-
-               inputRowHash = BinarySettingManager.getInstance().getInputRowHash();
-               inputRowList = BinarySettingManager.getInstance().getInputRowList();
-
-               String settingPath = AnalyzerPaths.DYNAMIC_ANALYZER_SETTING_PATH;
-               File settingFolder = new File(settingPath);
-               if (!settingFolder.exists() || !settingFolder.isDirectory()) {
-                       settingFolder.mkdirs();
-               }
-       }
-
-       private DACustomButtonClickEventListener addButtonListener = new DACustomButtonClickEventListener() {
-
-               @Override
-               public void handleClickEvent(DACustomButton button) {
-                       BinaryAddDialog dialog = new BinaryAddDialog(shell);
-                       Object result = dialog.open();
-
-                       if (result != null) {
-                               List<String> paths = (List<String>) result;
-                               InputRow inputRow = new InputRow(inputComposite);
-                               inputRow.setBinaryText(paths.get(0));
-                               inputRow.setSourceText(paths.get(1));
-                               inputRowHash.put(paths.get(0), inputRow);
-                               inputRowList.add(inputRow);
-                               inputComposite.layout();
-                       }
-               }
-       };
-
-       private DACustomButtonClickEventListener loadButtonListener = new DACustomButtonClickEventListener() {
-
-               @Override
-               public void handleClickEvent(DACustomButton button) {
-                       LoadSettingDialog dialog = new LoadSettingDialog(shell);
-//                     dialog.setParentDialog(me);
-                       Object result = dialog.open();
-                       if (result == null) {
-                               return;
-                       }
-
-                       cleanButtonListener.handleClickEvent(null);
-
-                       String path = (String) result;
-                       File saveFile = new File(path);
-                       BufferedReader br = null;
-                       String content = null;
-                       boolean success = false;
-                       // List<BinarySettingData> binData = new
-                       // ArrayList<BinarySettingData>();
-                       // List<InputRow> inputRows = new ArrayList<InputRow>();
-                       try {
-                               br = new BufferedReader(new FileReader(saveFile));
-                               while (null != (content = br.readLine())) {
-                                       // BinarySettingData data = new BinarySettingData();
-                                       InputRow inputRow = new InputRow(inputComposite);
-                                       String[] splitContent = content
-                                                       .split(CommonConstants.COMMA);
-                                       inputRow.setBinaryText(new String(splitContent[0]));
-                                       inputRow.setSourceText(new String(splitContent[1]));
-                                       inputRowList.add(inputRow);
-                                       inputRowHash.put(inputRow.getBinaryText(), inputRow);
-                               }
-                               success = true;
-                       } catch (FileNotFoundException e) {
-                               e.printStackTrace();
-                       } catch (IOException e) {
-                               e.printStackTrace();
-                       } finally {
-                               AnalyzerUtil.tryClose(br);
-                       }
-                       inputComposite.layout();
-               }
-       };
-
-       private DACustomButtonClickEventListener saveButtonListener = new DACustomButtonClickEventListener() {
-
-               @Override
-               public void handleClickEvent(DACustomButton button) {
-                       SaveSettingDialog dialog = new SaveSettingDialog(shell,
-                                       inputRowList);
-                       dialog.open();
-                       // save dialog
-                       // filename.setting
-               }
-       };
-
-       private DACustomButtonClickEventListener cleanButtonListener = new DACustomButtonClickEventListener() {
-
-               @Override
-               public void handleClickEvent(DACustomButton button) {
-                       for (int i = 0; i < inputRowList.size(); i++) {
-                               inputRowList.get(i).dispose();
-                       }
-                       inputRowList.clear();
-                       inputRowHash.clear();
-               }
-       };
-
-       private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
-
-               @Override
-               public void handleClickEvent(DACustomButton button) {
-                       List<BinarySettingData> tempBinarySettings = new ArrayList<BinarySettingData>();
-                       for (InputRow input : inputRowList) {
-                               BinarySettingData binaryData = new BinarySettingData();
-                               binaryData.setBinaryPath(input.getBinaryText());
-                               binaryData.setDebugPath(input.getSourceText());
-                               tempBinarySettings.add(binaryData);
-                       }
-                       BinarySettingManager.getInstance().putBinarySettingData(
-                                       tempBinarySettings);
-                       BinarySettingManager.getInstance().checkSourcePath();
-
-                       DACommunicator.sendBinaryInfoMessageForLib();
-                       int swapMsg = AnalyzerConstants.MSG_SWAP_INST_ADD;
-                       if (enableButton.isToggled()) {
-                               swapMsg = AnalyzerConstants.MSG_SWAP_INST_REMOVE;
-                       }
-                       DACommunicator.sendSWAPMessage(swapMsg);
-                       shell.dispose();
-               }
-       };
-
-       private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() {
-
-               @Override
-               public void handleClickEvent(DACustomButton button) {
-                       shell.dispose();
-               }
-       };
-
-       private DACustomButtonClickEventListener enableButtonListener = new DACustomButtonClickEventListener() {
-
-               @Override
-               public void handleClickEvent(DACustomButton button) {
-                       if (enableButton.isToggled()) {
-                               enableButton.setText("Remove");
-                       } else {
-                               enableButton.setText("Add");
-                       }
-               }
-       };
-
-       public Object open() {
-               block = true;
-               parentShell.setEnabled(false);
-               initSuccess = run();
-               if (initSuccess) {
-                       shell.open();
-                       initInputRows();
-                       if (block) {
-                               runEventLoop(shell);
-                       }
-               }
-               shell.dispose();
-               parentShell.setEnabled(true);
-               closeAction();
-               return result;
-       }
-
-       protected boolean run() {
-               shell.setLayout(new FormLayout());
-               shell.setSize(WIDTH, HEIGHT);
-               shell.setBackground(ColorResources.DIALOG_BG_UPPER);
-               shell.setText("Binaries for Analyzing");
-
-               Label binaryLabel = new Label(shell, SWT.TRANSPARENT);
-               FormData data = new FormData();
-               data.top = new FormAttachment(0, 15);
-               data.left = new FormAttachment(0, 20);
-               data.height = 15;
-               data.width = WIDTH / 3;
-               binaryLabel.setLayoutData(data);
-               binaryLabel.setForeground(ColorResources.BLACK);
-               binaryLabel.setText("Binary Name");
-               binaryLabel.setBackground(ColorResources.DIALOG_BG_UPPER);
-
-               Label sourceLabel = new Label(shell, SWT.TRANSPARENT);
-               data = new FormData();
-               data.top = new FormAttachment(0, 15);
-               data.left = new FormAttachment(binaryLabel, 0);
-               data.height = 15;
-               data.width = WIDTH / 3;
-               sourceLabel.setLayoutData(data);
-               sourceLabel.setForeground(ColorResources.BLACK);
-               sourceLabel.setText("Source Path");
-               sourceLabel.setBackground(ColorResources.DIALOG_BG_UPPER);
-
-               scrolledComposite = new ScrolledComposite(shell, SWT.BORDER
-                               | SWT.V_SCROLL | SWT.H_SCROLL);
-               data = new FormData();
-               data.top = new FormAttachment(binaryLabel, 5);
-               data.left = new FormAttachment(0, 15);
-               data.height = 465;
-               data.width = WIDTH - 35;
-               scrolledComposite.setLayoutData(data);
-               scrolledComposite.setLayout(new FormLayout());
-               scrolledComposite.setBackground(ColorResources.BLUE);
-               scrolledComposite.setExpandHorizontal(true);
-               scrolledComposite.setExpandVertical(true);
-
-               // scrolledComposite.setMinSize(WIDTH - 30, 200);
-
-               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(binaryLabel, 5);
-               data.left = new FormAttachment(0, 15);
-               data.height = 495;
-               data.width = WIDTH - 15 - 15;
-               inputComposite.setLayoutData(data);
-               inputComposite.setLayout(new FormLayout());
-               inputComposite.setBackground(ColorResources.DIALOG_BG_UPPER);
-
-               enableButton = new DACustomToggleButton(shell,
-                               ColorResources.BUTTON_NORMAL_COLOR_START,
-                               ColorResources.BUTTON_NORMAL_COLOR_END,
-                               ColorResources.BUTTON_PUSH_COLOR_START,
-                               ColorResources.BUTTON_PUSH_COLOR_END,
-                               ColorResources.BUTTON_HOVER_COLOR_START,
-                               ColorResources.BUTTON_HOVER_COLOR_END,
-                               ColorResources.BUTTON_DISABLE_COLOR_START,
-                               ColorResources.BUTTON_DISABLE_COLOR_END,
-                               ColorResources.BUTTON_NORMAL_COLOR_END,
-                               ColorResources.BUTTON_NORMAL_COLOR_START,
-                               ColorResources.BUTTON_HOVER_COLOR_END,
-                               ColorResources.BUTTON_HOVER_COLOR_START);
-               data = new FormData();
-               data.top = new FormAttachment(scrolledComposite, 5);
-               data.left = new FormAttachment(0, 15);
-               data.height = 18;
-               data.width = 95;
-               enableButton.setLayoutData(data);
-               enableButton.setText("Add");
-               enableButton.addClickListener(enableButtonListener);
-
-               cleanButton = new DAButton(shell, SWT.NONE);
-               data = new FormData();
-               data.top = new FormAttachment(scrolledComposite, 5);
-               data.left = new FormAttachment(0, 395);
-               data.height = 20;
-               data.width = 95;
-               cleanButton.setLayoutData(data);
-               cleanButton.setText("clean");
-               cleanButton.addClickListener(cleanButtonListener);
-
-               addButton = new DAButton(shell, SWT.NONE);
-               data = new FormData();
-               data.top = new FormAttachment(scrolledComposite, 5);
-               data.left = new FormAttachment(cleanButton, 5);
-               data.height = 20;
-               data.width = 95;
-               addButton.setLayoutData(data);
-               addButton.setText("add");
-               addButton.addClickListener(addButtonListener);
-
-               saveButton = new DAButton(shell, SWT.NONE);
-               data = new FormData();
-               data.top = new FormAttachment(scrolledComposite, 5);
-               data.left = new FormAttachment(addButton, 5);
-               data.height = 20;
-               data.width = 95;
-               saveButton.setLayoutData(data);
-               saveButton.setText("save");
-               saveButton.addClickListener(saveButtonListener);
-
-               loadButton = new DAButton(shell, SWT.NONE);
-               data = new FormData();
-               data.top = new FormAttachment(scrolledComposite, 5);
-               data.left = new FormAttachment(saveButton, 5);
-               data.height = 20;
-               data.width = 95;
-               loadButton.setLayoutData(data);
-               loadButton.setText("load");
-               loadButton.addClickListener(loadButtonListener);
-
-               bottomComp = new Composite(shell, SWT.NONE);
-               data = new FormData();
-               data.top = new FormAttachment(loadButton, 5);
-               data.left = new FormAttachment(0, 0);
-               data.height = 40;
-               data.width = WIDTH;
-               bottomComp.setLayoutData(data);
-               bottomComp.setLayout(new FormLayout());
-
-               cancelButton = new DAButton(bottomComp, SWT.NONE);
-               data = new FormData();
-               data.top = new FormAttachment(0, 5);
-               data.right = new FormAttachment(100, -10);
-               data.height = 25;
-               data.width = 100;
-               cancelButton.setLayoutData(data);
-               cancelButton.setText("Cancel");
-               cancelButton.addClickListener(cancelButtonListener);
-
-               okButton = new DAButton(bottomComp, SWT.NONE);
-               data = new FormData();
-               data.top = new FormAttachment(0, 5);
-               data.right = new FormAttachment(cancelButton, -5);
-               data.height = 25;
-               data.width = 100;
-               okButton.setLayoutData(data);
-               okButton.setText("Ok");
-               okButton.addClickListener(okButtonListener);
-
-               inputRowList.clear();
-               inputRowHash.clear();
-
-               return true;
-       }
-
-       public void initInputRows() {
-               if (!isLoaded) {
-                       List<BinarySettingData> binData = BinarySettingManager
-                                       .getInstance().getBinarySettings();
-                       for (int i = 0; i < binData.size(); i++) {
-                               InputRow inputRow = new InputRow(inputComposite);
-                               inputRow.setBinaryText(binData.get(i).getBinaryPath());
-                               String source = binData.get(i).getSourcePath();
-                               if (null != source && !source.isEmpty()) {
-                                       inputRow.setSourceText(source);
-                                       String[] splitSource = source.split(CommonConstants.SLASH);
-                                       String comboSel = new String(
-                                                       splitSource[splitSource.length - 1]);
-                                       // inputRow.setSourceComboText(comboSel);
-                               }
-                               inputRowHash.put(binData.get(i).getBinaryPath(), inputRow);
-                               inputRowList.add(inputRow);
-                       }
-                       inputComposite.layout();
-                       isLoaded = true;
-               }
-       }
-
-}
\ No newline at end of file
index 9dd8571..d2b1faf 100644 (file)
  */
 package org.tizen.dynamicanalyzer.swap.platform.ui;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.swt.SWT;
@@ -38,22 +34,14 @@ import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
 import org.eclipse.swt.widgets.Text;
-import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
 import org.tizen.dynamicanalyzer.common.CommonConstants;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
+import org.tizen.dynamicanalyzer.ui.toolbar.configuration.BinarySettingsPage;
 import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
-import org.tizen.dynamicanalyzer.ui.widgets.TitleComboPopupRenderer;
-import org.tizen.dynamicanalyzer.ui.widgets.TitleComboRenderer;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
-import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer;
-import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;
-import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboSelectionListener;
 
 public class InputRow extends Composite {
        private final static int ROW_HEIGHT = 18;
@@ -64,14 +52,26 @@ public class InputRow extends Composite {
        private DACustomButton minusButton = null;
        private int index = -1;
 
-       private List<String> sbiList = new ArrayList<String>();
        private DACustomButtonClickEventListener minusButtonListener = new DACustomButtonClickEventListener() {
 
                @Override
                public void handleClickEvent(DACustomButton button) {
                        BinarySettingManager.getInstance().removeInputRow(
                                        binaryPathText.getText());
+                       // get InputRow -> get Input Composite
                        Composite pp = button.getParent().getParent();
+                       // get Scrolled Composite -> binary Setting page
+                       Composite page = pp.getParent().getParent();
+                       BinarySettingsPage bsPage = (BinarySettingsPage) page;
+                       int selection = bsPage.getSelectedRadio();
+                       if (selection == BinarySettingsPage.RADIO_ADD) {
+                               BinarySettingManager.getInstance().removeAddBinarySettingData(
+                                               binaryPathText.getText());
+                       } else if (selection == BinarySettingsPage.RADIO_REMOVE) {
+                               BinarySettingManager
+                                               .getInstance()
+                                               .removeRemoveBinarySettingData(binaryPathText.getText());
+                       }
                        button.getParent().dispose();
                        pp.layout();
                }
@@ -86,6 +86,7 @@ public class InputRow extends Composite {
                                        sourcePathText.getText());
                        Object result = dialog.open();
                        if (null != result) {
+                               @SuppressWarnings("unchecked")
                                List<String> paths = (List<String>) result;
                                binaryPathText.setText(paths.get(0));
                                sourcePathText.setText(paths.get(1));
@@ -161,7 +162,7 @@ public class InputRow extends Composite {
                editButton.setLayoutData(data);
                editButton.setText("Edit");
                editButton.addClickListener(editButtonListener);
-               
+
                data = new FormData();
                data.top = new FormAttachment(0, 0);
                // data.left = new FormAttachment(85, 3);
@@ -311,4 +312,9 @@ public class InputRow extends Composite {
                }
                return strBuffer.toString();
        }
+
+       public void setDisable() {
+               editButton.setButtonEnabled(false);
+               minusButton.setButtonEnabled(false);
+       }
 }
index c0d7ed8..26bef72 100644 (file)
  */
 package org.tizen.dynamicanalyzer.swap.platform.ui;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
 
 import org.eclipse.nebula.widgets.grid.Grid;
 import org.eclipse.nebula.widgets.grid.GridItem;
@@ -51,12 +45,10 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
-import org.tizen.dynamicanalyzer.common.CommonConstants;
 import org.tizen.dynamicanalyzer.common.DesignConstants;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
-import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
 import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
 import org.tizen.dynamicanalyzer.ui.widgets.DAMessageBox;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
@@ -80,7 +72,6 @@ public class LoadSettingDialog extends DAMessageBox {
        private DATableComposite saveTable = null;
        private DACustomButton okButton = null;
        private DACustomButton cancelButton = null;
-//     BinaryAnalyzingConfigDialog parentDialog = null;
 
        private String[] columnNames = { "File name" };
        private int[] columnSizes = { 390 };
@@ -94,6 +85,7 @@ public class LoadSettingDialog extends DAMessageBox {
        protected boolean run() {
                shell.setLayout(new FormLayout());
                shell.setSize(400, 204);
+               AnalyzerUtil.setCenter(shell);
                shell.setText("Load Binary Settings");
 
                Composite tableComp = new Composite(shell, SWT.NONE);
index 724b6d7..b367525 100644 (file)
@@ -141,8 +141,9 @@ public class SaveSettingDialog extends DAMessageBox {
                File saveFile = new File(targetPath);
                FileWriter fileWriter = null;
                BufferedWriter bufWriter = null;
-//             List<BinarySettingData> binaryData = BinarySettingManager.getInstance()
-//                             .getTempBinarySettings();
+               // List<BinarySettingData> binaryData =
+               // BinarySettingManager.getInstance()
+               // .getTempBinarySettings();
                boolean success = false;
                try {
                        fileWriter = new FileWriter(saveFile);
@@ -174,6 +175,7 @@ public class SaveSettingDialog extends DAMessageBox {
                shell.setSize(446, 127 + 22);
                shell.setBackground(ColorResources.DIALOG_BG_UPPER);
                shell.setText("Save Binary Settings");
+               AnalyzerUtil.setCenter(shell);
 
                Label label = new Label(shell, SWT.TRANSPARENT);
                FormData data = new FormData();
@@ -195,6 +197,19 @@ public class SaveSettingDialog extends DAMessageBox {
                textBox.setLayoutData(data);
                textBox.setBackground(ColorResources.VIEW_BG_COLOR);
                textBox.addKeyListener(keyListener);
+               textBox.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               e.gc.setForeground(ColorResources.BUTTON_OUTLINE_HOVER_IN_COLOR);
+                               Text text = (Text) e.widget;
+                               Rectangle rect = text.getClientArea();
+                               e.gc.drawRectangle(rect.x, rect.y, rect.width - 1,
+                                               rect.height - 1);
+                               // e.gc.drawRectangle(rect.x + 1, rect.y + 1, rect.width - 3,
+                               // rect.height - 3);
+                       }
+               });
 
                Composite buttonComp = new Composite(shell, SWT.NONE);
                buttonComp.setLayout(new FormLayout());
index 95cc1a7..cbb94ea 100755 (executable)
@@ -96,6 +96,17 @@ public class SaveAsDialog extends DAMessageBox {
                textBox.setLayoutData(data);
                textBox.setBackground(ColorResources.VIEW_BG_COLOR);
                textBox.addKeyListener(keyListener);
+               textBox.addPaintListener(new PaintListener() {
+
+                       @Override
+                       public void paintControl(PaintEvent e) {
+                               e.gc.setForeground(ColorResources.BUTTON_OUTLINE_HOVER_IN_COLOR);
+                               Text text = (Text) e.widget;
+                               Rectangle rect = text.getClientArea();
+                               e.gc.drawRectangle(rect.x, rect.y, rect.width -1, rect.height - 1);
+//                             e.gc.drawRectangle(rect.x+1, rect.y+1, rect.width -3, rect.height - 3);
+                       }
+               });
 
                Composite buttonComp = new Composite(shell, SWT.NONE);
                buttonComp.setLayout(new FormLayout());
index 6730031..8b92496 100755 (executable)
@@ -59,7 +59,6 @@ import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
-import org.tizen.dynamicanalyzer.swap.platform.ui.BinaryAnalyzingConfigDialog;
 import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
 import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialog;
 import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceDialog;
@@ -110,7 +109,6 @@ public class ToolbarArea {
        private DACustomButton openTraceButton;
        private DACustomButton replayButton;
        private DACustomButton configButton;
-//     private DACustomButton binarySettingsButton;
 
        private DACustomButton aboutButton;
 
@@ -601,15 +599,6 @@ public class ToolbarArea {
                replayButton.setToolTipText(ShortCutManager.REPLAY);
                buttons.put(REPLAY_BUTTON, replayButton);
 
-               // create binarySettingButton
-//             binarySettingsButton = new DACustomButton(parent,
-//                             ImageResources.SCREEN_SHOT_TOGGLE,
-//                             ImageResources.SCREEN_SHOT_TOGGLE_PUSH,
-//                             ImageResources.SCREEN_SHOT_TOGGLE_HOVER,
-//                             ImageResources.SCREEN_SHOT_DISABLE);
-//             binarySettingsButton.setToolTipText("Binary Settings");
-//             buttons.put(SETTING_BUTTON, binarySettingsButton);
-
                // Creates config button
                configButton = new DACustomButton(parent,
                                ImageResources.SETTINGS_NORMAL, ImageResources.SETTINGS_PUSH,
index d44fd2d..76ce1ef 100644 (file)
@@ -42,36 +42,62 @@ import org.tizen.dynamicanalyzer.widgets.button.radio.DARadioSelectionListener;
 public class BinarySettingsPage extends DAPageComposite {
        public static final String ID = BinarySettingsPage.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 DACustomToggleButton enableButton = null;
-       private DARadioButton addLibButton = null;
-       private DARadioButton removeLibButton = null;
+
+       DARadioGroup radioGroup = null;
+       private DARadioButton currentRadioButton = null;
+       private DARadioButton addRadioButton = null;
+       private DARadioButton removeRadioButton = null;
 
        private DAButton cleanButton = null;
        private DAButton addButton = null;
        private DAButton saveButton = null;
        private DAButton loadButton = null;
 
-       private boolean isLoaded = false;
-       private boolean addLib = true;
+       private DARadioSelectionListener currentRadioButtonListener = new DARadioSelectionListener() {
+
+               @Override
+               public void handleSelectionEvent(DARadioButton radio) {
+                       cleanButtonListener.handleClickEvent(null);
+                       initInputRows();
+                       addButton.setButtonEnabled(false);
+                       saveButton.setButtonEnabled(false);
+                       loadButton.setButtonEnabled(false);
+                       cleanButton.setButtonEnabled(false);
+               }
+       };
 
-       private DARadioSelectionListener addLibButtonListener = new DARadioSelectionListener() {
+       private DARadioSelectionListener addRadioButtonListener = new DARadioSelectionListener() {
 
                @Override
                public void handleSelectionEvent(DARadioButton radio) {
-                       addLib = true;
+                       cleanButtonListener.handleClickEvent(null);
+                       initInputRows();
+                       addButton.setButtonEnabled(true);
+                       saveButton.setButtonEnabled(true);
+                       loadButton.setButtonEnabled(true);
+                       cleanButton.setButtonEnabled(true);
                }
        };
 
-       private DARadioSelectionListener removeLibButtonListener = new DARadioSelectionListener() {
+       private DARadioSelectionListener removeRadioButtonListener = new DARadioSelectionListener() {
 
                @Override
                public void handleSelectionEvent(DARadioButton radio) {
-                       addLib = false;
+                       cleanButtonListener.handleClickEvent(null);
+                       initInputRows();
+                       addButton.setButtonEnabled(true);
+                       saveButton.setButtonEnabled(true);
+                       loadButton.setButtonEnabled(true);
+                       cleanButton.setButtonEnabled(true);
                }
        };
        private DACustomButtonClickEventListener addButtonListener = new DACustomButtonClickEventListener() {
@@ -90,6 +116,19 @@ public class BinarySettingsPage extends DAPageComposite {
                                inputRow.setSourceText(paths.get(1));
                                inputRowHash.put(paths.get(0), inputRow);
                                inputRowList.add(inputRow);
+
+                               BinarySettingData binaryData = new BinarySettingData();
+                               binaryData.setBinaryPath(inputRow.getBinaryText());
+                               binaryData.setDebugPath(inputRow.getSourceText());
+
+                               if (addRadioButton.isSelected()) {
+                                       BinarySettingManager.getInstance().getAddBinarySettings()
+                                                       .add(binaryData);
+                               } else if (removeRadioButton.isSelected()) {
+                                       BinarySettingManager.getInstance()
+                                                       .getRemoveBinarySettings().add(binaryData);
+                               }
+
                                inputComposite.layout();
                        }
                }
@@ -113,6 +152,7 @@ public class BinarySettingsPage extends DAPageComposite {
                        BufferedReader br = null;
                        String content = null;
                        try {
+                               List<BinarySettingData> tempBinarySettings = new ArrayList<BinarySettingData>();
                                br = new BufferedReader(new FileReader(saveFile));
                                while (null != (content = br.readLine())) {
                                        InputRow inputRow = new InputRow(inputComposite);
@@ -122,7 +162,21 @@ public class BinarySettingsPage extends DAPageComposite {
                                        inputRow.setSourceText(new String(splitContent[1]));
                                        inputRowList.add(inputRow);
                                        inputRowHash.put(inputRow.getBinaryText(), inputRow);
+
+                                       BinarySettingData binaryData = new BinarySettingData();
+                                       binaryData.setBinaryPath(inputRow.getBinaryText());
+                                       binaryData.setDebugPath(inputRow.getSourceText());
+                                       tempBinarySettings.add(binaryData);
                                }
+                               if (addRadioButton.isSelected()) {
+                                       BinarySettingManager.getInstance().getAddBinarySettings()
+                                                       .addAll(tempBinarySettings);
+                               } else if (removeRadioButton.isSelected()) {
+                                       BinarySettingManager.getInstance()
+                                                       .getRemoveBinarySettings()
+                                                       .addAll(tempBinarySettings);
+                               }
+
                        } catch (FileNotFoundException e) {
                                e.printStackTrace();
                        } catch (IOException e) {
@@ -181,35 +235,49 @@ public class BinarySettingsPage extends DAPageComposite {
                data.height = 16;
                data.width = 60;
                msgTypeLabel.setLayoutData(data);
-               msgTypeLabel.setText("Msessage :");
+               msgTypeLabel.setText("Libraies :");
                msgTypeLabel.setBackground(ColorResources.DIALOG_BG_UPPER);
-               
-               DARadioGroup radioGroup = new DARadioGroup();
-               addLibButton = new DARadioButton(this, SWT.NONE);
+
+               radioGroup = new DARadioGroup();
+
+               currentRadioButton = new DARadioButton(this, SWT.NONE, RADIO_CURRENT);
                data = new FormData();
                data.top = new FormAttachment(0, 6);
                data.left = new FormAttachment(msgTypeLabel, 22);
                data.height = 16;
+               data.width = 120;
+               currentRadioButton.setLayoutData(data);
+               currentRadioButton.setForeground(ColorResources.BLACK);
+               currentRadioButton.setBackground(ColorResources.DIALOG_BG_UPPER);
+               currentRadioButton.setText("Current Libarry");
+               currentRadioButton.addSelectionListener(currentRadioButtonListener);
+               radioGroup.addChild(currentRadioButton);
+
+               addRadioButton = new DARadioButton(this, SWT.NONE, RADIO_ADD);
+               data = new FormData();
+               data.top = new FormAttachment(0, 6);
+               data.left = new FormAttachment(currentRadioButton, 22);
+               data.height = 16;
                data.width = 100;
-               addLibButton.setLayoutData(data);
-               addLibButton.setForeground(ColorResources.BLACK);
-               addLibButton.setBackground(ColorResources.DIALOG_BG_UPPER);
-               addLibButton.setText("Add Libarry");
-               addLibButton.addSelectionListener(addLibButtonListener);
-               radioGroup.addChild(addLibButton);
-
-               removeLibButton = new DARadioButton(this, SWT.NONE);
+               addRadioButton.setLayoutData(data);
+               addRadioButton.setForeground(ColorResources.BLACK);
+               addRadioButton.setBackground(ColorResources.DIALOG_BG_UPPER);
+               addRadioButton.setText("Add Libarry");
+               addRadioButton.addSelectionListener(addRadioButtonListener);
+               radioGroup.addChild(addRadioButton);
+
+               removeRadioButton = new DARadioButton(this, SWT.NONE, RADIO_REMOVE);
                data = new FormData();
                data.top = new FormAttachment(0, 6);
-               data.left = new FormAttachment(addLibButton, 22);
+               data.left = new FormAttachment(addRadioButton, 22);
                data.height = 16;
                data.width = 120;
-               removeLibButton.setLayoutData(data);
-               removeLibButton.setForeground(ColorResources.BLACK);
-               removeLibButton.setBackground(ColorResources.DIALOG_BG_UPPER);
-               removeLibButton.setText("Remove Library");
-               removeLibButton.addSelectionListener(removeLibButtonListener);
-               radioGroup.addChild(removeLibButton);
+               removeRadioButton.setLayoutData(data);
+               removeRadioButton.setForeground(ColorResources.BLACK);
+               removeRadioButton.setBackground(ColorResources.DIALOG_BG_UPPER);
+               removeRadioButton.setText("Remove Library");
+               removeRadioButton.addSelectionListener(removeRadioButtonListener);
+               radioGroup.addChild(removeRadioButton);
 
                Label binaryLabel = new Label(this, SWT.TRANSPARENT);
                data = new FormData();
@@ -218,7 +286,6 @@ public class BinarySettingsPage extends DAPageComposite {
                data.height = 10;
                data.width = 148 + 80;
                binaryLabel.setLayoutData(data);
-               binaryLabel.setForeground(ColorResources.BLACK);
                binaryLabel.setText("Binary Name");
                binaryLabel.setBackground(ColorResources.DIALOG_BG_UPPER);
                binaryLabel.setForeground(ColorResources.BLUE);
@@ -231,8 +298,7 @@ public class BinarySettingsPage extends DAPageComposite {
                data.height = 10;
                data.width = 207 + 60;
                sourceLabel.setLayoutData(data);
-               sourceLabel.setForeground(ColorResources.BLACK);
-               sourceLabel.setText("Source Path");
+               sourceLabel.setText("Debug Binary Path");
                sourceLabel.setBackground(ColorResources.DIALOG_BG_UPPER);
                sourceLabel.setForeground(ColorResources.BLUE);
                sourceLabel.setFont(FontResources.ADDITEM_BUTTON_FONT);
@@ -313,54 +379,115 @@ public class BinarySettingsPage extends DAPageComposite {
 
                        @Override
                        public void handleEvent(Event event) {
-                               System.out.println("show listener");
+                               if (currentRadioButton.isSelected()) {
+                                       addButton.setButtonEnabled(false);
+                                       saveButton.setButtonEnabled(false);
+                                       loadButton.setButtonEnabled(false);
+                                       cleanButton.setButtonEnabled(false);
+                               } else if (addRadioButton.isSelected()) {
+                                       addButton.setButtonEnabled(true);
+                                       saveButton.setButtonEnabled(true);
+                                       loadButton.setButtonEnabled(true);
+                                       cleanButton.setButtonEnabled(true);
+                               } else {
+                                       addButton.setButtonEnabled(true);
+                                       saveButton.setButtonEnabled(true);
+                                       loadButton.setButtonEnabled(true);
+                                       cleanButton.setButtonEnabled(true);
+                               }
                                initInputRows();
                        }
                });
 
+               this.addListener(SWT.Dispose, new Listener() {
+
+                       @Override
+                       public void handleEvent(Event event) {
+                               System.out.println(" dispose called!");
+                               BinarySettingManager.getInstance().getAddBinarySettings()
+                                               .clear();
+                               BinarySettingManager.getInstance().getRemoveBinarySettings()
+                                               .clear();
+                       }
+               });
        }
 
-       public void deApply() {
+       public void doApply() {
                List<BinarySettingData> tempBinarySettings = new ArrayList<BinarySettingData>();
-               for (InputRow input : inputRowList) {
-                       BinarySettingData binaryData = new BinarySettingData();
-                       binaryData.setBinaryPath(input.getBinaryText());
-                       binaryData.setDebugPath(input.getSourceText());
-                       tempBinarySettings.add(binaryData);
-               }
-               BinarySettingManager.getInstance().putBinarySettingData(
-                               tempBinarySettings);
-               BinarySettingManager.getInstance().checkSourcePath();
-
-               DACommunicator.sendBinaryInfoMessageForLib();
-               int swapMsg = AnalyzerConstants.MSG_SWAP_INST_ADD;
-               if (!addLib) {
-                       swapMsg = AnalyzerConstants.MSG_SWAP_INST_REMOVE;
+               if (addRadioButton.isSelected()) {
+                       for (InputRow input : inputRowList) {
+                               BinarySettingData binaryData = new BinarySettingData();
+                               binaryData.setBinaryPath(input.getBinaryText());
+                               binaryData.setDebugPath(input.getSourceText());
+                               tempBinarySettings.add(binaryData);
+                       }
+                       // BinarySettingManager.getInstance().putBinarySettingData(
+                       // tempBinarySettings);
+                       BinarySettingManager.getInstance().putRealBinarySettingData(
+                                       tempBinarySettings);
+                       BinarySettingManager.getInstance().checkSourcePath(
+                                       tempBinarySettings);
+
+                       DACommunicator.sendBinaryInfoMessageForLib(tempBinarySettings);
+                       DACommunicator.sendSWAPMessage(AnalyzerConstants.MSG_SWAP_INST_ADD,
+                                       tempBinarySettings);
+                       BinarySettingManager.getInstance().getAddBinarySettings().clear();
+               } else if (removeRadioButton.isSelected()) {
+                       for (InputRow input : inputRowList) {
+
+                               BinarySettingManager.getInstance().removeRealBinarySettingData(
+                                               input.getBinaryText());
+
+                               BinarySettingData binaryData = new BinarySettingData();
+                               binaryData.setBinaryPath(input.getBinaryText());
+                               binaryData.setDebugPath(input.getSourceText());
+                               tempBinarySettings.add(binaryData);
+                       }
+                       DACommunicator.sendSWAPMessage(
+                                       AnalyzerConstants.MSG_SWAP_INST_REMOVE, tempBinarySettings);
+                       BinarySettingManager.getInstance().getRemoveBinarySettings()
+                                       .clear();
+               } else {
+                       System.out.println("current do nothing");
                }
-               DACommunicator.sendSWAPMessage(swapMsg);
+               initInputRows();
+               // BinarySettingManager.getInstance().syncData();
        }
 
        public void initInputRows() {
-               if (!isLoaded) {
-                       List<BinarySettingData> binData = BinarySettingManager
-                                       .getInstance().getBinarySettings();
-                       for (int i = 0; i < binData.size(); i++) {
-                               InputRow inputRow = new InputRow(inputComposite);
-                               inputRow.setBinaryText(binData.get(i).getBinaryPath());
-                               String source = binData.get(i).getSourcePath();
-                               if (null != source && !source.isEmpty()) {
-                                       inputRow.setSourceText(source);
-                                       // String[] splitSource =
-                                       // source.split(CommonConstants.SLASH);
-                                       // String comboSel = new String(
-                                       // splitSource[splitSource.length - 1]);
-                                       // inputRow.setSourceComboText(comboSel);
-                               }
-                               inputRowHash.put(binData.get(i).getBinaryPath(), inputRow);
-                               inputRowList.add(inputRow);
+               List<BinarySettingData> binData = null;
+               if (addRadioButton.isSelected()) {
+                       binData = BinarySettingManager.getInstance().getAddBinarySettings();
+               } else if (removeRadioButton.isSelected()) {
+                       binData = BinarySettingManager.getInstance()
+                                       .getRemoveBinarySettings();
+               } else {
+                       binData = BinarySettingManager.getInstance()
+                                       .getRealBinarySettings();
+               }
+               cleanButtonListener.handleClickEvent(null);
+               for (int i = 0; i < binData.size(); i++) {
+                       InputRow inputRow = new InputRow(inputComposite);
+                       inputRow.setBinaryText(binData.get(i).getBinaryPath());
+                       String source = binData.get(i).getSourcePath();
+                       if (null != source && !source.isEmpty()) {
+                               inputRow.setSourceText(source);
+                               // String[] splitSource =
+                               // source.split(CommonConstants.SLASH);
+                               // String comboSel = new String(
+                               // splitSource[splitSource.length - 1]);
+                               // inputRow.setSourceComboText(comboSel);
+                       }
+                       inputRowHash.put(binData.get(i).getBinaryPath(), inputRow);
+                       inputRowList.add(inputRow);
+                       if (currentRadioButton.isSelected()) {
+                               inputRow.setDisable();
                        }
-                       inputComposite.layout();
-                       isLoaded = true;
                }
+               inputComposite.layout();
+       }
+
+       public int getSelectedRadio() {
+               return radioGroup.getSelection().getRadioId();
        }
 }
index e2a3ebd..aa9d173 100644 (file)
@@ -88,7 +88,7 @@ public class ConfigurationDialog extends DAMessageBox {
                                        null);
                } else {
                        BinarySettingsPage page = (BinarySettingsPage) selectedComposite;
-                       page.deApply();
+                       page.doApply();
                }
        }