1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 312165: Viewers should clearly indicate whether a folder is excluded

from build
This commit is contained in:
Andrew Gvozdev 2012-01-08 16:18:53 -05:00
parent f9c201f067
commit a98cf9a89d
3 changed files with 15 additions and 12 deletions

View file

@ -600,8 +600,8 @@ ShiftLeftAction.label= S&hift Left
# Decorators
indexedFilesDecorator.label = C/C++ Indexed Files
indexedFilesDecorator.description = Decorates files indexed by C/C++ Indexer.
excludedFile.name = C/C++ Files Excluded from Build
excludedFile.description = Decorates source files excluded from C/C++ build.
excludedFile.name = C/C++ Files and Folders Excluded from Build
excludedFile.description = Decorates source files and folders excluded from C/C++ build.
includeFolderDecorator.name = C/C++ Missing Include Folders
includeFolderDecorator.description = Decorates missing include folders with error/warning indicator.

View file

@ -4071,7 +4071,10 @@
state="true">
<description>%excludedFile.description</description>
<enablement>
<objectClass name="org.eclipse.core.resources.IFile" />
<or>
<objectClass name="org.eclipse.core.resources.IFile" />
<objectClass name="org.eclipse.core.resources.IFolder" />
</or>
</enablement>
</decorator>
<decorator

View file

@ -11,6 +11,8 @@
package org.eclipse.cdt.internal.ui.viewsupport;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.preference.JFacePreferences;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.IDecoration;
@ -31,29 +33,27 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
* renders the label using the qualifier (gray) color.
*/
public class ExcludedFileDecorator implements ILightweightLabelDecorator {
@Override
public void decorate(Object element, IDecoration decoration) {
if (element instanceof IFile) {
IFile resource = (IFile) element;
if (element instanceof IFile || element instanceof IFolder) {
IResource resource = (IResource) element;
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
ICProjectDescription desc = mngr.getProjectDescription(resource.getProject(), false);
if (desc == null)
return;
ICConfigurationDescription conf = desc.getDefaultSettingConfiguration();
ICSourceEntry[] entries = conf.getSourceEntries();
boolean isSource = false;
boolean isUnderSourceRoot = false;
for (ICSourceEntry icSourceEntry : entries) {
if (icSourceEntry.getFullPath().isPrefixOf(resource.getFullPath())) {
isSource = true;
isUnderSourceRoot = true;
break;
}
}
// Only bother to mark items that would be included otherwise
if (isSource && CDataUtil.isExcluded(resource.getFullPath(), entries)) {
if (isUnderSourceRoot && CDataUtil.isExcluded(resource.getFullPath(), entries)) {
decoration.addOverlay(CPluginImages.DESC_OVR_INACTIVE);
decoration.setForegroundColor(JFaceResources.getColorRegistry().get(
JFacePreferences.QUALIFIER_COLOR));
decoration.setForegroundColor(JFaceResources.getColorRegistry().get(JFacePreferences.QUALIFIER_COLOR));
}
}
}
@ -76,4 +76,4 @@ public class ExcludedFileDecorator implements ILightweightLabelDecorator {
public void removeListener(ILabelProviderListener listener) {
// We don't track state changes
}
}
}