LAUNCH: Added log in LaunchesListener 06/17006/1
authorTaeyoung Son <taeyoung2.son@samsung.com>
Fri, 28 Feb 2014 09:30:07 +0000 (18:30 +0900)
committerTaeyoung Son <taeyoung2.son@samsung.com>
Fri, 28 Feb 2014 09:30:07 +0000 (18:30 +0900)
Change-Id: Ib807819bbd953f5b603250a2e6bb6cf63640a15b
Signed-off-by: Taeyoung Son <taeyoung2.son@samsung.com>
org.tizen.common/src/org/tizen/common/launch/LaunchesListener.java

index c9d27b0..f9b1419 100644 (file)
@@ -70,11 +70,12 @@ public class LaunchesListener implements ILaunchesListener2 {
 
                 String projectName = config.getAttribute(CONFIG_ATTR_PROJECT_NAME, "");
                 String serialNum = config.getAttribute(CONFIG_ATTR_DEVICE_SERIAL_NO, "");
-
                 if (getContext(projectName, serialNum) != null) {
+                    logger.debug("launch already - project: {}, device serial: {}", projectName, serialNum);
                     launch.setAttribute(LAUNCH_ATTR_KEY_IS_LAUNCHING, LAUNCH_ATTR_VALUE_LAUNCHING_ALREADY);
                     continue;
                 } else {
+                    logger.debug("Added - project: {}, device serial: {}", projectName, serialNum);
                     addContext(projectName, serialNum);
                 }
             } catch (CoreException e) {
@@ -167,23 +168,15 @@ public class LaunchesListener implements ILaunchesListener2 {
 
     @Override
     public void launchesRemoved(ILaunch[] launches) {
-        for (ILaunch launch : launches) {
-            try {
-                String projectName = launch.getLaunchConfiguration().getAttribute(CONFIG_ATTR_PROJECT_NAME, "");
-                String deviceSerialNum = launch.getLaunchConfiguration().getAttribute(CONFIG_ATTR_DEVICE_SERIAL_NO, "");
-
-                LaunchContext context = getContext(projectName, deviceSerialNum);
-                contexts.remove(context);
-            } catch (CoreException e) {
-              //TODO: need to consider handle exception.
-                logger.error(e.getMessage(),e);
-            }
-        }
+        removeLaunches(launches);
     }
 
     @Override
     public void launchesTerminated(ILaunch[] launches) {
-      //TODO: need to consider this.
+        removeLaunches(launches);
+    }
+
+    public void removeLaunches(ILaunch[] launches) {
         for (ILaunch launch : launches) {
             try {
                 String projectName = launch.getLaunchConfiguration().getAttribute(CONFIG_ATTR_PROJECT_NAME, "");
@@ -191,6 +184,7 @@ public class LaunchesListener implements ILaunchesListener2 {
 
                 LaunchContext context = getContext(projectName, deviceSerialNum);
                 contexts.remove(context);
+                logger.debug("removed - project: {}, device serial: {}", projectName, deviceSerialNum);
             } catch (CoreException e) {
               //TODO: need to consider handle exception.
                 logger.error(e.getMessage(),e);