use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class GenericConcatConsumerTest method setUp.
protected void setUp() throws Exception {
super.setUp();
IContainer container = createContainer();
rsContainer = createRemoteServiceContainer(container);
targetID = createID(container, Generic.HOST_CONTAINER_ENDPOINT_ID);
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class ContainerStoreTest method testStoreContainer.
public ID testStoreContainer() throws Exception {
final IContainer container = createContainer();
final IContainerEntry containerEntry = storeContainer(getStorableContainerAdapter(container));
final ISecurePreferences prefs = containerEntry.getPreferences();
assertNotNull(prefs);
return container.getID();
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class GenericServerTest method testGetRemoteServiceContainerAdapter.
public void testGetRemoteServiceContainerAdapter() throws Exception {
IContainer container = server.getFirstServerContainer();
assertNotNull(container);
IRemoteServiceContainerAdapter adapter = (IRemoteServiceContainerAdapter) container.getAdapter(IRemoteServiceContainerAdapter.class);
assertNotNull(adapter);
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class GetFileHandler method openStartFileDownloadDialog.
public void openStartFileDownloadDialog(final Shell shell, String url) {
StartFileDownloadDialog dialog = new StartFileDownloadDialog(shell, url);
if (dialog.open() == Window.OK) {
final String scp = dialog.getValue();
final String userid = dialog.userid;
final String passwd = dialog.passwd;
final String fileName = dialog.filename;
new Job(SCP_JOB_FAMILY) {
protected IStatus run(final IProgressMonitor monitor) {
try {
final IContainer container = ContainerFactory.getDefault().createContainer();
IRetrieveFileTransferContainerAdapter adapter = (IRetrieveFileTransferContainerAdapter) container.getAdapter(IRetrieveFileTransferContainerAdapter.class);
final FileOutputStream out = new FileOutputStream(fileName);
IFileTransferListener listener = new IFileTransferListener() {
IIncomingFileTransfer incoming = null;
public void handleTransferEvent(IFileTransferEvent event) {
if (event instanceof IIncomingFileTransferReceiveStartEvent) {
IIncomingFileTransferReceiveStartEvent rse = (IIncomingFileTransferReceiveStartEvent) event;
try {
incoming = rse.receive(out);
addTransferToView(shell, incoming, fileName);
} catch (IOException e) {
// $NON-NLS-1$
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "failed to set output file", e));
}
} else if (event instanceof IIncomingFileTransferReceiveDataEvent) {
updateTransferInView(shell, incoming);
} else if (event instanceof IIncomingFileTransferReceiveDoneEvent) {
try {
out.close();
} catch (IOException e) {
// $NON-NLS-1$
Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "failed to close output file", e));
}
completeTransferInView(shell, incoming);
}
}
};
adapter.setConnectContextForAuthentication(ConnectContextFactory.createUsernamePasswordConnectContext(userid, passwd));
monitor.beginTask(SCP_JOB_FAMILY, IProgressMonitor.UNKNOWN);
adapter.sendRetrieveRequest(FileIDFactory.getDefault().createFileID(adapter.getRetrieveNamespace(), scp), listener, null);
} catch (Exception e) {
monitor.done();
// $NON-NLS-1$
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "get file failed", e);
}
monitor.done();
return Status.OK_STATUS;
}
}.schedule();
}
}
use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.
the class DocShareRosterMenuHandler method execute.
/**
* @throws ExecutionException
*/
public Object execute(ExecutionEvent arg0) throws ExecutionException {
IRosterEntry rosterEntry = getRosterEntry();
if (rosterEntry != null) {
IRoster roster = rosterEntry.getRoster();
final IContainer container = (IContainer) roster.getPresenceContainerAdapter().getAdapter(IContainer.class);
if (container.getConnectedID() == null)
showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_NOT_CONNECTED);
final DocShare sender = Activator.getDefault().getDocShare(container.getID());
if (sender == null)
showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_NO_SENDER);
if (sender.isSharing())
showErrorMessage(Messages.DocShareRosterMenuHandler_ERROR_EDITOR_ALREADY_SHARING);
final ITextEditor textEditor = getTextEditor();
if (textEditor == null)
showErrorMessage(Messages.DocShareRosterMenuHandler_EXCEPTION_EDITOR_NOT_TEXT);
final String inputName = getInputName(textEditor);
if (inputName == null)
showErrorMessage(Messages.DocShareRosterMenuHandler_NO_FILENAME_WITH_CONTENT);
final IUser user = roster.getUser();
sender.startShare(user.getID(), user.getName(), rosterEntry.getUser().getID(), inputName, textEditor);
}
return null;
}
Aggregations