Class ResourcesPlugin
- All Implemented Interfaces:
BundleActivator
org.eclipse.core.resources.IWorkspace service. 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
FieldsModifier and TypeFieldDescriptionstatic final booleanDefault setting for "separateDerivedEncodings".static final ObjectConstant identifying the job family identifier for the background autobuild job.static final ObjectConstant identifying the job family identifier for the background auto-refresh job.static final ObjectConstant identifying the job family identifier for a background build job.static final ObjectConstant identifying the job family identifier for a background refresh job.static final ObjectConstant identifying the job family identifier for a background workspace snapshot job.static final StringUnique identifier constant (value"org.eclipse.core.resources") for the standard Resources plug-in.static final StringName of a preference for configuring whether to apply the specified history size policy.static final StringName of a preference for configuring whether the workspace performs auto- builds.static final StringName of a preference for configuring whether the workspace performs auto- refresh.static final StringName of a preference for configuring the order projects in the workspace are built.static final StringName of a preference for configuring whether to use the workspace's default order for building projects.static final StringName of a preference for turning off support for linked resources.static final StringName of a preference indicating the encoding to use when reading text files in the workspace.static final StringName of a preference for configuring the maximum number of milliseconds a file state should be kept in the local historystatic final StringName of a preference for configuring whether derived files should be stored in the local history.static final StringName 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 final StringName 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 final StringName of the preference to set max number of concurrent jobs running the workspace build.static final StringName of a preference for configuring the maximum permitted size of a file to be stored in the local historystatic final StringName of a preference for configuring the maximum number of states per file that can be stored in the local history.static final StringDeprecated.Do not use.static final StringName of a preference for configuring the marker severity in case project does not specify its encoding.static final StringName of a preference for configuring the marker severity in case project description references an unknown nature.static final StringName of a preference for configuring whether encodings for derived resources within the project should be stored in a separate derived preference file.static final StringName of a preference for configuring the amount of time in milliseconds between automatic workspace snapshotsstatic final StringSimple identifier constant (value"builders") for the builders extension point.static final StringSimple identifier constant (value"fileModificationValidator") for the file modification validator extension point.static final StringSimple identifier constant (value"filterMatchers") for the filter matchers extension point.static final StringSimple identifier constant (value"markers") for the markers extension point.static final StringSimple identifier constant (value"modelProviders") for the model providers extension point.static final StringSimple identifier constant (value"moveDeleteHook") for the move/delete hook extension point.static final StringSimple identifier constant (value"natures") for the natures extension point.static final StringSimple identifier constant (value"refreshProviders") for the auto-refresh refresh providers extension point.static final StringSimple identifier constant (value"teamHook") for the team hook extension point.static final StringSimple 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns the encoding to use when reading text files in the workspace.static ResourcesPluginReturns the Resources plug-in.static IWorkspaceReturns the workspace.voidstart(BundleContext context) This implementation of the correspondingBundleActivatormethod opens the workspace.voidstop(BundleContext context) This implementation of the correspondingBundleActivatormethod closes the workspace without saving.Methods inherited from class org.eclipse.core.runtime.Plugin
find, find, getBundle, getLog, getPluginPreferences, getStateLocation, initializeDefaultPluginPreferences, internalInitializeDefaultPluginPreferences, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, shutdown, startup, toString
-
Field Details
-
PI_RESOURCES
Unique identifier constant (value"org.eclipse.core.resources") for the standard Resources plug-in.- See Also:
-
PT_BUILDERS
Simple identifier constant (value"builders") for the builders extension point.- See Also:
-
PT_NATURES
Simple identifier constant (value"natures") for the natures extension point.- See Also:
-
PT_MARKERS
Simple identifier constant (value"markers") for the markers extension point.- See Also:
-
PT_FILE_MODIFICATION_VALIDATOR
Simple identifier constant (value"fileModificationValidator") for the file modification validator extension point.- See Also:
-
PT_MOVE_DELETE_HOOK
Simple identifier constant (value"moveDeleteHook") for the move/delete hook extension point.- Since:
- 2.0
- See Also:
-
PT_TEAM_HOOK
Simple identifier constant (value"teamHook") for the team hook extension point.- Since:
- 2.1
- See Also:
-
PT_REFRESH_PROVIDERS
Simple identifier constant (value"refreshProviders") for the auto-refresh refresh providers extension point.- Since:
- 3.0
- See Also:
-
PT_MODEL_PROVIDERS
Simple identifier constant (value"modelProviders") for the model providers extension point.- Since:
- 3.2
- See Also:
-
PT_VARIABLE_PROVIDERS
Simple identifier constant (value"variableProviders") for the variable providers extension point.- Since:
- 3.6
- See Also:
-
PT_FILTER_MATCHERS
Simple identifier constant (value"filterMatchers") for the filter matchers extension point.- Since:
- 3.6
- See Also:
-
FAMILY_AUTO_BUILD
Constant identifying the job family identifier for the background autobuild job.- Since:
- 3.0
- See Also:
-
FAMILY_AUTO_REFRESH
Constant identifying the job family identifier for the background auto-refresh job.- Since:
- 3.1
- See Also:
-
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 ofbelongsTo.- Since:
- 3.0
- See Also:
-
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 ofbelongsTo.- Since:
- 3.4
- See Also:
-
FAMILY_SNAPSHOT
Constant identifying the job family identifier for a background workspace snapshot job. All clients that schedule background jobs for performing background workspace snapshots should include this job family in their implementation ofbelongsTo.- Since:
- 3.21
- See Also:
-
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 usingSystem.getProperty("file.encoding")before Java 18, and usingSystem.getProperty("native.encoding") with Java 18 and higher versions. There is also a convenience methodgetEncodingwhich 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
UnsupportedEncodingExceptionwhere this encoding is used.- See Also:
-
PREF_MAX_NOTIFICATION_DELAY
Deprecated.Do not use.- Since:
- 3.0
- See Also:
-
PREF_AUTO_BUILDING
Name of a preference for configuring whether the workspace performs auto- builds.- Since:
- 2.1
- See Also:
-
PREF_BUILD_ORDER
Name of a preference for configuring the order projects in the workspace are built.- Since:
- 2.1
- See Also:
-
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:
-
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:
-
PREF_APPLY_FILE_STATE_POLICY
Name of a preference for configuring whether to apply the specified history size policy.- Since:
- 3.6
- See Also:
-
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:
-
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:
-
PREF_KEEP_DERIVED_STATE
Name of a preference for configuring whether derived files should be stored in the local history.- Since:
- 3.15
- See Also:
-
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:
-
PREF_SNAPSHOT_INTERVAL
Name of a preference for configuring the amount of time in milliseconds between automatic workspace snapshots- Since:
- 2.1
- See Also:
-
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:
-
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:
-
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
See the discussion: https://bugs.eclipse.org/303517PREF_AUTO_REFRESHwill continue to enable filesystem hooks and the existing polling based monitor.)- Since:
- 3.7
- See Also:
-
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:
-
DEFAULT_PREF_SEPARATE_DERIVED_ENCODINGS
public static final boolean DEFAULT_PREF_SEPARATE_DERIVED_ENCODINGSDefault setting for "separateDerivedEncodings".- Since:
- 3.9
- See Also:
-
PREF_MISSING_NATURE_MARKER_SEVERITY
Name of a preference for configuring the marker severity in case project description references an unknown nature.- Since:
- 3.13
- See Also:
-
PREF_MISSING_ENCODING_MARKER_SEVERITY
Name of a preference for configuring the marker severity in case project does not specify its encoding.Supported severities are those from
IMarkerand also-1for "ignore".- Since:
- 3.18
- See Also:
-
PREF_MAX_CONCURRENT_BUILDS
Name of the preference to set max number of concurrent jobs running the workspace build.- Since:
- 3.13
- See Also:
-
-
Constructor Details
-
ResourcesPlugin
public ResourcesPlugin()
-
-
Method Details
-
getEncoding
Returns the encoding to use when reading text files in the workspace. This is the value of thePREF_ENCODINGpreference. If the preference is not set, the workspace is not ready yet or any other condition where it could not be determined, returns native file system encoding, as specified bySystem.getProperty("native.encoding")on Java 18 and laterSystem.getProperty("sun.jnu.encoding")on previous Java versions
Note that this method does not check whether the result is a supported encoding. Callers should be prepared to handle
UnsupportedEncodingExceptionwhere this encoding is used.Hint: Using this method might return different results depending on the system state. Code that don't want to be affected from this ambiguities should do the following:
- using any of your favorite techniques (Declarative Services, ServiceTracker, Blueprint, ...) to track the workspace
- Calling workspace.getRoot().getDefaultCharset(false)
- If
nullis returned take the appropriate action, e.g fall back toPlatform.getSystemCharset()
- Returns:
- the encoding to use when reading text files in the workspace
- See Also:
-
getPlugin
Returns the Resources plug-in.- Returns:
- the single instance of this plug-in runtime class
-
getWorkspace
Returns the workspace. The workspace is not accessible after the resources plug-in has shutdown. Hint: Accessing the Workspace in a static way is prone to start-up order problem, please consider using any of your favorite techniques (Declarative Services, ServiceTracker, Blueprint, ...) instead. Please see the documentation ofIWorkspacefor more information.- Returns:
- the workspace that was created by the single instance of this plug-in class.
-
stop
This implementation of the correspondingBundleActivatormethod closes the workspace without saving.- Specified by:
stopin interfaceBundleActivator- Overrides:
stopin classPlugin- Parameters:
context- the bundle context for this plug-in- Throws:
Exception- if this method fails to shut down this plug-in- See Also:
-
start
This implementation of the correspondingBundleActivatormethod opens the workspace.- Specified by:
startin interfaceBundleActivator- Overrides:
startin classPlugin- Parameters:
context- the bundle context for this plug-in- Throws:
Exception- if this plug-in did not start up properly- See Also:
-