About Access to Plug-in Resources and Workspace Files
Resources in a plug-in are files of images, XML, and properties with configuration data that you want another plug-in to access. Some examples of resources are a database setting that creates a connection, or the loading of an icon that is used in Java code to create a pop-up dialog.
File access is defined as read and write access to files in the Eclipse workspace. The files have data from a plug-in that you want to persist when the plug-in is executed in Sabre Red 360. An example of file access is a plug-in that obtains the path where the files of a specific plug-in are located in the workspace.
The requirements for resource and file access follow:
-
To access resources using the Sabre Red 360 API, your plug-in must define an Activator class and extend AbstractEdgeBasePlugin.
-
You can access resources located only inside your plug-in.
-
You can access files located in the workspace for your plug-in. The API allows access to files from other plug-ins, however, this is not recommended.
Dependencies and Classes
When you are accessing resources in a plug-in, both Eclipse and Sabre Red 360 have defined some dependencies, extension points, and classes that are required to access resources. They are listed below.
Minimum Required Dependencies
-
org.eclipse.ui
-
org.eclipse.core.runtime
-
com.sabre.edge.platform.core.common
Extension Points
Not applicable
Classes
-
Activator
-
Extend com.sabre.edge.platform.core.common.plugin.base.AbstractEdgeBasePlugin.
-
Call the getImageDescriptor() method from your Java code to obtain an instance of the class org.eclipse.jface.resource.ImageDescriptor.
-
To access resources that are not images in your plug-in, call getResourceAsStream() from your Java code. This is in AbstractEdgeBasePlugin.
-
To access a specific file in the workspace directory, use the getDataFile() method.