Class ResourceUtil

java.lang.Object
org.csstudio.opibuilder.util.ResourceUtil

public class ResourceUtil extends Object
Utility functions for resources.
  • Constructor Details

    • ResourceUtil

      public ResourceUtil()
  • Method Details

    • getCopyPvCursor

      public static Cursor getCopyPvCursor()
      Returns the cursor used during pv copy action.
      Returns:
      the cursor
    • getFile

      public static File getFile(IPath path) throws Exception
      Returns the absolute file represented by the path if such file exists. If it does not exist null is returned.
      Parameters:
      path - the path for which the file is requested
      Returns:
      the absolute file
      Throws:
      Exception - in case of an error
    • pathToInputStream

      public static InputStream pathToInputStream(IPath path) throws Exception
      Return the InputStream of the file that is available on the specified path.
      Parameters:
      path - The IPath to the file in the workspace, the local file system, or a platform URL
      Returns:
      The corresponding InputStream. Never null
      Throws:
      Exception
    • getInputStreamFromEditorInput

      public static InputStream getInputStreamFromEditorInput(IEditorInput editorInput)
      Returns a stream which can be used to read this editors input data.
      Parameters:
      editorInput -
      Returns:
      a stream which can be used to read this editors input data
    • isExistingWorkspaceFile

      public static boolean isExistingWorkspaceFile(IPath path)
      Parameters:
      path - the file path
      Returns:
      true if the file path is an existing workspace file.
    • isExistingLocalFile

      public static boolean isExistingLocalFile(IPath path)
    • buildAbsolutePath

      public static IPath buildAbsolutePath(AbstractWidgetModel model, IPath relativePath)
      Build the absolute path from the file path (without the file name part) of the widget model and the relative path.
      Parameters:
      model - the widget model
      relativePath - the relative path
      Returns:
      the absolute path.
    • buildRelativePath

      public static IPath buildRelativePath(IPath refPath, IPath fullPath)
      Build the relative path from a reference path.
      Parameters:
      refPath - the reference path which does not include the file name.
      fullPath - the absolute full path which includes the file name.
      Returns:
      the relative to path to refPath.
    • getPathInEditor

      public static IPath getPathInEditor(IEditorInput input)
    • getPathFromString

      public static IPath getPathFromString(String input)
      Returns IPath from String.
    • workspacePathToSysPath

      public static IPath workspacePathToSysPath(IPath path)
      Convert workspace path to OS system path.
      Parameters:
      path - the workspace path
      Returns:
      the corresponding system path. null if it is not exist.
    • isExsitingFile

      public static boolean isExsitingFile(IPath absolutePath, boolean runInUIJob)
      If the file on path is an existing file in workspace, local file system or available URL.
      Parameters:
      runInUIJob - true if this method should run as an UI Job. If it is true, this method must be called in UI thread.
    • editorInputFromPath

      public static IEditorInput editorInputFromPath(IPath path)
    • getScreenshotImage

      public static Image getScreenshotImage(org.eclipse.gef.GraphicalViewer viewer)
      Get screenshot image from GraphicalViewer
      Parameters:
      viewer - the GraphicalViewer
      Returns:
      the screenshot image
    • getScreenshotFile

      public static String getScreenshotFile(org.eclipse.gef.GraphicalViewer viewer) throws Exception
      Throws:
      Exception
    • getIFileFromIPath

      public static IFile getIFileFromIPath(IPath path)
      Get the IFile from IPath.
      Parameters:
      path - Path to file in workspace
      Returns:
      the IFile. null if no IFile on the path, file does not exist, internal error.