// Listen for changes in the primary login session. If one already
// exists then this will dispatch to the listener immediately. In
// such a case, look for all of the @ContextMenuEntry annotation classes
// and update factoryList.
LoginManager.addPrimaryServerListener(new PrimaryServerListener() {
public void primaryServer(ServerSessionManager server) {
synchronized (factoryList) {
// Remove any previously existing items in the list.
factoryList.clear();