summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-08 06:21:10 (EDT)
committerEike Stepper2007-10-08 06:21:10 (EDT)
commitc912fe331259a6adb8699e509dd17a0bb6b9dc10 (patch)
tree5795e951d9a432167f5922941d4d83f95d76f680
parent96a7a13f2b2d8c78f5f3b6b083b82f610dbba0f7 (diff)
downloadcdo-c912fe331259a6adb8699e509dd17a0bb6b9dc10.zip
cdo-c912fe331259a6adb8699e509dd17a0bb6b9dc10.tar.gz
cdo-c912fe331259a6adb8699e509dd17a0bb6b9dc10.tar.bz2
[205668] Provide buddies example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205668
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java49
1 files changed, 29 insertions, 20 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java
index 0319248..0794851 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java
@@ -18,6 +18,7 @@ import org.eclipse.net4j.util.container.IPluginContainer;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.ui.actions.SafeAction;
import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
import org.eclipse.net4j.util.ui.views.ContainerView;
@@ -75,30 +76,38 @@ public class BuddiesView extends ContainerView implements IListener
throw new IllegalStateException("connector == null");
}
- String userID = OM.PREF_USER_ID.getValue();
- String password = OM.PREF_PASSWORD.getValue();
- session = BuddiesUtil.openSession(connector, userID, password, 5000L);
- if (session != null)
+ boolean connected = connector.waitForConnection(5000L);
+ if (connected)
{
- if (connecting)
+ String userID = OM.PREF_USER_ID.getValue();
+ String password = OM.PREF_PASSWORD.getValue();
+ session = BuddiesUtil.openSession(connector, userID, password, 5000L);
+ if (session != null)
{
- resetInput();
- connectAction.setEnabled(false);
- disconnectAction.setEnabled(true);
- availableAction.setEnabled(true);
- availableAction.setChecked(session.getSelf().getState() == IBuddy.State.AVAILABLE);
- awayAction.setEnabled(true);
- awayAction.setChecked(session.getSelf().getState() == IBuddy.State.AWAY);
- doNotDisturbAction.setEnabled(true);
- doNotDisturbAction.setChecked(session.getSelf().getState() == IBuddy.State.DO_NOT_DISTURB);
- session.addListener(BuddiesView.this);
- }
- else
- {
- session.close();
- session = null;
+ if (connecting)
+ {
+ resetInput();
+ connectAction.setEnabled(false);
+ disconnectAction.setEnabled(true);
+ availableAction.setEnabled(true);
+ availableAction.setChecked(session.getSelf().getState() == IBuddy.State.AVAILABLE);
+ awayAction.setEnabled(true);
+ awayAction.setChecked(session.getSelf().getState() == IBuddy.State.AWAY);
+ doNotDisturbAction.setEnabled(true);
+ doNotDisturbAction.setChecked(session.getSelf().getState() == IBuddy.State.DO_NOT_DISTURB);
+ session.addListener(BuddiesView.this);
+ }
+ else
+ {
+ session.close();
+ session = null;
+ }
}
}
+ else
+ {
+ LifecycleUtil.deactivate(connector);
+ }
}
}
finally