mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Decorate absent external translation units
This commit is contained in:
parent
b0317c09ed
commit
4036cd3084
3 changed files with 57 additions and 0 deletions
|
@ -655,6 +655,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.
|
||||||
|
translationUnitDecorator.label = C/C++ Translation Units
|
||||||
|
translationUnitDecorator.description = Decorates C/C++ translation unit source and header files.
|
||||||
excludedFile.name = C/C++ Files and Folders Excluded from Build
|
excludedFile.name = C/C++ Files and Folders Excluded from Build
|
||||||
excludedFile.description = Decorates source files and folders 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
|
||||||
|
|
|
@ -4428,6 +4428,17 @@
|
||||||
</or>
|
</or>
|
||||||
</enablement>
|
</enablement>
|
||||||
</decorator>
|
</decorator>
|
||||||
|
<decorator
|
||||||
|
class="org.eclipse.cdt.internal.ui.viewsupport.TranslationUnitDecorator"
|
||||||
|
id="org.eclipse.cdt.ui.translationUnit"
|
||||||
|
label="%translationUnitDecorator.label"
|
||||||
|
lightweight="true"
|
||||||
|
state="true">
|
||||||
|
<description>%translationUnitDecorator.description</description>
|
||||||
|
<enablement>
|
||||||
|
<objectClass name="org.eclipse.cdt.core.model.ITranslationUnit"/>
|
||||||
|
</enablement>
|
||||||
|
</decorator>
|
||||||
<decorator
|
<decorator
|
||||||
adaptable="true"
|
adaptable="true"
|
||||||
class="org.eclipse.cdt.internal.ui.viewsupport.ExcludedFileDecorator"
|
class="org.eclipse.cdt.internal.ui.viewsupport.ExcludedFileDecorator"
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2023 John Dallaway and others.
|
||||||
|
*
|
||||||
|
* This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License 2.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* John Dallaway - initial implementation (#563)
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.ui.viewsupport;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
import org.eclipse.jface.preference.JFacePreferences;
|
||||||
|
import org.eclipse.jface.resource.JFaceResources;
|
||||||
|
import org.eclipse.jface.viewers.BaseLabelProvider;
|
||||||
|
import org.eclipse.jface.viewers.IDecoration;
|
||||||
|
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
|
||||||
|
import org.eclipse.swt.graphics.Color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decorates translation unit source and header files
|
||||||
|
*/
|
||||||
|
public final class TranslationUnitDecorator extends BaseLabelProvider implements ILightweightLabelDecorator {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLabelProperty(Object element, String property) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void decorate(Object element, IDecoration decoration) {
|
||||||
|
// if an external translation unit source file that is not present locally
|
||||||
|
if (element instanceof ITranslationUnit tu && (null == tu.getResource()) && !tu.exists()) {
|
||||||
|
// decorate label to indicate file is absent
|
||||||
|
Color color = JFaceResources.getColorRegistry().get(JFacePreferences.QUALIFIER_COLOR);
|
||||||
|
decoration.setForegroundColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue