Package org.csstudio.opibuilder.util
Class ResourceUtil
java.lang.Object
org.csstudio.opibuilder.util.ResourceUtil
Utility functions for resources.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.static IPath
buildRelativePath
(IPath refPath, IPath fullPath) Build the relative path from a reference path.static IEditorInput
editorInputFromPath
(IPath path) static Cursor
Returns the cursor used during pv copy action.static File
Returns the absolute file represented by thepath
if such file exists.static IFile
getIFileFromIPath
(IPath path) Get the IFile from IPath.static InputStream
getInputStreamFromEditorInput
(IEditorInput editorInput) Returns a stream which can be used to read this editors input data.static IPath
getPathFromString
(String input) Returns IPath from String.static IPath
getPathInEditor
(IEditorInput input) static String
getScreenshotFile
(org.eclipse.gef.GraphicalViewer viewer) static Image
getScreenshotImage
(org.eclipse.gef.GraphicalViewer viewer) Get screenshot image from GraphicalViewerstatic boolean
isExistingLocalFile
(IPath path) static boolean
isExistingWorkspaceFile
(IPath path) static boolean
isExsitingFile
(IPath absolutePath, boolean runInUIJob) If the file on path is an existing file in workspace, local file system or available URL.static InputStream
pathToInputStream
(IPath path) Return theInputStream
of the file that is available on the specified path.static IPath
workspacePathToSysPath
(IPath path) Convert workspace path to OS system path.
-
Constructor Details
-
ResourceUtil
public ResourceUtil()
-
-
Method Details
-
getCopyPvCursor
Returns the cursor used during pv copy action.- Returns:
- the cursor
-
getFile
Returns the absolute file represented by thepath
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
Return theInputStream
of the file that is available on the specified path.- Parameters:
path
- TheIPath
to the file in the workspace, the local file system, or a platform URL- Returns:
- The corresponding
InputStream
. Nevernull
- Throws:
Exception
-
getInputStreamFromEditorInput
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
- Parameters:
path
- the file path- Returns:
- true if the file path is an existing workspace file.
-
isExistingLocalFile
-
buildAbsolutePath
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 modelrelativePath
- the relative path- Returns:
- the absolute path.
-
buildRelativePath
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
-
getPathFromString
Returns IPath from String. -
workspacePathToSysPath
Convert workspace path to OS system path.- Parameters:
path
- the workspace path- Returns:
- the corresponding system path. null if it is not exist.
-
isExsitingFile
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
-
getScreenshotImage
Get screenshot image from GraphicalViewer- Parameters:
viewer
- the GraphicalViewer- Returns:
- the screenshot image
-
getScreenshotFile
- Throws:
Exception
-
getIFileFromIPath
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.
-