summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-09 09:26:39 (EDT)
committerEike Stepper2007-10-09 09:26:39 (EDT)
commit99f9a9c932e64b07b1f1fa69dc2089a5617279e1 (patch)
tree69e9428787c8c233642c58ca5faa5d0c32567507
parent38ae2e2de0c3f4bdfa642cf704b4c57ff8e32b8e (diff)
downloadcdo-99f9a9c932e64b07b1f1fa69dc2089a5617279e1.zip
cdo-99f9a9c932e64b07b1f1fa69dc2089a5617279e1.tar.gz
cdo-99f9a9c932e64b07b1f1fa69dc2089a5617279e1.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.java19
1 files changed, 11 insertions, 8 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 e79fdae..7fb6f02 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
@@ -171,6 +171,7 @@ public class BuddiesView extends ContainerView implements IListener
protected Control createUI(Composite parent)
{
Control control = super.createUI(parent);
+ updateState();
INSTANCE = this;
return control;
}
@@ -246,14 +247,16 @@ public class BuddiesView extends ContainerView implements IListener
protected void updateState()
{
- availableAction.setEnabled(true);
- availableAction.setChecked(session.getSelf().getState() == IBuddy.State.AVAILABLE);
- lonesomeAction.setEnabled(true);
- lonesomeAction.setChecked(session.getSelf().getState() == IBuddy.State.LONESOME);
- awayAction.setEnabled(true);
- awayAction.setChecked(session.getSelf().getState() == IBuddy.State.AWAY);
- doNotDisturbAction.setEnabled(true);
- doNotDisturbAction.setChecked(session.getSelf().getState() == IBuddy.State.DO_NOT_DISTURB);
+ updateState(availableAction, IBuddy.State.AVAILABLE);
+ updateState(lonesomeAction, IBuddy.State.LONESOME);
+ updateState(awayAction, IBuddy.State.AWAY);
+ updateState(doNotDisturbAction, IBuddy.State.DO_NOT_DISTURB);
+ }
+
+ protected void updateState(StateAction action, State state)
+ {
+ action.setEnabled(session != null);
+ action.setChecked(session != null && session.getSelf().getState() == state);
}
/**