/* (non-Javadoc) * @see org.eclipse.team.internal.core.BackgroundEventHandler#processEvent(org.eclipse.team.internal.core.BackgroundEventHandler.Event, org.eclipse.core.runtime.IProgressMonitor) */ protected void processEvent(Event event, IProgressMonitor monitor) throws CoreException { switch (event.getType()) { case BackgroundEventHandler.RUNNABLE_EVENT: executeRunnable(event, monitor); break; case MARKERS_CHANGED: // Changes contains all elements that need their labels updated long start = System.currentTimeMillis(); ISynchronizeModelElement[] elements = getChangedElements(event); for (int i = 0; i < elements.length; i++) { ISynchronizeModelElement element = elements[i]; propagateProblemMarkers(element); updateParentLabels(element); } if (Policy.DEBUG_SYNC_MODELS) { long time = System.currentTimeMillis() - start; DateFormat TIME_FORMAT = new SimpleDateFormat("m:ss.SSS"); // $NON-NLS-1$ String took = TIME_FORMAT.format(new Date(time)); System.out.println( took + " for " + elements.length + " files"); // $NON-NLS-1$//$NON-NLS-2$ } break; case BUSY_STATE_CHANGED: BusyStateChangeEvent e = (BusyStateChangeEvent) event; queueForLabelUpdate(e.getElement()); if (e.isBusy()) { // indicate that we want an early dispatch to show busy elements dispatchEarly = true; } break; case RESET: // Perform the reset immediately pendingLabelUpdates.clear(); provider.reset(); break; case SYNC_INFO_SET_CHANGED: // Handle the sync change immediately handleChanges(((SyncInfoSetChangeEvent) event).getEvent(), monitor); default: break; } }
private ISynchronizeModelElement[] getChangedElements(Event event) { if (event.getType() == MARKERS_CHANGED) { return ((MarkerChangeEvent) event).getElements(); } return new ISynchronizeModelElement[0]; }