Search in sources :

Example 1 with IImageSender

use of org.eclipse.ecf.ui.screencapture.IImageSender in project ecf by eclipse.

the class ChatComposite method sendImage.

private void sendImage(final IUser toUser) {
    if (MessageDialog.openQuestion(null, MessageLoader.getString("ChatComposite.DIALOG_SCREEN_CAPTURE_TITLE"), MessageLoader.getString("ChatComposite.DIALOG_SCREEN_CAPTURE_TEXT"))) {
        // $NON-NLS-1$ //$NON-NLS-2$
        final Job job = new ScreenCaptureJob(getDisplay(), toUser.getID(), toUser.getNickname(), new IImageSender() {

            public void sendImage(ID targetID, ImageData imageData) {
                view.lch.sendImage(toUser.getID(), imageData);
            }
        });
        job.schedule(5000);
    }
}
Also used : IImageSender(org.eclipse.ecf.ui.screencapture.IImageSender) ID(org.eclipse.ecf.core.identity.ID) Job(org.eclipse.core.runtime.jobs.Job) ScreenCaptureJob(org.eclipse.ecf.ui.screencapture.ScreenCaptureJob) ScreenCaptureJob(org.eclipse.ecf.ui.screencapture.ScreenCaptureJob)

Example 2 with IImageSender

use of org.eclipse.ecf.ui.screencapture.IImageSender 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;
}
Also used : IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) IImageSender(org.eclipse.ecf.ui.screencapture.IImageSender) IAction(org.eclipse.jface.action.IAction) ImageData(org.eclipse.swt.graphics.ImageData) IChannelContainerAdapter(org.eclipse.ecf.datashare.IChannelContainerAdapter) IRosterEntry(org.eclipse.ecf.presence.roster.IRosterEntry) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) ID(org.eclipse.ecf.core.identity.ID) IContainer(org.eclipse.ecf.core.IContainer) ScreenCaptureJob(org.eclipse.ecf.ui.screencapture.ScreenCaptureJob)

Aggregations

ID (org.eclipse.ecf.core.identity.ID)2 IImageSender (org.eclipse.ecf.ui.screencapture.IImageSender)2 ScreenCaptureJob (org.eclipse.ecf.ui.screencapture.ScreenCaptureJob)2 Job (org.eclipse.core.runtime.jobs.Job)1 IContainer (org.eclipse.ecf.core.IContainer)1 IChannelContainerAdapter (org.eclipse.ecf.datashare.IChannelContainerAdapter)1 IRosterEntry (org.eclipse.ecf.presence.roster.IRosterEntry)1 Action (org.eclipse.jface.action.Action)1 IAction (org.eclipse.jface.action.IAction)1 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)1 ImageData (org.eclipse.swt.graphics.ImageData)1