`
qqjavagood
  • 浏览: 98536 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论
阅读更多

    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

 
0
0
分享到:
评论

相关推荐

    UNIX编程常见问题解答

    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 ...

    Common System and Software Testing Pitfalls How to Prevent and Mitigate epub

    Common System and Software Testing Pitfalls How to Prevent and Mitigate Them 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除

    a project model for the FreeBSD Project.7z

    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 ...

    Sakemail

    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/...

    BURNINTEST--硬件检测工具

    - 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 ...

    apktool documentation

    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 ...

    「安全活动」Spyware,Ransomware_and_Worms._How_to_prevent_the_next_S

    标题中的“「安全活动」Spyware,Ransomware_and_Worms._How_to_prevent_the_next_S”指的是一次关于防范间谍软件(Spyware)、勒索软件(Ransomware)和蠕虫(Worms)的安全研讨会或活动,其目的是教育参与者如何...

    Eclipse Rich Ajax Platform: Bringing Rich Client to the Web

    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 ...

    Android代码-Prevent-Screen-Off

    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 ...

    VB编程资源大全(英文源码 其它)

    <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,...

    微软内部资料-SQL性能优化3

    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, ...

    微软内部资料-SQL性能优化2

    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...

    C Programming

    - **Making Multiple Decisions**: Explanation of how the `switch` statement works and when it's appropriate to use it instead of nested `if` statements. #### Strings The document explains strings, ...

    外文翻译 stus MVC

    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 无水印原版pdf

    Common System and Software Testing Pitfalls How to Prevent and Mitigate Them 英文无水印原版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如...

    麦肯锡2010.01最新报告debt and deleveraging:The global credit bubble and its economic consequences

    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 ...

    数位板压力测试

    • The user should be able to control how applications use the tablet. The user interface must be ef-ficient, consistent, and customizable. 2 DESIGN GOALS While the tablet interface design must ...

Global site tag (gtag.js) - Google Analytics