Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.core.resources
Class WorkspaceJob

java.lang.Object
  extended by 

org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.core.internal.jobs.InternalJob
          extended by 

org.eclipse.core.runtime.jobs.Job
              extended by org.eclipse.core.internal.resources.InternalWorkspaceJob
                  extended by 
org.eclipse.core.resources.WorkspaceJob
All Implemented Interfaces:
Comparable, IAdaptable

public abstract class WorkspaceJob
extends org.eclipse.core.internal.resources.InternalWorkspaceJob

A job that makes an atomic modification to the workspace. Clients must implement the abstract method runInWorkspace instead of the usual Job.run method.

After running a method that modifies resources in the workspace, registered listeners receive after-the-fact notification of what just transpired, in the form of a resource change event. This method allows clients to call a number of methods that modify resources and only have resource change event notifications reported at the end of the entire batch. This mechanism is used to avoid unnecessary builds and notifications.

Platform may decide to perform notifications during the operation. The reason for this is that it is possible for multiple threads to be modifying the workspace concurrently. When one thread finishes modifying the workspace, a notification is required to prevent responsiveness problems, even if the other operation has not yet completed.

A WorkspaceJob is the asynchronous equivalent of IWorkspaceRunnable

Note that the workspace is not locked against other threads during the execution of a workspace job. Other threads can be modifying the workspace concurrently with a workspace job. To obtain exclusive access to a portion of the workspace, set the scheduling rule on the job to be a resource scheduling rule. The interface IResourceRuleFactory is used to create a scheduling rule for a particular workspace modification operation.

Since:
3.0
See Also:
IWorkspaceRunnable, IResourceRuleFactory, IWorkspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor)

Field Summary
 
Fields inherited from class org.eclipse.core.runtime.jobs. Job
ASYNC_FINISH, BUILD, DECORATE, INTERACTIVE, LONG, NONE, RUNNING, SHORT, SLEEPING, WAITING
 
Fields inherited from class org.eclipse.core.internal.jobs.InternalJob
manager
 
Constructor Summary
WorkspaceJob ( String name)
          Creates a new workspace job.
 
Method Summary
abstract   IStatus runInWorkspace ( IProgressMonitor monitor)
          Runs the operation, reporting progress to and accepting cancelation requests from the given progress monitor.
 
Methods inherited from class org.eclipse.core.internal.resources.InternalWorkspaceJob
run
 
Methods inherited from class org.eclipse.core.runtime.jobs. Job
addJobChangeListener, belongsTo, cancel, canceling, done, getJobManager, getName, getPriority, getProperty, getResult, getRule, getState, getThread, isBlocking, isSystem, isUser, join, removeJobChangeListener, schedule, schedule, setName, setPriority, setProgressGroup, setProperty, setRule, setSystem, setThread, setUser, shouldRun, shouldSchedule, sleep, wakeUp, wakeUp
 
Methods inherited from class org.eclipse.core.internal.jobs.InternalJob
compareTo, toString
 
Methods inherited from class org.eclipse.core.runtime. PlatformObject
getAdapter
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.runtime. IAdaptable
getAdapter
 

Constructor Detail

WorkspaceJob

public WorkspaceJob(
String name)
Creates a new workspace job.

Parameters:
name - the name of the job
Method Detail

runInWorkspace

public abstract 
IStatus runInWorkspace(
IProgressMonitor monitor)
                                throws 
CoreException
Runs the operation, reporting progress to and accepting cancelation requests from the given progress monitor.

Implementors of this method should check the progress monitor for cancelation when it is safe and appropriate to do so. The cancelation request should be propagated to the caller by throwing OperationCanceledException.

Specified by:
runInWorkspace in class org.eclipse.core.internal.resources.InternalWorkspaceJob
Parameters:
monitor - a progress monitor, or null if progress reporting and cancelation are not desired
Returns:
the result of running the operation
Throws:
CoreException - if this operation fails.

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

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


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire