@Override public ProcessingItem[] process(final CompileContext context, final ProcessingItem[] items) { context.getProgressIndicator().setText(myValidator.getProgressIndicatorText()); final List<ProcessingItem> processedItems = new ArrayList<ProcessingItem>(); final List<LocalInspectionTool> inspections = new ArrayList<LocalInspectionTool>(); for (final Class aClass : myValidator.getInspectionToolClasses(context)) { try { inspections.add((LocalInspectionTool) aClass.newInstance()); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new Error(e); } } for (int i = 0; i < items.length; i++) { final MyValidatorProcessingItem item = (MyValidatorProcessingItem) items[i]; context.getProgressIndicator().checkCanceled(); context.getProgressIndicator().setFraction((double) i / items.length); try { ourCompilationThreads.set(Boolean.TRUE); if (checkFile(inspections, item, context)) { processedItems.add(item); } } finally { ourCompilationThreads.set(Boolean.FALSE); } } return processedItems.toArray(new ProcessingItem[processedItems.size()]); }
public static boolean isCompilationThread() { return ourCompilationThreads.get().booleanValue(); }