Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to handle changes to workspace outside Eclipse with a Job
How to handle changes to workspace outside Eclipse with a Job [message #334957] Wed, 11 March 2009 19:14
Mikael Petterson is currently offline Mikael PettersonFriend
Messages: 156
Registered: July 2009
Senior Member

We have a StateCacheJobQueue that extends Job. I looked at: .html

I create it with the following snippet:

public void schedule(int jobPriority) {
priority = jobPriority;
StateCacheJobQueue queue = StateCacheFactory.getInstance()

In the StateCacheJobQueue the run is executed ( see below). It then calls
executePendingJobs(). Is it within this method that I should call my
refreshLocal() on the resource to take into account changes in the
workspace that are not made from within Eclipse.

I don't know where to find the information. If this is not the correct
forum please point me in the right direction.

I am really stuck in this matter so all pointers are greatly appreciated.



* (non-Javadoc)
* @see ore.runtime.IProgressMonitor)
protected IStatus run(IProgressMonitor monitor) {
//synchronized in case build starts during checkCancel
synchronized (this) {
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
// if the system is shutting down, don't update
if (systemBundle.getState() == Bundle.STOPPING)
return Status.OK_STATUS;
try {
// if the update was successful then it should not be recorded
// interrupted
interrupted = false;
return Status.OK_STATUS;
} catch (OperationCanceledException e) {
return Status.CANCEL_STATUS;
} catch (CoreException sig) {
return sig.getStatus();

* Executes all pending jobs
* @param monitor
* @throws CoreException
* @throws OperationCanceledException
private void executePendingJobs(IProgressMonitor monitor)
throws CoreException, OperationCanceledException {

try {
monitor.beginTask(MESSAGE_QUEUE_NAME, priorityQueue.size());

while (!priorityQueue.isEmpty()) {


StateCacheJob job = null;

// synchronize on the buffer but execute job outside lock
synchronized (priorityQueue) {
if (!priorityQueue.isEmpty())
job = (StateCacheJob) priorityQueue.remove();

// check if buffer was empty
if (null == job) break;

// execute job
if (null != job.getStateCache().getResource()) {
job.execute(new SubProgressMonitor(monitor, 1));
} finally {
Previous Topic:Trying to figure out how I was supposed to figure this out
Next Topic:XML and Content Types
Goto Forum:

Current Time: Tue Jun 19 18:44:15 GMT 2018

Powered by FUDForum. Page generated in 0.01822 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top