listener on SmartDevelopmentBridge additionally.
[Type]
[Module]
[Priority]
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase
Change-Id: Ieb13761d63f44cfacd1abe7e2191e4a5f46458a3
protected void postCreation()
{
ConnectionPlugin.getDefault().addSelectionListener(this);
- SmartDevelopmentBridge sdbBridge = SmartDevelopmentBridge.getBridge();
SmartDevelopmentBridge.addDebugBridgeChangeListener(this);
- SmartDevelopmentBridge.addDeviceChangeListener(this);
-
- IDevice[] devices = null;
- if (sdbBridge != null)
- {
- devices = sdbBridge.getDevices();
- }
- if (devices != null && devices.length != 0)
- {
- for (IDevice device : devices)
- {
- this.deviceConnected(device);
- }
- }
+ SmartDevelopmentBridge.addDeviceChangeListener(this, true);
}
/**
}
});
- SmartDevelopmentBridge.addDeviceChangeListener(this);
- // Create default device tab if device(s) is connected
- createDefaultTabs();
+ SmartDevelopmentBridge.addDeviceChangeListener(this, true);
return null;
}
getSelectionLogTab().setLevelMode(levelMode);
}
- // create the logtab with default devices
- private void createDefaultTabs()
- {
- for (IDevice device : getDevices())
- {
- if (device.isOffline())
- {
- continue;
- }
- LogTab dTab = createLogTab(ConnectionExplorerLabelProvider.getDeviceSerialWithName(device), device, true);
- dTab.start();
- }
- }
-
/**
* Create LogTab and TabItem and
* set action and icon status
* @param listener The listener which should be notified.
*/
public static void addDeviceChangeListener(IDeviceChangeListener listener) {
+ addDeviceChangeListener(listener, false);
+ }
+
+ /**
+ * Adds the listener to the collection of listeners who will be notified when a {@link IDevice}
+ * is connected, disconnected, or when its properties or its {@link Client} list changed,
+ * by sending it one of the messages defined in the {@link IDeviceChangeListener} interface.
+ *
+ * @param listener The listener which should be notified.
+ * @param getPreviousNoti Provides connected device notification which not notified before adding listener.
+ */
+ public static void addDeviceChangeListener(IDeviceChangeListener listener, boolean getPreviousNoti) {
synchronized (sLock) {
if (sDeviceListeners.contains(listener) == false) {
sDeviceListeners.add(listener);
+ if(getPreviousNoti)
+ {
+ IDevice[] devices = SmartDevelopmentBridge.getBridge().getDevices();
+ for(IDevice device : devices)
+ {
+ if(device.isOnline())
+ {
+ listener.deviceConnected(device);
+ }
+ }
+ }
}
}
}