Bug 49599 Occurrences finder should use a job
Build: 3.0 M6 I noticed that the background task to find occurrences in the file creates a new thread every time, rather than using jobs. This is exactly the situation that jobs were created for (in fact Erich used this as a demo of the job infrastructure at a code camp). Some advantages of changing to jobs: - less overhead (currently a new thread is created per key press, jobs use a thread pool) - better handling of priority (currently running in a thread with same priority as the UI, and thus is competing with UI thread for CPU more than it should) - smarter scheduling. Jobs with "DECORATE" priority are run based on a check of how busy the system is. Thus they do not run immediately if there are other things going on (they will run eventually, just not as quickly). This smooths over bottlenecks when the system is busy. Note that you can prevent this job from showing in the progress view or making the progress animation (cigarette) move by making it a system job (Job.setSystem(true)). Generally jobs that the user didn't explicitly start can be marked as system jobs. If there was a reason why jobs were considered and rejected, I'd be curious to know. If the infrastructure isn't useful to you then I want to fix it.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
removeOccurrenceAnnotations();
		}
	}
	
	protected final static String LINK_COLOR= PreferenceConstants.EDITOR_LINK_COLOR;
	
	protected final static String MATCHING_BRACKETS=  PreferenceConstants.EDITOR_MATCHING_BRACKETS;
	
	protected final static String MATCHING_BRACKETS_COLOR=  PreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR;
	
	private final static String COMPILER_TASK_TAGS= JavaCore.COMPILER_TASK_TAGS;
	
	private final static String BROWSER_LIKE_LINKS= PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS;
	
	private final static String BROWSER_LIKE_LINKS_KEY_MODIFIER= PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER;
	/**
	 * Preference key for key modifier mask of browser like links.
	 * The value is only used if the value of <code>EDITOR_BROWSER_LIKE_LINKS</code>
	 * cannot be resolved to valid SWT modifier bits.
	 * 
	 * @since 2.1.1
	 */
	private final static String BROWSER_LIKE_LINKS_KEY_MODIFIER_MASK= PreferenceConstants.EDITOR_BROWSER_LIKE_LINKS_KEY_MODIFIER_MASK;
	
	protected final static char[] BRACKETS= { '{', '}', '(', ')', '[', ']' };
	
	protected JavaOutlinePage fOutlinePage;
	
	protected String fOutlinerContextMenuId;
	/**