VIEW: ROOTSTRAP: Supported to open debug source in ubuntu. 70/20370/1
authordonghyuk.yang <donghyuk.yang@samsung.com>
Tue, 6 May 2014 02:10:31 +0000 (11:10 +0900)
committerdonghyuk.yang <donghyuk.yang@samsung.com>
Tue, 6 May 2014 02:10:31 +0000 (11:10 +0900)
User can open installed debug source using "Open Debug Source" menu in
rootstrap view. File dialog will show file list in
{rootstrap_path}/usr/src/debug path.

Change-Id: Ia9d46bd70c5c38cd8afcfa1389242f4bf403b268
Signed-off-by: donghyuk.yang <donghyuk.yang@samsung.com>
org.tizen.nativeplatform/src/org/tizen/nativeplatform/views/ui/RootstrapView.java

index 093c9ee..8a5a772 100644 (file)
@@ -539,10 +539,10 @@ public class RootstrapView extends ViewPart {
         manager.add(actionChangeConfFile);
         manager.add(new Separator());
         if (OSChecker.isWindows()) {
-            manager.add(actionSync);            
-            manager.add(actionOpenDbgsrc);
-            manager.add(new Separator());
+            manager.add(actionSync);
         }
+        manager.add(actionOpenDbgsrc);
+        manager.add(new Separator());
         manager.add(actionPkgMgr);
     }
 
@@ -558,8 +558,8 @@ public class RootstrapView extends ViewPart {
         contextService.activateContext("org.tizen.nativeplatform.rootstrap.change.conffile.context");
         if (OSChecker.isWindows()) {
             contextService.activateContext("org.tizen.nativeplatform.rootstrap.sync.includes");
-            contextService.activateContext("org.tizen.nativeplatform.rootstrap.open.debugsource");
         }
+        contextService.activateContext("org.tizen.nativeplatform.rootstrap.open.debugsource");
     }
 
     private void makeActions() {
@@ -611,15 +611,14 @@ public class RootstrapView extends ViewPart {
                 }
             };
             actionSync.setText(resources.getString("View.Contextmenu.Sync"));
-            
-            actionOpenDbgsrc = new Action() {
-                @Override
-                public void run() {                    
-                    openDebugSource();
-                }
-            };
-            actionOpenDbgsrc.setText(resources.getString("View.Contextmenu.OpenDbgsrc"));
         }
+        actionOpenDbgsrc = new Action() {
+            @Override
+            public void run() {                    
+                openDebugSource();
+            }
+        };
+        actionOpenDbgsrc.setText(resources.getString("View.Contextmenu.OpenDbgsrc"));
     }
 
     private void updateToolbarEnable() {
@@ -788,7 +787,12 @@ public class RootstrapView extends ViewPart {
                Table table = tableViewer.getTable();
                 TableItem[] item = table.getSelection();
                 final PlatformRootstrap selected = (PlatformRootstrap) item[0].getData();
-                String rootstrapPath = RootstrapUtil.getUserSyncRootstrapPath(selected.getId());
+                String rootstrapPath = "";
+                if (OSChecker.isWindows()) {
+                    rootstrapPath = RootstrapUtil.getUserSyncRootstrapPath(selected.getId());
+                } else {
+                    rootstrapPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(selected.getPath());
+                }
                 String defaultPath = new Path(rootstrapPath).append("usr").append("src").append("debug").toString();
                 File debugSrcPath = new File(defaultPath);
                 if (!debugSrcPath.exists()) {
@@ -797,32 +801,34 @@ public class RootstrapView extends ViewPart {
                     DialogUtil.openMessageDialog(shell, msg);
                     return;
                 }
-                long dstTime = debugSrcPath.lastModified();
-                long srcTime = RootstrapSynchronizer.getDebugsrcPathLastmodifiedTime(selected);
-                if (srcTime != dstTime) {
-                    String msg = "There are changes for debug source in remote rootstrap.\n" +
-                               "Do you want to synchronize the changes?";
-                    int result = DialogUtil.openQuestionDialog(shell, "Do you want to synchronize?", msg);
-                    if (result == SWT.YES) {
-                        ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
-                        try {
-                            dialog.run(true, true, new IRunnableWithProgress() {
-                                @Override
-                                public void run(IProgressMonitor monitor)
-                                        throws InvocationTargetException, InterruptedException {
-                                    monitor.beginTask("Synchronize debug sources...", -1);
-                                    try {
-                                        RootstrapSynchronizer.syncronize(selected, false, true, monitor);
-                                    } finally {
-                                        monitor.done();
+                if (OSChecker.isWindows()) {
+                    long dstTime = debugSrcPath.lastModified();
+                    long srcTime = RootstrapSynchronizer.getDebugsrcPathLastmodifiedTime(selected);
+                    if (srcTime != dstTime) {
+                        String msg = "There are changes for debug source in remote rootstrap.\n" +
+                                       "Do you want to synchronize the changes?";
+                        int result = DialogUtil.openQuestionDialog(shell, "Do you want to synchronize?", msg);
+                        if (result == SWT.YES) {
+                            ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
+                            try {
+                                dialog.run(true, true, new IRunnableWithProgress() {
+                                    @Override
+                                    public void run(IProgressMonitor monitor)
+                                            throws InvocationTargetException, InterruptedException {
+                                        monitor.beginTask("Synchronize debug sources...", -1);
+                                        try {
+                                            RootstrapSynchronizer.syncronize(selected, false, true, monitor);
+                                        } finally {
+                                            monitor.done();
+                                        }
                                     }
-                                }
-                            });
-                        } catch (Exception e) {
-                            logger.error("Failed to syncronize debug sources", e);
-                            DialogUtil.openErrorDialog(String.format("%s\n * %s",
-                                    "Failed to syncronize debug sources", e.toString()));
-                            return;
+                                });
+                            } catch (Exception e) {
+                                logger.error("Failed to syncronize debug sources", e);
+                                DialogUtil.openErrorDialog(String.format("%s\n * %s",
+                                        "Failed to syncronize debug sources", e.toString()));
+                                return;
+                            }
                         }
                     }
                 }