use of org.eclipse.ecf.datashare.IChannelContainerAdapter in project ecf by eclipse.
the class ScreenCaptureShareRosterContributionItem method makeActions.
protected IAction[] makeActions() {
final IRoster roster = getSelectedRoster();
if (roster != null) {
// Roster is selected
final IContainer c = getContainerForRoster(roster);
if (c != null) {
// Get existing ScreenCaptureShare for this container (if it exists)
final ScreenCaptureShare screenCaptureShare = ScreenCaptureShare.getScreenCaptureShare(c.getID());
// If it does exist already, then create action to remove
if (screenCaptureShare != null)
return createActionRemove(c.getID(), screenCaptureShare);
final IChannelContainerAdapter channelAdapter = (IChannelContainerAdapter) c.getAdapter(IChannelContainerAdapter.class);
return (channelAdapter == null) ? null : createActionAdd(c.getID(), channelAdapter);
}
}
return null;
}
use of org.eclipse.ecf.datashare.IChannelContainerAdapter in project ecf by eclipse.
the class ScreenCaptureShareRosterEntryContributionItem 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 ScreenCaptureShare tmp = ScreenCaptureShare.getScreenCaptureShare(c.getID());
// If there is an URL share associated with this container
if (tmp != null) {
final ScreenCaptureShare screencaptureshare = tmp;
final IAction action = new Action() {
public void run() {
MessageDialog dialog = new MessageDialog(null, Messages.ScreenCaptureShareRosterEntryContributionItem_SCREEN_CAPTURE_MESSAGEBOX_TITLE, Window.getDefaultImage(), Messages.ScreenCaptureShareRosterEntryContributionItem_SCREEN_CAPTURE_MESSAGEBOX_MESSAGE, MessageDialog.QUESTION, new String[] { NLS.bind(Messages.ScreenCaptureShareRosterEntryContributionItem_VERIFY_SEND_BUTTON_TEXT, entry.getName()), Messages.ScreenCaptureShareRosterEntryContributionItem_VERIFY_CANCEL_BUTTON_TEXT }, 0);
if (dialog.open() == Window.OK) {
ScreenCaptureJob screenCaptureJob = new ScreenCaptureJob(Display.getCurrent(), entry.getUser().getID(), entry.getUser().getName(), new IImageSender() {
public void sendImage(ID targetID, ImageData imageData) {
screencaptureshare.sendImage(entry.getRoster().getUser().getID(), entry.getRoster().getUser().getName(), targetID, imageData);
}
});
screenCaptureJob.schedule(SCREEN_CAPTURE_DELAY);
}
}
};
action.setText(Messages.ScreenCaptureShareRosterEntryContributionItem_SCREEN_CAPTURE_MENU);
action.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEF_VIEW));
return new IAction[] { action };
}
}
}
return null;
}
use of org.eclipse.ecf.datashare.IChannelContainerAdapter in project ecf by eclipse.
the class URLShareRosterContributionItem method makeActions.
protected IAction[] makeActions() {
final IRoster roster = getSelectedRoster();
if (roster != null) {
// Roster is selected
final IContainer c = getContainerForRoster(roster);
if (c != null) {
// Get existing urlshare for this container (if it exists)
final URLShare urlshare = URLShare.getURLShare(c.getID());
// If it does exist already, then create action to remove
if (urlshare != null)
return createActionRemove(c.getID(), urlshare);
final IChannelContainerAdapter channelAdapter = (IChannelContainerAdapter) c.getAdapter(IChannelContainerAdapter.class);
return (channelAdapter == null) ? null : createActionAdd(c.getID(), channelAdapter);
}
}
return null;
}
use of org.eclipse.ecf.datashare.IChannelContainerAdapter in project ecf by eclipse.
the class ViewShareRosterContributionItem method makeActions.
protected IAction[] makeActions() {
final IRoster roster = getSelectedRoster();
if (roster != null) {
// Roster is selected
final IContainer c = getContainerForRoster(roster);
if (c != null) {
// Get existing ViewShare for this container (if it exists)
final ViewShare viewShare = ViewShare.getViewShare(c.getID());
// If it does exist already, then create action to remove
if (viewShare != null)
return createActionRemove(c.getID(), viewShare);
final IChannelContainerAdapter channelAdapter = (IChannelContainerAdapter) c.getAdapter(IChannelContainerAdapter.class);
return (channelAdapter == null) ? null : createActionAdd(c.getID(), channelAdapter);
}
}
return null;
}
use of org.eclipse.ecf.datashare.IChannelContainerAdapter in project ecf by eclipse.
the class DsClient2 method createChannel.
protected IChannel createChannel(IContainer container) throws ECFException {
// Get IChannelContainerAdapter adapter
IChannelContainerAdapter channelContainer = (IChannelContainerAdapter) container.getAdapter(IChannelContainerAdapter.class);
// Check it's valid, throw if not
if (channelContainer == null)
throw new NullPointerException("cannot get channel container adapter");
// Create channel ID with fixed name 'channel2'
final ID channelID = IDFactory.getDefault().createID(channelContainer.getChannelNamespace(), "channel2");
// Setup listener so then when channelmessageevents are received that
// they present in UI
final IChannelListener channelListener = new IChannelListener() {
public void handleChannelEvent(final IChannelEvent event) {
if (event instanceof IChannelMessageEvent) {
IChannelMessageEvent msg = (IChannelMessageEvent) event;
showMessageInUI(new String(msg.getData()));
} else
System.out.println("got channel event " + event);
}
};
// Create channel config information
IChannelConfig config = new BaseChannelConfig(channelID, channelListener, new HashMap());
// Create and return new channel
return channelContainer.createChannel(config);
}
Aggregations