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;
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()
{
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()))
@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);
}
}
});