summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-11 02:36:55 (EDT)
committerEike Stepper2007-10-11 02:36:55 (EDT)
commit590e7416ee163b9ddafa98bb6541eb0326bdacf0 (patch)
tree2695fb00fb7337dfa04a555bfd98c3e80290678d
parent33916423dcc4944857821599de6fbef1dfa7a9f4 (diff)
downloadcdo-590e7416ee163b9ddafa98bb6541eb0326bdacf0.zip
cdo-590e7416ee163b9ddafa98bb6541eb0326bdacf0.tar.gz
cdo-590e7416ee163b9ddafa98bb6541eb0326bdacf0.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/actions/StateAction.java7
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java15
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java5
3 files changed, 16 insertions, 11 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/StateAction.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/StateAction.java
index ebdd0bf..b0c4040 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/StateAction.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/StateAction.java
@@ -24,6 +24,13 @@ public class StateAction extends SafeAction
this.state = state;
}
+ public void updateState()
+ {
+ IBuddySession session = IBuddiesManager.INSTANCE.getSession();
+ setEnabled(session != null);
+ setChecked(session != null && session.getSelf().getState() == state);
+ }
+
@Override
protected void safeRun() throws Exception
{
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 67bb526..05d1d20 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
@@ -21,7 +21,6 @@ import org.eclipse.net4j.buddies.internal.ui.actions.StateAction.DoNotDisturbAct
import org.eclipse.net4j.buddies.internal.ui.actions.StateAction.LonesomeAction;
import org.eclipse.net4j.buddies.protocol.IBuddy;
import org.eclipse.net4j.buddies.protocol.IBuddyStateChangedEvent;
-import org.eclipse.net4j.buddies.protocol.IBuddy.State;
import org.eclipse.net4j.buddies.ui.IBuddiesManager;
import org.eclipse.net4j.buddies.ui.IBuddiesManagerStateChangedEvent;
import org.eclipse.net4j.util.container.ContainerUtil;
@@ -172,15 +171,9 @@ public class BuddiesView extends ContainerView implements IListener
disconnectAction.setEnabled(session != null);
flashAction.setEnabled(session != null && !IBuddiesManager.INSTANCE.isFlashing());
- 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);
+ availableAction.updateState();
+ lonesomeAction.updateState();
+ awayAction.updateState();
+ doNotDisturbAction.updateState();
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
index bcf845b..16c47e5 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java
@@ -200,5 +200,10 @@ public class CollaborationsView extends ContainerView implements IListener
// connectAction.setEnabled(session == null);
// disconnectAction.setEnabled(session != null);
// flashAction.setEnabled(session != null && !IBuddiesManager.INSTANCE.isFlashing());
+
+ // availableAction.updateState();
+ // lonesomeAction.updateState();
+ // awayAction.updateState();
+ // doNotDisturbAction.updateState();
}
} \ No newline at end of file