use of org.eclipse.ecf.presence.roster.IRosterEntry in project ecf by eclipse.
the class URLShareRosterEntryContributionItem method makeActions.
protected IAction[] makeActions() {
// Else check for Roster entry
final IRosterEntry entry = getSelectedRosterEntry();
final IContainer c = getContainerForRosterEntry(entry);
// If roster entry is selected and it has a container
if (entry != null && c != null) {
final IChannelContainerAdapter channelAdapter = (IChannelContainerAdapter) c.getAdapter(IChannelContainerAdapter.class);
// If the container has channel container adapter and is online/available
if (channelAdapter != null && isAvailable(entry)) {
final URLShare tmp = URLShare.getURLShare(c.getID());
// If there is an URL share associated with this container
if (tmp != null) {
final URLShare urlshare = tmp;
final IAction action = new Action() {
public void run() {
urlshare.showDialogAndSendURL(entry.getRoster().getUser().getName(), entry.getUser().getID());
}
};
action.setText(Messages.URLShareRosterEntryContributionItem_SEND_URL_MENU_TEXT);
action.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, Messages.URLShareRosterContributionItem_BROWSER_ICON));
return new IAction[] { action };
}
}
}
return null;
}
use of org.eclipse.ecf.presence.roster.IRosterEntry in project ecf by eclipse.
the class ViewShareRosterEntryContributionItem method makeActions.
protected IAction[] makeActions() {
// Else check for Roster entry
final IRosterEntry entry = getSelectedRosterEntry();
final IContainer c = getContainerForRosterEntry(entry);
// If roster entry is selected and it has a container
if (entry != null && c != null) {
final IChannelContainerAdapter channelAdapter = (IChannelContainerAdapter) c.getAdapter(IChannelContainerAdapter.class);
// If the container has channel container adapter and is online/available
if (channelAdapter != null && isAvailable(entry)) {
final ViewShare tmp = ViewShare.getViewShare(c.getID());
// If there is an URL share associated with this container
if (tmp != null) {
final ViewShare viewshare = tmp;
final IAction action = new Action() {
public void run() {
viewshare.sendOpenViewRequest(entry.getRoster().getUser().getName(), entry.getUser().getID());
}
};
action.setText(Messages.ViewShareRosterEntryContributionItem_VIEWSHARE_MENU_TEXT);
action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEF_VIEW));
return new IAction[] { action };
}
}
}
return null;
}
use of org.eclipse.ecf.presence.roster.IRosterEntry in project ecf by eclipse.
the class ConsoleShareRosterEntryContributionItem method makeActions.
protected IAction[] makeActions() {
final TextSelection selection = ConsoleShare.getSelection();
if (selection == null)
return null;
// Else check for Roster entry
final IRosterEntry entry = getSelectedRosterEntry();
final IContainer c = getContainerForRosterEntry(entry);
// If roster entry is selected and it has a container
if (entry != null && c != null) {
final IChannelContainerAdapter channelAdapter = (IChannelContainerAdapter) c.getAdapter(IChannelContainerAdapter.class);
// If the container has channel container adapter and is online/available
if (channelAdapter != null && isAvailable(entry)) {
final ConsoleShare tmp = ConsoleShare.getStackShare(c.getID());
// If there is an URL share associated with this container
if (tmp != null) {
final ConsoleShare stackshare = tmp;
final IAction action = new Action() {
public void run() {
stackshare.sendShareConsoleSelection(entry.getRoster().getUser().getName(), entry.getUser().getID(), selection.getText());
}
};
action.setText(Messages.ConsoleShare_RosterEntryMenu);
action.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, Messages.ConsoleShare_RosterContributionItem_CONSOLE_ICON));
return new IAction[] { action };
}
}
}
return null;
}
use of org.eclipse.ecf.presence.roster.IRosterEntry in project ecf by eclipse.
the class XMPPCompoundContributionItem method getContributionItems.
protected IContributionItem[] getContributionItems() {
final Object selection = getSelection();
if (!(selection instanceof IRosterEntry)) {
return EMPTY_ARRAY;
}
final IRosterEntry entry = (IRosterEntry) selection;
final IContainer container = getContainerForRosterEntry(entry);
if (container instanceof XMPPContainer) {
final IContributionItem[] contributions = new IContributionItem[1];
final ISendFileTransferContainerAdapter ioftca = (ISendFileTransferContainerAdapter) container.getAdapter(ISendFileTransferContainerAdapter.class);
if (!(ioftca != null && isAvailable(entry)))
return EMPTY_ARRAY;
final IAction fileSendAction = new Action() {
public void run() {
sendFileToTarget(ioftca, entry.getUser().getID());
}
};
fileSendAction.setText(Messages.XMPPCompoundContributionItem_SEND_FILE);
fileSendAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FILE));
contributions[0] = new ActionContributionItem(fileSendAction);
return contributions;
} else {
return EMPTY_ARRAY;
}
}
use of org.eclipse.ecf.presence.roster.IRosterEntry in project ecf by eclipse.
the class XMPPContainerPresenceHelper method createRosterEntry.
protected IRosterEntry createRosterEntry(ID userID, String name, Iterator grps) {
final List groups = new ArrayList();
for (; grps.hasNext(); ) {
final Object o = grps.next();
final String groupName = (o instanceof String) ? (String) o : ((RosterGroup) o).getName();
final IRosterGroup localGrp = new org.eclipse.ecf.presence.roster.RosterGroup(roster, groupName);
groups.add(localGrp);
}
final IUser user = new User(userID, name);
IRosterEntry newEntry = null;
if (groups.size() == 0)
return new org.eclipse.ecf.presence.roster.RosterEntry(roster, user, new org.eclipse.ecf.presence.Presence(IPresence.Type.UNAVAILABLE, IPresence.Type.UNAVAILABLE.toString(), IPresence.Mode.AWAY));
else
for (int i = 0; i < groups.size(); i++) {
final IRosterGroup grp = (IRosterGroup) groups.get(i);
if (i == 0)
newEntry = new org.eclipse.ecf.presence.roster.RosterEntry(grp, user, null);
else {
grp.getEntries().add(newEntry);
newEntry.getGroups().add(grp);
}
}
return newEntry;
}
Aggregations