use of org.eclipse.ecf.ui.dialogs.ContainerConnectErrorDialog 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.ui.dialogs.ContainerConnectErrorDialog in project ecf by eclipse.
the class BitTorrentConnectWizard method performFinish.
public boolean performFinish() {
workbenchPage = workbench.getActiveWorkbenchWindow().getActivePage();
final IRetrieveFileTransferContainerAdapter irftca = (IRetrieveFileTransferContainerAdapter) container.getAdapter(IRetrieveFileTransferContainerAdapter.class);
try {
targetID = FileIDFactory.getDefault().createFileID(irftca.getRetrieveNamespace(), page.getTorrentName());
} catch (final FileCreateException e) {
new ContainerConnectErrorDialog(workbench.getActiveWorkbenchWindow().getShell(), 1, "The target ID to connect to could not be created", page.getTorrentName(), e).open();
return true;
}
try {
irftca.sendRetrieveRequest(targetID, new IFileTransferListener() {
public void handleTransferEvent(final IFileTransferEvent e) {
if (e instanceof IIncomingFileTransferReceiveStartEvent) {
try {
final IFileTransfer ift = ((IIncomingFileTransferReceiveStartEvent) e).receive(new File(page.getTargetName()));
workbenchPage.getWorkbenchWindow().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
FileTransfersView.addTransfer(ift);
}
});
} catch (final IOException ioe) {
new ContainerConnectErrorDialog(workbench.getActiveWorkbenchWindow().getShell(), 1, "Could not write to " + page.getTargetName(), page.getTargetName(), null).open();
}
} else if (e instanceof IIncomingFileTransferEvent) {
final FileTransfersView ftv = (FileTransfersView) workbenchPage.findView(FileTransfersView.ID);
if (ftv != null) {
workbenchPage.getWorkbenchWindow().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
ftv.update(((IIncomingFileTransferEvent) e).getSource());
}
});
}
}
}
}, null);
} catch (final IncomingFileTransferException e) {
new ContainerConnectErrorDialog(workbench.getActiveWorkbenchWindow().getShell(), 1, "Could not send retrieval request.", targetID.getName(), e).open();
}
return true;
}
Aggregations