Atomic workspace changes [message #290730] |
Tue, 30 August 2005 23:34 |
Eclipse User |
|
|
|
Originally posted by: thhal.mailblocks.com
I've tried a couple of different methods to postpone all
IResourceChangeEvents issued from my workspace. None of them works it
seems. I read up on resource change listeners in this article
http://www.eclipse.org/articles/Article-Resource-deltas/reso urce-deltas.html.
It was helpful but it didn't solve my problem.
Here's what I'm trying to do:
I have a long running operation that creates several projects in my
workspace by downloading them from various sources. A lot of
File.create() happens. No matter what I do, at least one project
suddenly shows up in my navigator long before the operation is complete.
If I debug my Eclipse IDE, and set a breakpoint in the
NotificationManager.notify() method, then sure enough, notifications are
issued. They stem from a Workspace.endOperation() call made by
File.create().
I have tried using a WorkspaceModifyOperation, a IWorkspaceRunnable, and
a WorkspaceJob. Setting the IWorkspace.AVOID_UPDATE status doesn't help.
Using the workspace root as an ISchedulingRule doesn't help either.
Is there really no way to make the notifier shut up completely during an
operation?
Regards,
Thomas Hallgren
|
|
|
Re: Atomic workspace changes [message #290741 is a reply to message #290730] |
Wed, 31 August 2005 08:21 |
Eclipse User |
|
|
|
Originally posted by: thhal.mailblocks.com
I figured this one out myself. Perhaps my solution can help someone else
so here it is.
I subclass a WorkspaceJob and in the runInWorkspace method, I suspend
all other jobs, like this:
public IStatus runInWorkspace(IProgressMonitor monitor)
throws CoreException {
IJobManager jobManager = Platform.getJobManager();
// Suspend all other jobs for now. This one is already running
// and will not be affected.
//
jobManager.suspend();
try {
// Do the job here ...
} finally {
jobManager.resume();
}
return Status.OK_STATUS;
}
Regards,
Thomas Hallgren
Thomas Hallgren wrote:
> I've tried a couple of different methods to postpone all
> IResourceChangeEvents issued from my workspace. None of them works it
> seems. I read up on resource change listeners in this article
> http://www.eclipse.org/articles/Article-Resource-deltas/reso urce-deltas.html.
> It was helpful but it didn't solve my problem.
>
> Here's what I'm trying to do:
>
> I have a long running operation that creates several projects in my
> workspace by downloading them from various sources. A lot of
> File.create() happens. No matter what I do, at least one project
> suddenly shows up in my navigator long before the operation is complete.
> If I debug my Eclipse IDE, and set a breakpoint in the
> NotificationManager.notify() method, then sure enough, notifications are
> issued. They stem from a Workspace.endOperation() call made by
> File.create().
>
> I have tried using a WorkspaceModifyOperation, a IWorkspaceRunnable, and
> a WorkspaceJob. Setting the IWorkspace.AVOID_UPDATE status doesn't help.
> Using the workspace root as an ISchedulingRule doesn't help either.
>
> Is there really no way to make the notifier shut up completely during an
> operation?
>
> Regards,
> Thomas Hallgren
|
|
|
Powered by
FUDForum. Page generated in 0.02368 seconds