Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-07-19 08:22:04 +0000
committerEike Stepper2012-07-19 08:22:04 +0000
commit1460904fd3c193ffaf809913b2983a400fce9d94 (patch)
tree72f3a17b75fedba3ae1060df1d32c9c7889be954 /plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse
parent5f360965ae87478e0681899bf310a210cafc2c44 (diff)
downloadcdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.gz
cdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.xz
cdo-1460904fd3c193ffaf809913b2983a400fce9d94.zip
Fix line endings in master (dos2unix)
Diffstat (limited to 'plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse')
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/AbstractItemProvider.java474
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/BuddiesContentProvider.java82
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/BuddiesItemProvider.java98
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/ChatInstaller.java58
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/CollaborationsContentProvider.java82
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/CollaborationsItemProvider.java282
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/MembershipItemProvider.java98
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/ConnectAction.java64
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/DisconnectAction.java64
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/FlashAction.java64
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/ReconnectAction.java66
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/StateAction.java380
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/bundle/OM.java118
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/dnd/BuddiesTransfer.java158
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/messages/Messages.java82
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/messages/messages.properties74
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/preferences/BuddiesPreferencePage.java174
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesDragListener.java128
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesDropAdapter.java112
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesView.java126
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java668
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsView.java442
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/FacilityPane.java484
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/SessionManagerView.java306
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/ui/IFacilityPaneCreator.java56
25 files changed, 2370 insertions, 2370 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/AbstractItemProvider.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/AbstractItemProvider.java
index 4659c473cb..381ec467a3 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/AbstractItemProvider.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/AbstractItemProvider.java
@@ -1,237 +1,237 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui;
-
-import org.eclipse.net4j.buddies.IBuddyCollaboration;
-import org.eclipse.net4j.buddies.common.IBuddy;
-import org.eclipse.net4j.buddies.common.ICollaboration;
-import org.eclipse.net4j.buddies.common.IMembership;
-import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
-import org.eclipse.net4j.ui.shared.SharedIcons;
-import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-import org.eclipse.net4j.util.ui.UIUtil;
-import org.eclipse.net4j.util.ui.actions.LongRunningAction;
-import org.eclipse.net4j.util.ui.actions.SafeAction;
-import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
-import org.eclipse.net4j.util.ui.views.ContainerView;
-import org.eclipse.net4j.util.ui.views.IElementFilter;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Eike Stepper
- */
-public abstract class AbstractItemProvider extends ContainerItemProvider<IContainer<Object>>
-{
- public static final Color GRAY = UIUtil.getDisplay().getSystemColor(SWT.COLOR_GRAY);
-
- private Font bold;
-
- public AbstractItemProvider()
- {
- }
-
- public AbstractItemProvider(IElementFilter rootElementFilter)
- {
- super(rootElementFilter);
- }
-
- @Override
- public void dispose()
- {
- UIUtil.dispose(bold);
- super.dispose();
- }
-
- public Font getBold()
- {
- return bold;
- }
-
- @Override
- protected Node createNode(Node parent, Object element)
- {
- if (element instanceof IMembership)
- {
- IMembership membership = (IMembership)element;
- return createMembershipNode(parent, membership);
- }
-
- return super.createNode(parent, element);
- }
-
- protected abstract Node createMembershipNode(Node parent, IMembership membership);
-
- @Override
- public String getText(Object obj)
- {
- if (obj instanceof IBuddy)
- {
- IBuddy buddy = (IBuddy)obj;
- return buddy.getUserID();
- }
-
- if (obj instanceof ICollaboration)
- {
- ICollaboration collaboration = (ICollaboration)obj;
- return collaboration.getTitle();
- }
-
- if (obj instanceof IMembership)
- {
- IMembership membership = (IMembership)obj;
- return getText(membership);
- }
-
- return super.getText(obj);
- }
-
- protected abstract String getText(IMembership membership);
-
- @Override
- public Image getImage(Object obj)
- {
- if (obj instanceof IBuddy)
- {
- IBuddy buddy = (IBuddy)obj;
- switch (buddy.getState())
- {
- case AVAILABLE:
- return SharedIcons.getImage(SharedIcons.OBJ_BUDDY);
-
- case LONESOME:
- return SharedIcons.getImage(SharedIcons.OBJ_BUDDY_LONESOME);
-
- case AWAY:
- return SharedIcons.getImage(SharedIcons.OBJ_BUDDY_AWAY);
-
- case DO_NOT_DISTURB:
- return SharedIcons.getImage(SharedIcons.OBJ_BUDDY_DO_NOT_DISTURB);
- }
- }
-
- if (obj instanceof ICollaboration)
- {
- return SharedIcons.getImage(SharedIcons.OBJ_COLLABORATION);
- }
-
- if (obj instanceof IMembership)
- {
- IMembership membership = (IMembership)obj;
- return getImage(membership);
- }
-
- return super.getImage(obj);
- }
-
- protected abstract Image getImage(IMembership membership);
-
- @Override
- public Color getForeground(Object obj)
- {
- if (obj instanceof IBuddy)
- {
- IBuddy buddy = (IBuddy)obj;
- switch (buddy.getState())
- {
- case AWAY:
- case DO_NOT_DISTURB:
- return GRAY;
- }
- }
-
- return super.getForeground(obj);
- }
-
- @Override
- public Font getFont(Object obj)
- {
- if (obj instanceof IBuddy)
- {
- IBuddy buddy = (IBuddy)obj;
- switch (buddy.getState())
- {
- case LONESOME:
- return bold;
- }
- }
-
- return super.getFont(obj);
- }
-
- @Override
- protected void fillContextMenu(IMenuManager manager, ITreeSelection selection)
- {
- manager.add(new Separator());
- if (selection.size() == 1)
- {
- Object obj = selection.getFirstElement();
- if (obj instanceof IBuddy)
- {
- manager.add(new RemoveAction(obj));
- }
- else if (obj instanceof IBuddyCollaboration)
- {
- final IBuddyCollaboration collaboration = (IBuddyCollaboration)obj;
- manager.add(new SafeAction(
- Messages.getString("AbstractItemProvider.0"), Messages.getString("AbstractItemProvider.1")) //$NON-NLS-1$ //$NON-NLS-2$
- {
- @Override
- protected void safeRun() throws Exception
- {
- collaboration.leave();
- }
- });
- }
- }
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- UIUtil.dispose(bold);
- super.inputChanged(viewer, oldInput, newInput);
- bold = UIUtil.getBoldFont(getViewer().getControl());
- }
-
- /**
- * @author Eike Stepper
- */
- public class RemoveAction extends LongRunningAction
- {
- private Object object;
-
- public RemoveAction(Object object)
- {
- super(
- Messages.getString("AbstractItemProvider.2"), Messages.getString("AbstractItemProvider.3"), ContainerView.getDeleteImageDescriptor()); //$NON-NLS-1$ //$NON-NLS-2$
- this.object = object;
- }
-
- /**
- * @since 2.0
- */
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- LifecycleUtil.deactivateNoisy(object);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui;
+
+import org.eclipse.net4j.buddies.IBuddyCollaboration;
+import org.eclipse.net4j.buddies.common.IBuddy;
+import org.eclipse.net4j.buddies.common.ICollaboration;
+import org.eclipse.net4j.buddies.common.IMembership;
+import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
+import org.eclipse.net4j.ui.shared.SharedIcons;
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
+import org.eclipse.net4j.util.ui.UIUtil;
+import org.eclipse.net4j.util.ui.actions.LongRunningAction;
+import org.eclipse.net4j.util.ui.actions.SafeAction;
+import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
+import org.eclipse.net4j.util.ui.views.ContainerView;
+import org.eclipse.net4j.util.ui.views.IElementFilter;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AbstractItemProvider extends ContainerItemProvider<IContainer<Object>>
+{
+ public static final Color GRAY = UIUtil.getDisplay().getSystemColor(SWT.COLOR_GRAY);
+
+ private Font bold;
+
+ public AbstractItemProvider()
+ {
+ }
+
+ public AbstractItemProvider(IElementFilter rootElementFilter)
+ {
+ super(rootElementFilter);
+ }
+
+ @Override
+ public void dispose()
+ {
+ UIUtil.dispose(bold);
+ super.dispose();
+ }
+
+ public Font getBold()
+ {
+ return bold;
+ }
+
+ @Override
+ protected Node createNode(Node parent, Object element)
+ {
+ if (element instanceof IMembership)
+ {
+ IMembership membership = (IMembership)element;
+ return createMembershipNode(parent, membership);
+ }
+
+ return super.createNode(parent, element);
+ }
+
+ protected abstract Node createMembershipNode(Node parent, IMembership membership);
+
+ @Override
+ public String getText(Object obj)
+ {
+ if (obj instanceof IBuddy)
+ {
+ IBuddy buddy = (IBuddy)obj;
+ return buddy.getUserID();
+ }
+
+ if (obj instanceof ICollaboration)
+ {
+ ICollaboration collaboration = (ICollaboration)obj;
+ return collaboration.getTitle();
+ }
+
+ if (obj instanceof IMembership)
+ {
+ IMembership membership = (IMembership)obj;
+ return getText(membership);
+ }
+
+ return super.getText(obj);
+ }
+
+ protected abstract String getText(IMembership membership);
+
+ @Override
+ public Image getImage(Object obj)
+ {
+ if (obj instanceof IBuddy)
+ {
+ IBuddy buddy = (IBuddy)obj;
+ switch (buddy.getState())
+ {
+ case AVAILABLE:
+ return SharedIcons.getImage(SharedIcons.OBJ_BUDDY);
+
+ case LONESOME:
+ return SharedIcons.getImage(SharedIcons.OBJ_BUDDY_LONESOME);
+
+ case AWAY:
+ return SharedIcons.getImage(SharedIcons.OBJ_BUDDY_AWAY);
+
+ case DO_NOT_DISTURB:
+ return SharedIcons.getImage(SharedIcons.OBJ_BUDDY_DO_NOT_DISTURB);
+ }
+ }
+
+ if (obj instanceof ICollaboration)
+ {
+ return SharedIcons.getImage(SharedIcons.OBJ_COLLABORATION);
+ }
+
+ if (obj instanceof IMembership)
+ {
+ IMembership membership = (IMembership)obj;
+ return getImage(membership);
+ }
+
+ return super.getImage(obj);
+ }
+
+ protected abstract Image getImage(IMembership membership);
+
+ @Override
+ public Color getForeground(Object obj)
+ {
+ if (obj instanceof IBuddy)
+ {
+ IBuddy buddy = (IBuddy)obj;
+ switch (buddy.getState())
+ {
+ case AWAY:
+ case DO_NOT_DISTURB:
+ return GRAY;
+ }
+ }
+
+ return super.getForeground(obj);
+ }
+
+ @Override
+ public Font getFont(Object obj)
+ {
+ if (obj instanceof IBuddy)
+ {
+ IBuddy buddy = (IBuddy)obj;
+ switch (buddy.getState())
+ {
+ case LONESOME:
+ return bold;
+ }
+ }
+
+ return super.getFont(obj);
+ }
+
+ @Override
+ protected void fillContextMenu(IMenuManager manager, ITreeSelection selection)
+ {
+ manager.add(new Separator());
+ if (selection.size() == 1)
+ {
+ Object obj = selection.getFirstElement();
+ if (obj instanceof IBuddy)
+ {
+ manager.add(new RemoveAction(obj));
+ }
+ else if (obj instanceof IBuddyCollaboration)
+ {
+ final IBuddyCollaboration collaboration = (IBuddyCollaboration)obj;
+ manager.add(new SafeAction(
+ Messages.getString("AbstractItemProvider.0"), Messages.getString("AbstractItemProvider.1")) //$NON-NLS-1$ //$NON-NLS-2$
+ {
+ @Override
+ protected void safeRun() throws Exception
+ {
+ collaboration.leave();
+ }
+ });
+ }
+ }
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+ {
+ UIUtil.dispose(bold);
+ super.inputChanged(viewer, oldInput, newInput);
+ bold = UIUtil.getBoldFont(getViewer().getControl());
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public class RemoveAction extends LongRunningAction
+ {
+ private Object object;
+
+ public RemoveAction(Object object)
+ {
+ super(
+ Messages.getString("AbstractItemProvider.2"), Messages.getString("AbstractItemProvider.3"), ContainerView.getDeleteImageDescriptor()); //$NON-NLS-1$ //$NON-NLS-2$
+ this.object = object;
+ }
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ LifecycleUtil.deactivateNoisy(object);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/BuddiesContentProvider.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/BuddiesContentProvider.java
index b2f89d1fa2..bbb50a79c6 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/BuddiesContentProvider.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/BuddiesContentProvider.java
@@ -1,41 +1,41 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui;
-
-import org.eclipse.net4j.buddies.common.IBuddyContainer;
-import org.eclipse.net4j.util.ui.StructuredContentProvider;
-
-/**
- * @author Eike Stepper
- */
-public class BuddiesContentProvider extends StructuredContentProvider<IBuddyContainer>
-{
- public BuddiesContentProvider()
- {
- }
-
- public Object[] getElements(Object inputElement)
- {
- return getInput().getElements();
- }
-
- @Override
- protected void connectInput(IBuddyContainer input)
- {
- input.addListener(this);
- }
-
- @Override
- protected void disconnectInput(IBuddyContainer input)
- {
- input.removeListener(this);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui;
+
+import org.eclipse.net4j.buddies.common.IBuddyContainer;
+import org.eclipse.net4j.util.ui.StructuredContentProvider;
+
+/**
+ * @author Eike Stepper
+ */
+public class BuddiesContentProvider extends StructuredContentProvider<IBuddyContainer>
+{
+ public BuddiesContentProvider()
+ {
+ }
+
+ public Object[] getElements(Object inputElement)
+ {
+ return getInput().getElements();
+ }
+
+ @Override
+ protected void connectInput(IBuddyContainer input)
+ {
+ input.addListener(this);
+ }
+
+ @Override
+ protected void disconnectInput(IBuddyContainer input)
+ {
+ input.removeListener(this);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/BuddiesItemProvider.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/BuddiesItemProvider.java
index 3f2113169b..9a9d66545b 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/BuddiesItemProvider.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/BuddiesItemProvider.java
@@ -1,49 +1,49 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui;
-
-import org.eclipse.net4j.buddies.common.IMembership;
-import org.eclipse.net4j.util.ui.views.IElementFilter;
-
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Eike Stepper
- */
-public class BuddiesItemProvider extends AbstractItemProvider
-{
- public BuddiesItemProvider()
- {
- }
-
- public BuddiesItemProvider(IElementFilter rootElementFilter)
- {
- super(rootElementFilter);
- }
-
- @Override
- protected Node createMembershipNode(Node parent, IMembership membership)
- {
- return createLeafNode(parent, membership);
- }
-
- @Override
- protected String getText(IMembership membership)
- {
- return getText(membership.getCollaboration());
- }
-
- @Override
- protected Image getImage(IMembership membership)
- {
- return getImage(membership.getCollaboration());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui;
+
+import org.eclipse.net4j.buddies.common.IMembership;
+import org.eclipse.net4j.util.ui.views.IElementFilter;
+
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Eike Stepper
+ */
+public class BuddiesItemProvider extends AbstractItemProvider
+{
+ public BuddiesItemProvider()
+ {
+ }
+
+ public BuddiesItemProvider(IElementFilter rootElementFilter)
+ {
+ super(rootElementFilter);
+ }
+
+ @Override
+ protected Node createMembershipNode(Node parent, IMembership membership)
+ {
+ return createLeafNode(parent, membership);
+ }
+
+ @Override
+ protected String getText(IMembership membership)
+ {
+ return getText(membership.getCollaboration());
+ }
+
+ @Override
+ protected Image getImage(IMembership membership)
+ {
+ return getImage(membership.getCollaboration());
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/ChatInstaller.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/ChatInstaller.java
index be76e940b6..a6b7184bff 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/ChatInstaller.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/ChatInstaller.java
@@ -1,29 +1,29 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui;
-
-import org.eclipse.net4j.buddies.IBuddyCollaboration;
-import org.eclipse.net4j.buddies.chat.IChat;
-
-/**
- * @author Eike Stepper
- */
-public final class ChatInstaller
-{
- private ChatInstaller()
- {
- }
-
- public static void installChat(IBuddyCollaboration collaboration)
- {
- collaboration.installFacility(IChat.TYPE);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui;
+
+import org.eclipse.net4j.buddies.IBuddyCollaboration;
+import org.eclipse.net4j.buddies.chat.IChat;
+
+/**
+ * @author Eike Stepper
+ */
+public final class ChatInstaller
+{
+ private ChatInstaller()
+ {
+ }
+
+ public static void installChat(IBuddyCollaboration collaboration)
+ {
+ collaboration.installFacility(IChat.TYPE);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/CollaborationsContentProvider.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/CollaborationsContentProvider.java
index 0c30de6453..5d508835ae 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/CollaborationsContentProvider.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/CollaborationsContentProvider.java
@@ -1,41 +1,41 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui;
-
-import org.eclipse.net4j.buddies.common.ICollaborationContainer;
-import org.eclipse.net4j.util.ui.StructuredContentProvider;
-
-/**
- * @author Eike Stepper
- */
-public class CollaborationsContentProvider extends StructuredContentProvider<ICollaborationContainer>
-{
- public CollaborationsContentProvider()
- {
- }
-
- public Object[] getElements(Object inputElement)
- {
- return getInput().getElements();
- }
-
- @Override
- protected void connectInput(ICollaborationContainer input)
- {
- input.addListener(this);
- }
-
- @Override
- protected void disconnectInput(ICollaborationContainer input)
- {
- input.removeListener(this);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui;
+
+import org.eclipse.net4j.buddies.common.ICollaborationContainer;
+import org.eclipse.net4j.util.ui.StructuredContentProvider;
+
+/**
+ * @author Eike Stepper
+ */
+public class CollaborationsContentProvider extends StructuredContentProvider<ICollaborationContainer>
+{
+ public CollaborationsContentProvider()
+ {
+ }
+
+ public Object[] getElements(Object inputElement)
+ {
+ return getInput().getElements();
+ }
+
+ @Override
+ protected void connectInput(ICollaborationContainer input)
+ {
+ input.addListener(this);
+ }
+
+ @Override
+ protected void disconnectInput(ICollaborationContainer input)
+ {
+ input.removeListener(this);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/CollaborationsItemProvider.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/CollaborationsItemProvider.java
index d0cb7ee1e1..c453e89f0f 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/CollaborationsItemProvider.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/CollaborationsItemProvider.java
@@ -1,141 +1,141 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui;
-
-import org.eclipse.net4j.buddies.common.ICollaboration;
-import org.eclipse.net4j.buddies.common.IMembership;
-import org.eclipse.net4j.internal.buddies.Self;
-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.ui.views.IElementFilter;
-
-import org.eclipse.swt.graphics.Image;
-
-import java.util.Collection;
-
-/**
- * @author Eike Stepper
- */
-public class CollaborationsItemProvider extends AbstractItemProvider
-{
- public CollaborationsItemProvider()
- {
- }
-
- public CollaborationsItemProvider(IElementFilter rootElementFilter)
- {
- super(rootElementFilter);
- }
-
- @Override
- protected Node createNode(Node parent, Object element)
- {
- if (element instanceof Self)
- {
- return new SelfNode((Self)element);
- }
-
- if (element instanceof IMembership)
- {
- IMembership membership = (IMembership)element;
- if (membership.getBuddy() instanceof Self)
- {
- return null;
- }
- }
-
- return super.createNode(parent, element);
- }
-
- @Override
- protected Node createMembershipNode(Node parent, IMembership membership)
- {
- return createLeafNode(parent, membership);
- }
-
- @Override
- protected String getText(IMembership membership)
- {
- return getText(membership.getBuddy());
- }
-
- @Override
- protected Image getImage(IMembership membership)
- {
- return getImage(membership.getBuddy());
- }
-
- /**
- * @since 4.0
- */
- @Override
- public void refreshElement(Object element, boolean updateLabels)
- {
- super.refreshElement(null, updateLabels);
- }
-
- /**
- * @author Eike Stepper
- */
- private class SelfNode extends AbstractContainerNode implements IListener
- {
- private Self self;
-
- public SelfNode(Self self)
- {
- super(null);
- this.self = self;
- }
-
- @Override
- public void dispose()
- {
- if (!isDisposed())
- {
- self.removeListener(containerListener);
- super.dispose();
- }
- }
-
- public Self getElement()
- {
- return self;
- }
-
- public void notifyEvent(IEvent event)
- {
- IMembership membership = (IMembership)event.getSource();
- if (event instanceof ILifecycleEvent)
- {
- ILifecycleEvent e = (ILifecycleEvent)event;
- if (e.getKind() == ILifecycleEvent.Kind.DEACTIVATED)
- {
- membership.removeListener(this);
- ICollaboration collaboration = membership.getCollaboration();
- Node node = getNode(collaboration);
- if (node != null)
- {
- node.dispose();
- }
- }
- }
- }
-
- @Override
- protected Node addChild(Collection<Node> children, Object element)
- {
- IMembership membership = (IMembership)element;
- membership.addListener(this);
- return super.addChild(children, membership.getCollaboration());
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui;
+
+import org.eclipse.net4j.buddies.common.ICollaboration;
+import org.eclipse.net4j.buddies.common.IMembership;
+import org.eclipse.net4j.internal.buddies.Self;
+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.ui.views.IElementFilter;
+
+import org.eclipse.swt.graphics.Image;
+
+import java.util.Collection;
+
+/**
+ * @author Eike Stepper
+ */
+public class CollaborationsItemProvider extends AbstractItemProvider
+{
+ public CollaborationsItemProvider()
+ {
+ }
+
+ public CollaborationsItemProvider(IElementFilter rootElementFilter)
+ {
+ super(rootElementFilter);
+ }
+
+ @Override
+ protected Node createNode(Node parent, Object element)
+ {
+ if (element instanceof Self)
+ {
+ return new SelfNode((Self)element);
+ }
+
+ if (element instanceof IMembership)
+ {
+ IMembership membership = (IMembership)element;
+ if (membership.getBuddy() instanceof Self)
+ {
+ return null;
+ }
+ }
+
+ return super.createNode(parent, element);
+ }
+
+ @Override
+ protected Node createMembershipNode(Node parent, IMembership membership)
+ {
+ return createLeafNode(parent, membership);
+ }
+
+ @Override
+ protected String getText(IMembership membership)
+ {
+ return getText(membership.getBuddy());
+ }
+
+ @Override
+ protected Image getImage(IMembership membership)
+ {
+ return getImage(membership.getBuddy());
+ }
+
+ /**
+ * @since 4.0
+ */
+ @Override
+ public void refreshElement(Object element, boolean updateLabels)
+ {
+ super.refreshElement(null, updateLabels);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private class SelfNode extends AbstractContainerNode implements IListener
+ {
+ private Self self;
+
+ public SelfNode(Self self)
+ {
+ super(null);
+ this.self = self;
+ }
+
+ @Override
+ public void dispose()
+ {
+ if (!isDisposed())
+ {
+ self.removeListener(containerListener);
+ super.dispose();
+ }
+ }
+
+ public Self getElement()
+ {
+ return self;
+ }
+
+ public void notifyEvent(IEvent event)
+ {
+ IMembership membership = (IMembership)event.getSource();
+ if (event instanceof ILifecycleEvent)
+ {
+ ILifecycleEvent e = (ILifecycleEvent)event;
+ if (e.getKind() == ILifecycleEvent.Kind.DEACTIVATED)
+ {
+ membership.removeListener(this);
+ ICollaboration collaboration = membership.getCollaboration();
+ Node node = getNode(collaboration);
+ if (node != null)
+ {
+ node.dispose();
+ }
+ }
+ }
+ }
+
+ @Override
+ protected Node addChild(Collection<Node> children, Object element)
+ {
+ IMembership membership = (IMembership)element;
+ membership.addListener(this);
+ return super.addChild(children, membership.getCollaboration());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/MembershipItemProvider.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/MembershipItemProvider.java
index 8d2e434109..f472653fff 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/MembershipItemProvider.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/MembershipItemProvider.java
@@ -1,49 +1,49 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui;
-
-import org.eclipse.net4j.buddies.common.IMembership;
-import org.eclipse.net4j.util.ui.views.IElementFilter;
-
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Eike Stepper
- */
-public class MembershipItemProvider extends AbstractItemProvider
-{
- public MembershipItemProvider()
- {
- }
-
- public MembershipItemProvider(IElementFilter rootElementFilter)
- {
- super(rootElementFilter);
- }
-
- @Override
- protected Node createMembershipNode(Node parent, IMembership membership)
- {
- return createContaineNode(parent, membership);
- }
-
- @Override
- protected String getText(IMembership membership)
- {
- return getText(membership.getBuddy()) + "(" + getText(membership.getCollaboration()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Override
- protected Image getImage(IMembership membership)
- {
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui;
+
+import org.eclipse.net4j.buddies.common.IMembership;
+import org.eclipse.net4j.util.ui.views.IElementFilter;
+
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Eike Stepper
+ */
+public class MembershipItemProvider extends AbstractItemProvider
+{
+ public MembershipItemProvider()
+ {
+ }
+
+ public MembershipItemProvider(IElementFilter rootElementFilter)
+ {
+ super(rootElementFilter);
+ }
+
+ @Override
+ protected Node createMembershipNode(Node parent, IMembership membership)
+ {
+ return createContaineNode(parent, membership);
+ }
+
+ @Override
+ protected String getText(IMembership membership)
+ {
+ return getText(membership.getBuddy()) + "(" + getText(membership.getCollaboration()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Override
+ protected Image getImage(IMembership membership)
+ {
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/ConnectAction.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/ConnectAction.java
index eec38de927..fdd917d9f6 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/ConnectAction.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/ConnectAction.java
@@ -1,32 +1,32 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.actions;
-
-import org.eclipse.net4j.buddies.ISessionManager;
-import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
-import org.eclipse.net4j.util.ui.actions.SafeAction;
-
-/**
- * @author Eike Stepper
- */
-public final class ConnectAction extends SafeAction
-{
- public ConnectAction()
- {
- super(Messages.getString("ConnectAction_0"), Messages.getString("ConnectAction_1")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Override
- protected void safeRun() throws Exception
- {
- ISessionManager.INSTANCE.connect();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.actions;
+
+import org.eclipse.net4j.buddies.ISessionManager;
+import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
+import org.eclipse.net4j.util.ui.actions.SafeAction;
+
+/**
+ * @author Eike Stepper
+ */
+public final class ConnectAction extends SafeAction
+{
+ public ConnectAction()
+ {
+ super(Messages.getString("ConnectAction_0"), Messages.getString("ConnectAction_1")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Override
+ protected void safeRun() throws Exception
+ {
+ ISessionManager.INSTANCE.connect();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/DisconnectAction.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/DisconnectAction.java
index 90a3534123..e23b486a7d 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/DisconnectAction.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/DisconnectAction.java
@@ -1,32 +1,32 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.actions;
-
-import org.eclipse.net4j.buddies.ISessionManager;
-import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
-import org.eclipse.net4j.util.ui.actions.SafeAction;
-
-/**
- * @author Eike Stepper
- */
-public final class DisconnectAction extends SafeAction
-{
- public DisconnectAction()
- {
- super(Messages.getString("DisconnectAction_0"), Messages.getString("DisconnectAction_1")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Override
- protected void safeRun() throws Exception
- {
- ISessionManager.INSTANCE.disconnect();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.actions;
+
+import org.eclipse.net4j.buddies.ISessionManager;
+import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
+import org.eclipse.net4j.util.ui.actions.SafeAction;
+
+/**
+ * @author Eike Stepper
+ */
+public final class DisconnectAction extends SafeAction
+{
+ public DisconnectAction()
+ {
+ super(Messages.getString("DisconnectAction_0"), Messages.getString("DisconnectAction_1")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Override
+ protected void safeRun() throws Exception
+ {
+ ISessionManager.INSTANCE.disconnect();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/FlashAction.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/FlashAction.java
index 856614978e..41bed59617 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/FlashAction.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/FlashAction.java
@@ -1,32 +1,32 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.actions;
-
-import org.eclipse.net4j.buddies.ISessionManager;
-import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
-import org.eclipse.net4j.util.ui.actions.SafeAction;
-
-/**
- * @author Eike Stepper
- */
-public final class FlashAction extends SafeAction
-{
- public FlashAction()
- {
- super(Messages.getString("FlashAction_0"), Messages.getString("FlashAction_1")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Override
- protected void safeRun() throws Exception
- {
- ISessionManager.INSTANCE.flashMe();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.actions;
+
+import org.eclipse.net4j.buddies.ISessionManager;
+import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
+import org.eclipse.net4j.util.ui.actions.SafeAction;
+
+/**
+ * @author Eike Stepper
+ */
+public final class FlashAction extends SafeAction
+{
+ public FlashAction()
+ {
+ super(Messages.getString("FlashAction_0"), Messages.getString("FlashAction_1")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Override
+ protected void safeRun() throws Exception
+ {
+ ISessionManager.INSTANCE.flashMe();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/ReconnectAction.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/ReconnectAction.java
index c3a43124f1..25aafd30fd 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/ReconnectAction.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/actions/ReconnectAction.java
@@ -1,33 +1,33 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.actions;
-
-import org.eclipse.net4j.buddies.ISessionManager;
-import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
-import org.eclipse.net4j.util.ui.actions.SafeAction;
-
-/**
- * @author Eike Stepper
- */
-public final class ReconnectAction extends SafeAction
-{
- public ReconnectAction()
- {
- super(Messages.getString("ReconnectAction_0"), Messages.getString("ReconnectAction_1")); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- @Override
- protected void safeRun() throws Exception
- {
- ISessionManager.INSTANCE.disconnect();
- ISessionManager.INSTANCE.connect();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.actions;
+
+import org.eclipse.net4j.buddies.ISessionManager;
+import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
+import org.eclipse.net4j.util.ui.actions.SafeAction;
+
+/**
+ * @author Eike Stepper
+ */
+public final class ReconnectAction extends SafeAction
+{
+ public ReconnectAction()
+ {
+ super(Messages.getString("ReconnectAction_0"), Messages.getString("ReconnectAction_1")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ @Override
+ protected void safeRun() throws Exception
+ {
+ ISessionManager.INSTANCE.disconnect();
+ ISessionManager.INSTANCE.connect();
+ }
+}
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 1e2c374309..d0d98384ac 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
@@ -1,190 +1,190 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.actions;
-
-import org.eclipse.net4j.buddies.IBuddySession;
-import org.eclipse.net4j.buddies.ISessionManager;
-import org.eclipse.net4j.buddies.common.IBuddy.State;
-import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
-import org.eclipse.net4j.internal.buddies.Self;
-import org.eclipse.net4j.ui.shared.SharedIcons;
-import org.eclipse.net4j.util.ui.actions.SafeAction;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class StateAction extends SafeAction
-{
- private State state;
-
- public StateAction(String text, State state, String key)
- {
- super(text, Action.AS_RADIO_BUTTON);
- setToolTipText(MessageFormat.format(Messages.getString("StateAction_0"), text.toLowerCase())); //$NON-NLS-1$
- setImageDescriptor(SharedIcons.getDescriptor(key));
- this.state = state;
- }
-
- public void updateState()
- {
- IBuddySession session = ISessionManager.INSTANCE.getSession();
- setEnabled(session != null);
- setChecked(session != null && session.getSelf().getState() == state);
- }
-
- @Override
- protected void safeRun() throws Exception
- {
- IBuddySession session = ISessionManager.INSTANCE.getSession();
- if (session != null && isChecked())
- {
- Self self = (Self)session.getSelf();
- self.setState(state);
- }
- }
-
- public static class DropDownAction extends Action implements IMenuCreator
- {
- private Menu fMenu;
-
- private StateAction availableAction = new AvailableAction();
-
- private StateAction lonesomeAction = new LonesomeAction();
-
- private StateAction awayAction = new AwayAction();
-
- private StateAction doNotDisturbAction = new DoNotDisturbAction();
-
- public DropDownAction()
- {
- setText(Messages.getString("StateAction_2")); //$NON-NLS-1$
- setMenuCreator(this);
- }
-
- public void dispose()
- {
- if (fMenu != null)
- {
- fMenu.dispose();
- fMenu = null;
- }
- }
-
- public void updateState()
- {
- availableAction.updateState();
- lonesomeAction.updateState();
- awayAction.updateState();
- doNotDisturbAction.updateState();
-
- IBuddySession session = ISessionManager.INSTANCE.getSession();
- if (session != null)
- {
- setEnabled(true);
- State state = session.getSelf().getState();
- switch (state)
- {
- case AVAILABLE:
- setImageDescriptor(availableAction.getImageDescriptor());
- break;
-
- case LONESOME:
- setImageDescriptor(lonesomeAction.getImageDescriptor());
- break;
-
- case AWAY:
- setImageDescriptor(awayAction.getImageDescriptor());
- break;
-
- case DO_NOT_DISTURB:
- setImageDescriptor(doNotDisturbAction.getImageDescriptor());
- break;
- }
- }
- else
- {
- setImageDescriptor(awayAction.getImageDescriptor());
- setEnabled(false);
- }
- }
-
- public Menu getMenu(Control parent)
- {
- if (fMenu != null)
- {
- fMenu.dispose();
- }
-
- fMenu = new Menu(parent);
- addActionToMenu(fMenu, availableAction);
- addActionToMenu(fMenu, lonesomeAction);
- addActionToMenu(fMenu, awayAction);
- addActionToMenu(fMenu, doNotDisturbAction);
- return fMenu;
- }
-
- public Menu getMenu(Menu parent)
- {
- return null;
- }
-
- @Override
- public void run()
- {
- }
-
- protected void addActionToMenu(Menu parent, Action action)
- {
- ActionContributionItem item = new ActionContributionItem(action);
- item.fill(parent, -1);
- }
- }
-
- public static final class AvailableAction extends StateAction
- {
- public AvailableAction()
- {
- super(Messages.getString("StateAction_3"), State.AVAILABLE, SharedIcons.OBJ_BUDDY); //$NON-NLS-1$
- }
- }
-
- public static final class LonesomeAction extends StateAction
- {
- public LonesomeAction()
- {
- super(Messages.getString("StateAction_4"), State.LONESOME, SharedIcons.OBJ_BUDDY_LONESOME); //$NON-NLS-1$
- }
- }
-
- public static final class AwayAction extends StateAction
- {
- public AwayAction()
- {
- super(Messages.getString("StateAction_5"), State.AWAY, SharedIcons.OBJ_BUDDY_AWAY); //$NON-NLS-1$
- }
- }
-
- public static final class DoNotDisturbAction extends StateAction
- {
- public DoNotDisturbAction()
- {
- super(Messages.getString("StateAction_6"), State.DO_NOT_DISTURB, SharedIcons.OBJ_BUDDY_DO_NOT_DISTURB); //$NON-NLS-1$
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.actions;
+
+import org.eclipse.net4j.buddies.IBuddySession;
+import org.eclipse.net4j.buddies.ISessionManager;
+import org.eclipse.net4j.buddies.common.IBuddy.State;
+import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
+import org.eclipse.net4j.internal.buddies.Self;
+import org.eclipse.net4j.ui.shared.SharedIcons;
+import org.eclipse.net4j.util.ui.actions.SafeAction;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class StateAction extends SafeAction
+{
+ private State state;
+
+ public StateAction(String text, State state, String key)
+ {
+ super(text, Action.AS_RADIO_BUTTON);
+ setToolTipText(MessageFormat.format(Messages.getString("StateAction_0"), text.toLowerCase())); //$NON-NLS-1$
+ setImageDescriptor(SharedIcons.getDescriptor(key));
+ this.state = state;
+ }
+
+ public void updateState()
+ {
+ IBuddySession session = ISessionManager.INSTANCE.getSession();
+ setEnabled(session != null);
+ setChecked(session != null && session.getSelf().getState() == state);
+ }
+
+ @Override
+ protected void safeRun() throws Exception
+ {
+ IBuddySession session = ISessionManager.INSTANCE.getSession();
+ if (session != null && isChecked())
+ {
+ Self self = (Self)session.getSelf();
+ self.setState(state);
+ }
+ }
+
+ public static class DropDownAction extends Action implements IMenuCreator
+ {
+ private Menu fMenu;
+
+ private StateAction availableAction = new AvailableAction();
+
+ private StateAction lonesomeAction = new LonesomeAction();
+
+ private StateAction awayAction = new AwayAction();
+
+ private StateAction doNotDisturbAction = new DoNotDisturbAction();
+
+ public DropDownAction()
+ {
+ setText(Messages.getString("StateAction_2")); //$NON-NLS-1$
+ setMenuCreator(this);
+ }
+
+ public void dispose()
+ {
+ if (fMenu != null)
+ {
+ fMenu.dispose();
+ fMenu = null;
+ }
+ }
+
+ public void updateState()
+ {
+ availableAction.updateState();
+ lonesomeAction.updateState();
+ awayAction.updateState();
+ doNotDisturbAction.updateState();
+
+ IBuddySession session = ISessionManager.INSTANCE.getSession();
+ if (session != null)
+ {
+ setEnabled(true);
+ State state = session.getSelf().getState();
+ switch (state)
+ {
+ case AVAILABLE:
+ setImageDescriptor(availableAction.getImageDescriptor());
+ break;
+
+ case LONESOME:
+ setImageDescriptor(lonesomeAction.getImageDescriptor());
+ break;
+
+ case AWAY:
+ setImageDescriptor(awayAction.getImageDescriptor());
+ break;
+
+ case DO_NOT_DISTURB:
+ setImageDescriptor(doNotDisturbAction.getImageDescriptor());
+ break;
+ }
+ }
+ else
+ {
+ setImageDescriptor(awayAction.getImageDescriptor());
+ setEnabled(false);
+ }
+ }
+
+ public Menu getMenu(Control parent)
+ {
+ if (fMenu != null)
+ {
+ fMenu.dispose();
+ }
+
+ fMenu = new Menu(parent);
+ addActionToMenu(fMenu, availableAction);
+ addActionToMenu(fMenu, lonesomeAction);
+ addActionToMenu(fMenu, awayAction);
+ addActionToMenu(fMenu, doNotDisturbAction);
+ return fMenu;
+ }
+
+ public Menu getMenu(Menu parent)
+ {
+ return null;
+ }
+
+ @Override
+ public void run()
+ {
+ }
+
+ protected void addActionToMenu(Menu parent, Action action)
+ {
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+ }
+
+ public static final class AvailableAction extends StateAction
+ {
+ public AvailableAction()
+ {
+ super(Messages.getString("StateAction_3"), State.AVAILABLE, SharedIcons.OBJ_BUDDY); //$NON-NLS-1$
+ }
+ }
+
+ public static final class LonesomeAction extends StateAction
+ {
+ public LonesomeAction()
+ {
+ super(Messages.getString("StateAction_4"), State.LONESOME, SharedIcons.OBJ_BUDDY_LONESOME); //$NON-NLS-1$
+ }
+ }
+
+ public static final class AwayAction extends StateAction
+ {
+ public AwayAction()
+ {
+ super(Messages.getString("StateAction_5"), State.AWAY, SharedIcons.OBJ_BUDDY_AWAY); //$NON-NLS-1$
+ }
+ }
+
+ public static final class DoNotDisturbAction extends StateAction
+ {
+ public DoNotDisturbAction()
+ {
+ super(Messages.getString("StateAction_6"), State.DO_NOT_DISTURB, SharedIcons.OBJ_BUDDY_DO_NOT_DISTURB); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/bundle/OM.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/bundle/OM.java
index e31b237815..14cabc5e87 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/bundle/OM.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/bundle/OM.java
@@ -1,59 +1,59 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.bundle;
-
-import org.eclipse.net4j.internal.buddies.SessionManager;
-import org.eclipse.net4j.util.om.OMBundle;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.net4j.util.om.trace.OMTracer;
-import org.eclipse.net4j.util.ui.UIActivator;
-
-/**
- * The <em>Operations & Maintenance</em> class of this bundle.
- *
- * @author Eike Stepper
- */
-public abstract class OM
-{
- public static final String BUNDLE_ID = "org.eclipse.net4j.buddies.ui"; //$NON-NLS-1$
-
- public static final String EXT_POINT = "facilityPaneCreators"; //$NON-NLS-1$
-
- public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
-
- public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
-
- public static final OMLogger LOG = BUNDLE.logger();
-
- /**
- * @author Eike Stepper
- */
- public static final class Activator extends UIActivator
- {
- public Activator()
- {
- super(BUNDLE);
- }
-
- @Override
- protected void doStart() throws Exception
- {
- SessionManager.INSTANCE.activate();
- }
-
- @Override
- protected void doStop() throws Exception
- {
- SessionManager.INSTANCE.deactivate();
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.bundle;
+
+import org.eclipse.net4j.internal.buddies.SessionManager;
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.log.OMLogger;
+import org.eclipse.net4j.util.om.trace.OMTracer;
+import org.eclipse.net4j.util.ui.UIActivator;
+
+/**
+ * The <em>Operations & Maintenance</em> class of this bundle.
+ *
+ * @author Eike Stepper
+ */
+public abstract class OM
+{
+ public static final String BUNDLE_ID = "org.eclipse.net4j.buddies.ui"; //$NON-NLS-1$
+
+ public static final String EXT_POINT = "facilityPaneCreators"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Activator extends UIActivator
+ {
+ public Activator()
+ {
+ super(BUNDLE);
+ }
+
+ @Override
+ protected void doStart() throws Exception
+ {
+ SessionManager.INSTANCE.activate();
+ }
+
+ @Override
+ protected void doStop() throws Exception
+ {
+ SessionManager.INSTANCE.deactivate();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/dnd/BuddiesTransfer.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/dnd/BuddiesTransfer.java
index ad4eecc499..e7d4a84e0a 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/dnd/BuddiesTransfer.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/dnd/BuddiesTransfer.java
@@ -1,79 +1,79 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.dnd;
-
-import org.eclipse.net4j.buddies.IBuddySession;
-import org.eclipse.net4j.buddies.common.IBuddy;
-import org.eclipse.net4j.buddies.internal.ui.bundle.OM;
-import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
-import org.eclipse.net4j.internal.buddies.SessionManager;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-import org.eclipse.net4j.util.ui.dnd.DNDTransfer;
-
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class BuddiesTransfer extends DNDTransfer<IBuddy[]>
-{
- public static final String TYPE_NAME = "buddies-transfer-format"; //$NON-NLS-1$
-
- public static final BuddiesTransfer INSTANCE = new BuddiesTransfer();
-
- public BuddiesTransfer()
- {
- super(TYPE_NAME);
- }
-
- @Override
- protected void writeObject(ExtendedDataOutputStream out, IBuddy[] buddies) throws IOException
- {
- out.writeInt(buddies.length);
- for (IBuddy buddy : buddies)
- {
- out.writeString(buddy.getUserID());
- }
- }
-
- @Override
- protected IBuddy[] readObject(ExtendedDataInputStream in) throws IOException
- {
- IBuddySession session = SessionManager.INSTANCE.getSession();
- if (session == null)
- {
- OM.LOG.warn(Messages.getString("BuddiesTransfer_1")); //$NON-NLS-1$
- return null;
- }
-
- List<IBuddy> buddies = new ArrayList<IBuddy>();
- int size = in.readInt();
- for (int i = 0; i < size; i++)
- {
- String userID = in.readString();
- IBuddy buddy = session.getBuddy(userID);
- if (buddy != null)
- {
- buddies.add(buddy);
- }
- else
- {
- OM.LOG.warn(MessageFormat.format(Messages.getString("BuddiesTransfer_2"), userID)); //$NON-NLS-1$
- }
- }
-
- return buddies.toArray(new IBuddy[buddies.size()]);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.dnd;
+
+import org.eclipse.net4j.buddies.IBuddySession;
+import org.eclipse.net4j.buddies.common.IBuddy;
+import org.eclipse.net4j.buddies.internal.ui.bundle.OM;
+import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
+import org.eclipse.net4j.internal.buddies.SessionManager;
+import org.eclipse.net4j.util.io.ExtendedDataInputStream;
+import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
+import org.eclipse.net4j.util.ui.dnd.DNDTransfer;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class BuddiesTransfer extends DNDTransfer<IBuddy[]>
+{
+ public static final String TYPE_NAME = "buddies-transfer-format"; //$NON-NLS-1$
+
+ public static final BuddiesTransfer INSTANCE = new BuddiesTransfer();
+
+ public BuddiesTransfer()
+ {
+ super(TYPE_NAME);
+ }
+
+ @Override
+ protected void writeObject(ExtendedDataOutputStream out, IBuddy[] buddies) throws IOException
+ {
+ out.writeInt(buddies.length);
+ for (IBuddy buddy : buddies)
+ {
+ out.writeString(buddy.getUserID());
+ }
+ }
+
+ @Override
+ protected IBuddy[] readObject(ExtendedDataInputStream in) throws IOException
+ {
+ IBuddySession session = SessionManager.INSTANCE.getSession();
+ if (session == null)
+ {
+ OM.LOG.warn(Messages.getString("BuddiesTransfer_1")); //$NON-NLS-1$
+ return null;
+ }
+
+ List<IBuddy> buddies = new ArrayList<IBuddy>();
+ int size = in.readInt();
+ for (int i = 0; i < size; i++)
+ {
+ String userID = in.readString();
+ IBuddy buddy = session.getBuddy(userID);
+ if (buddy != null)
+ {
+ buddies.add(buddy);
+ }
+ else
+ {
+ OM.LOG.warn(MessageFormat.format(Messages.getString("BuddiesTransfer_2"), userID)); //$NON-NLS-1$
+ }
+ }
+
+ return buddies.toArray(new IBuddy[buddies.size()]);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/messages/Messages.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/messages/Messages.java
index 80188c78be..6d44ae2178 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/messages/Messages.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/messages/Messages.java
@@ -1,41 +1,41 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Victor Roldan Betancort - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.net4j.buddies.internal.ui.messages;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class Messages
-{
- private static final String BUNDLE_NAME = "org.eclipse.net4j.buddies.internal.ui.messages.messages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
- private Messages()
- {
- }
-
- public static String getString(String key)
- {
- try
- {
- return RESOURCE_BUNDLE.getString(key);
- }
- catch (MissingResourceException e)
- {
- return '!' + key + '!';
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.net4j.buddies.internal.ui.messages;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.eclipse.net4j.buddies.internal.ui.messages.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private Messages()
+ {
+ }
+
+ public static String getString(String key)
+ {
+ try
+ {
+ return RESOURCE_BUNDLE.getString(key);
+ }
+ catch (MissingResourceException e)
+ {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/messages/messages.properties b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/messages/messages.properties
index f892419e7d..187586764f 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/messages/messages.properties
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/messages/messages.properties
@@ -1,37 +1,37 @@
-# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Victor Roldan Betancort - initial API and implementation
-# Eike Stepper - maintenance
-
-AbstractItemProvider.0=Leave
-AbstractItemProvider.1=Leave this collaboration
-AbstractItemProvider.2=Remove
-AbstractItemProvider.3=Remove
-BuddiesPreferencePage_0=Server:
-BuddiesPreferencePage_1=User ID:
-BuddiesPreferencePage_2=Password:
-BuddiesPreferencePage_3=Auto Connect
-BuddiesTransfer_1=Buddy session is not available
-BuddiesTransfer_2=Buddy is not available: {0}
-CollaborationsPane_0=Activate {0} facility
-CollaborationsView_2=Start {0}
-CollaborationsView_3=Start a {0} facility
-ConnectAction_0=Connect
-ConnectAction_1=Connect to buddies server
-DisconnectAction_0=Disonnect
-DisconnectAction_1=Disconnect from buddies server
-FlashAction_0=Flash Me
-FlashAction_1=Flash Me
-ReconnectAction_0=Reconnect
-ReconnectAction_1=Reconnect to buddies server
-StateAction_0=Set own state to \"{0}\"
-StateAction_2=Set My State
-StateAction_3=Available
-StateAction_4=Lonesome
-StateAction_5=Away
-StateAction_6=Do Not Disturb
+# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Victor Roldan Betancort - initial API and implementation
+# Eike Stepper - maintenance
+
+AbstractItemProvider.0=Leave
+AbstractItemProvider.1=Leave this collaboration
+AbstractItemProvider.2=Remove
+AbstractItemProvider.3=Remove
+BuddiesPreferencePage_0=Server:
+BuddiesPreferencePage_1=User ID:
+BuddiesPreferencePage_2=Password:
+BuddiesPreferencePage_3=Auto Connect
+BuddiesTransfer_1=Buddy session is not available
+BuddiesTransfer_2=Buddy is not available: {0}
+CollaborationsPane_0=Activate {0} facility
+CollaborationsView_2=Start {0}
+CollaborationsView_3=Start a {0} facility
+ConnectAction_0=Connect
+ConnectAction_1=Connect to buddies server
+DisconnectAction_0=Disonnect
+DisconnectAction_1=Disconnect from buddies server
+FlashAction_0=Flash Me
+FlashAction_1=Flash Me
+ReconnectAction_0=Reconnect
+ReconnectAction_1=Reconnect to buddies server
+StateAction_0=Set own state to \"{0}\"
+StateAction_2=Set My State
+StateAction_3=Available
+StateAction_4=Lonesome
+StateAction_5=Away
+StateAction_6=Do Not Disturb
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/preferences/BuddiesPreferencePage.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/preferences/BuddiesPreferencePage.java
index 9b37f23910..7ebe04e821 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/preferences/BuddiesPreferencePage.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/preferences/BuddiesPreferencePage.java
@@ -1,87 +1,87 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.preferences;
-
-import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
-import org.eclipse.net4j.internal.buddies.bundle.OM;
-import org.eclipse.net4j.util.ui.UIUtil;
-import org.eclipse.net4j.util.ui.prefs.OMPreferencePage;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Eike Stepper
- */
-public class BuddiesPreferencePage extends OMPreferencePage
-{
- private Text connectorDescription;
-
- private Text userID;
-
- private Text password;
-
- private Button autoConnect;
-
- public BuddiesPreferencePage()
- {
- super(OM.PREFS);
- }
-
- @Override
- protected Control createUI(Composite parent)
- {
- Composite composite = UIUtil.createGridComposite(parent, 2);
- composite.setLayoutData(UIUtil.createGridData());
-
- new Label(composite, SWT.NONE).setText(Messages.getString("BuddiesPreferencePage_0")); //$NON-NLS-1$
- connectorDescription = new Text(composite, SWT.BORDER);
- connectorDescription.setLayoutData(UIUtil.createGridData(true, false));
-
- new Label(composite, SWT.NONE).setText(Messages.getString("BuddiesPreferencePage_1")); //$NON-NLS-1$
- userID = new Text(composite, SWT.BORDER);
- userID.setLayoutData(new GridData(100, SWT.DEFAULT));
-
- new Label(composite, SWT.NONE).setText(Messages.getString("BuddiesPreferencePage_2")); //$NON-NLS-1$
- password = new Text(composite, SWT.BORDER | SWT.PASSWORD);
- password.setLayoutData(new GridData(100, SWT.DEFAULT));
-
- new Label(composite, SWT.NONE);
- autoConnect = new Button(composite, SWT.CHECK);
- autoConnect.setText(Messages.getString("BuddiesPreferencePage_3")); //$NON-NLS-1$
-
- initValues();
- return composite;
- }
-
- protected void initValues()
- {
- connectorDescription.setText(OM.PREF_CONNECTOR_DESCRIPTION.getValue());
- userID.setText(OM.PREF_USER_ID.getValue());
- password.setText(OM.PREF_PASSWORD.getValue());
- autoConnect.setSelection(OM.PREF_AUTO_CONNECT.getValue());
- }
-
- @Override
- public boolean performOk()
- {
- OM.PREF_CONNECTOR_DESCRIPTION.setValue(connectorDescription.getText());
- OM.PREF_USER_ID.setValue(userID.getText());
- OM.PREF_PASSWORD.setValue(password.getText());
- OM.PREF_AUTO_CONNECT.setValue(autoConnect.getSelection());
- return super.performOk();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.preferences;
+
+import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
+import org.eclipse.net4j.internal.buddies.bundle.OM;
+import org.eclipse.net4j.util.ui.UIUtil;
+import org.eclipse.net4j.util.ui.prefs.OMPreferencePage;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Eike Stepper
+ */
+public class BuddiesPreferencePage extends OMPreferencePage
+{
+ private Text connectorDescription;
+
+ private Text userID;
+
+ private Text password;
+
+ private Button autoConnect;
+
+ public BuddiesPreferencePage()
+ {
+ super(OM.PREFS);
+ }
+
+ @Override
+ protected Control createUI(Composite parent)
+ {
+ Composite composite = UIUtil.createGridComposite(parent, 2);
+ composite.setLayoutData(UIUtil.createGridData());
+
+ new Label(composite, SWT.NONE).setText(Messages.getString("BuddiesPreferencePage_0")); //$NON-NLS-1$
+ connectorDescription = new Text(composite, SWT.BORDER);
+ connectorDescription.setLayoutData(UIUtil.createGridData(true, false));
+
+ new Label(composite, SWT.NONE).setText(Messages.getString("BuddiesPreferencePage_1")); //$NON-NLS-1$
+ userID = new Text(composite, SWT.BORDER);
+ userID.setLayoutData(new GridData(100, SWT.DEFAULT));
+
+ new Label(composite, SWT.NONE).setText(Messages.getString("BuddiesPreferencePage_2")); //$NON-NLS-1$
+ password = new Text(composite, SWT.BORDER | SWT.PASSWORD);
+ password.setLayoutData(new GridData(100, SWT.DEFAULT));
+
+ new Label(composite, SWT.NONE);
+ autoConnect = new Button(composite, SWT.CHECK);
+ autoConnect.setText(Messages.getString("BuddiesPreferencePage_3")); //$NON-NLS-1$
+
+ initValues();
+ return composite;
+ }
+
+ protected void initValues()
+ {
+ connectorDescription.setText(OM.PREF_CONNECTOR_DESCRIPTION.getValue());
+ userID.setText(OM.PREF_USER_ID.getValue());
+ password.setText(OM.PREF_PASSWORD.getValue());
+ autoConnect.setSelection(OM.PREF_AUTO_CONNECT.getValue());
+ }
+
+ @Override
+ public boolean performOk()
+ {
+ OM.PREF_CONNECTOR_DESCRIPTION.setValue(connectorDescription.getText());
+ OM.PREF_USER_ID.setValue(userID.getText());
+ OM.PREF_PASSWORD.setValue(password.getText());
+ OM.PREF_AUTO_CONNECT.setValue(autoConnect.getSelection());
+ return super.performOk();
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesDragListener.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesDragListener.java
index 0b8d31b5a6..ff47beca18 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesDragListener.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesDragListener.java
@@ -1,64 +1,64 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.views;
-
-import org.eclipse.net4j.buddies.common.IBuddy;
-import org.eclipse.net4j.buddies.internal.ui.dnd.BuddiesTransfer;
-import org.eclipse.net4j.util.ui.dnd.DNDDragListener;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.Transfer;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-/**
- * @author Eike Stepper
- */
-public class BuddiesDragListener extends DNDDragListener<IBuddy[]>
-{
- private static final Transfer[] TRANSFERS = new Transfer[] { BuddiesTransfer.INSTANCE };
-
- protected BuddiesDragListener(StructuredViewer viewer)
- {
- super(TRANSFERS, viewer);
- }
-
- @Override
- protected IBuddy[] getObject(IStructuredSelection selection)
- {
- Collection<IBuddy> buddies = new ArrayList<IBuddy>();
- for (Iterator<?> it = selection.iterator(); it.hasNext();)
- {
- Object element = it.next();
- if (element instanceof IBuddy)
- {
- IBuddy buddy = (IBuddy)element;
- buddies.add(buddy);
- }
- }
-
- if (buddies.isEmpty())
- {
- return null;
- }
-
- return buddies.toArray(new IBuddy[buddies.size()]);
- }
-
- public static void support(StructuredViewer viewer)
- {
- viewer.addDragSupport(DND.DROP_MOVE, TRANSFERS, new BuddiesDragListener(viewer));
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.views;
+
+import org.eclipse.net4j.buddies.common.IBuddy;
+import org.eclipse.net4j.buddies.internal.ui.dnd.BuddiesTransfer;
+import org.eclipse.net4j.util.ui.dnd.DNDDragListener;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * @author Eike Stepper
+ */
+public class BuddiesDragListener extends DNDDragListener<IBuddy[]>
+{
+ private static final Transfer[] TRANSFERS = new Transfer[] { BuddiesTransfer.INSTANCE };
+
+ protected BuddiesDragListener(StructuredViewer viewer)
+ {
+ super(TRANSFERS, viewer);
+ }
+
+ @Override
+ protected IBuddy[] getObject(IStructuredSelection selection)
+ {
+ Collection<IBuddy> buddies = new ArrayList<IBuddy>();
+ for (Iterator<?> it = selection.iterator(); it.hasNext();)
+ {
+ Object element = it.next();
+ if (element instanceof IBuddy)
+ {
+ IBuddy buddy = (IBuddy)element;
+ buddies.add(buddy);
+ }
+ }
+
+ if (buddies.isEmpty())
+ {
+ return null;
+ }
+
+ return buddies.toArray(new IBuddy[buddies.size()]);
+ }
+
+ public static void support(StructuredViewer viewer)
+ {
+ viewer.addDragSupport(DND.DROP_MOVE, TRANSFERS, new BuddiesDragListener(viewer));
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesDropAdapter.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesDropAdapter.java
index d4b3062e2a..d39615456b 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesDropAdapter.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/BuddiesDropAdapter.java
@@ -1,56 +1,56 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.views;
-
-import org.eclipse.net4j.buddies.IBuddyCollaboration;
-import org.eclipse.net4j.buddies.common.IBuddy;
-import org.eclipse.net4j.buddies.internal.ui.dnd.BuddiesTransfer;
-import org.eclipse.net4j.util.ui.dnd.DNDDropAdapter;
-
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.Transfer;
-
-/**
- * @author Eike Stepper
- */
-public class BuddiesDropAdapter extends DNDDropAdapter<IBuddy[]>
-{
- /**
- * @since 3.0
- */
- public static final Transfer[] TRANSFERS = new Transfer[] { BuddiesTransfer.INSTANCE };
-
- protected BuddiesDropAdapter(StructuredViewer viewer)
- {
- super(TRANSFERS, viewer);
- setExpandEnabled(false);
- }
-
- @Override
- protected boolean validateTarget(Object target, int operation)
- {
- return target instanceof IBuddyCollaboration;
- }
-
- @Override
- protected boolean performDrop(IBuddy[] buddies, Object target)
- {
- IBuddyCollaboration collaboration = (IBuddyCollaboration)target;
- collaboration.invite(buddies);
- return true;
- }
-
- public static void support(StructuredViewer viewer)
- {
- viewer.addDropSupport(DND.DROP_MOVE, TRANSFERS, new BuddiesDropAdapter(viewer));
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.views;
+
+import org.eclipse.net4j.buddies.IBuddyCollaboration;
+import org.eclipse.net4j.buddies.common.IBuddy;
+import org.eclipse.net4j.buddies.internal.ui.dnd.BuddiesTransfer;
+import org.eclipse.net4j.util.ui.dnd.DNDDropAdapter;
+
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+
+/**
+ * @author Eike Stepper
+ */
+public class BuddiesDropAdapter extends DNDDropAdapter<IBuddy[]>
+{
+ /**
+ * @since 3.0
+ */
+ public static final Transfer[] TRANSFERS = new Transfer[] { BuddiesTransfer.INSTANCE };
+
+ protected BuddiesDropAdapter(StructuredViewer viewer)
+ {
+ super(TRANSFERS, viewer);
+ setExpandEnabled(false);
+ }
+
+ @Override
+ protected boolean validateTarget(Object target, int operation)
+ {
+ return target instanceof IBuddyCollaboration;
+ }
+
+ @Override
+ protected boolean performDrop(IBuddy[] buddies, Object target)
+ {
+ IBuddyCollaboration collaboration = (IBuddyCollaboration)target;
+ collaboration.invite(buddies);
+ return true;
+ }
+
+ public static void support(StructuredViewer viewer)
+ {
+ viewer.addDropSupport(DND.DROP_MOVE, TRANSFERS, new BuddiesDropAdapter(viewer));
+ }
+}
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 68099e144e..53b9f04471 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
@@ -1,63 +1,63 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.views;
-
-import org.eclipse.net4j.buddies.IBuddyCollaboration;
-import org.eclipse.net4j.buddies.common.IBuddy;
-import org.eclipse.net4j.buddies.common.IMembership;
-import org.eclipse.net4j.buddies.internal.ui.ChatInstaller;
-import org.eclipse.net4j.util.container.ContainerUtil;
-import org.eclipse.net4j.util.container.IContainer;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-public class BuddiesView extends SessionManagerView
-{
- public BuddiesView()
- {
- }
-
- @Override
- protected IContainer<?> getContainer()
- {
- return getSession() != null ? getSession() : ContainerUtil.emptyContainer();
- }
-
- @Override
- protected Control createControl(Composite parent)
- {
- Control control = super.createControl(parent);
- BuddiesDragListener.support(getViewer());
- BuddiesDropAdapter.support(getViewer());
- return control;
- }
-
- @Override
- protected void doubleClicked(Object object)
- {
- if (getSession() != null && object instanceof IBuddy)
- {
- IBuddy buddy = (IBuddy)object;
- IBuddy self = getSession().getSelf();
- IMembership membership = self.initiate(buddy);
-
- try
- {
- // The chat dependency is optional
- ChatInstaller.installChat((IBuddyCollaboration)membership.getCollaboration());
- }
- catch (Throwable ignore)
- {
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.views;
+
+import org.eclipse.net4j.buddies.IBuddyCollaboration;
+import org.eclipse.net4j.buddies.common.IBuddy;
+import org.eclipse.net4j.buddies.common.IMembership;
+import org.eclipse.net4j.buddies.internal.ui.ChatInstaller;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IContainer;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class BuddiesView extends SessionManagerView
+{
+ public BuddiesView()
+ {
+ }
+
+ @Override
+ protected IContainer<?> getContainer()
+ {
+ return getSession() != null ? getSession() : ContainerUtil.emptyContainer();
+ }
+
+ @Override
+ protected Control createControl(Composite parent)
+ {
+ Control control = super.createControl(parent);
+ BuddiesDragListener.support(getViewer());
+ BuddiesDropAdapter.support(getViewer());
+ return control;
+ }
+
+ @Override
+ protected void doubleClicked(Object object)
+ {
+ if (getSession() != null && object instanceof IBuddy)
+ {
+ IBuddy buddy = (IBuddy)object;
+ IBuddy self = getSession().getSelf();
+ IMembership membership = self.initiate(buddy);
+
+ try
+ {
+ // The chat dependency is optional
+ ChatInstaller.installChat((IBuddyCollaboration)membership.getCollaboration());
+ }
+ catch (Throwable ignore)
+ {
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
index 3be3363beb..ce8761be95 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
@@ -1,334 +1,334 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.views;
-
-import org.eclipse.net4j.buddies.IBuddyCollaboration;
-import org.eclipse.net4j.buddies.IBuddySession;
-import org.eclipse.net4j.buddies.common.ICollaboration;
-import org.eclipse.net4j.buddies.common.IFacility;
-import org.eclipse.net4j.buddies.common.IFacilityInstalledEvent;
-import org.eclipse.net4j.buddies.common.IMembership;
-import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
-import org.eclipse.net4j.buddies.ui.IFacilityPaneCreator;
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.StringUtil;
-import org.eclipse.net4j.util.container.IContainerEvent;
-import org.eclipse.net4j.util.container.IContainerEventVisitor;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.ui.actions.SafeAction;
-
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IActionBars;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Eike Stepper
- */
-public class CollaborationsPane extends Composite implements IListener
-{
- private CollaborationsView collaborationsView;
-
- private IBuddySession session;
-
- private IBuddyCollaboration activeCollaboration;
-
- private Map<IBuddyCollaboration, IFacility> activeFacilities = new HashMap<IBuddyCollaboration, IFacility>();
-
- private Map<IFacility, FacilityPane> facilityPanes = new HashMap<IFacility, FacilityPane>();
-
- private List<ActivateFacilityAction> activateFacilityActions = new ArrayList<ActivateFacilityAction>();
-
- private StackLayout paneStack;
-
- public CollaborationsPane(Composite parent, CollaborationsView collaborationsView)
- {
- super(parent, SWT.NONE);
- setLayout(paneStack = new StackLayout());
- this.collaborationsView = collaborationsView;
- }
-
- public CollaborationsView getCollaborationsView()
- {
- return collaborationsView;
- }
-
- public IBuddySession getSession()
- {
- return session;
- }
-
- public void setSession(IBuddySession session)
- {
- this.session = session;
- if (session != null)
- {
- for (ICollaboration collaboration : session.getSelf().getCollaborations())
- {
- collaborationAdded((IBuddyCollaboration)collaboration);
- }
- }
-
- updateState();
- }
-
- public IBuddyCollaboration getActiveCollaboration()
- {
- return activeCollaboration;
- }
-
- public void setActiveCollaboration(IBuddyCollaboration collaboration)
- {
- if (activeCollaboration != collaboration)
- {
- activeCollaboration = collaboration;
- IFacility facility = activeFacilities.get(collaboration);
- setActiveFacility(collaboration, facility);
- updateState();
- collaborationsView.refreshViewer(true);
- }
- }
-
- public void setActiveFacility(IBuddyCollaboration collaboration, IFacility facility)
- {
- activeFacilities.put(collaboration, facility);
- if (collaboration == activeCollaboration)
- {
- FacilityPane facilityPane = facilityPanes.get(facility);
- setActiveFacilityPane(facilityPane);
- updateState();
- }
- }
-
- protected void setActiveFacilityPane(FacilityPane newPane)
- {
- if (paneStack.topControl != newPane)
- {
- FacilityPane oldPane = (FacilityPane)paneStack.topControl;
- if (oldPane != null)
- {
- oldPane.hidden(newPane);
- }
-
- paneStack.topControl = newPane;
- layout();
- if (newPane != null)
- {
- newPane.showed(oldPane);
- }
-
- updateState();
- }
- }
-
- public void fillActionBars(IActionBars bars)
- {
- IToolBarManager manager = bars.getToolBarManager();
- for (IFacilityPaneCreator c : collaborationsView.getFacilityPaneCreators().values())
- {
- ActivateFacilityAction action = new ActivateFacilityAction(c.getType(), c.getImageDescriptor());
- activateFacilityActions.add(action);
- manager.add(action);
- }
- }
-
- public void updateState()
- {
- for (ActivateFacilityAction action : activateFacilityActions)
- {
- if (activeCollaboration == null)
- {
- action.setEnabled(false);
- }
- else
- {
- String type = action.getType();
- action.setEnabled(activeCollaboration.getFacility(type) != null);
-
- IFacility activeFacility = activeFacilities.get(activeCollaboration);
- action.setChecked(activeFacility != null && ObjectUtil.equals(activeFacility.getType(), type));
- }
- }
- }
-
- public void notifyEvent(IEvent event)
- {
- if (session == null)
- {
- return;
- }
-
- if (event.getSource() == session.getSelf() && event instanceof IContainerEvent<?>)
- {
- @SuppressWarnings("unchecked")
- IContainerEvent<IMembership> e = (IContainerEvent<IMembership>)event;
- e.accept(new IContainerEventVisitor<IMembership>()
- {
- public void added(IMembership membership)
- {
- collaborationAdded((IBuddyCollaboration)membership.getCollaboration());
- }
-
- public void removed(IMembership membership)
- {
- collaborationRemoved((IBuddyCollaboration)membership.getCollaboration());
- }
- });
- }
- else if (event instanceof IFacilityInstalledEvent)
- {
- IFacilityInstalledEvent e = (IFacilityInstalledEvent)event;
- facilityInstalled(e.getFacility(), e.fromRemote());
- }
- }
-
- protected void collaborationAdded(IBuddyCollaboration collaboration)
- {
- IFacility[] facilities = collaboration.getFacilities();
- for (IFacility facility : facilities)
- {
- addFacilityPane(facility);
- }
-
- if (activeCollaboration == null)
- {
- setActiveCollaboration(collaboration);
- }
-
- if (facilities.length != 0)
- {
- setActiveFacility(collaboration, facilities[0]);
- }
-
- collaboration.addListener(this);
- }
-
- protected void collaborationRemoved(IBuddyCollaboration collaboration)
- {
- collaboration.removeListener(this);
- if (activeCollaboration == collaboration)
- {
- setActiveCollaboration(activeFacilities.isEmpty() ? null : activeFacilities.keySet().iterator().next());
- }
-
- activeFacilities.remove(collaboration);
- for (IFacility facility : collaboration.getFacilities())
- {
- FacilityPane pane = facilityPanes.remove(facility);
- if (pane != null)
- {
- pane.dispose();
- }
- }
- }
-
- protected void facilityInstalled(final IFacility facility, boolean fromRemote)
- {
- final IBuddyCollaboration collaboration = (IBuddyCollaboration)facility.getCollaboration();
- if (fromRemote)
- {
- Runnable runnable = new Runnable()
- {
- public void run()
- {
- try
- {
- addFacilityPane(facility);
- IFacility activeFacility = activeFacilities.get(collaboration);
- if (activeFacility == null)
- {
- setActiveFacility(collaboration, facility);
- }
- else
- {
- updateState();
- }
- }
- catch (RuntimeException ignore)
- {
- }
- }
- };
-
- try
- {
- Display display = getDisplay();
- if (display.getThread() == Thread.currentThread())
- {
- runnable.run();
- }
- else
- {
- display.asyncExec(runnable);
- }
- }
- catch (RuntimeException ignore)
- {
- }
- }
- else
- {
- addFacilityPane(facility);
- setActiveCollaboration(collaboration);
- setActiveFacility(collaboration, facility);
- }
- }
-
- protected FacilityPane addFacilityPane(IFacility facility)
- {
- IFacilityPaneCreator creator = collaborationsView.getFacilityPaneCreators().get(facility.getType());
- FacilityPane pane = creator.createPane(this, SWT.NONE);
- pane.setFacility(facility);
- facilityPanes.put(facility, pane);
- return pane;
- }
-
- /**
- * @author Eike Stepper
- */
- private final class ActivateFacilityAction extends SafeAction
- {
- private final String type;
-
- private ActivateFacilityAction(String type, ImageDescriptor descriptor)
- {
- super(StringUtil.cap(type), AS_RADIO_BUTTON);
- setToolTipText(MessageFormat.format(Messages.getString("CollaborationsPane_0"), type)); //$NON-NLS-1$
- setImageDescriptor(descriptor);
- this.type = type;
- }
-
- public String getType()
- {
- return type;
- }
-
- @Override
- protected void safeRun() throws Exception
- {
- if (activeCollaboration != null)
- {
- IFacility facility = activeCollaboration.getFacility(type);
- setActiveFacility(activeCollaboration, facility);
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.views;
+
+import org.eclipse.net4j.buddies.IBuddyCollaboration;
+import org.eclipse.net4j.buddies.IBuddySession;
+import org.eclipse.net4j.buddies.common.ICollaboration;
+import org.eclipse.net4j.buddies.common.IFacility;
+import org.eclipse.net4j.buddies.common.IFacilityInstalledEvent;
+import org.eclipse.net4j.buddies.common.IMembership;
+import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
+import org.eclipse.net4j.buddies.ui.IFacilityPaneCreator;
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.StringUtil;
+import org.eclipse.net4j.util.container.IContainerEvent;
+import org.eclipse.net4j.util.container.IContainerEventVisitor;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.ui.actions.SafeAction;
+
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IActionBars;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Eike Stepper
+ */
+public class CollaborationsPane extends Composite implements IListener
+{
+ private CollaborationsView collaborationsView;
+
+ private IBuddySession session;
+
+ private IBuddyCollaboration activeCollaboration;
+
+ private Map<IBuddyCollaboration, IFacility> activeFacilities = new HashMap<IBuddyCollaboration, IFacility>();
+
+ private Map<IFacility, FacilityPane> facilityPanes = new HashMap<IFacility, FacilityPane>();
+
+ private List<ActivateFacilityAction> activateFacilityActions = new ArrayList<ActivateFacilityAction>();
+
+ private StackLayout paneStack;
+
+ public CollaborationsPane(Composite parent, CollaborationsView collaborationsView)
+ {
+ super(parent, SWT.NONE);
+ setLayout(paneStack = new StackLayout());
+ this.collaborationsView = collaborationsView;
+ }
+
+ public CollaborationsView getCollaborationsView()
+ {
+ return collaborationsView;
+ }
+
+ public IBuddySession getSession()
+ {
+ return session;
+ }
+
+ public void setSession(IBuddySession session)
+ {
+ this.session = session;
+ if (session != null)
+ {
+ for (ICollaboration collaboration : session.getSelf().getCollaborations())
+ {
+ collaborationAdded((IBuddyCollaboration)collaboration);
+ }
+ }
+
+ updateState();
+ }
+
+ public IBuddyCollaboration getActiveCollaboration()
+ {
+ return activeCollaboration;
+ }
+
+ public void setActiveCollaboration(IBuddyCollaboration collaboration)
+ {
+ if (activeCollaboration != collaboration)
+ {
+ activeCollaboration = collaboration;
+ IFacility facility = activeFacilities.get(collaboration);
+ setActiveFacility(collaboration, facility);
+ updateState();
+ collaborationsView.refreshViewer(true);
+ }
+ }
+
+ public void setActiveFacility(IBuddyCollaboration collaboration, IFacility facility)
+ {
+ activeFacilities.put(collaboration, facility);
+ if (collaboration == activeCollaboration)
+ {
+ FacilityPane facilityPane = facilityPanes.get(facility);
+ setActiveFacilityPane(facilityPane);
+ updateState();
+ }
+ }
+
+ protected void setActiveFacilityPane(FacilityPane newPane)
+ {
+ if (paneStack.topControl != newPane)
+ {
+ FacilityPane oldPane = (FacilityPane)paneStack.topControl;
+ if (oldPane != null)
+ {
+ oldPane.hidden(newPane);
+ }
+
+ paneStack.topControl = newPane;
+ layout();
+ if (newPane != null)
+ {
+ newPane.showed(oldPane);
+ }
+
+ updateState();
+ }
+ }
+
+ public void fillActionBars(IActionBars bars)
+ {
+ IToolBarManager manager = bars.getToolBarManager();
+ for (IFacilityPaneCreator c : collaborationsView.getFacilityPaneCreators().values())
+ {
+ ActivateFacilityAction action = new ActivateFacilityAction(c.getType(), c.getImageDescriptor());
+ activateFacilityActions.add(action);
+ manager.add(action);
+ }
+ }
+
+ public void updateState()
+ {
+ for (ActivateFacilityAction action : activateFacilityActions)
+ {
+ if (activeCollaboration == null)
+ {
+ action.setEnabled(false);
+ }
+ else
+ {
+ String type = action.getType();
+ action.setEnabled(activeCollaboration.getFacility(type) != null);
+
+ IFacility activeFacility = activeFacilities.get(activeCollaboration);
+ action.setChecked(activeFacility != null && ObjectUtil.equals(activeFacility.getType(), type));
+ }
+ }
+ }
+
+ public void notifyEvent(IEvent event)
+ {
+ if (session == null)
+ {
+ return;
+ }
+
+ if (event.getSource() == session.getSelf() && event instanceof IContainerEvent<?>)
+ {
+ @SuppressWarnings("unchecked")
+ IContainerEvent<IMembership> e = (IContainerEvent<IMembership>)event;
+ e.accept(new IContainerEventVisitor<IMembership>()
+ {
+ public void added(IMembership membership)
+ {
+ collaborationAdded((IBuddyCollaboration)membership.getCollaboration());
+ }
+
+ public void removed(IMembership membership)
+ {
+ collaborationRemoved((IBuddyCollaboration)membership.getCollaboration());
+ }
+ });
+ }
+ else if (event instanceof IFacilityInstalledEvent)
+ {
+ IFacilityInstalledEvent e = (IFacilityInstalledEvent)event;
+ facilityInstalled(e.getFacility(), e.fromRemote());
+ }
+ }
+
+ protected void collaborationAdded(IBuddyCollaboration collaboration)
+ {
+ IFacility[] facilities = collaboration.getFacilities();
+ for (IFacility facility : facilities)
+ {
+ addFacilityPane(facility);
+ }
+
+ if (activeCollaboration == null)
+ {
+ setActiveCollaboration(collaboration);
+ }
+
+ if (facilities.length != 0)
+ {
+ setActiveFacility(collaboration, facilities[0]);
+ }
+
+ collaboration.addListener(this);
+ }
+
+ protected void collaborationRemoved(IBuddyCollaboration collaboration)
+ {
+ collaboration.removeListener(this);
+ if (activeCollaboration == collaboration)
+ {
+ setActiveCollaboration(activeFacilities.isEmpty() ? null : activeFacilities.keySet().iterator().next());
+ }
+
+ activeFacilities.remove(collaboration);
+ for (IFacility facility : collaboration.getFacilities())
+ {
+ FacilityPane pane = facilityPanes.remove(facility);
+ if (pane != null)
+ {
+ pane.dispose();
+ }
+ }
+ }
+
+ protected void facilityInstalled(final IFacility facility, boolean fromRemote)
+ {
+ final IBuddyCollaboration collaboration = (IBuddyCollaboration)facility.getCollaboration();
+ if (fromRemote)
+ {
+ Runnable runnable = new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ addFacilityPane(facility);
+ IFacility activeFacility = activeFacilities.get(collaboration);
+ if (activeFacility == null)
+ {
+ setActiveFacility(collaboration, facility);
+ }
+ else
+ {
+ updateState();
+ }
+ }
+ catch (RuntimeException ignore)
+ {
+ }
+ }
+ };
+
+ try
+ {
+ Display display = getDisplay();
+ if (display.getThread() == Thread.currentThread())
+ {
+ runnable.run();
+ }
+ else
+ {
+ display.asyncExec(runnable);
+ }
+ }
+ catch (RuntimeException ignore)
+ {
+ }
+ }
+ else
+ {
+ addFacilityPane(facility);
+ setActiveCollaboration(collaboration);
+ setActiveFacility(collaboration, facility);
+ }
+ }
+
+ protected FacilityPane addFacilityPane(IFacility facility)
+ {
+ IFacilityPaneCreator creator = collaborationsView.getFacilityPaneCreators().get(facility.getType());
+ FacilityPane pane = creator.createPane(this, SWT.NONE);
+ pane.setFacility(facility);
+ facilityPanes.put(facility, pane);
+ return pane;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class ActivateFacilityAction extends SafeAction
+ {
+ private final String type;
+
+ private ActivateFacilityAction(String type, ImageDescriptor descriptor)
+ {
+ super(StringUtil.cap(type), AS_RADIO_BUTTON);
+ setToolTipText(MessageFormat.format(Messages.getString("CollaborationsPane_0"), type)); //$NON-NLS-1$
+ setImageDescriptor(descriptor);
+ this.type = type;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ @Override
+ protected void safeRun() throws Exception
+ {
+ if (activeCollaboration != null)
+ {
+ IFacility facility = activeCollaboration.getFacility(type);
+ setActiveFacility(activeCollaboration, facility);
+ }
+ }
+ }
+}
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 30244a6900..5bfb94524d 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
@@ -1,221 +1,221 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.views;
-
-import org.eclipse.net4j.buddies.IBuddyCollaboration;
-import org.eclipse.net4j.buddies.internal.ui.CollaborationsItemProvider;
-import org.eclipse.net4j.buddies.internal.ui.bundle.OM;
-import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
-import org.eclipse.net4j.buddies.ui.IFacilityPaneCreator;
-import org.eclipse.net4j.util.StringUtil;
-import org.eclipse.net4j.util.container.ContainerUtil;
-import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.ui.actions.SafeAction;
-import org.eclipse.net4j.util.ui.actions.SashLayoutAction;
-import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
-import org.eclipse.net4j.util.ui.widgets.SashComposite;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.Map;
-
-public class CollaborationsView extends SessionManagerView
-{
- private SashComposite sashComposite;
-
- private Map<String, IFacilityPaneCreator> facilityPaneCreators = new HashMap<String, IFacilityPaneCreator>();
-
- public CollaborationsView()
- {
- initFacilityPaneCreators();
- }
-
- public CollaborationsPane getCollaborationsPane()
- {
- return (CollaborationsPane)sashComposite.getControl2();
- }
-
- public Map<String, IFacilityPaneCreator> getFacilityPaneCreators()
- {
- return facilityPaneCreators;
- }
-
- @Override
- protected Control createControl(Composite parent)
- {
- sashComposite = new SashComposite(parent, SWT.NONE, 10, 30)
- {
- @Override
- protected Control createControl1(Composite parent)
- {
- return CollaborationsView.super.createControl(parent);
- }
-
- @Override
- protected Control createControl2(Composite parent)
- {
- return new CollaborationsPane(parent, CollaborationsView.this);
- }
- };
-
- IActionBars bars = getViewSite().getActionBars();
- bars.getMenuManager().add(new Separator());
- bars.getToolBarManager().add(new Separator());
- getCollaborationsPane().fillActionBars(bars);
-
- BuddiesDropAdapter.support(getViewer());
- return sashComposite;
- }
-
- @Override
- protected void queryBuddiesManager()
- {
- super.queryBuddiesManager();
- getCollaborationsPane().setSession(getSession());
- }
-
- @Override
- public void notifyEvent(IEvent event)
- {
- super.notifyEvent(event);
- getCollaborationsPane().notifyEvent(event);
- }
-
- @Override
- protected void fillLocalPullDown(IMenuManager manager)
- {
- super.fillLocalPullDown(manager);
- manager.add(new Separator());
- manager.add(new SashLayoutAction.LayoutMenu(sashComposite));
- }
-
- @Override
- protected void fillContextMenu(IMenuManager manager, ITreeSelection selection)
- {
- super.fillContextMenu(manager, selection);
- if (selection.size() == 1)
- {
- final IBuddyCollaboration collaboration = (IBuddyCollaboration)selection.getFirstElement();
- if (collaboration != null)
- {
- manager.insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
- for (IFacilityPaneCreator c : facilityPaneCreators.values())
- {
- String type = c.getType();
- if (collaboration.getFacility(type) == null)
- {
- IAction action = new StartFacilityAction(collaboration, type, c.getImageDescriptor());
- manager.insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, action);
- }
- }
- }
- }
- }
-
- @Override
- protected void doubleClicked(Object object)
- {
- if (object instanceof IBuddyCollaboration)
- {
- IBuddyCollaboration collaboration = (IBuddyCollaboration)object;
- getCollaborationsPane().setActiveCollaboration(collaboration);
- }
- }
-
- @Override
- protected IContainer<?> getContainer()
- {
- return getSession() != null ? getSession().getSelf() : ContainerUtil.emptyContainer();
- }
-
- @Override
- protected ContainerItemProvider<IContainer<Object>> createContainerItemProvider()
- {
- return new CollaborationsItemProvider()
- {
- @Override
- public Font getFont(Object obj)
- {
- if (obj instanceof IBuddyCollaboration)
- {
- if (obj == getCollaborationsPane().getActiveCollaboration())
- {
- return getBold();
- }
- }
-
- return super.getFont(obj);
- }
- };
- }
-
- protected void initFacilityPaneCreators()
- {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IConfigurationElement[] elements = registry.getConfigurationElementsFor(OM.BUNDLE_ID, OM.EXT_POINT);
- for (final IConfigurationElement element : elements)
- {
- if ("facilityPaneCreator".equals(element.getName())) //$NON-NLS-1$
- {
- try
- {
- IFacilityPaneCreator creator = (IFacilityPaneCreator)element.createExecutableExtension("class"); //$NON-NLS-1$
- facilityPaneCreators.put(creator.getType(), creator);
- }
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- }
- }
- }
- }
-
- /**
- * @author Eike Stepper
- */
- private final class StartFacilityAction extends SafeAction
- {
- private final String type;
-
- private IBuddyCollaboration collaboration;
-
- private StartFacilityAction(IBuddyCollaboration collaboration, String type, ImageDescriptor descriptor)
- {
- super(MessageFormat.format(Messages.getString("CollaborationsView_2"), StringUtil.cap(type)), AS_RADIO_BUTTON); //$NON-NLS-1$
- setToolTipText(MessageFormat.format(Messages.getString("CollaborationsView_3"), type)); //$NON-NLS-1$
- setImageDescriptor(descriptor);
- this.collaboration = collaboration;
- this.type = type;
- }
-
- @Override
- protected void safeRun() throws Exception
- {
- collaboration.installFacility(type);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.views;
+
+import org.eclipse.net4j.buddies.IBuddyCollaboration;
+import org.eclipse.net4j.buddies.internal.ui.CollaborationsItemProvider;
+import org.eclipse.net4j.buddies.internal.ui.bundle.OM;
+import org.eclipse.net4j.buddies.internal.ui.messages.Messages;
+import org.eclipse.net4j.buddies.ui.IFacilityPaneCreator;
+import org.eclipse.net4j.util.StringUtil;
+import org.eclipse.net4j.util.container.ContainerUtil;
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.ui.actions.SafeAction;
+import org.eclipse.net4j.util.ui.actions.SashLayoutAction;
+import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
+import org.eclipse.net4j.util.ui.widgets.SashComposite;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Map;
+
+public class CollaborationsView extends SessionManagerView
+{
+ private SashComposite sashComposite;
+
+ private Map<String, IFacilityPaneCreator> facilityPaneCreators = new HashMap<String, IFacilityPaneCreator>();
+
+ public CollaborationsView()
+ {
+ initFacilityPaneCreators();
+ }
+
+ public CollaborationsPane getCollaborationsPane()
+ {
+ return (CollaborationsPane)sashComposite.getControl2();
+ }
+
+ public Map<String, IFacilityPaneCreator> getFacilityPaneCreators()
+ {
+ return facilityPaneCreators;
+ }
+
+ @Override
+ protected Control createControl(Composite parent)
+ {
+ sashComposite = new SashComposite(parent, SWT.NONE, 10, 30)
+ {
+ @Override
+ protected Control createControl1(Composite parent)
+ {
+ return CollaborationsView.super.createControl(parent);
+ }
+
+ @Override
+ protected Control createControl2(Composite parent)
+ {
+ return new CollaborationsPane(parent, CollaborationsView.this);
+ }
+ };
+
+ IActionBars bars = getViewSite().getActionBars();
+ bars.getMenuManager().add(new Separator());
+ bars.getToolBarManager().add(new Separator());
+ getCollaborationsPane().fillActionBars(bars);
+
+ BuddiesDropAdapter.support(getViewer());
+ return sashComposite;
+ }
+
+ @Override
+ protected void queryBuddiesManager()
+ {
+ super.queryBuddiesManager();
+ getCollaborationsPane().setSession(getSession());
+ }
+
+ @Override
+ public void notifyEvent(IEvent event)
+ {
+ super.notifyEvent(event);
+ getCollaborationsPane().notifyEvent(event);
+ }
+
+ @Override
+ protected void fillLocalPullDown(IMenuManager manager)
+ {
+ super.fillLocalPullDown(manager);
+ manager.add(new Separator());
+ manager.add(new SashLayoutAction.LayoutMenu(sashComposite));
+ }
+
+ @Override
+ protected void fillContextMenu(IMenuManager manager, ITreeSelection selection)
+ {
+ super.fillContextMenu(manager, selection);
+ if (selection.size() == 1)
+ {
+ final IBuddyCollaboration collaboration = (IBuddyCollaboration)selection.getFirstElement();
+ if (collaboration != null)
+ {
+ manager.insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());
+ for (IFacilityPaneCreator c : facilityPaneCreators.values())
+ {
+ String type = c.getType();
+ if (collaboration.getFacility(type) == null)
+ {
+ IAction action = new StartFacilityAction(collaboration, type, c.getImageDescriptor());
+ manager.insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, action);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ protected void doubleClicked(Object object)
+ {
+ if (object instanceof IBuddyCollaboration)
+ {
+ IBuddyCollaboration collaboration = (IBuddyCollaboration)object;
+ getCollaborationsPane().setActiveCollaboration(collaboration);
+ }
+ }
+
+ @Override
+ protected IContainer<?> getContainer()
+ {
+ return getSession() != null ? getSession().getSelf() : ContainerUtil.emptyContainer();
+ }
+
+ @Override
+ protected ContainerItemProvider<IContainer<Object>> createContainerItemProvider()
+ {
+ return new CollaborationsItemProvider()
+ {
+ @Override
+ public Font getFont(Object obj)
+ {
+ if (obj instanceof IBuddyCollaboration)
+ {
+ if (obj == getCollaborationsPane().getActiveCollaboration())
+ {
+ return getBold();
+ }
+ }
+
+ return super.getFont(obj);
+ }
+ };
+ }
+
+ protected void initFacilityPaneCreators()
+ {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] elements = registry.getConfigurationElementsFor(OM.BUNDLE_ID, OM.EXT_POINT);
+ for (final IConfigurationElement element : elements)
+ {
+ if ("facilityPaneCreator".equals(element.getName())) //$NON-NLS-1$
+ {
+ try
+ {
+ IFacilityPaneCreator creator = (IFacilityPaneCreator)element.createExecutableExtension("class"); //$NON-NLS-1$
+ facilityPaneCreators.put(creator.getType(), creator);
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class StartFacilityAction extends SafeAction
+ {
+ private final String type;
+
+ private IBuddyCollaboration collaboration;
+
+ private StartFacilityAction(IBuddyCollaboration collaboration, String type, ImageDescriptor descriptor)
+ {
+ super(MessageFormat.format(Messages.getString("CollaborationsView_2"), StringUtil.cap(type)), AS_RADIO_BUTTON); //$NON-NLS-1$
+ setToolTipText(MessageFormat.format(Messages.getString("CollaborationsView_3"), type)); //$NON-NLS-1$
+ setImageDescriptor(descriptor);
+ this.collaboration = collaboration;
+ this.type = type;
+ }
+
+ @Override
+ protected void safeRun() throws Exception
+ {
+ collaboration.installFacility(type);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/FacilityPane.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/FacilityPane.java
index 9e0ae522d5..866cd663ab 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/FacilityPane.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/FacilityPane.java
@@ -1,242 +1,242 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.views;
-
-import org.eclipse.net4j.buddies.common.IFacility;
-import org.eclipse.net4j.buddies.internal.ui.bundle.OM;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.ui.UIUtil;
-
-import org.eclipse.jface.action.CoolBarManager;
-import org.eclipse.jface.action.IContributionManager;
-import org.eclipse.jface.action.ICoolBarManager;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.CoolBar;
-import org.eclipse.swt.widgets.Layout;
-
-/**
- * @author Eike Stepper
- */
-public abstract class FacilityPane extends Composite implements IListener
-{
- private IFacility facility;
-
- private CollaborationsPane collaborationsPane;
-
- private CoolBarManager coolBarManager;
-
- private Control control;
-
- public FacilityPane(CollaborationsPane collaborationsPane, int style)
- {
- super(collaborationsPane, style);
- this.collaborationsPane = collaborationsPane;
- setLayout(new FacilityPaneLayout());
-
- ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT | SWT.RIGHT | SWT.WRAP);
- fillCoolBar(toolBarManager);
-
- coolBarManager = new CoolBarManager(SWT.FLAT | SWT.RIGHT | SWT.WRAP);
- coolBarManager.add(toolBarManager);
- coolBarManager.setLockLayout(true);
- coolBarManager.createControl(this);
- coolBarManager.update(true);
-
- Composite composite = new Composite(this, SWT.NONE);
- composite.setLayout(UIUtil.createGridLayout(1));
-
- control = createUI(composite);
- control.setLayoutData(UIUtil.createGridData());
- }
-
- @Override
- public void dispose()
- {
- facility.removeListener(this);
- coolBarManager.dispose();
- super.dispose();
- }
-
- public IFacility getFacility()
- {
- return facility;
- }
-
- public void setFacility(IFacility facility)
- {
- this.facility = facility;
- facility.addListener(this);
- }
-
- public CollaborationsPane getCollaborationsPane()
- {
- return collaborationsPane;
- }
-
- public ICoolBarManager getCoolBarManager()
- {
- return coolBarManager;
- }
-
- public Control getControl()
- {
- return control;
- }
-
- public final void notifyEvent(final IEvent event)
- {
- try
- {
- control.getDisplay().syncExec(new Runnable()
- {
- public void run()
- {
- try
- {
- handleEvent(event);
- }
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- }
- }
- });
- }
- catch (RuntimeException ignore)
- {
- }
- }
-
- protected abstract void handleEvent(IEvent event) throws Exception;
-
- public void hidden(FacilityPane newPane)
- {
- }
-
- public void showed(FacilityPane oldPane)
- {
- }
-
- protected abstract Control createUI(Composite parent);
-
- protected CoolBar getCoolBarControl()
- {
- if (coolBarManager != null)
- {
- return coolBarManager.getControl();
- }
-
- return null;
- }
-
- protected void fillCoolBar(IContributionManager manager)
- {
- }
-
- /**
- * @author Eike Stepper
- * @see org.eclipse.jface.window.ApplicationWindow.ApplicationWindowLayout
- */
- public class FacilityPaneLayout extends Layout
- {
- static final int BAR_SIZE = 23;
-
- @Override
- protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache)
- {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- {
- return new Point(wHint, hHint);
- }
-
- Point result = new Point(0, 0);
- Control[] ws = composite.getChildren();
- for (int i = 0; i < ws.length; i++)
- {
- Control w = ws[i];
- boolean hide = false;
- if (w == getCoolBarControl())
- {
- if (!coolBarChildrenExist())
- {
- hide = true;
- result.y += BAR_SIZE;
- }
- }
- else if (i > 0)
- {
- hide = false;
- }
-
- if (!hide)
- {
- Point e = w.computeSize(wHint, hHint, flushCache);
- result.x = Math.max(result.x, e.x);
- result.y += e.y;
- }
- }
-
- if (wHint != SWT.DEFAULT)
- {
- result.x = wHint;
- }
-
- if (hHint != SWT.DEFAULT)
- {
- result.y = hHint;
- }
-
- return result;
- }
-
- @Override
- protected void layout(Composite composite, boolean flushCache)
- {
- Rectangle clientArea = composite.getClientArea();
- Control[] ws = composite.getChildren();
- for (int i = 0; i < ws.length; i++)
- {
- Control w = ws[i];
- if (w == getCoolBarControl())
- {
- if (coolBarChildrenExist())
- {
- Point e = w.computeSize(clientArea.width, SWT.DEFAULT, flushCache);
- w.setBounds(clientArea.x, clientArea.y, clientArea.width, e.y);
- clientArea.y += e.y;
- clientArea.height -= e.y;
- }
- }
- else
- {
- w.setBounds(clientArea.x, clientArea.y, clientArea.width, clientArea.height);
- }
- }
- }
-
- protected boolean coolBarChildrenExist()
- {
- CoolBar coolBarControl = getCoolBarControl();
- if (coolBarControl != null)
- {
- return coolBarControl.getItemCount() > 0;
- }
-
- return false;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.views;
+
+import org.eclipse.net4j.buddies.common.IFacility;
+import org.eclipse.net4j.buddies.internal.ui.bundle.OM;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.ui.UIUtil;
+
+import org.eclipse.jface.action.CoolBarManager;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.ICoolBarManager;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.CoolBar;
+import org.eclipse.swt.widgets.Layout;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class FacilityPane extends Composite implements IListener
+{
+ private IFacility facility;
+
+ private CollaborationsPane collaborationsPane;
+
+ private CoolBarManager coolBarManager;
+
+ private Control control;
+
+ public FacilityPane(CollaborationsPane collaborationsPane, int style)
+ {
+ super(collaborationsPane, style);
+ this.collaborationsPane = collaborationsPane;
+ setLayout(new FacilityPaneLayout());
+
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT | SWT.RIGHT | SWT.WRAP);
+ fillCoolBar(toolBarManager);
+
+ coolBarManager = new CoolBarManager(SWT.FLAT | SWT.RIGHT | SWT.WRAP);
+ coolBarManager.add(toolBarManager);
+ coolBarManager.setLockLayout(true);
+ coolBarManager.createControl(this);
+ coolBarManager.update(true);
+
+ Composite composite = new Composite(this, SWT.NONE);
+ composite.setLayout(UIUtil.createGridLayout(1));
+
+ control = createUI(composite);
+ control.setLayoutData(UIUtil.createGridData());
+ }
+
+ @Override
+ public void dispose()
+ {
+ facility.removeListener(this);
+ coolBarManager.dispose();
+ super.dispose();
+ }
+
+ public IFacility getFacility()
+ {
+ return facility;
+ }
+
+ public void setFacility(IFacility facility)
+ {
+ this.facility = facility;
+ facility.addListener(this);
+ }
+
+ public CollaborationsPane getCollaborationsPane()
+ {
+ return collaborationsPane;
+ }
+
+ public ICoolBarManager getCoolBarManager()
+ {
+ return coolBarManager;
+ }
+
+ public Control getControl()
+ {
+ return control;
+ }
+
+ public final void notifyEvent(final IEvent event)
+ {
+ try
+ {
+ control.getDisplay().syncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ handleEvent(event);
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
+ });
+ }
+ catch (RuntimeException ignore)
+ {
+ }
+ }
+
+ protected abstract void handleEvent(IEvent event) throws Exception;
+
+ public void hidden(FacilityPane newPane)
+ {
+ }
+
+ public void showed(FacilityPane oldPane)
+ {
+ }
+
+ protected abstract Control createUI(Composite parent);
+
+ protected CoolBar getCoolBarControl()
+ {
+ if (coolBarManager != null)
+ {
+ return coolBarManager.getControl();
+ }
+
+ return null;
+ }
+
+ protected void fillCoolBar(IContributionManager manager)
+ {
+ }
+
+ /**
+ * @author Eike Stepper
+ * @see org.eclipse.jface.window.ApplicationWindow.ApplicationWindowLayout
+ */
+ public class FacilityPaneLayout extends Layout
+ {
+ static final int BAR_SIZE = 23;
+
+ @Override
+ protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache)
+ {
+ if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
+ {
+ return new Point(wHint, hHint);
+ }
+
+ Point result = new Point(0, 0);
+ Control[] ws = composite.getChildren();
+ for (int i = 0; i < ws.length; i++)
+ {
+ Control w = ws[i];
+ boolean hide = false;
+ if (w == getCoolBarControl())
+ {
+ if (!coolBarChildrenExist())
+ {
+ hide = true;
+ result.y += BAR_SIZE;
+ }
+ }
+ else if (i > 0)
+ {
+ hide = false;
+ }
+
+ if (!hide)
+ {
+ Point e = w.computeSize(wHint, hHint, flushCache);
+ result.x = Math.max(result.x, e.x);
+ result.y += e.y;
+ }
+ }
+
+ if (wHint != SWT.DEFAULT)
+ {
+ result.x = wHint;
+ }
+
+ if (hHint != SWT.DEFAULT)
+ {
+ result.y = hHint;
+ }
+
+ return result;
+ }
+
+ @Override
+ protected void layout(Composite composite, boolean flushCache)
+ {
+ Rectangle clientArea = composite.getClientArea();
+ Control[] ws = composite.getChildren();
+ for (int i = 0; i < ws.length; i++)
+ {
+ Control w = ws[i];
+ if (w == getCoolBarControl())
+ {
+ if (coolBarChildrenExist())
+ {
+ Point e = w.computeSize(clientArea.width, SWT.DEFAULT, flushCache);
+ w.setBounds(clientArea.x, clientArea.y, clientArea.width, e.y);
+ clientArea.y += e.y;
+ clientArea.height -= e.y;
+ }
+ }
+ else
+ {
+ w.setBounds(clientArea.x, clientArea.y, clientArea.width, clientArea.height);
+ }
+ }
+ }
+
+ protected boolean coolBarChildrenExist()
+ {
+ CoolBar coolBarControl = getCoolBarControl();
+ if (coolBarControl != null)
+ {
+ return coolBarControl.getItemCount() > 0;
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/SessionManagerView.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/SessionManagerView.java
index 9deb5a52f3..1162a5e3a7 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/SessionManagerView.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/SessionManagerView.java
@@ -1,153 +1,153 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.internal.ui.views;
-
-import org.eclipse.net4j.buddies.IBuddySession;
-import org.eclipse.net4j.buddies.ISessionManager;
-import org.eclipse.net4j.buddies.ISessionManagerEvent;
-import org.eclipse.net4j.buddies.common.IBuddyStateEvent;
-import org.eclipse.net4j.buddies.internal.ui.BuddiesItemProvider;
-import org.eclipse.net4j.buddies.internal.ui.actions.ConnectAction;
-import org.eclipse.net4j.buddies.internal.ui.actions.DisconnectAction;
-import org.eclipse.net4j.buddies.internal.ui.actions.FlashAction;
-import org.eclipse.net4j.buddies.internal.ui.actions.ReconnectAction;
-import org.eclipse.net4j.buddies.internal.ui.actions.StateAction.DropDownAction;
-import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
-import org.eclipse.net4j.util.ui.views.ContainerView;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-public abstract class SessionManagerView extends ContainerView implements IListener
-{
- private IBuddySession session;
-
- private ConnectAction connectAction = new ConnectAction();
-
- private DisconnectAction disconnectAction = new DisconnectAction();
-
- private ReconnectAction reconnectAction = new ReconnectAction();
-
- private FlashAction flashAction = new FlashAction();
-
- private DropDownAction dropDownAction = new DropDownAction();
-
- private Control control;
-
- public SessionManagerView()
- {
- }
-
- public IBuddySession getSession()
- {
- return session;
- }
-
- @Override
- public void dispose()
- {
- ISessionManager.INSTANCE.removeListener(this);
- session = null;
- super.dispose();
- }
-
- public void notifyEvent(IEvent event)
- {
- if (event instanceof ISessionManagerEvent)
- {
- queryBuddiesManager();
- }
- else if (event instanceof IBuddyStateEvent)
- {
- if (session != null && event.getSource() == session.getSelf())
- {
- updateState();
- }
- }
- }
-
- @Override
- protected final Control createUI(Composite parent)
- {
- control = createControl(parent);
- queryBuddiesManager();
- ISessionManager.INSTANCE.addListener(this);
- return control;
- }
-
- protected Control createControl(Composite parent)
- {
- return super.createUI(parent);
- }
-
- @Override
- protected ContainerItemProvider<IContainer<Object>> createContainerItemProvider()
- {
- return new BuddiesItemProvider();
- }
-
- @Override
- protected void fillLocalToolBar(IToolBarManager manager)
- {
- super.fillLocalToolBar(manager);
- manager.add(dropDownAction);
- }
-
- @Override
- protected void fillLocalPullDown(IMenuManager manager)
- {
- manager.add(connectAction);
- manager.add(disconnectAction);
- manager.add(reconnectAction);
- manager.add(new Separator());
- manager.add(flashAction);
- super.fillLocalPullDown(manager);
- }
-
- protected void queryBuddiesManager()
- {
- IBuddySession oldSession = session;
- session = ISessionManager.INSTANCE.getSession();
- if (oldSession != session)
- {
- if (oldSession != null)
- {
- oldSession.removeListener(this);
- oldSession.getSelf().removeListener(this);
- }
-
- if (session != null)
- {
- session.addListener(this);
- session.getSelf().addListener(this);
- }
- }
-
- resetInput();
- updateState();
- }
-
- protected void updateState()
- {
- connectAction.setEnabled(session == null);
- disconnectAction.setEnabled(session != null);
- reconnectAction.setEnabled(session != null);
- flashAction.setEnabled(session != null && !ISessionManager.INSTANCE.isFlashing());
- dropDownAction.updateState();
- // control.setEnabled(session != null);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.internal.ui.views;
+
+import org.eclipse.net4j.buddies.IBuddySession;
+import org.eclipse.net4j.buddies.ISessionManager;
+import org.eclipse.net4j.buddies.ISessionManagerEvent;
+import org.eclipse.net4j.buddies.common.IBuddyStateEvent;
+import org.eclipse.net4j.buddies.internal.ui.BuddiesItemProvider;
+import org.eclipse.net4j.buddies.internal.ui.actions.ConnectAction;
+import org.eclipse.net4j.buddies.internal.ui.actions.DisconnectAction;
+import org.eclipse.net4j.buddies.internal.ui.actions.FlashAction;
+import org.eclipse.net4j.buddies.internal.ui.actions.ReconnectAction;
+import org.eclipse.net4j.buddies.internal.ui.actions.StateAction.DropDownAction;
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
+import org.eclipse.net4j.util.ui.views.ContainerView;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public abstract class SessionManagerView extends ContainerView implements IListener
+{
+ private IBuddySession session;
+
+ private ConnectAction connectAction = new ConnectAction();
+
+ private DisconnectAction disconnectAction = new DisconnectAction();
+
+ private ReconnectAction reconnectAction = new ReconnectAction();
+
+ private FlashAction flashAction = new FlashAction();
+
+ private DropDownAction dropDownAction = new DropDownAction();
+
+ private Control control;
+
+ public SessionManagerView()
+ {
+ }
+
+ public IBuddySession getSession()
+ {
+ return session;
+ }
+
+ @Override
+ public void dispose()
+ {
+ ISessionManager.INSTANCE.removeListener(this);
+ session = null;
+ super.dispose();
+ }
+
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof ISessionManagerEvent)
+ {
+ queryBuddiesManager();
+ }
+ else if (event instanceof IBuddyStateEvent)
+ {
+ if (session != null && event.getSource() == session.getSelf())
+ {
+ updateState();
+ }
+ }
+ }
+
+ @Override
+ protected final Control createUI(Composite parent)
+ {
+ control = createControl(parent);
+ queryBuddiesManager();
+ ISessionManager.INSTANCE.addListener(this);
+ return control;
+ }
+
+ protected Control createControl(Composite parent)
+ {
+ return super.createUI(parent);
+ }
+
+ @Override
+ protected ContainerItemProvider<IContainer<Object>> createContainerItemProvider()
+ {
+ return new BuddiesItemProvider();
+ }
+
+ @Override
+ protected void fillLocalToolBar(IToolBarManager manager)
+ {
+ super.fillLocalToolBar(manager);
+ manager.add(dropDownAction);
+ }
+
+ @Override
+ protected void fillLocalPullDown(IMenuManager manager)
+ {
+ manager.add(connectAction);
+ manager.add(disconnectAction);
+ manager.add(reconnectAction);
+ manager.add(new Separator());
+ manager.add(flashAction);
+ super.fillLocalPullDown(manager);
+ }
+
+ protected void queryBuddiesManager()
+ {
+ IBuddySession oldSession = session;
+ session = ISessionManager.INSTANCE.getSession();
+ if (oldSession != session)
+ {
+ if (oldSession != null)
+ {
+ oldSession.removeListener(this);
+ oldSession.getSelf().removeListener(this);
+ }
+
+ if (session != null)
+ {
+ session.addListener(this);
+ session.getSelf().addListener(this);
+ }
+ }
+
+ resetInput();
+ updateState();
+ }
+
+ protected void updateState()
+ {
+ connectAction.setEnabled(session == null);
+ disconnectAction.setEnabled(session != null);
+ reconnectAction.setEnabled(session != null);
+ flashAction.setEnabled(session != null && !ISessionManager.INSTANCE.isFlashing());
+ dropDownAction.updateState();
+ // control.setEnabled(session != null);
+ }
+}
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/ui/IFacilityPaneCreator.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/ui/IFacilityPaneCreator.java
index 21e190e208..73000c2430 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/ui/IFacilityPaneCreator.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/ui/IFacilityPaneCreator.java
@@ -1,28 +1,28 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.buddies.ui;
-
-import org.eclipse.net4j.buddies.internal.ui.views.CollaborationsPane;
-import org.eclipse.net4j.buddies.internal.ui.views.FacilityPane;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * @author Eike Stepper
- */
-public interface IFacilityPaneCreator
-{
- public String getType();
-
- public ImageDescriptor getImageDescriptor();
-
- public FacilityPane createPane(CollaborationsPane collaborationsPane, int style);
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.net4j.buddies.ui;
+
+import org.eclipse.net4j.buddies.internal.ui.views.CollaborationsPane;
+import org.eclipse.net4j.buddies.internal.ui.views.FacilityPane;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IFacilityPaneCreator
+{
+ public String getType();
+
+ public ImageDescriptor getImageDescriptor();
+
+ public FacilityPane createPane(CollaborationsPane collaborationsPane, int style);
+}

Back to the top