Search in sources :

Example 1 with IRemoteEnvironmentInfo

use of org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo in project ecf by eclipse.

the class Lab1Action method run.

/**
 * The action has been activated. The argument of the
 * method represents the 'real' action sitting
 * in the workbench UI.
 * @see IWorkbenchWindowActionDelegate#run
 */
public void run(IAction action) {
    try {
        IRemoteServiceContainerAdapter adapter = getContainerAdapter();
        // Create target ID
        String target = TARGET;
        ID targetID = createTargetID(container, target);
        // Get and resolve remote service reference
        IRemoteServiceReference[] ref = adapter.getRemoteServiceReferences(targetID, org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo.class.getName(), null);
        IRemoteService svc = adapter.getRemoteService(ref[0]);
        // get proxy
        IRemoteEnvironmentInfo proxy = (IRemoteEnvironmentInfo) svc.getProxy();
        // Call it!
        String osArch = proxy.getOSArch();
        // Show result
        MessageDialog.openInformation(window.getShell(), "ECF Lab 1", "Target " + target + " has OS Arch=" + osArch);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : IRemoteServiceReference(org.eclipse.ecf.remoteservice.IRemoteServiceReference) IRemoteEnvironmentInfo(org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo) IRemoteServiceContainerAdapter(org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter) ID(org.eclipse.ecf.core.identity.ID) IRemoteService(org.eclipse.ecf.remoteservice.IRemoteService) ContainerCreateException(org.eclipse.ecf.core.ContainerCreateException)

Aggregations

ContainerCreateException (org.eclipse.ecf.core.ContainerCreateException)1 ID (org.eclipse.ecf.core.identity.ID)1 IRemoteEnvironmentInfo (org.eclipse.ecf.examples.remoteservices.common.IRemoteEnvironmentInfo)1 IRemoteService (org.eclipse.ecf.remoteservice.IRemoteService)1 IRemoteServiceContainerAdapter (org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter)1 IRemoteServiceReference (org.eclipse.ecf.remoteservice.IRemoteServiceReference)1