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:
parent
f9c201f067
commit
a98cf9a89d
3 changed files with 15 additions and 12 deletions
|
@ -600,8 +600,8 @@ ShiftLeftAction.label= S&hift Left
|
||||||
# Decorators
|
# Decorators
|
||||||
indexedFilesDecorator.label = C/C++ Indexed Files
|
indexedFilesDecorator.label = C/C++ Indexed Files
|
||||||
indexedFilesDecorator.description = Decorates files indexed by C/C++ Indexer.
|
indexedFilesDecorator.description = Decorates files indexed by C/C++ Indexer.
|
||||||
excludedFile.name = C/C++ Files Excluded from Build
|
excludedFile.name = C/C++ Files and Folders Excluded from Build
|
||||||
excludedFile.description = Decorates source files excluded from C/C++ build.
|
excludedFile.description = Decorates source files and folders excluded from C/C++ build.
|
||||||
includeFolderDecorator.name = C/C++ Missing Include Folders
|
includeFolderDecorator.name = C/C++ Missing Include Folders
|
||||||
includeFolderDecorator.description = Decorates missing include folders with error/warning indicator.
|
includeFolderDecorator.description = Decorates missing include folders with error/warning indicator.
|
||||||
|
|
||||||
|
|
|
@ -4071,7 +4071,10 @@
|
||||||
state="true">
|
state="true">
|
||||||
<description>%excludedFile.description</description>
|
<description>%excludedFile.description</description>
|
||||||
<enablement>
|
<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>
|
</enablement>
|
||||||
</decorator>
|
</decorator>
|
||||||
<decorator
|
<decorator
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
package org.eclipse.cdt.internal.ui.viewsupport;
|
package org.eclipse.cdt.internal.ui.viewsupport;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IFile;
|
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.preference.JFacePreferences;
|
||||||
import org.eclipse.jface.resource.JFaceResources;
|
import org.eclipse.jface.resource.JFaceResources;
|
||||||
import org.eclipse.jface.viewers.IDecoration;
|
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.
|
* renders the label using the qualifier (gray) color.
|
||||||
*/
|
*/
|
||||||
public class ExcludedFileDecorator implements ILightweightLabelDecorator {
|
public class ExcludedFileDecorator implements ILightweightLabelDecorator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decorate(Object element, IDecoration decoration) {
|
public void decorate(Object element, IDecoration decoration) {
|
||||||
if (element instanceof IFile) {
|
if (element instanceof IFile || element instanceof IFolder) {
|
||||||
IFile resource = (IFile) element;
|
IResource resource = (IResource) element;
|
||||||
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
||||||
ICProjectDescription desc = mngr.getProjectDescription(resource.getProject(), false);
|
ICProjectDescription desc = mngr.getProjectDescription(resource.getProject(), false);
|
||||||
if (desc == null)
|
if (desc == null)
|
||||||
return;
|
return;
|
||||||
ICConfigurationDescription conf = desc.getDefaultSettingConfiguration();
|
ICConfigurationDescription conf = desc.getDefaultSettingConfiguration();
|
||||||
ICSourceEntry[] entries = conf.getSourceEntries();
|
ICSourceEntry[] entries = conf.getSourceEntries();
|
||||||
boolean isSource = false;
|
boolean isUnderSourceRoot = false;
|
||||||
for (ICSourceEntry icSourceEntry : entries) {
|
for (ICSourceEntry icSourceEntry : entries) {
|
||||||
if (icSourceEntry.getFullPath().isPrefixOf(resource.getFullPath())) {
|
if (icSourceEntry.getFullPath().isPrefixOf(resource.getFullPath())) {
|
||||||
isSource = true;
|
isUnderSourceRoot = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Only bother to mark items that would be included otherwise
|
// 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.addOverlay(CPluginImages.DESC_OVR_INACTIVE);
|
||||||
decoration.setForegroundColor(JFaceResources.getColorRegistry().get(
|
decoration.setForegroundColor(JFaceResources.getColorRegistry().get(JFacePreferences.QUALIFIER_COLOR));
|
||||||
JFacePreferences.QUALIFIER_COLOR));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,4 +76,4 @@ public class ExcludedFileDecorator implements ILightweightLabelDecorator {
|
||||||
public void removeListener(ILabelProviderListener listener) {
|
public void removeListener(ILabelProviderListener listener) {
|
||||||
// We don't track state changes
|
// We don't track state changes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue