Every time resources in the workspace change, a resource change notification is broadcast, and autobuild gets a chance to run. This can become very costly if you are making several changes in succession to the workspace. To avoid these extra builds and notifications, it is very important that you batch all of your workspace changes into a single workspace operation. It is easy to accidentally cause extra builds if you aren’t very careful about batching your changes. For example, even creating and modifying attributes on IMarker objects will cause separate resource change events if they are not batched.
Two different mechanisms are available for batching changes. To run a series of changes in the current thread, use IWorkspaceRunnable. Here is an example of a workspace runnable that creates two folders:
final IFolder folder1 = ..., folder2 = ...;
workspace.run(new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) {
folder1.create(IResource.NONE, true, null);
folder2.create(IResource.NONE, true, null);
}
}, null);
The other mechanism for batching resource changes is a WorkspaceJob. Introduced in Eclipse 3.0, this mechanism is the asynchronous equivalent of IWorkspaceRunnable. When you create and schedule a workspace job, it will perform the changes in a background thread and then cause a single resource change notification and autobuild to occur. Here is sample code using a workspace job:
final IFolder folder1 = ..., folder2 = ...;
Job job = new WorkspaceJob("Creating folders") {
public IStatus runInWorkspace(IProgressMonitor monitor)
throws CoreException {
folder1.create(IResource.NONE, true, null);
folder2.create(IResource.NONE, true, null);
return Status.OK_STATUS;
}
};
job.schedule();
原文:http://wiki.eclipse.org/FAQ_How_do_I_prevent_builds_between_multiple_changes_to_the_workspace%3F
分享到:
相关推荐
1.7 How do I get my program to act like a daemon? 1.8 How can I look at process in the system like ps does? 1.9 Given a pid, how can I tell if it's a running program? 1.10 What's the return value ...
1.6.2 How do I prevent them from occuring? 我怎样避免它们的出现? 1.7 How do I get my program to act like a daemon? 我怎样使我的程序作为守护程序运行? 1.8 How can I look at process in the system like ...
Common System and Software Testing Pitfalls How to Prevent and Mitigate Them 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除
I would like to thank the following people for taking the time to explain things that were unclear to me and for proofreading the document. Andrey A. Chernov Bruce A. Mah Dag-Erling Smørgrav ...
Some changes to the code.17/11/971.2.1- Now, all searches are made in case-insensitive, it could prevent some unexpected responses (no one reported, but...). Some changes to the code (again).20/11/...
How to do it 216 How it works 217 There's more... 217 Managing who Sees Ads 218 Getting ready 218 How to do it 219 How it works 220 There's more... 220 Advanced conditions 221 Inserting ads ...
spelling ,usage,and how to prevent and correct these errors,Every chapter is designed to relate directly to your essay,giving you the knowledge and the know -how you need to secceed. The book is ...
original = META-INF folder / AndroidManifest.xml, which are needed to retain the signature of apks to prevent needing to resign. Used with -c / --copy-original on [b]uild unknown = Files / folders ...
I show you how to use it from the command line and from Eclipse using the Subversive plug-in. Chapter 4:Setuptools:Harnessing Your Code You can’t replicate your work for testing purposes without ...
Eclipse Rich Ajax Platform: Bringing Rich Client to the Web Paperback: 148 pages Publisher: Apress; 1 edition (December 29, 2008) Language: English ISBN-10: 1430218835 ISBN-13: 978-1430218838 ...
- Added a hot Key, F4, to set the auto run flag and run the tests (i.e. set "-r" and then run the tests). - Other minor changes. Release 5.3 build 1018 WIN32 release 16 April 2008 - Added an ...
As a result, banks do not man- age to make a quantitative link to the correlation driving risks and fail to prevent concentrations from accumulating. In this paper, we argue that Bayesian networks ...
Prevent-Screen-Off Featured in: Medium What is this library for? Ideally, when you user is looking at the screen, your application should not turn the screen off. This is huge deal for the ...
<END><br>77,MousePointer.zip 1 simple line of code to show the effects of how the Mouse Pointer changes with the click of a button. <END><br>78,ShutDnCtl.zip This has been tested on Windows 9x,...
In this scenario, since T1 believes it locks the entire table, it might inadvertently make changes to the same row that T2 thought it has locked exclusively. In a multigranular locking environment, ...
Dropout:A Simple Way to Prevent Neural Networks from Overfitting.zip
Before we look at how SQL Server uses and manages its memory, we need to ensure a full understanding of the more common memory related terms. The following definitions will help you understand how SQL...
The Web brought some unique challenges to software developers, most notably the stateless connection between the client and the server. This stateless behavior made it difficult for the model to ...
Common System and Software Testing Pitfalls How to Prevent and Mitigate Them 英文无水印原版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如...
Today, government and business leaders are facing the twin questions of how to prevent similar crises in the future and how to guide their economies through the looming and lengthy process of debt ...