Utils.runSafeSWTAsync(log, new Runnable() {
public void run() {
List<User> participants = SelectionRetrieverFactory
.getSelectionRetriever(User.class).getSelection();
if (participants.size() == 1) {
VideoSharingSession videoSharingSession = sessionObservable
.getValue();
if (videoSharing.ready()) {
try {
setEnabled(false);
videoSharing.startSharing(participants.get(0));
} catch (final SarosCancellationException e) {
Utils.popUpFailureMessage(
Messages.VideoSharingAction_error_could_not_establish_screensharing_text,
e.getMessage(), false);
log.error("Could not establish screensharing: ", e); //$NON-NLS-1$
}
} else {
switch (videoSharingSession.getMode()) {
case LOCAL:
case HOST: // $FALL-THROUGH$
break;
case CLIENT:
videoSharingSession.requestStop();
break;
}
videoSharingSession.dispose();
}
updateEnablement();
} else {
log.warn("More than one participant selected."); //$NON-NLS-1$
}