/** * 取消C++/C工程的 Index 任务 * @param modelProject * @param jobManager * @throws CoreException */ private List<Job> cancelCPPIndexJob(IProject project) { List<Job> jobs=new ArrayList<Job>(); //过滤非c++的工程 if (project == null || !ILanguageType.LANGUAGE_TYPE_CPP.equals(LanguageTypeUtil.getLanguageType(project))) { return jobs; } Job[] findJobs = Job.getJobManager() .find(CCorePlugin.getIndexManager()); if (findJobs == null) { return jobs; } for (Job job : findJobs) { if (job instanceof PDOMIndexerJob) { IIndexManager indexManager = CCorePlugin.getIndexManager(); if (indexManager instanceof PDOMManager) { Object object = ReflectionUtil.invokeMethod(indexManager, "getIndexer", //$NON-NLS-1$ new Class[] {ICProject.class}, CoreModel.getDefault().create(project)); if (object instanceof IPDOMIndexer) { ((PDOMIndexerJob)job).cancelJobs((IPDOMIndexer)object, true); } } } } return jobs; }