[Title] Libinst user source path setting added
authorjooyoul_lee <jy.exe.lee@samsung.com>
Mon, 11 Nov 2013 07:48:36 +0000 (16:48 +0900)
committerjooyoul_lee <jy.exe.lee@samsung.com>
Mon, 11 Nov 2013 07:48:36 +0000 (16:48 +0900)
[Desc.]
[Issue]

14 files changed:
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/listeners/TableTooltipListener.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/BinarySettingData.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/DAFileTreeExplorer.java [moved from org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DAFileExplorer.java with 95% similarity]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DAFileTreeExplorerRenderer.java [moved from org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DAFileExplorerRenderer.java with 92% similarity]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DAFileTreeExplorerToggleRenderer.java [moved from org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DAFileExplorerToggleRenderer.java with 98% similarity]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DeviceExplorer/DeviceExplorer.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/DeviceExplorer/DeviceExplorerDilaog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/FileExplorer/DAFileExplorer.java [moved from org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/FileExplorer/DAFileExplorerCasval.java with 81% similarity]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/FileExplorer/FileExplorerDialog.java [moved from org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/FileExplorer/FileExplorerCasvalDialog.java with 92% similarity]
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/FileExplorerDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/swap/platform/ui/InputRow.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/configuration/BinarySettingsPage.java

index 9d35b8f..68da76f 100644 (file)
@@ -26,6 +26,7 @@
 package org.tizen.dynamicanalyzer.listeners;\r
 \r
 import java.io.BufferedReader;\r
+import java.io.File;\r
 import java.io.FileNotFoundException;\r
 import java.io.FileReader;\r
 import java.io.IOException;\r
@@ -205,17 +206,32 @@ public class TableTooltipListener implements Listener {
                String filePath = null;\r
                String libName = getLibPath(item);\r
 \r
-               if (!isLibrary(libName)) {\r
-                       filePath = sourceLine.getFilePath();\r
+               BinarySettingData binData = BinarySettingManager.getInstance()\r
+                               .getRealBinarySetting(libName);\r
+               String fileName = getSourceFileName(sourceLine.getFilePath());\r
+\r
+               if (null != binData && null != binData.getUserSourcePath()\r
+                               && !binData.getUserSourcePath().isEmpty()) {\r
+                       filePath = binData.getUserSourcePath() + File.separator + fileName;\r
                } else {\r
-                       BinarySettingData binData = BinarySettingManager.getInstance()\r
-                                       .getRealBinarySetting(libName);\r
-                       filePath = binData.getSourcePath() + sourceLine.getFilePath();\r
+                       if (!isLibrary(libName)) {\r
+                               filePath = sourceLine.getFilePath();\r
+                       } else {\r
+                               filePath = binData.getDebugSourcePath()\r
+                                               + sourceLine.getFilePath();\r
+                       }\r
                }\r
-\r
                return filePath;\r
        }\r
 \r
+       private String getSourceFileName(String sourcePath) {\r
+               String[] splitPath = sourcePath.split(CommonConstants.SLASH);\r
+               if (splitPath.length > 0) {\r
+                       return new String(splitPath[splitPath.length - 1]);\r
+               }\r
+               return null;\r
+       }\r
+\r
        private void createTooltip(Event event) {\r
                GridItem item = grid.getItem(new Point(event.x, event.y));\r
                if (null != item) {\r
index f35bb50..e441b63 100644 (file)
@@ -29,10 +29,10 @@ import org.tizen.dynamicanalyzer.common.CommonConstants;
 
 public class BinarySettingData {
        private String binaryPath = null;
-       private String sourcePath = null;
+       private String debugSourcePath = null;
        private String debugPath = null;
        private String debugFilePath = null;
-       private String rpmSourcePath = null;
+       private String userSourcePath = null;
 
        public String getBinaryPath() {
                return binaryPath;
@@ -42,21 +42,21 @@ public class BinarySettingData {
                this.binaryPath = binaryPath;
        }
 
-       public String getSourcePath() {
-               return sourcePath;
+       public String getDebugSourcePath() {
+               return debugSourcePath;
        }
 
-       public void setSourcePath(String sourcePath) {
-               this.sourcePath = sourcePath;
+       public void setDebugSourcePath(String sourcePath) {
+               this.debugSourcePath = sourcePath;
        }
 
        public String getSaveData() {
                StringBuffer strBuffer = new StringBuffer();
                strBuffer.append(binaryPath).append(CommonConstants.COMMA);
-               if (null == sourcePath) {
+               if (null == debugSourcePath) {
                        strBuffer.append(CommonConstants.SPACE);
                } else {
-                       strBuffer.append(sourcePath);
+                       strBuffer.append(debugSourcePath);
                }
                return strBuffer.toString();
        }
@@ -76,14 +76,6 @@ public class BinarySettingData {
                this.debugPath = debugPath;
        }
 
-       public String getRpmSourcePath() {
-               return rpmSourcePath;
-       }
-
-       public void setRpmSourcePath(String rpmSourcePath) {
-               this.rpmSourcePath = rpmSourcePath;
-       }
-
        public String getDebugFilePath() {
                return debugFilePath;
        }
@@ -92,4 +84,12 @@ public class BinarySettingData {
                this.debugFilePath = debugFilePath;
        }
 
+       public String getUserSourcePath() {
+               return userSourcePath;
+       }
+
+       public void setUserSourcePath(String userSourcePath) {
+               this.userSourcePath = userSourcePath;
+       }
+
 }
index 6dab6a9..eda553e 100644 (file)
@@ -33,6 +33,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
+import org.eclipse.cdt.utils.debug.DebugField;
 import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
 import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
@@ -92,14 +93,10 @@ public class BinarySettingManager {
                        if (null != binData.getDebugPath()
                                        && !binData.getDebugPath().isEmpty()) {
                                // check dir exists.
-                               String sourcePath = binData.getDebugPath();
-                               File sourceDir = new File(sourcePath);
-                               String[] files = sourceDir.list();
+                               String debugPath = binData.getDebugPath();
+                               File debugInfoFile = new File(debugPath);
 
-                               if (!sourceDir.exists() || !sourceDir.isDirectory()) {
-                                       continue;
-                               }
-                               if (files.length == 0) {
+                               if (!debugInfoFile.exists() || debugInfoFile.isDirectory()) {
                                        continue;
                                }
                                // check rpm file exists
@@ -109,26 +106,11 @@ public class BinarySettingManager {
                                String libFullName = splitTargetLib[splitTargetLib.length - 1];
                                int index = libFullName.indexOf(".so");
                                // 3 means remove "lib" string
-                               String debugInfoToken = libFullName.substring(3, index)
-                                               + "-debuginfo";
                                String debugSourceToken = libFullName.substring(3, index)
                                                + "-debugsource";
-
-                               String debugInfoRpmName = null;
+                               String[] files = debugInfoFile.getParentFile().list();
                                String debugInfoSourceRpmName = null;
                                for (int j = 0; j < files.length; j++) {
-                                       if (files[j].contains(debugInfoToken)) {
-                                               debugInfoRpmName = files[j];
-                                               break;
-                                       }
-                               }
-
-                               if (null == binData.getDebugPath()
-                                               || binData.getDebugPath().isEmpty()) {
-                                       continue;
-                               }
-
-                               for (int j = 0; j < files.length; j++) {
                                        if (files[j].contains(debugSourceToken)) {
                                                debugInfoSourceRpmName = files[j];
                                                break;
@@ -143,8 +125,8 @@ public class BinarySettingManager {
                                        rpms.mkdirs();
                                }
 
-                               String from = sourcePath + File.separator + debugInfoRpmName;
-                               String to = rpmPath + File.separator + debugInfoRpmName;
+                               String from = debugPath;
+                               String to = rpmPath + File.separator + debugInfoFile.getName();
                                String debugRpmPath = null;
                                String debugRpmSourcePath = null;
                                if (AnalyzerUtil.copyFile(from, to)) {
@@ -155,7 +137,7 @@ public class BinarySettingManager {
 
                                if (null != debugInfoSourceRpmName
                                                && !debugInfoSourceRpmName.isEmpty()) {
-                                       from = sourcePath + File.separator + debugInfoSourceRpmName;
+                                       from = debugInfoFile.getParent() + File.separator + debugInfoSourceRpmName;
                                        to = rpmPath + File.separator + debugInfoSourceRpmName;
                                        if (AnalyzerUtil.copyFile(from, to)) {
                                                debugRpmSourcePath = to;
@@ -253,7 +235,7 @@ public class BinarySettingManager {
                                                BufferedReader error = new BufferedReader(
                                                                new InputStreamReader(process.getErrorStream()));
                                                String errorStr = error.readLine();
-                                               System.out.println("host md5sum get failed : "
+                                               System.out.println("source file path get failed.. : "
                                                                + errorStr);
                                                continue;
                                        }
@@ -266,7 +248,7 @@ public class BinarySettingManager {
                                        e.printStackTrace();
                                        continue;
                                }
-                               binData.setSourcePath(sourceFilePath);
+                               binData.setDebugSourcePath(sourceFilePath);
                        }
                }
 
index 161e695..b0fcab0 100644 (file)
@@ -1,10 +1,15 @@
 package org.tizen.dynamicanalyzer.swap.platform.ui;
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
 import org.eclipse.swt.events.KeyEvent;
 import org.eclipse.swt.events.KeyListener;
 import org.eclipse.swt.events.PaintEvent;
@@ -17,12 +22,14 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
+import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
 import org.tizen.dynamicanalyzer.common.CommonConstants;
 import org.tizen.dynamicanalyzer.common.DesignConstants;
+import org.tizen.dynamicanalyzer.common.PathManager;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.swap.platform.ui.DeviceExplorer.DeviceExplorerDilaog;
-import org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer.FileExplorerCasvalDialog;
+import org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer.FileExplorerDialog;
 import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
 import org.tizen.dynamicanalyzer.ui.widgets.DAMessageBox;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
@@ -32,12 +39,13 @@ import org.tizen.sdblib.service.FileEntry;
 
 public class BinaryAddDialog extends DAMessageBox {
 
-       private Text binary = null;
-       // private Text source = null;
-       private Text debugPackage = null;
+       private Text binaryText = null;
+       private Text sourceText = null;
+       private Text debugPackageText = null;
 
        private DAButton findButton = null;
        private DAButton findPackageButton = null;
+       private DAButton findSourceButton = null;
        private DAButton okButton = null;
        private DAButton cancelButton = null;
 
@@ -60,11 +68,27 @@ public class BinaryAddDialog extends DAMessageBox {
                @Override
                public void handleClickEvent(DACustomButton button) {
                        DeviceExplorerDilaog dialog = new DeviceExplorerDilaog(shell);
+                       if (!binaryText.getText().isEmpty()) {
+                               dialog.getExplorer().setCurrent(binaryText.getText());
+                       }
                        Object result = dialog.open();
                        if (result != null) {
                                FileEntry entry = (FileEntry) result;
-                               binary.setText(entry.getFullPath());
+                               binaryText.setText(entry.getFullPath());
                                okButton.setButtonEnabled(true);
+                               debugPackageText.setEnabled(true);
+                               findPackageButton.setButtonEnabled(true);
+                               if (!debugPackageText.getText().isEmpty()) {
+                                       sourceText.setEnabled(true);
+                                       findSourceButton.setButtonEnabled(true);
+                               }
+
+                               String debugPath = getDebugInfoPath(binaryText.getText());
+                               if (null != debugPath) {
+                                       debugPackageText.setText(debugPath);
+                                       sourceText.setEnabled(true);
+                                       findSourceButton.setButtonEnabled(true);
+                               }
                        }
                }
        };
@@ -73,21 +97,47 @@ public class BinaryAddDialog extends DAMessageBox {
 
                @Override
                public void handleClickEvent(DACustomButton button) {
-                       FileExplorerCasvalDialog dialog = new FileExplorerCasvalDialog(shell);
+                       FileExplorerDialog dialog = new FileExplorerDialog(shell);
+                       dialog.getExplorer().setRoot(PathManager.getRootStrapsPath());
+                       if (!debugPackageText.getText().isEmpty()) {
+                               dialog.getExplorer().setCurrent(debugPackageText.getText());
+                       }
+                       Object result = dialog.open();
+                       if (result != null) {
+                               File file = (File) result;
+                               debugPackageText.setText(file.getAbsolutePath());
+                               sourceText.setEnabled(true);
+                               findSourceButton.setButtonEnabled(true);
+                       }
+               }
+       };
+
+       private DACustomButtonClickEventListener findSourceButtonListener = new DACustomButtonClickEventListener() {
+
+               @Override
+               public void handleClickEvent(DACustomButton button) {
+                       FileExplorerDialog dialog = new FileExplorerDialog(shell);
+                       dialog.getExplorer().setReturnDirectory(true);
+                       dialog.getExplorer().setRoot("/home/");
+                       if (!sourceText.getText().isEmpty()) {
+                               dialog.getExplorer().setCurrent(sourceText.getText());
+                       }
                        Object result = dialog.open();
                        if (result != null) {
                                File file = (File) result;
-                               debugPackage.setText(file.getAbsolutePath());
+                               sourceText.setText(file.getAbsolutePath());
                        }
                }
        };
+
        private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
 
                @Override
                public void handleClickEvent(DACustomButton button) {
                        List<String> paths = new ArrayList<String>();
-                       paths.add(binary.getText());
-                       paths.add(debugPackage.getText());
+                       paths.add(binaryText.getText());
+                       paths.add(debugPackageText.getText());
+                       paths.add(sourceText.getText());
                        result = paths;
                        shell.dispose();
                }
@@ -105,10 +155,49 @@ public class BinaryAddDialog extends DAMessageBox {
 
                @Override
                public void keyReleased(KeyEvent e) {
-                       if (binary.getText().isEmpty()) {
+                       if (binaryText.getText().isEmpty()) {
                                okButton.setButtonEnabled(false);
+                               debugPackageText.setEnabled(false);
+                               findPackageButton.setButtonEnabled(false);
+                               sourceText.setEnabled(false);
+                               findSourceButton.setButtonEnabled(false);
                        } else {
                                okButton.setButtonEnabled(true);
+                               debugPackageText.setEnabled(true);
+                               findPackageButton.setButtonEnabled(true);
+                               if (!debugPackageText.getText().isEmpty()) {
+                                       sourceText.setEnabled(true);
+                                       findSourceButton.setButtonEnabled(true);
+                               }
+                       }
+                       System.out.println("key " + e.keyCode);
+                       if (!binaryText.getText().isEmpty() && e.keyCode == 13) // enter
+                       {
+                               String debugPath = getDebugInfoPath(binaryText.getText());
+                               if (null != debugPath) {
+                                       debugPackageText.setText(debugPath);
+                                       sourceText.setEnabled(true);
+                                       findSourceButton.setButtonEnabled(true);
+                               }
+                       }
+               }
+
+               @Override
+               public void keyPressed(KeyEvent e) {
+
+               }
+       };
+
+       private KeyListener debugKeyListener = new KeyListener() {
+
+               @Override
+               public void keyReleased(KeyEvent e) {
+                       if (debugPackageText.getText().isEmpty()) {
+                               sourceText.setEnabled(false);
+                               findSourceButton.setButtonEnabled(false);
+                       } else {
+                               sourceText.setEnabled(true);
+                               findSourceButton.setButtonEnabled(true);
                        }
                }
 
@@ -120,7 +209,7 @@ public class BinaryAddDialog extends DAMessageBox {
 
        protected boolean run() {
                shell.setLayout(new FormLayout());
-               shell.setSize(446, 225);
+               shell.setSize(446, 300);
                shell.setBackground(ColorResources.DIALOG_BG_UPPER);
                shell.setText("Add Binary Setting");
                AnalyzerUtil.setCenter(shell);
@@ -136,17 +225,17 @@ public class BinaryAddDialog extends DAMessageBox {
                label.setText("Binary Path");
                label.setBackground(ColorResources.DIALOG_BG_UPPER);
 
-               binary = new Text(shell, SWT.SINGLE);
+               binaryText = new Text(shell, SWT.SINGLE);
                data = new FormData();
                data.top = new FormAttachment(label, 5);
                data.left = new FormAttachment(0, 12);
                data.height = 24;
                data.width = 330;
-               binary.setLayoutData(data);
-               binary.setBackground(ColorResources.WHITE);
-               binary.addKeyListener(binaryKeyListener);
-               binary.setText(binaryStr);
-               binary.addPaintListener(new PaintListener() {
+               binaryText.setLayoutData(data);
+               binaryText.setBackground(ColorResources.WHITE);
+               binaryText.addKeyListener(binaryKeyListener);
+               binaryText.setText(binaryStr);
+               binaryText.addPaintListener(new PaintListener() {
 
                        @Override
                        public void paintControl(PaintEvent e) {
@@ -163,36 +252,16 @@ public class BinaryAddDialog extends DAMessageBox {
                findButton = new DAButton(shell, SWT.NONE);
                data = new FormData();
                data.top = new FormAttachment(label, 4);
-               data.left = new FormAttachment(binary, 5);
+               data.left = new FormAttachment(binaryText, 5);
                data.height = 30;
                data.width = 80;
                findButton.setLayoutData(data);
                findButton.setText("Find file");
                findButton.addClickListener(findButtonListener);
 
-               // Label sourceLabel = new Label(shell, SWT.TRANSPARENT);
-               // data = new FormData();
-               // data.top = new FormAttachment(binary, 15);
-               // data.left = new FormAttachment(0, 12);
-               // data.height = 15;
-               // data.width = 150;
-               // sourceLabel.setLayoutData(data);
-               // sourceLabel.setForeground(ColorResources.BLACK);
-               // sourceLabel.setText("Source Path");
-               // sourceLabel.setBackground(ColorResources.DIALOG_BG_UPPER);
-               //
-               // source = new Text(shell, SWT.SINGLE);
-               // data = new FormData();
-               // data.top = new FormAttachment(sourceLabel, 10);
-               // data.left = new FormAttachment(0, 12);
-               // data.height = 26;
-               // data.width = 350;
-               // source.setLayoutData(data);
-               // source.setBackground(ColorResources.VIEW_BG_COLOR);
-
                Label debugLabel = new Label(shell, SWT.TRANSPARENT);
                data = new FormData();
-               data.top = new FormAttachment(binary, 15);
+               data.top = new FormAttachment(binaryText, 15);
                data.left = new FormAttachment(0, 12);
                data.height = 15;
                data.width = 150;
@@ -201,17 +270,18 @@ public class BinaryAddDialog extends DAMessageBox {
                debugLabel.setText("Debug directory path");
                debugLabel.setBackground(ColorResources.DIALOG_BG_UPPER);
 
-               debugPackage = new Text(shell, SWT.SINGLE);
+               debugPackageText = new Text(shell, SWT.SINGLE);
                data = new FormData();
                data.top = new FormAttachment(debugLabel, 5);
                data.left = new FormAttachment(0, 12);
                data.height = 26;
                data.width = 330;
-               debugPackage.setLayoutData(data);
-               debugPackage.setBackground(ColorResources.WHITE);
-               debugPackage.setText(debutStr);
+               debugPackageText.setLayoutData(data);
+               debugPackageText.setBackground(ColorResources.WHITE);
+               debugPackageText.addKeyListener(debugKeyListener);
+               debugPackageText.setText(debutStr);
 
-               debugPackage.addPaintListener(new PaintListener() {
+               debugPackageText.addPaintListener(new PaintListener() {
 
                        @Override
                        public void paintControl(PaintEvent e) {
@@ -228,13 +298,54 @@ public class BinaryAddDialog extends DAMessageBox {
                findPackageButton = new DAButton(shell, SWT.NONE);
                data = new FormData();
                data.top = new FormAttachment(debugLabel, 4);
-               data.left = new FormAttachment(debugPackage, 5);
+               data.left = new FormAttachment(debugPackageText, 5);
                data.height = 30;
                data.width = 80;
                findPackageButton.setLayoutData(data);
                findPackageButton.setText("Find dir");
                findPackageButton.addClickListener(findDebugButtonListener);
-               
+
+               Label sourceLabel = new Label(shell, SWT.TRANSPARENT);
+               data = new FormData();
+               data.top = new FormAttachment(debugPackageText, 15);
+               data.left = new FormAttachment(0, 12);
+               data.height = 15;
+               data.width = 200;
+               sourceLabel.setLayoutData(data);
+               sourceLabel.setForeground(ColorResources.BLACK);
+               sourceLabel.setText("User defined source directory");
+               sourceLabel.setBackground(ColorResources.DIALOG_BG_UPPER);
+
+               sourceText = new Text(shell, SWT.SINGLE);
+               data = new FormData();
+               data.top = new FormAttachment(sourceLabel, 5);
+               data.left = new FormAttachment(0, 12);
+               data.height = 26;
+               data.width = 330;
+               sourceText.setLayoutData(data);
+               sourceText.setBackground(ColorResources.WHITE);
+               sourceText.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);
+                       }
+               });
+
+               findSourceButton = new DAButton(shell, SWT.NONE);
+               data = new FormData();
+               data.top = new FormAttachment(sourceLabel, 4);
+               data.left = new FormAttachment(debugPackageText, 5);
+               data.height = 30;
+               data.width = 80;
+               findSourceButton.setLayoutData(data);
+               findSourceButton.setText("Find Dir");
+               findSourceButton.addClickListener(findSourceButtonListener);
+
                Composite buttonComp = new Composite(shell, SWT.NONE);
                buttonComp.setLayout(new FormLayout());
                buttonComp.setBackground(ColorResources.DIALOG_BG_LOWER);
@@ -254,7 +365,7 @@ public class BinaryAddDialog extends DAMessageBox {
                });
 
                FormData compData = new FormData();
-               compData.top = new FormAttachment(debugPackage, 20);
+               compData.top = new FormAttachment(sourceText, 20);
                compData.left = new FormAttachment(0, 0);
                compData.right = new FormAttachment(100, 0);
                compData.bottom = new FormAttachment(100, 0);
@@ -269,7 +380,7 @@ public class BinaryAddDialog extends DAMessageBox {
                okButton.setLayoutData(data);
                okButton.setText(AnalyzerLabels.OK);
                okButton.addClickListener(okButtonListener);
-               if (binary.getText().isEmpty()) {
+               if (binaryText.getText().isEmpty()) {
                        okButton.setButtonEnabled(false);
                }
 
@@ -283,7 +394,99 @@ public class BinaryAddDialog extends DAMessageBox {
                cancelButton.setText(AnalyzerLabels.CANCEL);
                cancelButton.addClickListener(cancelButtonListener);
 
+               shell.addControlListener(new ControlListener() {
+
+                       @Override
+                       public void controlResized(ControlEvent e) {
+                               if (binaryText.getText().isEmpty()) {
+                                       debugPackageText.setEnabled(false);
+                                       findPackageButton.setButtonEnabled(false);
+                                       sourceText.setEnabled(false);
+                                       findSourceButton.setButtonEnabled(false);
+                               } else {
+                                       debugPackageText.setEnabled(true);
+                                       findPackageButton.setButtonEnabled(true);
+                                       sourceText.setEnabled(true);
+                                       findSourceButton.setButtonEnabled(true);
+                               }
+
+                               if (debugPackageText.getText().isEmpty()) {
+                                       sourceText.setEnabled(false);
+                                       findSourceButton.setButtonEnabled(false);
+                               } else {
+                                       sourceText.setEnabled(true);
+                                       findSourceButton.setButtonEnabled(true);
+                               }
+                       }
+
+                       @Override
+                       public void controlMoved(ControlEvent e) {
+                       }
+               });
+
                return true;
        }
 
+       private String getDebugInfoPath(String libPath) {
+               String[] splitTargetLib = libPath.split(CommonConstants.SLASH);
+               String libFullName = splitTargetLib[splitTargetLib.length - 1];
+               int index = libFullName.indexOf(".so");
+               if (index < 0) {
+                       return null;
+               }
+               // 3 means remove "lib" string
+               String debugInfoToken = "*" + libFullName.substring(3, index)
+                               + "-debuginfo*.rpm";
+               String rootstrapPath = PathManager.getRootStrapsPath();
+               List<String> lines = new ArrayList<String>();
+               String toolPath = AnalyzerPaths.TOOL_FOLDER_PATH + File.separator
+                               + "debuginfo.sh";
+               String[] command = new String[] { toolPath, "-f", rootstrapPath,
+                               debugInfoToken };
+               try {
+                       Runtime rt = Runtime.getRuntime();
+                       Process process = rt.exec(command);
+                       process.waitFor();
+                       BufferedReader reader = new BufferedReader(new InputStreamReader(
+                                       process.getInputStream()));
+                       int lineCount = 0;
+                       String line = null;
+                       while (null != (line = reader.readLine())) {
+                               lineCount++;
+                               System.out.println("LINE (" + lineCount + ") : " + line);
+                               lines.add(line);
+                       }
+                       if (lineCount == 0) {
+                               BufferedReader error = new BufferedReader(
+                                               new InputStreamReader(process.getErrorStream()));
+                               String errorStr = error.readLine();
+                               System.out.println("find debug info path fail.. " + errorStr);
+                               return null;
+                       }
+               } catch (IOException e) {
+                       e.printStackTrace();
+                       return null;
+               } catch (InterruptedException e) {
+                       e.printStackTrace();
+                       return null;
+               }
+
+               String select = null;
+               for (String line : lines) {
+                       if (null == select) {
+                               select = line;
+                       } else if (select.length() > line.length()) {
+                               select = line;
+                       }
+               }
+
+               String debugPath = null;
+               if (null == select) {
+                       return null;
+               } else {
+                       select = select.substring(1, select.length());
+                       debugPath = rootstrapPath + select;
+               }
+               return debugPath;
+       }
 }
@@ -43,16 +43,14 @@ import org.tizen.dynamicanalyzer.ui.widgets.DAGrid;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableEmptyCellRenderer;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableHeaderRenderer;
 import org.tizen.sdblib.IDevice;
-import org.tizen.sdblib.receiver.FileEntryFactory;
 import org.tizen.sdblib.service.FileEntry;
 import org.tizen.sdblib.service.FileEntryType;
-import org.tizen.sdblib.util.FileEntryUtil;
 
-public class DAFileExplorer extends Composite {
+public class DAFileTreeExplorer extends Composite {
        protected Grid table;
        private HashMap<String, Boolean> checkedChild = new HashMap<String, Boolean>();
 
-       public DAFileExplorer(Composite parent) {
+       public DAFileTreeExplorer(Composite parent) {
                super(parent, SWT.NONE);
                this.setLayout(new FillLayout());
                table = new DAGrid(this, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL
@@ -108,7 +106,7 @@ public class DAFileExplorer extends Composite {
 
        public void setColumns() {
                GridColumn column = new GridColumn(table, SWT.NONE);
-               column.setCellRenderer(new DAFileExplorerRenderer());
+               column.setCellRenderer(new DAFileTreeExplorerRenderer());
                column.setHeaderRenderer(new DATableHeaderRenderer());
                column.setText("Node");
                column.setWidth(500);
@@ -30,13 +30,13 @@ import org.eclipse.nebula.widgets.grid.GridItem;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableCellRenderer;
 import org.tizen.sdblib.service.FileEntry;
 
-public class DAFileExplorerRenderer extends DATableCellRenderer {
+public class DAFileTreeExplorerRenderer extends DATableCellRenderer {
        @Override
        public void setTree(boolean tree) {
                super.setTree(tree);
 
                if (tree) {
-                       toggleRenderer = new DAFileExplorerToggleRenderer();
+                       toggleRenderer = new DAFileTreeExplorerToggleRenderer();
                        toggleRenderer.setDisplay(getDisplay());
                }
        }
@@ -36,7 +36,7 @@ import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.ui.widgets.table.DATableToggleRenderer;
 import org.tizen.sdblib.service.FileEntry;
 
-public class DAFileExplorerToggleRenderer extends DATableToggleRenderer {
+public class DAFileTreeExplorerToggleRenderer extends DATableToggleRenderer {
 
        public void paint(GC gc, Object value) {
                GridItem item = (GridItem) value;
index 536b9d7..88f07d1 100644 (file)
@@ -29,16 +29,23 @@ import org.tizen.sdblib.IDevice;
 import org.tizen.sdblib.service.FileEntry;
 
 public class DeviceExplorer extends Composite {
+       private static int FAIL = -1;
+       private static int FILE = 1;
+       private static int DIRECTORY = 2;
+
        protected Grid table = null;
        protected Text inputText = null;
        protected DACustomButton goButton = null;
        protected Label info = null;
+       private boolean getDirectory = false;
 
        private IDevice device = null;
        private FileEntry root = null;
        private FileEntry current = null;
        private FileEntry selected = null;
 
+       private String selectionStr = null;
+
        private SelectionListener tableSelectionListener = new SelectionListener() {
 
                @Override
@@ -102,16 +109,24 @@ public class DeviceExplorer extends Composite {
                                return;
                        }
 
-                       FileEntry file = device.getFileEntry(path);
-                       if (null == file || (!file.isDirectory() && !file.isRoot())) {
-                               System.out.println("target path is invalid");
+                       int ret = setCurrent(path);
+                       if (ret != FAIL) {
+                               inputText.setBackground(ColorResources.WHITE);
+                       } else {
                                inputText.setBackground(ColorResources.RED);
                                info.setText("Invalid path");
-                               return;
                        }
-                       inputText.setBackground(ColorResources.WHITE);
-                       current = file;
-                       updateData();
+
+                       // FileEntry file = device.getFileEntry(path);
+                       // if (null == file || (!file.isDirectory() && !file.isRoot())) {
+                       // System.out.println("target path is invalid");
+                       // inputText.setBackground(ColorResources.RED);
+                       // info.setText("Invalid path");
+                       // return;
+                       // }
+                       // inputText.setBackground(ColorResources.WHITE);
+                       // current = file;
+                       // updateData();
                }
        };
 
@@ -138,17 +153,6 @@ public class DeviceExplorer extends Composite {
                goButton.setText("Go");
                goButton.addClickListener(goButtonClickListener);
 
-               // Label label = new Label(this, SWT.TRANSPARENT);
-               // data = new FormData();
-               // data.top = new FormAttachment(inputText, 5);
-               // data.left = new FormAttachment(0, 20);
-               // data.height = 18;
-               // data.width = 70;
-               // label.setLayoutData(data);
-               // label.setText(CommonConstants.EMPTY);
-               // label.setBackground(ColorResources.DIALOG_BG_UPPER);
-               // label.setFont(FontResources.TABLE_CELL_FONT);
-
                info = new Label(this, SWT.TRANSPARENT);
                data = new FormData();
                data.top = new FormAttachment(inputText, 10);
@@ -216,6 +220,7 @@ public class DeviceExplorer extends Composite {
                        parentItem.setData(ExplorerUtil.DATA_FIEL_KEY, current.getParent());
                }
                FileEntry[] children = current.getChildren();
+               int selectionIndex = -1;
                if (null != children) {
                        int size = children.length;
                        for (int i = 0; i < size; i++) {
@@ -223,9 +228,19 @@ public class DeviceExplorer extends Composite {
                                GridItem item = new GridItem(table, SWT.NONE);
                                item.setText(1, child.getName());
                                item.setData(ExplorerUtil.DATA_FIEL_KEY, child);
+                               if (null != selectionStr
+                                               && selectionStr.equals(child.getFullPath())) {
+                                       int index = table.indexOf(item);
+                                       // table.getVerticalBar().setSelection(index);
+                                       table.setSelection(index);
+                                       selected = child;
+                                       inputText.setText(child.getFullPath());
+                                       selectionIndex = index;
+                               }
                        }
+                       table.getVerticalBar().setMaximum(size);
+                       table.getVerticalBar().setSelection(selectionIndex);
                }
-
                table.update();
        }
 
@@ -255,17 +270,52 @@ public class DeviceExplorer extends Composite {
                        }
                        FileEntry entry = (FileEntry) selection
                                        .getData(ExplorerUtil.DATA_FIEL_KEY);
-                       if (!entry.isDirectory() && !entry.isRoot()) {
-                               return entry;
+                       if (entry.isDirectory() || entry.isRoot()) {
+                               if (getDirectory) {
+                                       return entry;
+                               } else {
+                                       return null;
+                               }
                        } else {
-                               return null;
+                               if (getDirectory) {
+                                       return entry.getParent();
+                               } else {
+                                       return entry;
+                               }
                        }
                } else {
                        return null;
                }
        }
 
+       public void setReturnDirectory(boolean getDir) {
+               getDirectory = getDir;
+       }
+
        public void setDevice(IDevice dev) {
                this.device = dev;
        }
+
+       public int setCurrent(String path) {
+               int result = FAIL;
+               if (null != path && !path.isEmpty()) {
+                       FileEntry file = device.getFileEntry(path);
+                       if (file == null) {
+                               System.out.println("invalid path");
+                               return result;
+                       } else if (!file.isDirectory() || !file.isRoot()) {
+                               current = file.getParent();
+                               selectionStr = file.getFullPath();
+                               result = FILE;
+                       } else {
+                               current = file;
+                               selectionStr = CommonConstants.EMPTY;
+                               result = DIRECTORY;
+                       }
+                       updateData();
+                       return result;
+               }
+               return result;
+       }
+
 }
index 13827e2..57cf29f 100644 (file)
@@ -140,4 +140,8 @@ public class DeviceExplorerDilaog extends DAMessageBox {
                        }
                });
        }
+
+       public DeviceExplorer getExplorer() {
+               return explorer;
+       }
 }
@@ -26,17 +26,24 @@ import org.tizen.dynamicanalyzer.ui.widgets.table.DATableHeaderRenderer;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
 
-public class DAFileExplorerCasval extends Composite {
+public class DAFileExplorer extends Composite {
+
+       private static int FAIL = -1;
+       private static int FILE = 1;
+       private static int DIRECTORY = 2;
 
        protected Grid table = null;
        protected Text inputText = null;
        protected DACustomButton goButton = null;
        protected Label info = null;
+       private boolean getDirectory = false;
 
        private File root = null;
        private File current = null;
        private File selected = null;
 
+       private String selectionStr = null;
+
        private SelectionListener tableSelectionListener = new SelectionListener() {
 
                @Override
@@ -99,20 +106,27 @@ public class DAFileExplorerCasval extends Composite {
                                return;
                        }
 
-                       File file = new File(path);
-                       if (!file.exists() || !file.isDirectory()) {
-                               System.out.println("target path is invalid");
+                       int ret = setCurrent(path);
+                       if (ret != FAIL) {
+                               inputText.setBackground(ColorResources.WHITE);
+                       } else {
                                inputText.setBackground(ColorResources.RED);
                                info.setText("Invalid path");
-                               return;
                        }
-                       inputText.setBackground(ColorResources.WHITE);
-                       current = file;
-                       updateData();
+                       // File file = new File(path);
+                       // if (!file.exists() || !file.isDirectory()) {
+                       // System.out.println("target path is invalid");
+                       // inputText.setBackground(ColorResources.RED);
+                       // info.setText("Invalid path");
+                       // return;
+                       // }
+                       // inputText.setBackground(ColorResources.WHITE);
+                       // current = file;
+                       // updateData();
                }
        };
 
-       public DAFileExplorerCasval(Composite parent) {
+       public DAFileExplorer(Composite parent) {
                super(parent, SWT.NONE);
                this.setLayout(new FormLayout());
                this.setBackground(ColorResources.DIALOG_BG_UPPER);
@@ -135,17 +149,6 @@ public class DAFileExplorerCasval extends Composite {
                goButton.setText("Go");
                goButton.addClickListener(goButtonClickListener);
 
-//             Label label = new Label(this, SWT.TRANSPARENT);
-//             data = new FormData();
-//             data.top = new FormAttachment(inputText, 5);
-//             data.left = new FormAttachment(0, 20);
-//             data.height = 18;
-//             data.width = 70;
-//             label.setLayoutData(data);
-//             label.setText(CommonConstants.EMPTY);
-//             label.setBackground(ColorResources.DIALOG_BG_UPPER);
-//             label.setFont(FontResources.TABLE_CELL_FONT);
-
                info = new Label(this, SWT.TRANSPARENT);
                data = new FormData();
                data.top = new FormAttachment(inputText, 10);
@@ -221,6 +224,13 @@ public class DAFileExplorerCasval extends Composite {
                                GridItem item = new GridItem(table, SWT.NONE);
                                item.setText(1, child.getName());
                                item.setData(ExplorerUtil.DATA_FIEL_KEY, child);
+                               if (null != selectionStr
+                                               && selectionStr.equals(child.getAbsolutePath())) {
+                                       int index = table.indexOf(item);
+                                       table.setSelection(index);
+                                       selected = child;
+                                       inputText.setText(child.getAbsolutePath());
+                               }
                        }
                }
 
@@ -252,13 +262,46 @@ public class DAFileExplorerCasval extends Composite {
                        }
                        File entry = (File) selection.getData(ExplorerUtil.DATA_FIEL_KEY);
                        if (entry.isDirectory()) {
-                               return entry;
+                               if (getDirectory) {
+                                       return entry;
+                               } else {
+                                       return null;
+                               }
                        } else {
-                               return entry.getParentFile();
+                               if (getDirectory) {
+                                       return entry.getParentFile();
+                               } else {
+                                       return entry;
+                               }
                        }
                } else {
                        return null;
                }
        }
 
+       public void setReturnDirectory(boolean getDir) {
+               getDirectory = getDir;
+       }
+
+       public int setCurrent(String path) {
+               int result = FAIL;
+               if (null != path && !path.isEmpty()) {
+                       File file = new File(path);
+                       if (!file.exists()) {
+                               System.out.println("invalid path");
+                               return result;
+                       } else if (!file.isDirectory()) {
+                               current = file.getParentFile();
+                               selectionStr = file.getAbsolutePath();
+                               result = FILE;
+                       } else {
+                               current = file;
+                               selectionStr = CommonConstants.EMPTY;
+                               result = DIRECTORY;
+                       }
+                       updateData();
+                       return result;
+               }
+               return result;
+       }
 }
@@ -10,7 +10,6 @@ import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.dynamicanalyzer.common.DesignConstants;
-import org.tizen.dynamicanalyzer.common.PathManager;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
@@ -18,27 +17,26 @@ import org.tizen.dynamicanalyzer.ui.widgets.DAMessageBox;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
 
-public class FileExplorerCasvalDialog extends DAMessageBox {
-       private DAFileExplorerCasval explorer = null;
+public class FileExplorerDialog extends DAMessageBox {
+       private DAFileExplorer explorer = null;
        private DACustomButton okButton = null;
        private DACustomButton cancelButton = null;
 
-       public FileExplorerCasvalDialog(Shell parentShell) {
+       public FileExplorerDialog(Shell parentShell) {
                super(parentShell);
+
                shell.setLayout(new FormLayout());
                shell.setSize(446, 600);
                shell.setBackground(ColorResources.DIALOG_BG_UPPER);
                shell.setText("Select binary");
 
-               explorer = new DAFileExplorerCasval(shell);
+               explorer = new DAFileExplorer(shell);
                FormData data = new FormData();
                data.top = new FormAttachment(0, 17);
                data.left = new FormAttachment(0, 6);
                data.height = 476;
                data.width = 434;
                explorer.setLayoutData(data);
-               explorer.setRoot(PathManager.getRootStrapsPath());
-               explorer.updateData();
 
                Composite buttonComp = new Composite(shell, SWT.NONE);
                buttonComp.setLayout(new FormLayout());
@@ -99,7 +97,10 @@ public class FileExplorerCasvalDialog extends DAMessageBox {
                                shell.dispose();
                        }
                });
+       }
 
+       protected boolean run() {
+               explorer.updateData();
                // explorer.getTable().addMouseListener(new MouseListener() {
                //
                // @Override
@@ -130,5 +131,11 @@ public class FileExplorerCasvalDialog extends DAMessageBox {
                // }
                // }
                // });
+               return true;
        }
+
+       public DAFileExplorer getExplorer() {
+               return explorer;
+       }
+
 }
index c5cc01f..f76907c 100644 (file)
@@ -43,7 +43,7 @@ import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener
 import org.tizen.sdblib.service.FileEntry;
 
 public class FileExplorerDialog extends DAMessageBox {
-       private DAFileExplorer explorerTree = null;
+       private DAFileTreeExplorer explorerTree = null;
        private DACustomButton okButton = null;
        private DACustomButton cancelButton = null;
 
@@ -54,7 +54,7 @@ public class FileExplorerDialog extends DAMessageBox {
                shell.setBackground(ColorResources.DIALOG_BG_UPPER);
                shell.setText("Select binary");
 
-               explorerTree = new DAFileExplorer(shell);
+               explorerTree = new DAFileTreeExplorer(shell);
                FormData data = new FormData();
                data.top = new FormAttachment(0, 15);
                data.left = new FormAttachment(0, 20);
index d2b1faf..7bae4e2 100644 (file)
@@ -46,10 +46,11 @@ import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener
 public class InputRow extends Composite {
        private final static int ROW_HEIGHT = 18;
        private Text binaryPathText = null;
+       private Text debugPathText = null;
        private Text sourcePathText = null;
-       // private DACustomCombo sourceCombo = null;
+
        private DACustomButton editButton = null;
-       private DACustomButton minusButton = null;
+       private DACustomButton removeButton = null;
        private int index = -1;
 
        private DACustomButtonClickEventListener minusButtonListener = new DACustomButtonClickEventListener() {
@@ -83,18 +84,15 @@ public class InputRow extends Composite {
                public void handleClickEvent(DACustomButton button) {
                        BinaryAddDialog dialog = new BinaryAddDialog(
                                        getParent().getShell(), binaryPathText.getText(),
-                                       sourcePathText.getText());
+                                       debugPathText.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));
+                               debugPathText.setText(paths.get(1));
+                               sourcePathText.setText(paths.get(2));
                        }
-                       // BinarySettingManager.getInstance().removeInputRow(
-                       // binaryPathText.getText());
-                       // button.getParent().dispose();
-
                }
        };
 
@@ -125,12 +123,13 @@ public class InputRow extends Composite {
                binaryPathText.setEditable(false);
                binaryPathText.setBackground(ColorResources.GRAY_170);
 
-               sourcePathText = new Text(this, SWT.SINGLE);
-               sourcePathText.setEditable(false);
-               sourcePathText.setBackground(ColorResources.GRAY_170);
-               // sourceCombo = new DACustomCombo(this, SWT.NONE);
+               debugPathText = new Text(this, SWT.SINGLE);
+               debugPathText.setEditable(false);
+               debugPathText.setBackground(ColorResources.GRAY_170);
                editButton = new DAButton(this, SWT.NONE);
-               minusButton = new DAButton(this, SWT.NONE);
+               removeButton = new DAButton(this, SWT.NONE);
+
+               sourcePathText = new Text(this, SWT.SINGLE);
 
                data = new FormData();
                data.top = new FormAttachment(0, 0);
@@ -144,19 +143,19 @@ public class InputRow extends Composite {
                data.left = new FormAttachment(37, 5);
                data.right = new FormAttachment(74, 0);
                data.height = ROW_HEIGHT;
-               sourcePathText.setLayoutData(data);
+               debugPathText.setLayoutData(data);
 
-               // data = new FormData();
-               // data.top = new FormAttachment(0, 0);
-               // data.left = new FormAttachment(60, 5);
-               // data.right = new FormAttachment(85, 0);
-               // data.height = ROW_HEIGHT;
-               // sourceCombo.setLayoutData(data);
+               data = new FormData();
+               data.top = new FormAttachment(0, 0);
+               data.left = new FormAttachment(60, 5);
+               data.right = new FormAttachment(85, 0);
+               data.height = 0;
+               data.width = 0;
+               sourcePathText.setLayoutData(data);
 
                data = new FormData();
                data.top = new FormAttachment(0, 0);
-               // data.left = new FormAttachment(60, 5);
-               data.left = new FormAttachment(sourcePathText, 3);
+               data.left = new FormAttachment(debugPathText, 3);
                data.width = 65;
                data.height = ROW_HEIGHT;
                editButton.setLayoutData(data);
@@ -169,108 +168,10 @@ public class InputRow extends Composite {
                data.left = new FormAttachment(editButton, 3);
                data.width = 65;
                data.height = ROW_HEIGHT;
-               minusButton.setLayoutData(data);
-               minusButton.setText("remove");
-               minusButton.addClickListener(minusButtonListener);
+               removeButton.setLayoutData(data);
+               removeButton.setText("remove");
+               removeButton.addClickListener(minusButtonListener);
 
-               // sourceCombo.setComboButtonGradation(
-               // ColorResources.DEVICE_APPLICATION_BUTTON_NORMAL_START,
-               // ColorResources.DEVICE_APPLICATION_BUTTON_NORMAL_END,
-               // ColorResources.DEVICE_APPLICATION_BUTTON_PUSH_START,
-               // ColorResources.DEVICE_APPLICATION_BUTTON_PUSH_END,
-               // ColorResources.DEVICE_APPLICATION_BUTTON_HOVER_START,
-               // ColorResources.DEVICE_APPLICATION_BUTTON_HOVER_END,
-               // ColorResources.DEVICE_APPLICATION_BUTTON_DISABLE_START,
-               // ColorResources.DEVICE_APPLICATION_BUTTON_DISABLE_END);
-               // sourceCombo.setButtonImages(ImageResources.COMBO_DROPDOWN_UP,
-               // ImageResources.COMBO_DROPDOWN_DOWN);
-               // sourceCombo.setItemHeight(ROW_HEIGHT);
-               // sourceCombo.setComboRender(new TitleComboRenderer());
-               // sourceCombo.setComboPopupRender(new TitleComboPopupRenderer());
-               // sourceCombo.setButtonRenderer(new DACustomButtonRenderer());
-               // sourceCombo.setText("select list");
-               // sourceCombo.addListener(SWT.MouseDown, new Listener() {
-               //
-               // @Override
-               // public void handleEvent(Event event) {
-               // if (!sourceCombo.isChildShellOpened()) {
-               // try {
-               // Runtime rt = Runtime.getRuntime();
-               // Process process = rt.exec(new String[] {
-               // AnalyzerPaths.SBI_COMMAND, "list", "root" });
-               // process.waitFor();
-               // BufferedReader reader = new BufferedReader(
-               // new InputStreamReader(process.getInputStream()));
-               // BufferedReader error = new BufferedReader(
-               // new InputStreamReader(process.getErrorStream()));
-               // String line = null;
-               // sbiList.clear();
-               // while (null != (line = reader.readLine())) {
-               // sbiList.add(line);
-               // }
-               //
-               // if (!sbiList.isEmpty()) {
-               // sourceCombo.initCombo();
-               // for (String item : sbiList) {
-               // sourceCombo.add(item);
-               // }
-               // } else {
-               // String errStr = error.readLine();
-               // System.out.println("Error : " + errStr);
-               // }
-               // } catch (IOException e) {
-               // e.printStackTrace();
-               // } catch (InterruptedException e) {
-               // e.printStackTrace();
-               // }
-               // }
-               // }
-               // });
-               //
-               // sourceCombo.addSelectionListener(new DACustomComboSelectionListener()
-               // {
-               //
-               // @Override
-               // public void selectionEvent(DACustomCombo combo) {
-               // String rootName = combo.getText();
-               // if (null != rootName && !rootName.isEmpty()) {
-               // try {
-               // Runtime rt = Runtime.getRuntime();
-               // Process process = rt.exec(new String[] {
-               // AnalyzerPaths.SBI_COMMAND, "show", "root",
-               // rootName });
-               // process.waitFor();
-               // BufferedReader reader = new BufferedReader(
-               // new InputStreamReader(process.getInputStream()));
-               // BufferedReader error = new BufferedReader(
-               // new InputStreamReader(process.getErrorStream()));
-               // String line = null;
-               // // sbiList.clear();
-               // String sysRootPath = null;
-               // while (null != (line = reader.readLine())) {
-               // // sbiList.add(line);
-               // if (line.contains("SYSROOT_PATH")) {
-               // int index = line.indexOf("=");
-               // sysRootPath = line.substring(index + 1);
-               // }
-               // }
-               //
-               // if (null == sysRootPath) {
-               // String errStr = error.readLine();
-               // System.out.println("Error : " + errStr);
-               // }
-               // System.out.println(sysRootPath);
-               // sourcePathText.setText(sysRootPath);
-               // BinarySettingManager.getInstance().updateInputRow(
-               // binaryPathText.getText(), sysRootPath);
-               // } catch (IOException e) {
-               // e.printStackTrace();
-               // } catch (InterruptedException e) {
-               // e.printStackTrace();
-               // }
-               // }
-               // }
-               // });
        }
 
        public int getIndex() {
@@ -289,6 +190,14 @@ public class InputRow extends Composite {
                return binaryPathText.getText();
        }
 
+       public void setDebugText(String text) {
+               debugPathText.setText(text);
+       }
+
+       public String getDebugText() {
+               return debugPathText.getText();
+       }
+
        public void setSourceText(String text) {
                sourcePathText.setText(text);
        }
@@ -297,14 +206,20 @@ public class InputRow extends Composite {
                return sourcePathText.getText();
        }
 
-       // public void setSourceComboText(String text) {
-       // sourceCombo.setText(text);
-       // }
-
        public String getSaveData() {
                StringBuffer strBuffer = new StringBuffer();
                strBuffer.append(binaryPathText.getText())
                                .append(CommonConstants.COMMA);
+               if (null == debugPathText.getText()) {
+                       strBuffer.append(CommonConstants.SPACE).append(
+                                       CommonConstants.COMMA);
+                       ;
+               } else {
+                       strBuffer.append(debugPathText.getText()).append(
+                                       CommonConstants.COMMA);
+                       ;
+               }
+
                if (null == sourcePathText.getText()) {
                        strBuffer.append(CommonConstants.SPACE);
                } else {
@@ -315,6 +230,6 @@ public class InputRow extends Composite {
 
        public void setDisable() {
                editButton.setButtonEnabled(false);
-               minusButton.setButtonEnabled(false);
+               removeButton.setButtonEnabled(false);
        }
 }
index a07d620..27fdcf8 100644 (file)
@@ -69,7 +69,7 @@ public class BinarySettingsPage extends DAPageComposite {
                        cleanButtonListener.handleClickEvent(null);
                        initInputRows();
                        addButton.setButtonEnabled(false);
-                       saveButton.setButtonEnabled(false);
+                       saveButton.setButtonEnabled(true);
                        loadButton.setButtonEnabled(false);
                        cleanButton.setButtonEnabled(false);
                }
@@ -113,13 +113,15 @@ public class BinarySettingsPage extends DAPageComposite {
                                List<String> paths = (List<String>) result;
                                InputRow inputRow = new InputRow(inputComposite);
                                inputRow.setBinaryText(paths.get(0));
-                               inputRow.setSourceText(paths.get(1));
+                               inputRow.setDebugText(paths.get(1));
+                               inputRow.setSourceText(paths.get(2));
                                inputRowHash.put(paths.get(0), inputRow);
                                inputRowList.add(inputRow);
 
                                BinarySettingData binaryData = new BinarySettingData();
                                binaryData.setBinaryPath(inputRow.getBinaryText());
-                               binaryData.setDebugPath(inputRow.getSourceText());
+                               binaryData.setDebugPath(inputRow.getDebugText());
+                               binaryData.setUserSourcePath(inputRow.getSourceText());
 
                                if (addRadioButton.isSelected()) {
                                        BinarySettingManager.getInstance().getAddBinarySettings()
@@ -159,13 +161,15 @@ public class BinarySettingsPage extends DAPageComposite {
                                        String[] splitContent = content
                                                        .split(CommonConstants.COMMA);
                                        inputRow.setBinaryText(new String(splitContent[0]));
-                                       inputRow.setSourceText(new String(splitContent[1]));
+                                       inputRow.setDebugText(new String(splitContent[1]));
+                                       inputRow.setSourceText(new String(splitContent[2]));
                                        inputRowList.add(inputRow);
                                        inputRowHash.put(inputRow.getBinaryText(), inputRow);
 
                                        BinarySettingData binaryData = new BinarySettingData();
                                        binaryData.setBinaryPath(inputRow.getBinaryText());
-                                       binaryData.setDebugPath(inputRow.getSourceText());
+                                       binaryData.setDebugPath(inputRow.getDebugText());
+                                       binaryData.setUserSourcePath(inputRow.getSourceText());
                                        tempBinarySettings.add(binaryData);
                                }
                                if (addRadioButton.isSelected()) {
@@ -381,7 +385,7 @@ public class BinarySettingsPage extends DAPageComposite {
                        public void handleEvent(Event event) {
                                if (currentRadioButton.isSelected()) {
                                        addButton.setButtonEnabled(false);
-                                       saveButton.setButtonEnabled(false);
+                                       saveButton.setButtonEnabled(true);
                                        loadButton.setButtonEnabled(false);
                                        cleanButton.setButtonEnabled(false);
                                } else if (addRadioButton.isSelected()) {
@@ -418,7 +422,8 @@ public class BinarySettingsPage extends DAPageComposite {
                        for (InputRow input : inputRowList) {
                                BinarySettingData binaryData = new BinarySettingData();
                                binaryData.setBinaryPath(input.getBinaryText());
-                               binaryData.setDebugPath(input.getSourceText());
+                               binaryData.setDebugPath(input.getDebugText());
+                               binaryData.setUserSourcePath(input.getSourceText());
                                tempBinarySettings.add(binaryData);
                        }
                        // BinarySettingManager.getInstance().putBinarySettingData(
@@ -440,7 +445,8 @@ public class BinarySettingsPage extends DAPageComposite {
 
                                BinarySettingData binaryData = new BinarySettingData();
                                binaryData.setBinaryPath(input.getBinaryText());
-                               binaryData.setDebugPath(input.getSourceText());
+                               binaryData.setDebugPath(input.getDebugText());
+                               binaryData.setUserSourcePath(input.getSourceText());
                                tempBinarySettings.add(binaryData);
                        }
                        DACommunicator.sendSWAPMessage(
@@ -471,7 +477,7 @@ public class BinarySettingsPage extends DAPageComposite {
                        inputRow.setBinaryText(binData.get(i).getBinaryPath());
                        String source = binData.get(i).getDebugPath();
                        if (null != source && !source.isEmpty()) {
-                               inputRow.setSourceText(source);
+                               inputRow.setDebugText(source);
                                // String[] splitSource =
                                // source.split(CommonConstants.SLASH);
                                // String comboSel = new String(