@@ -234,41 +234,26 @@ static ThreadJob joinRun(ThreadJob threadJob, IProgressMonitor monitor) {
234234
235235 public static boolean identifyThreadAction () {
236236 String threadName = Thread .currentThread ().getName ();
237- Job [] jobs = Job .getJobManager ().find (null );
238-
239- // Get the job running in the current thread
240- Job currentJob = null ;
241- for (Job job : jobs ) {
242- if (job .getThread () == Thread .currentThread ()) {
243- currentJob = job ;
244- break ;
245- }
246- }
237+ Job currentJob = Job .getJobManager ().currentJob ();
247238
248239 // UI Thread (User interactions)
249- if (threadName . equals ( "main" )) { //$NON-NLS-1$
250- return true ; // This is the UI Thread! (Handling direct user interactions)
240+ if ("main" . equals ( threadName )) { //$NON-NLS-1$
241+ return true ;
251242 }
252243
253244 // Background Worker Threads
254- if (threadName .contains ("Worker" )) { //$NON-NLS-1$
255- if (currentJob != null ) {
256- String jobName = currentJob .getName ();
257-
258- if (jobName .toLowerCase ().contains ("save" ) || jobName .toLowerCase ().contains ("edit" )) { //$NON-NLS-1$ //$NON-NLS-2$
259- return true ; // This thread is handling a FILE SAVE/EDIT operation.
260- } else if (jobName .toLowerCase ().contains ("vcs" ) || jobName .toLowerCase ().contains ("git" ) //$NON-NLS-1$ //$NON-NLS-2$
261- || jobName .toLowerCase ().contains ("commit" )) { //$NON-NLS-1$
262- return true ; // This thread is handling a VCS (Version Control) operation.
263- } else if (jobName .toLowerCase ().contains ("build" ) || jobName .toLowerCase ().contains ("debug" )) { //$NON-NLS-1$ //$NON-NLS-2$
264- return false ; // This thread is handling a BUILD/RUN/DEBUG job.
265- } else {
266- return false ; // This thread is handling an unknown background job
267- }
245+ if (threadName .contains ("Worker" ) && currentJob != null ) { //$NON-NLS-1$
246+ String jobName = currentJob .getName ().toLowerCase ();
247+ if (jobName .contains ("build" )) { //$NON-NLS-1$
248+ // This thread is handling a BUILD job
249+ return false ;
268250 }
251+ // Any other worker-thread job
252+ return false ;
269253 }
270- // If not identified
271- return false ; // Thread not recognized
254+
255+ // Everything else defaults to false
256+ return false ;
272257 }
273258
274259 /**
0 commit comments