use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class AbstractPresenceTestCase method getServerConnectID.
protected ID getServerConnectID(int client) {
final IContainer container = getClient(client);
final Namespace connectNamespace = container.getConnectNamespace();
final String username = getUsername(client);
try {
return IDFactory.getDefault().createID(connectNamespace, username);
} catch (final IDCreateException e) {
fail("Could not create server connect ID");
return null;
}
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class BrowseHandler method execute.
/**
* the command has been executed, so extract extract the needed information
* from the application context.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IContainerManager containerManager = Activator.getDefault().getContainerManager();
IContainer[] containers = containerManager.getAllContainers();
BrowseDialog dialog = new BrowseDialog(window.getShell(), containers);
int status = dialog.open();
if (status == Window.OK) {
Object[] object = dialog.getResult();
IRosterEntry entry = (IRosterEntry) object[0];
IRoster roster = entry.getRoster();
if (roster != null) {
IChatManager manager = roster.getPresenceContainerAdapter().getChatManager();
IChatMessageSender icms = manager.getChatMessageSender();
ITypingMessageSender itms = manager.getTypingMessageSender();
try {
MessagesView view = (MessagesView) window.getActivePage().showView(MessagesView.VIEW_ID);
view.selectTab(icms, itms, roster.getUser().getID(), entry.getUser().getID(), entry.getUser().getName());
} catch (PartInitException e) {
e.printStackTrace();
}
}
}
return null;
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class MultiRosterView method selectAndJoinChatRoomForAccounts.
private void selectAndJoinChatRoomForAccounts(MultiRosterAccount[] accounts) {
// Create chat room selection dialog with managers, open
ChatRoomSelectionDialog dialog = new ChatRoomSelectionDialog(getViewSite().getShell(), accounts);
dialog.open();
// If selection cancelled then simply return
if (dialog.getReturnCode() != Window.OK)
return;
// Get selected room, selected manager, and selected IChatRoomInfo
IChatRoomInfo selectedInfo = dialog.getSelectedRoom().getRoomInfo();
MultiRosterAccount account = dialog.getSelectedRoom().getAccount();
// Now get the secondary ID from the selected room id
final IContainer container = account.getContainer();
final ID connectedID = container.getConnectedID();
if (connectedID == null) {
MessageDialog.openError(getViewSite().getShell(), Messages.MultiRosterView_NO_IDENTIFIER_FOR_ROOM_TITLE, NLS.bind(Messages.MultiRosterView_NO_IDENTIFIER_FOR_ROOM_MESSAGE, selectedInfo.getRoomID()));
return;
}
try {
joinChatRoom(container, selectedInfo, null);
} catch (ECFException e) {
Throwable e1 = e.getStatus().getException();
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.MultiRosterView_EXCEPTION_LOG_JOIN_ROOM, e1));
ContainerConnectErrorDialog ed = new ContainerConnectErrorDialog(getViewSite().getShell(), selectedInfo.getRoomID().getName(), e1);
ed.open();
}
}
use of org.eclipse.ecf.core.IContainer 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.core.IContainer 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;
}
Aggregations