Example #1
0
def __getPluginPath__(plugin):
    """ Get path to classes in plugin (if running under Eclipse)
        @param plugin Plugin ID
        @return Path to the classes in the plugin, or None
    """
    try:
        # Under Eclipse, should be able to locate the bundle
        from org.eclipse.core.runtime import Platform
        from org.eclipse.core.runtime import FileLocator
        from org.eclipse.core.runtime import Path
        bundle = Platform.getBundle(plugin)
        # While in the IDE, the classes are in a bin subdir
        url = FileLocator.find(bundle, Path("bin"), None)
        if url:
            return FileLocator.resolve(url).getPath()
        # In an exported product, the classes are
        # at the root of the jar or the expanded
        # plugin directory
        return FileLocator.getBundleFile(bundle).getPath()
    except:
        # Not running under Eclipse
        return None
def __getPluginPath__(plugin):
    """ Get path to classes in plugin (if running under Eclipse)
        @param plugin Plugin ID
        @return Path to the classes in the plugin, or None
    """
    try:
        # Under Eclipse, should be able to locate the bundle
        from org.eclipse.core.runtime import Platform
        from org.eclipse.core.runtime import FileLocator
        from org.eclipse.core.runtime import Path
        bundle = Platform.getBundle(plugin)
        # While in the IDE, the classes are in a bin subdir
        url = FileLocator.find(bundle, Path("bin"), None)
        if url:
            return FileLocator.resolve(url).getPath()
        # In an exported product, the classes are
        # at the root of the jar or the expanded
        # plugin directory
        return FileLocator.getBundleFile(bundle).getPath()
    except:
        # Not running under Eclipse
        return None
Example #3
0
    from numpy import *
else:
    try:
        # If this succeeds, the binaries are already in the classpath
        # (set on command line, or running within scan server)
        import org.csstudio.ndarray.NDArray as NDArray
    except:
        # Need to locate NDArray binaries
        try:
            # When running under Eclipse, locate org.epics.util and NDArray bundle
            from org.eclipse.core.runtime import Platform
            from org.eclipse.core.runtime import FileLocator
            from org.eclipse.core.runtime import Path
            
            bundle = Platform.getBundle("org.epics.util")
            url = FileLocator.find(bundle, Path("bin"), None)
            if url:
                # While in the IDE, the plugin classes are in a bin subdir
                sys.path.append(FileLocator.resolve(url).getPath())
            else:
                # In an exported product, the classes are at the root
                sys.path.append(FileLocator.getBundleFile(bundle).getPath())
            
            bundle = Platform.getBundle("org.csstudio.ndarray")
            url = FileLocator.find(bundle, Path("bin"), None)
            if url:
                sys.path.append(FileLocator.resolve(url).getPath())
            else:
                sys.path.append(FileLocator.getBundleFile(bundle).getPath())
        except:
            # Not running under Eclipse
Example #4
0
import sys, os

try:
    # If this succeeds, the binaries are already in the classpath
    # (set on command line, or running within scan server)
    import org.csstudio.ndarray.NDArray as NDArray
except:
    # Need to locate NDArray binaries
    try:
        # When running under Eclipse, locate org.epics.util and NDArray bundle
        from org.eclipse.core.runtime import Platform
        from org.eclipse.core.runtime import FileLocator
        from org.eclipse.core.runtime import Path
        
        bundle = Platform.getBundle("org.epics.util")
        url = FileLocator.find(bundle, Path("bin"), None)
        if url:
            # While in the IDE, the plugin classes are in a bin subdir
            sys.path.append(FileLocator.resolve(url).getPath())
        else:
            # In an exported product, the classes are at the root
            sys.path.append(FileLocator.getBundleFile(bundle).getPath())
        
        bundle = Platform.getBundle("org.csstudio.ndarray")
        url = FileLocator.find(bundle, Path("bin"), None)
        if url:
            sys.path.append(FileLocator.resolve(url).getPath())
        else:
            sys.path.append(FileLocator.getBundleFile(bundle).getPath())
    except:
        # Not running under Eclipse