Eclipse Platform Release 3.7

## org.eclipse.core.resources
Class ResourcesPlugin

    java.lang.Object
      org.eclipse.core.runtime.Plugin
          org.eclipse.core.resources.ResourcesPlugin

All Implemented Interfaces:
  BundleActivator

    public final class ResourcesPlugin

extends Plugin

The plug-in runtime class for the Resources plug-in. This is the starting point for all workspace and resource manipulation. A typical sequence of events would be for a dependent plug-in to call `ResourcesPlugin.getWorkspace()`. Doing so would cause this plug-in to be activated and the workspace (if any) to be loaded from disk and initialized.

Restriction:
  This class is not intended to be instantiated by clients.

Field Summary
`static Object` `FAMILY_AUTO_BUILD` Constant identifying the job family identifier for the background autobuild job.
`static Object` `FAMILY_AUTO_REFRESH` Constant identifying the job family identifier for the background auto-refresh job.
`static Object` `FAMILY_MANUAL_BUILD` Constant identifying the job family identifier for a background build job.
`static Object` `FAMILY_MANUAL_REFRESH` Constant identifying the job family identifier for a background refresh job.
`static String` `PI_RESOURCES` Unique identifier constant (value `"org.eclipse.core.resources"`) for the standard Resources plug-in.
`static String` `PREF_APPLY_FILE_STATE_POLICY` Name of a preference for configuring whether to apply the specified history size policy.
`static String` `PREF_AUTO_BUILDING` Name of a preference for configuring whether the workspace performs auto- builds.
`static String` `PREF_AUTO_REFRESH` Name of a preference for configuring whether the workspace performs auto- refresh.
`static String` `PREF_BUILD_ORDER` Name of a preference for configuring the order projects in the workspace are built.
`static String` `PREF_DEFAULT_BUILD_ORDER` Name of a preference for configuring whether to use the workspace's default order for building projects.
`static String` `PREF_DISABLE_LINKING` Name of a preference for turning off support for linked resources.
`static String` `PREF_ENCODING` Name of a preference indicating the encoding to use when reading text files in the workspace.
`static String` `PREF_FILE_STATE_LONGEVITY` Name of a preference for configuring the maximum number of milliseconds a file state should be kept in the local history
`static String` `PREF_LIGHTWEIGHT_AUTO_REFRESH` Name of a preference for configuring whether out-of-sync resources are automatically asynchronously refreshed, when discovered to be out-of-sync by the workspace.
`static String` `PREF_MAX_BUILD_ITERATIONS` Name of a preference for configuring the maximum number of times that the workspace should rebuild when builders affect projects that have already been built.
`static String` `PREF_MAX_FILE_STATE_SIZE` Name of a preference for configuring the maximum permitted size of a file to be stored in the local history
`static String` `PREF_MAX_FILE_STATES` Name of a preference for configuring the maximum number of states per file that can be stored in the local history.
`static String` `PREF_MAX_NOTIFICATION_DELAY` Deprecated. Do not use.
`static String` `PREF_SEPARATE_DERIVED_ENCODINGS` Name of a preference for configuring whether encodings for derived resources within the project should be stored in a separate derived preference file.
`static String` `PREF_SNAPSHOT_INTERVAL` Name of a preference for configuring the amount of time in milliseconds between automatic workspace snapshots
`static String` `PT_BUILDERS` Simple identifier constant (value `"builders"`) for the builders extension point.
`static String` `PT_FILE_MODIFICATION_VALIDATOR` Simple identifier constant (value `"fileModificationValidator"`) for the file modification validator extension point.
`static String` `PT_FILTER_MATCHERS` Simple identifier constant (value `"filterMatchers"`) for the filter matchers extension point.
`static String` `PT_MARKERS` Simple identifier constant (value `"markers"`) for the markers extension point.
`static String` `PT_MODEL_PROVIDERS` Simple identifier constant (value `"modelProviders"`) for the model providers extension point.
`static String` `PT_MOVE_DELETE_HOOK` Simple identifier constant (value `"moveDeleteHook"`) for the move/delete hook extension point.
`static String` `PT_NATURES` Simple identifier constant (value `"natures"`) for the natures extension point.
`static String` `PT_REFRESH_PROVIDERS` Simple identifier constant (value `"refreshProviders"`) for the auto-refresh refresh providers extension point.
`static String` `PT_TEAM_HOOK` Simple identifier constant (value `"teamHook"`) for the team hook extension point.
`static String` `PT_VARIABLE_PROVIDERS` Simple identifier constant (value `"variableProviders"`) for the variable providers extension point.

Fields inherited from class org.eclipse.core.runtime.Plugin
`PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME`

Constructor Summary
`ResourcesPlugin()` Constructs an instance of this plug-in runtime class.

Method Summary
`static String` `getEncoding()` Returns the encoding to use when reading text files in the workspace.
`static ResourcesPlugin` `getPlugin()` Returns the Resources plug-in.
`static IWorkspace` `getWorkspace()` Returns the workspace.
`void` `start(BundleContext context)` This implementation of the corresponding `BundleActivator` method opens the workspace.
`void` `stop(BundleContext context)` This implementation of the corresponding `BundleActivator` method closes the workspace without saving.

Methods inherited from class org.eclipse.core.runtime.Plugin
`find, find, getBundle, getDescriptor, getLog, getPluginPreferences, getStateLocation, initializeDefaultPluginPreferences, internalInitializeDefaultPluginPreferences, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, shutdown, startup, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### PI_RESOURCES

    public static final String PI_RESOURCES

  Unique identifier constant (value `"org.eclipse.core.resources"`) for the standard Resources plug-in.

  See Also:
    Constant Field Values

### PT_BUILDERS

    public static final String PT_BUILDERS

  Simple identifier constant (value `"builders"`) for the builders extension point.

  See Also:
    Constant Field Values

### PT_NATURES

    public static final String PT_NATURES

  Simple identifier constant (value `"natures"`) for the natures extension point.

  See Also:
    Constant Field Values

### PT_MARKERS

    public static final String PT_MARKERS

  Simple identifier constant (value `"markers"`) for the markers extension point.

  See Also:
    Constant Field Values

### PT_FILE_MODIFICATION_VALIDATOR

    public static final String PT_FILE_MODIFICATION_VALIDATOR

  Simple identifier constant (value `"fileModificationValidator"`) for the file modification validator extension point.

  See Also:
    Constant Field Values

### PT_MOVE_DELETE_HOOK

    public static final String PT_MOVE_DELETE_HOOK

  Simple identifier constant (value `"moveDeleteHook"`) for the move/delete hook extension point.

  Since:
    2.0
  See Also:
    Constant Field Values

### PT_TEAM_HOOK

    public static final String PT_TEAM_HOOK

  Simple identifier constant (value `"teamHook"`) for the team hook extension point.

  Since:
    2.1
  See Also:
    Constant Field Values

### PT_REFRESH_PROVIDERS

    public static final String PT_REFRESH_PROVIDERS

  Simple identifier constant (value `"refreshProviders"`) for the auto-refresh refresh providers extension point.

  Since:
    3.0
  See Also:
    Constant Field Values

### PT_MODEL_PROVIDERS

    public static final String PT_MODEL_PROVIDERS

  Simple identifier constant (value `"modelProviders"`) for the model providers extension point.

  Since:
    3.2
  See Also:
    Constant Field Values

### PT_VARIABLE_PROVIDERS

    public static final String PT_VARIABLE_PROVIDERS

  Simple identifier constant (value `"variableProviders"`) for the variable providers extension point.

  Since:
    3.6
  See Also:
    Constant Field Values

### PT_FILTER_MATCHERS

    public static final String PT_FILTER_MATCHERS

  Simple identifier constant (value `"filterMatchers"`) for the filter matchers extension point.

  Since:
    3.6
  See Also:
    Constant Field Values

### FAMILY_AUTO_BUILD

    public static final Object FAMILY_AUTO_BUILD

  Constant identifying the job family identifier for the background autobuild job.

  Since:
    3.0
  See Also:
    `IJobManager.join(Object, IProgressMonitor)`

### FAMILY_AUTO_REFRESH

    public static final Object FAMILY_AUTO_REFRESH

  Constant identifying the job family identifier for the background auto-refresh job.

  Since:
    3.1
  See Also:
    `IJobManager.join(Object, IProgressMonitor)`

### FAMILY_MANUAL_BUILD

    public static final Object FAMILY_MANUAL_BUILD

  Constant identifying the job family identifier for a background build job. All clients that schedule background jobs for performing builds should include this job family in their implementation of `belongsTo`.

  Since:
    3.0
  See Also:
    `IJobManager.join(Object, IProgressMonitor)`, `Job.belongsTo(Object)`

### FAMILY_MANUAL_REFRESH

    public static final Object FAMILY_MANUAL_REFRESH

  Constant identifying the job family identifier for a background refresh job. All clients that schedule background jobs for performing refreshing should include this job family in their implementation of `belongsTo`.

  Since:
    3.4
  See Also:
    `IJobManager.join(Object, IProgressMonitor)`, `Job.belongsTo(Object)`

### PREF_ENCODING

    public static final String PREF_ENCODING

  Name of a preference indicating the encoding to use when reading text files in the workspace. The value is a string, and may be the default empty string, indicating that the file system encoding should be used instead. The file system encoding can be retrieved using `System.getProperty("file.encoding")`. There is also a convenience method `getEncoding` which returns the value of this preference, or the file system encoding if this preference is not set.

  Note that there is no guarantee that the value is a supported encoding. Callers should be prepared to handle `UnsupportedEncodingException` where this encoding is used.

  See Also:
    `getEncoding()`, `UnsupportedEncodingException`, Constant Field Values

### PREF_MAX_NOTIFICATION_DELAY

    public static final String PREF_MAX_NOTIFICATION_DELAY

  Deprecated. Do not use.
  Since:
    3.0
  See Also:
    Constant Field Values

### PREF_AUTO_BUILDING

    public static final String PREF_AUTO_BUILDING

  Name of a preference for configuring whether the workspace performs auto- builds.

  Since:
    2.1
  See Also:
    `IWorkspaceDescription.isAutoBuilding()`, `IWorkspaceDescription.setAutoBuilding(boolean)`, Constant Field Values

### PREF_BUILD_ORDER

    public static final String PREF_BUILD_ORDER

  Name of a preference for configuring the order projects in the workspace are built.

  Since:
    2.1
  See Also:
    `IWorkspaceDescription.getBuildOrder()`, `IWorkspaceDescription.setBuildOrder(String[])`, Constant Field Values

### PREF_DEFAULT_BUILD_ORDER

    public static final String PREF_DEFAULT_BUILD_ORDER

  Name of a preference for configuring whether to use the workspace's default order for building projects.

  Since:
    2.1
  See Also:
    Constant Field Values

### PREF_MAX_BUILD_ITERATIONS

    public static final String PREF_MAX_BUILD_ITERATIONS

  Name of a preference for configuring the maximum number of times that the workspace should rebuild when builders affect projects that have already been built.

  Since:
    2.1
  See Also:
    `IWorkspaceDescription.getMaxBuildIterations()`, `IWorkspaceDescription.setMaxBuildIterations(int)`, Constant Field Values

### PREF_APPLY_FILE_STATE_POLICY

    public static final String PREF_APPLY_FILE_STATE_POLICY

  Name of a preference for configuring whether to apply the specified history size policy.

  Since:
    3.6
  See Also:
    `IWorkspaceDescription.isApplyFileStatePolicy()`, `IWorkspaceDescription.setApplyFileStatePolicy(boolean)`, Constant Field Values

### PREF_FILE_STATE_LONGEVITY

    public static final String PREF_FILE_STATE_LONGEVITY

  Name of a preference for configuring the maximum number of milliseconds a file state should be kept in the local history

  Since:
    2.1
  See Also:
    `IWorkspaceDescription.getFileStateLongevity()`, `IWorkspaceDescription.setFileStateLongevity(long)`, Constant Field Values

### PREF_MAX_FILE_STATE_SIZE

    public static final String PREF_MAX_FILE_STATE_SIZE

  Name of a preference for configuring the maximum permitted size of a file to be stored in the local history

  Since:
    2.1
  See Also:
    `IWorkspaceDescription.getMaxFileStateSize()`, `IWorkspaceDescription.setMaxFileStateSize(long)`, Constant Field Values

### PREF_MAX_FILE_STATES

    public static final String PREF_MAX_FILE_STATES

  Name of a preference for configuring the maximum number of states per file that can be stored in the local history.

  Since:
    2.1
  See Also:
    `IWorkspaceDescription.getMaxFileStates()`, `IWorkspaceDescription.setMaxFileStates(int)`, Constant Field Values

### PREF_SNAPSHOT_INTERVAL

    public static final String PREF_SNAPSHOT_INTERVAL

  Name of a preference for configuring the amount of time in milliseconds between automatic workspace snapshots

  Since:
    2.1
  See Also:
    `IWorkspaceDescription.getSnapshotInterval()`, `IWorkspaceDescription.setSnapshotInterval(long)`, Constant Field Values

### PREF_DISABLE_LINKING

    public static final String PREF_DISABLE_LINKING

  Name of a preference for turning off support for linked resources. When this preference is set to "true", attempting to create linked resources will fail.

  Since:
    2.1
  See Also:
    Constant Field Values

### PREF_AUTO_REFRESH

    public static final String PREF_AUTO_REFRESH

  Name of a preference for configuring whether the workspace performs auto- refresh. Auto-refresh installs a file-system listener, or performs periodic file-system polling to actively discover changes in the resource hierarchy.

  Since:
    3.0
  See Also:
    Constant Field Values

### PREF_LIGHTWEIGHT_AUTO_REFRESH

    public static final String PREF_LIGHTWEIGHT_AUTO_REFRESH

  Name of a preference for configuring whether out-of-sync resources are automatically asynchronously refreshed, when discovered to be out-of-sync by the workspace.

  This preference suppresses out-of-sync CoreException for some read methods, including: `IFile.getContents()` & `IFile.getContentDescription()`.

  In the future the workspace may enable other lightweight auto-refresh mechanisms when this preference is true. (The existing `PREF_AUTO_REFRESH` will continue to enable filesystem hooks and the existing polling based monitor.)

  See the discussion: https://bugs.eclipse.org/303517

  Since:
    3.7
  See Also:
    Constant Field Values

### PREF_SEPARATE_DERIVED_ENCODINGS

    public static final String PREF_SEPARATE_DERIVED_ENCODINGS

  Name of a preference for configuring whether encodings for derived resources within the project should be stored in a separate derived preference file.

  Since:
    3.7
  See Also:
    Constant Field Values

Constructor Detail

### ResourcesPlugin

    public ResourcesPlugin()

  Constructs an instance of this plug-in runtime class.

  An instance of this plug-in runtime class is automatically created when the facilities provided by the Resources plug-in are required. Clients must never explicitly instantiate a plug-in runtime class.

Method Detail

### getEncoding

    public static String getEncoding()

  Returns the encoding to use when reading text files in the workspace. This is the value of the `PREF_ENCODING` preference, or the file system encoding (`System.getProperty("file.encoding")`) if the preference is not set.

  Note that this method does not check whether the result is a supported encoding. Callers should be prepared to handle `UnsupportedEncodingException` where this encoding is used.

  Returns:
    the encoding to use when reading text files in the workspace
  See Also:
    `UnsupportedEncodingException`

### getPlugin

    public static ResourcesPlugin getPlugin()

  Returns the Resources plug-in.

  Returns:
    the single instance of this plug-in runtime class

### getWorkspace

    public static IWorkspace getWorkspace()

  Returns the workspace. The workspace is not accessible after the resources plug-in has shutdown.

  Returns:
    the workspace that was created by the single instance of this plug-in class.

### stop

    public void stop(BundleContext context)
              throws Exception

  This implementation of the corresponding `BundleActivator` method closes the workspace without saving.

  Specified by:
    `stop` in interface `BundleActivator`
  Overrides:
    `stop` in class `Plugin`
  Parameters:
    `context` - the bundle context for this plug-in
  Throws:
    `Exception` - if this method fails to shut down this plug-in
  See Also:
    `BundleActivator.stop(BundleContext)`

### start

    public void start(BundleContext context)
               throws Exception

  This implementation of the corresponding `BundleActivator` method opens the workspace.

  Specified by:
    `start` in interface `BundleActivator`
  Overrides:
    `start` in class `Plugin`
  Parameters:
    `context` - the bundle context for this plug-in
  Throws:
    `Exception` - if this plug-in did not start up properly
  See Also:
    `BundleActivator.start(BundleContext)`

Eclipse Platform Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.