From: hyunsik.noh Date: Mon, 10 Dec 2012 07:26:01 +0000 (+0900) Subject: [Title] Fix bug when compare string with integer X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9fe94221a991631133bbefc229da56983cbc3a17;p=sdk%2Fide%2Fcommon-eplugin.git [Title] Fix bug when compare string with integer Set invisible log menu when failed to get platformlog [Type] [Module] [Priority] [CQ#] [Redmine#] 7548 [Problem] [Cause] [Solution] Change-Id: I9d7f2bf2764be8de6ed6ff5e4e3245850c0935e9 --- diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionExplorer.java b/org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionExplorer.java index d892cf1..fec0b83 100755 --- a/org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionExplorer.java +++ b/org.tizen.common.connection/src/org/tizen/common/connection/ui/ConnectionExplorer.java @@ -27,6 +27,7 @@ package org.tizen.common.connection.ui; import java.io.File; import java.io.IOException; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import org.eclipse.jface.action.Action; @@ -92,8 +93,8 @@ public class ConnectionExplorer extends ViewPart private MenuManager menuMgr; private static ConnectionExplorer explorer; - public static int PLATFORMLOG_ON = 1; - public static int PLATFORMLOG_OFF = 0; + public static String PLATFORMLOG_ON = "1"; + public static String PLATFORMLOG_OFF = "0"; synchronized public static ConnectionExplorer gerDefault() { @@ -428,17 +429,17 @@ public class ConnectionExplorer extends ViewPart subLogMenu.add(actionPlatformLogOn); subLogMenu.add(actionPlatformLogOff); manager.add(subLogMenu); - boolean isOn = (getPlatformLogStatus() == PLATFORMLOG_ON) ? true : false; + boolean isOn = isPlatformLogOn(); actionPlatformLogOn.setChecked(isOn); actionPlatformLogOff.setChecked(!isOn); } - private int getPlatformLogStatus() + private boolean isPlatformLogOn() { TreeItem[] items = panel.getTreeViewer().getTree().getSelection(); FileEntry file = (FileEntry)items[0].getData(); IDevice[] devices = SmartDevelopmentBridge.getBridge().getDevices(); - final AtomicInteger result = new AtomicInteger(0); + final AtomicBoolean result = new AtomicBoolean(false); for(IDevice device : devices) { if(file.getName().equals(device.getDeviceName())) @@ -451,13 +452,23 @@ public class ConnectionExplorer extends ViewPart @Override public void processNewLines(String[] lines) { - if(lines[0].equals(PLATFORMLOG_ON) || lines[0].equals(PLATFORMLOG_OFF)) + boolean isOn = lines[0].equals(PLATFORMLOG_ON); + boolean isOff = lines[0].equals(PLATFORMLOG_OFF); + if(isOn || isOff) { - result.set(Integer.parseInt(lines[0])); + if(isOn) + { + result.set(true); + } + if(!subLogMenu.isVisible()) + { + subLogMenu.setVisible(true); + } } else { MessageDialog.openError(parent.getShell(), ConnectionUIMessages.Explorer_Message_PlatformLogError, lines[0] ); //$NON-NLS-1$ + subLogMenu.setVisible(false); } } });