diff options
author | Chris Recoskie | 2013-09-23 14:54:33 +0000 |
---|---|---|
committer | Chris Recoskie | 2013-09-26 19:53:25 +0000 |
commit | daa86dd8c1f6fe1d9496953be175ce8a2bc0b7fe (patch) | |
tree | cf1c6986290bbd1db8293c2ec033dab110f5adb0 | |
parent | 501f1e8b0192caceb02e6e48213e21ceb6aa24cc (diff) | |
download | org.eclipse.cdt-cdt_8_1.tar.gz org.eclipse.cdt-cdt_8_1.tar.xz org.eclipse.cdt-cdt_8_1.zip |
Change-Id: Iee639c9ecb6daca06946e57546b0ec9f501655e4
Reviewed-on: https://git.eclipse.org/r/16695
Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
IP-Clean: Chris Recoskie <recoskie@ca.ibm.com>
Tested-by: Chris Recoskie <recoskie@ca.ibm.com>
Reviewed-by: Chris Recoskie <recoskie@ca.ibm.com>
-rw-r--r-- | core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesLabelProvider.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesLabelProvider.java index c163f9cf9a0..79dc1e7e7f7 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/IndexedFilesLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Wind River Systems, Inc. and others. + * Copyright (c) 2008, 2013 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,17 +7,21 @@ * * Contributors: * Markus Schorn - initial API and implementation + * IBM Corporation *******************************************************************************/ package org.eclipse.cdt.internal.ui.viewsupport; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.IDecoration; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.ILightweightLabelDecorator; import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.eclipse.cdt.core.CCProjectNature; +import org.eclipse.cdt.core.CProjectNature; import org.eclipse.cdt.core.index.IIndexFileLocation; import org.eclipse.cdt.core.index.IndexLocationFactory; import org.eclipse.cdt.core.model.ITranslationUnit; @@ -64,15 +68,24 @@ public class IndexedFilesLabelProvider implements ILightweightLabelDecorator { IProject project= null; if (element instanceof IFile) { final IFile file = (IFile) element; - ifl= IndexLocationFactory.getWorkspaceIFL(file); - project= file.getProject(); + project= file.getProject(); + + try { + if (project.hasNature(CProjectNature.C_NATURE_ID) + || project.hasNature(CCProjectNature.CC_NATURE_ID)) { + ifl = IndexLocationFactory.getWorkspaceIFL(file); + } + } catch (CoreException e) { + CUIPlugin.log(e); + } + } else if (element instanceof ITranslationUnit) { final ITranslationUnit tu = (ITranslationUnit) element; ifl= IndexLocationFactory.getIFL(tu); project= tu.getCProject().getProject(); } - if (isIndexed(project, ifl)) { + if (ifl != null && isIndexed(project, ifl)) { decoration.addOverlay(INDEXED, IDecoration.TOP_LEFT); } } |