mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
bug 398550: Use platform decorator manager to manage 'custom build settings' decoration
This commit is contained in:
parent
0bd7133168
commit
36dd99f435
5 changed files with 126 additions and 144 deletions
|
@ -606,6 +606,8 @@ 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
|
||||||
includeFolderDecorator.description = Decorates missing include folders with error/warning indicator.
|
includeFolderDecorator.description = Decorates missing include folders with error/warning indicator.
|
||||||
|
CustomBuildSettingsDecorator.name= C/C++ Files and Folders with Customized Build Settings
|
||||||
|
CustomBuildSettingsDecorator.description= Decorates files and folders when build settings are different from parent resource.
|
||||||
|
|
||||||
templatesViewName= Templates
|
templatesViewName= Templates
|
||||||
|
|
||||||
|
|
|
@ -4156,6 +4156,22 @@
|
||||||
</or>
|
</or>
|
||||||
</enablement>
|
</enablement>
|
||||||
</decorator>
|
</decorator>
|
||||||
|
<decorator
|
||||||
|
adaptable="true"
|
||||||
|
class="org.eclipse.cdt.internal.ui.viewsupport.CustomBuildSettingsDecorator"
|
||||||
|
id="org.eclipse.cdt.internal.ui.CustomBuildSettingsDecorator"
|
||||||
|
label="%CustomBuildSettingsDecorator.name"
|
||||||
|
lightweight="true"
|
||||||
|
location="TOP_RIGHT"
|
||||||
|
state="true">
|
||||||
|
<description>%CustomBuildSettingsDecorator.description</description>
|
||||||
|
<enablement>
|
||||||
|
<or>
|
||||||
|
<objectClass name="org.eclipse.core.resources.IFile" />
|
||||||
|
<objectClass name="org.eclipse.core.resources.IFolder" />
|
||||||
|
</or>
|
||||||
|
</enablement>
|
||||||
|
</decorator>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<!-- Hyperlinking support -->
|
<!-- Hyperlinking support -->
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2013, 2013 Andrew Gvozdev 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
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* Andrew Gvozdev - Initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.ui.viewsupport;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IFolder;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.jface.viewers.IDecoration;
|
||||||
|
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||||
|
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines if a file or folder got customized build settings and if so decorates with the "wrench" overlay.
|
||||||
|
*/
|
||||||
|
public class CustomBuildSettingsDecorator implements ILightweightLabelDecorator {
|
||||||
|
@Override
|
||||||
|
public void decorate(Object element, IDecoration decoration) {
|
||||||
|
if (element instanceof IFile || element instanceof IFolder) {
|
||||||
|
IResource rc = (IResource) element;
|
||||||
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(rc.getProject(), false);
|
||||||
|
if (prjDescription != null) {
|
||||||
|
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
||||||
|
if (cfgDescription != null) {
|
||||||
|
if (isCustomizedResource(cfgDescription, rc))
|
||||||
|
decoration.addOverlay(CPluginImages.DESC_OVR_SETTING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isCustomizedResource(ICConfigurationDescription cfgDescription, IResource rc) {
|
||||||
|
if (!ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(rc.getProject())) {
|
||||||
|
ICResourceDescription rcDescription = cfgDescription.getResourceDescription(rc.getProjectRelativePath(), true);
|
||||||
|
return rcDescription != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
for (ILanguageSettingsProvider provider: ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders()) {
|
||||||
|
for (String languageId : LanguageSettingsManager.getLanguages(rc, cfgDescription)) {
|
||||||
|
List<ICLanguageSettingEntry> list = provider.getSettingEntries(cfgDescription, rc, languageId);
|
||||||
|
if (list != null) {
|
||||||
|
List<ICLanguageSettingEntry> listDefault = provider.getSettingEntries(cfgDescription, rc.getParent(), languageId);
|
||||||
|
// != is OK here due as the equal lists will have the same reference in WeakHashSet
|
||||||
|
if (list != listDefault)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addListener(ILabelProviderListener listener) {
|
||||||
|
// We don't track state changes
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isLabelProperty(Object element, String property) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeListener(ILabelProviderListener listener) {
|
||||||
|
// We don't track state changes
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2010 IBM Corporation and others.
|
* Copyright (c) 2000, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,10 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.viewsupport;
|
package org.eclipse.cdt.internal.ui.viewsupport;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IProject;
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceStatus;
|
import org.eclipse.core.resources.IResourceStatus;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -30,20 +27,10 @@ import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.ui.texteditor.MarkerUtilities;
|
import org.eclipse.ui.texteditor.MarkerUtilities;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
|
||||||
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ISourceRange;
|
import org.eclipse.cdt.core.model.ISourceRange;
|
||||||
import org.eclipse.cdt.core.model.ISourceReference;
|
import org.eclipse.cdt.core.model.ISourceReference;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
|
||||||
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
|
@ -98,7 +85,6 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
|
|
||||||
private static final int ERRORTICK_WARNING= CElementImageDescriptor.WARNING;
|
private static final int ERRORTICK_WARNING= CElementImageDescriptor.WARNING;
|
||||||
private static final int ERRORTICK_ERROR= CElementImageDescriptor.ERROR;
|
private static final int ERRORTICK_ERROR= CElementImageDescriptor.ERROR;
|
||||||
private static final int TICK_CONFIGURATION = CElementImageDescriptor.SETTINGS;
|
|
||||||
|
|
||||||
private ImageDescriptorRegistry fRegistry;
|
private ImageDescriptorRegistry fRegistry;
|
||||||
private boolean fUseNewRegistry= false;
|
private boolean fUseNewRegistry= false;
|
||||||
|
@ -114,15 +100,13 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
fUseNewRegistry= true;
|
fUseNewRegistry= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Creates decorator with a shared image registry.
|
* Creates decorator with a shared image registry.
|
||||||
|
* Note: This constructor is for internal use only. Clients should not call this constructor.
|
||||||
*
|
*
|
||||||
* @param registry The registry to use or <code>null</code> to use the Java plugin's
|
* @param registry The registry to use or <code>null</code> to use the Java plugin's
|
||||||
* image registry.
|
* image registry.
|
||||||
*/
|
*/
|
||||||
/**
|
|
||||||
* Note: This constructor is for internal use only. Clients should not call this constructor.
|
|
||||||
*/
|
|
||||||
public ProblemsLabelDecorator(ImageDescriptorRegistry registry) {
|
public ProblemsLabelDecorator(ImageDescriptorRegistry registry) {
|
||||||
fRegistry= registry;
|
fRegistry= registry;
|
||||||
fProblemChangedListener= null;
|
fProblemChangedListener= null;
|
||||||
|
@ -136,17 +120,11 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see ILabelDecorator#decorateText(String, Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String decorateText(String text, Object element) {
|
public String decorateText(String text, Object element) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see ILabelDecorator#decorateImage(Image, Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Image decorateImage(Image image, Object obj) {
|
public Image decorateImage(Image image, Object obj) {
|
||||||
int adornmentFlags= computeAdornmentFlags(obj);
|
int adornmentFlags= computeAdornmentFlags(obj);
|
||||||
|
@ -169,9 +147,9 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ICElement.C_PROJECT:
|
case ICElement.C_PROJECT:
|
||||||
case ICElement.C_CCONTAINER:
|
case ICElement.C_CCONTAINER:
|
||||||
return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_INFINITE, null) | getTicks(element.getResource());
|
return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_INFINITE, null);
|
||||||
case ICElement.C_UNIT:
|
case ICElement.C_UNIT:
|
||||||
return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_ONE, null) | getTicks(element.getResource());
|
return getErrorTicksFromMarkers(element.getResource(), IResource.DEPTH_ONE, null);
|
||||||
case ICElement.C_FUNCTION:
|
case ICElement.C_FUNCTION:
|
||||||
case ICElement.C_CLASS:
|
case ICElement.C_CLASS:
|
||||||
case ICElement.C_UNION:
|
case ICElement.C_UNION:
|
||||||
|
@ -185,14 +163,9 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (obj instanceof IResource) {
|
} else if (obj instanceof IResource) {
|
||||||
return getErrorTicksFromMarkers((IResource) obj, IResource.DEPTH_INFINITE, null) | getTicks((IResource)obj);
|
return getErrorTicksFromMarkers((IResource) obj, IResource.DEPTH_INFINITE, null);
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
if (e instanceof CModelException) {
|
|
||||||
// if (((CModelException) e).isDoesNotExist()) {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
if (e.getStatus().getCode() == IResourceStatus.MARKER_NOT_FOUND) {
|
if (e.getStatus().getCode() == IResourceStatus.MARKER_NOT_FOUND) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -240,42 +213,6 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// private int getErrorTicksFromWorkingCopy(ITranslationUnit original, ISourceReference sourceElement) throws CoreException {
|
|
||||||
// int info= 0;
|
|
||||||
// FileEditorInput editorInput= new FileEditorInput((IFile) original.getResource());
|
|
||||||
// IAnnotationModel model= CUIPlugin.getDefault().getTranslationUnitDocumentProvider().getAnnotationModel(editorInput);
|
|
||||||
// if (model != null) {
|
|
||||||
// Iterator iter= model.getAnnotationIterator();
|
|
||||||
// while ((info != ERRORTICK_ERROR) && iter.hasNext()) {
|
|
||||||
// Annotation curr= (Annotation) iter.next();
|
|
||||||
// IMarker marker= isAnnotationInRange(model, curr, sourceElement);
|
|
||||||
// if (marker != null) {
|
|
||||||
// int priority= marker.getAttribute(IMarker.SEVERITY, -1);
|
|
||||||
// if (priority == IMarker.SEVERITY_WARNING) {
|
|
||||||
// info= ERRORTICK_WARNING;
|
|
||||||
// } else if (priority == IMarker.SEVERITY_ERROR) {
|
|
||||||
// info= ERRORTICK_ERROR;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return info;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private IMarker isAnnotationInRange(IAnnotationModel model, Annotation annot, ISourceReference sourceElement) throws CoreException {
|
|
||||||
// if (annot instanceof MarkerAnnotation) {
|
|
||||||
// IMarker marker= ((MarkerAnnotation) annot).getMarker();
|
|
||||||
// if (marker.exists() && marker.isSubtypeOf(IMarker.PROBLEM)) {
|
|
||||||
// Position pos= model.getPosition(annot);
|
|
||||||
// if (pos != null && (sourceElement == null || isInside(pos.getOffset(), -1, sourceElement))) {
|
|
||||||
// return marker;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests if a position is inside the source range of an element. Usually this is done
|
* Tests if a position is inside the source range of an element. Usually this is done
|
||||||
* by looking at the offset. In case the offset equals <code>-1</code>, the line is
|
* by looking at the offset. In case the offset equals <code>-1</code>, the line is
|
||||||
|
@ -300,9 +237,6 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see IBaseLabelProvider#dispose()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
if (fProblemChangedListener != null) {
|
if (fProblemChangedListener != null) {
|
||||||
|
@ -314,17 +248,11 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see IBaseLabelProvider#isLabelProperty(Object, String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLabelProperty(Object element, String property) {
|
public boolean isLabelProperty(Object element, String property) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see IBaseLabelProvider#addListener(ILabelProviderListener)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void addListener(ILabelProviderListener listener) {
|
public void addListener(ILabelProviderListener listener) {
|
||||||
if (fListeners == null) {
|
if (fListeners == null) {
|
||||||
|
@ -342,9 +270,6 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see IBaseLabelProvider#removeListener(ILabelProviderListener)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void removeListener(ILabelProviderListener listener) {
|
public void removeListener(ILabelProviderListener listener) {
|
||||||
if (fListeners != null) {
|
if (fListeners != null) {
|
||||||
|
@ -366,68 +291,14 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void decorate(Object element, IDecoration decoration) {
|
public void decorate(Object element, IDecoration decoration) {
|
||||||
int adornmentFlags= computeAdornmentFlags(element);
|
int adornmentFlags= computeAdornmentFlags(element);
|
||||||
|
|
||||||
if ((adornmentFlags & TICK_CONFIGURATION) != 0) {
|
|
||||||
decoration.addOverlay(CPluginImages.DESC_OVR_SETTING);
|
|
||||||
adornmentFlags &= ~TICK_CONFIGURATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (adornmentFlags == ERRORTICK_ERROR) {
|
if (adornmentFlags == ERRORTICK_ERROR) {
|
||||||
decoration.addOverlay(CPluginImages.DESC_OVR_ERROR);
|
decoration.addOverlay(CPluginImages.DESC_OVR_ERROR);
|
||||||
} else if (adornmentFlags == ERRORTICK_WARNING) {
|
} else if (adornmentFlags == ERRORTICK_WARNING) {
|
||||||
decoration.addOverlay(CPluginImages.DESC_OVR_WARNING);
|
decoration.addOverlay(CPluginImages.DESC_OVR_WARNING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isCustomizedResource(ICConfigurationDescription cfgDescription, IResource rc) {
|
|
||||||
if (rc instanceof IProject)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(rc.getProject())) {
|
|
||||||
ICResourceDescription rcDescription = cfgDescription.getResourceDescription(rc.getProjectRelativePath(), true);
|
|
||||||
return rcDescription != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
|
||||||
for (ILanguageSettingsProvider provider: ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders()) {
|
|
||||||
for (String languageId : LanguageSettingsManager.getLanguages(rc, cfgDescription)) {
|
|
||||||
List<ICLanguageSettingEntry> list = provider.getSettingEntries(cfgDescription, rc, languageId);
|
|
||||||
if (list != null) {
|
|
||||||
List<ICLanguageSettingEntry> listDefault = provider.getSettingEntries(cfgDescription, rc.getParent(), languageId);
|
|
||||||
// != is OK here due as the equal lists will have the same reference in WeakHashSet
|
|
||||||
if (list != listDefault)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param rc - resource to check
|
|
||||||
* @return flags {@link TICK_CONFIGURATION} if the resource has custom settings and possibly needs
|
|
||||||
* to be adorned or 0 otherwise.
|
|
||||||
*/
|
|
||||||
private int getTicks (IResource rc) {
|
|
||||||
if (rc == null || rc instanceof IProject)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
int result = 0;
|
|
||||||
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(rc.getProject(), false);
|
|
||||||
if (prjDescription != null) {
|
|
||||||
ICConfigurationDescription cfgDescription = prjDescription.getDefaultSettingConfiguration();
|
|
||||||
if (cfgDescription != null) {
|
|
||||||
if (isCustomizedResource(cfgDescription, rc))
|
|
||||||
result |= TICK_CONFIGURATION;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2009 IBM Corporation and others.
|
* Copyright (c) 2000, 2013 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -20,6 +20,7 @@ import org.eclipse.swt.graphics.ImageData;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
|
import org.eclipse.cdt.internal.ui.viewsupport.CustomBuildSettingsDecorator;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,9 +105,13 @@ public class CElementImageDescriptor extends CompositeImageDescriptor {
|
||||||
/** Flag to render the 'external file' adornment for translation units */
|
/** Flag to render the 'external file' adornment for translation units */
|
||||||
public static final int EXTERNAL_FILE = 0x40000;
|
public static final int EXTERNAL_FILE = 0x40000;
|
||||||
|
|
||||||
/** Flag to render the 'custom settings' adornment
|
/** Flag to render the 'custom settings' adornment. Do not use, this flag has been discontinued.
|
||||||
* @since 5.2 */
|
* @since 5.2
|
||||||
public final static int SETTINGS= 0x80000;
|
* @deprecated The constant has been discontinued since CDT 8.1. The adornment moved to separate class
|
||||||
|
* {@link CustomBuildSettingsDecorator}.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public final static int SETTINGS= 0x80000;
|
||||||
|
|
||||||
private ImageDescriptor fBaseImage;
|
private ImageDescriptor fBaseImage;
|
||||||
private int fFlags;
|
private int fFlags;
|
||||||
|
@ -243,11 +248,6 @@ public class CElementImageDescriptor extends CompositeImageDescriptor {
|
||||||
x -= data.width;
|
x -= data.width;
|
||||||
drawImage(data, x, 0);
|
drawImage(data, x, 0);
|
||||||
}
|
}
|
||||||
if ((fFlags & SETTINGS) != 0) {
|
|
||||||
data = CPluginImages.DESC_OVR_SETTING.getImageData();
|
|
||||||
x -= data.width;
|
|
||||||
drawImage(data, x, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawBottomRight() {
|
private void drawBottomRight() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue