1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

bug 416628: "Export" of entries of language settings providers to referencing projects - added capability

This commit is contained in:
Andrew Gvozdev 2013-09-06 15:13:30 -04:00
parent 90d35a99f0
commit da95189bb4
9 changed files with 250 additions and 48 deletions

View file

@ -1025,6 +1025,49 @@ public class LanguageSettingsSerializableProviderTests extends BaseTestCase {
} }
} }
/**
* Serialization of include path.
*/
public void testEntryFlagsDOM() throws Exception {
Element elementProvider;
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
entries.add(new CIncludePathEntry("path0",
ICSettingEntry.BUILTIN
| ICSettingEntry.READONLY
| ICSettingEntry.LOCAL
| ICSettingEntry.VALUE_WORKSPACE_PATH
| ICSettingEntry.RESOLVED
| ICSettingEntry.UNDEFINED
| ICSettingEntry.FRAMEWORKS_MAC
| ICSettingEntry.EXPORTED
));
{
// create a provider and serialize its settings
LanguageSettingsSerializableProvider provider = new LanguageSettingsSerializableProvider(PROVIDER_1, PROVIDER_NAME_1);
provider.setSettingEntries(null, null, null, entries);
Document doc = XmlUtil.newDocument();
Element rootElement = XmlUtil.appendElement(doc, ELEM_TEST);
elementProvider = provider.serialize(rootElement);
}
{
// re-load and check language settings of the newly loaded provider
LanguageSettingsSerializableProvider provider = new LanguageSettingsSerializableProvider(elementProvider);
assertEquals(PROVIDER_1, provider.getId());
List<ICLanguageSettingEntry> actual = provider.getSettingEntries(null, null, null);
ICLanguageSettingEntry entry = actual.get(0);
assertTrue(entry instanceof CIncludePathEntry);
CIncludePathEntry includePathEntry = (CIncludePathEntry)entry;
assertEquals(entries.get(0).getName(), includePathEntry.getName());
assertEquals(entries.get(0).getValue(), includePathEntry.getValue());
assertEquals(entries.get(0).getKind(), includePathEntry.getKind());
assertEquals(entries.get(0).getFlags(), includePathEntry.getFlags());
assertEquals(entries.get(0), includePathEntry);
}
}
/** /**
* Serialization of entries for default and specific languages together. * Serialization of entries for default and specific languages together.
*/ */

View file

@ -388,6 +388,13 @@
kind="includePath" kind="includePath"
name="/test/include/path"> name="/test/include/path">
</entry> </entry>
<entry
kind="includePath"
name="/test/include/exported">
<flag
value="EXPORTED">
</flag>
</entry>
<entry <entry
kind="includePath" kind="includePath"
name="/test/workspace/include/path"> name="/test/workspace/include/path">

View file

@ -79,6 +79,15 @@ public interface ICSettingEntry {
*/ */
int FRAMEWORKS_MAC = 1 << 6; int FRAMEWORKS_MAC = 1 << 6;
/**
* Flag {@code UNDEFINED} indicates that the entry is "Exported" to referencing projects.
* It will be passed to the projects configurations referencing the configuration the entry
* belongs to.
*
* @since 5.6
*/
int EXPORTED = 1 << 7;
int INCLUDE_PATH = 1; int INCLUDE_PATH = 1;
int INCLUDE_FILE = 1 << 1; int INCLUDE_FILE = 1 << 1;
int MACRO = 1 << 2; int MACRO = 1 << 2;

View file

@ -54,6 +54,7 @@ public class LanguageSettingEntriesSerializer {
public static final String RESOLVED = "RESOLVED"; //$NON-NLS-1$ public static final String RESOLVED = "RESOLVED"; //$NON-NLS-1$
private static final String UNDEFINED = "UNDEFINED"; //$NON-NLS-1$ private static final String UNDEFINED = "UNDEFINED"; //$NON-NLS-1$
private static final String FRAMEWORK = "FRAMEWORK"; //$NON-NLS-1$ private static final String FRAMEWORK = "FRAMEWORK"; //$NON-NLS-1$
private static final String EXPORTED = "EXPORTED"; //$NON-NLS-1$
public static final String FLAGS_SEPARATOR = "|"; //$NON-NLS-1$ public static final String FLAGS_SEPARATOR = "|"; //$NON-NLS-1$
@ -270,6 +271,12 @@ public class LanguageSettingEntriesSerializer {
buf.append(FRAMEWORK); buf.append(FRAMEWORK);
} }
if ((flags & ICLanguageSettingEntry.EXPORTED) != 0) {
if (buf.length() != 0)
buf.append(FLAGS_SEPARATOR);
buf.append(EXPORTED);
}
return buf.toString(); return buf.toString();
} }
@ -299,6 +306,8 @@ public class LanguageSettingEntriesSerializer {
flags |= ICSettingEntry.UNDEFINED; flags |= ICSettingEntry.UNDEFINED;
if (FRAMEWORK.equals(f)) if (FRAMEWORK.equals(f))
flags |= ICSettingEntry.FRAMEWORKS_MAC; flags |= ICSettingEntry.FRAMEWORKS_MAC;
if (EXPORTED.equals(f))
flags |= ICSettingEntry.EXPORTED;
} }
return flags; return flags;

View file

@ -202,6 +202,7 @@ The value &quot;true&quot; of this attribute is meaningful only for providers ca
&lt;br&gt;- &lt;samp&gt;RESOLVED&lt;/samp&gt; : Indicates that the entries do not need to be resolved such as expansion of environment variables, normalizing the path against build working directory etc. &lt;br&gt;- &lt;samp&gt;RESOLVED&lt;/samp&gt; : Indicates that the entries do not need to be resolved such as expansion of environment variables, normalizing the path against build working directory etc.
&lt;br&gt;- &lt;samp&gt;VALUE_WORKSPACE_PATH&lt;/samp&gt; : is used to indicate that the entry is a resource managed by eclipse in the workspace. The path is rooted in the workspace root. &lt;br&gt;- &lt;samp&gt;VALUE_WORKSPACE_PATH&lt;/samp&gt; : is used to indicate that the entry is a resource managed by eclipse in the workspace. The path is rooted in the workspace root.
&lt;br&gt;- &lt;samp&gt;UNDEFINED&lt;/samp&gt; : indicates that the entry should not be defined, corresponds to &lt;samp&gt;-U&lt;/samp&gt; option of gcc compiler. If this flag is defined it will negate entries with the same name (and kind) for all providers down the list. &lt;br&gt;- &lt;samp&gt;UNDEFINED&lt;/samp&gt; : indicates that the entry should not be defined, corresponds to &lt;samp&gt;-U&lt;/samp&gt; option of gcc compiler. If this flag is defined it will negate entries with the same name (and kind) for all providers down the list.
&lt;br&gt;- &lt;samp&gt;EXPORTED&lt;/samp&gt; : indicates that the entry is exported to referencing projects. It will be passed to the projects configurations referencing the configuration the entry belongs to.
</documentation> </documentation>
</annotation> </annotation>
<simpleType> <simpleType>
@ -216,6 +217,8 @@ The value &quot;true&quot; of this attribute is meaningful only for providers ca
</enumeration> </enumeration>
<enumeration value="UNDEFINED"> <enumeration value="UNDEFINED">
</enumeration> </enumeration>
<enumeration value="EXPORTED">
</enumeration>
</restriction> </restriction>
</simpleType> </simpleType>
</attribute> </attribute>

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

View file

@ -59,6 +59,7 @@ import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICResourceDescription; import org.eclipse.cdt.core.settings.model.ICResourceDescription;
import org.eclipse.cdt.core.settings.model.ICSettingEntry; import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.ui.CDTSharedImages; import org.eclipse.cdt.ui.CDTSharedImages;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab; import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
@ -74,6 +75,9 @@ import org.eclipse.cdt.internal.ui.newui.StatusMessageLine;
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
*/ */
public class LanguageSettingsEntriesTab extends AbstractCPropertyTab { public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
private static final String EXPORT_STR = Messages.AbstractLangsListTab_Export;
private static final String UNEXPORT_STR = Messages.AbstractLangsListTab_Unexport;
private static final int[] DEFAULT_ENTRIES_SASH_WEIGHTS = new int[] { 10, 30 }; private static final int[] DEFAULT_ENTRIES_SASH_WEIGHTS = new int[] { 10, 30 };
private SashForm sashFormEntries; private SashForm sashFormEntries;
@ -91,15 +95,17 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
private static final int BUTTON_ADD = 0; private static final int BUTTON_ADD = 0;
private static final int BUTTON_EDIT = 1; private static final int BUTTON_EDIT = 1;
private static final int BUTTON_DELETE = 2; private static final int BUTTON_DELETE = 2;
// there is a separator instead of button #3 private static final int BUTTON_EXPORT = 3;
private static final int BUTTON_MOVE_UP = 4; // there is a separator instead of button #4
private static final int BUTTON_MOVE_DOWN = 5; private static final int BUTTON_MOVE_UP = 5;
private static final int BUTTON_MOVE_DOWN = 6;
private static final String[] BUTTON_LABELS = new String[6]; private static final String[] BUTTON_LABELS = new String[7];
{ {
BUTTON_LABELS[BUTTON_ADD] = ADD_STR; BUTTON_LABELS[BUTTON_ADD] = ADD_STR;
BUTTON_LABELS[BUTTON_EDIT] = EDIT_STR; BUTTON_LABELS[BUTTON_EDIT] = EDIT_STR;
BUTTON_LABELS[BUTTON_DELETE] = DEL_STR; BUTTON_LABELS[BUTTON_DELETE] = DEL_STR;
BUTTON_LABELS[BUTTON_EXPORT] = EXPORT_STR;
BUTTON_LABELS[BUTTON_MOVE_UP] = MOVEUP_STR; BUTTON_LABELS[BUTTON_MOVE_UP] = MOVEUP_STR;
BUTTON_LABELS[BUTTON_MOVE_DOWN] = MOVEDOWN_STR; BUTTON_LABELS[BUTTON_MOVE_DOWN] = MOVEDOWN_STR;
} }
@ -341,7 +347,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
if (items.length > 0) { if (items.length > 0) {
currentLanguageId = (String) items[0].getData(); currentLanguageId = (String) items[0].getData();
currentLanguageIdGlobal = currentLanguageId; currentLanguageIdGlobal = currentLanguageId;
updateTreeForEntries(); updateTreeForEntries(null, null);
} }
} }
}); });
@ -440,7 +446,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
builtInCheckBox.addSelectionListener(new SelectionAdapter() { builtInCheckBox.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
updateTreeForEntries(); updateTreeForEntries(null, null);
} }
}); });
builtInCheckBox.setSelection(true); builtInCheckBox.setSelection(true);
@ -485,16 +491,45 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
buttoncomp.setEnabled(enable); buttoncomp.setEnabled(enable);
if (enable) { if (enable) {
updateTreeForEntries(); updateTreeForEntries(null, null);
} else { } else {
buttonSetEnabled(BUTTON_ADD, false); buttonSetEnabled(BUTTON_ADD, false);
buttonSetEnabled(BUTTON_EDIT, false); buttonSetEnabled(BUTTON_EDIT, false);
buttonSetEnabled(BUTTON_DELETE, false); buttonSetEnabled(BUTTON_DELETE, false);
buttonSetEnabled(BUTTON_EXPORT, false);
buttonSetEnabled(BUTTON_MOVE_UP, false); buttonSetEnabled(BUTTON_MOVE_UP, false);
buttonSetEnabled(BUTTON_MOVE_DOWN, false); buttonSetEnabled(BUTTON_MOVE_DOWN, false);
} }
} }
/**
* Check if "Export" button is in "Export" mode or "Unexport" mode.
*/
private boolean isExportMode(ILanguageSettingsProvider provider, ICLanguageSettingEntry entry) {
List<ICLanguageSettingEntry> entries = getSettingEntriesUpResourceTree(provider);
boolean isAllowedToEdit = provider instanceof ILanguageSettingsEditableProvider
&& LanguageSettingsProviderAssociationManager.isAllowedToEditEntries(provider);
boolean canExport = isAllowedToEdit && entries != null && entries.size() > 0;
boolean isExported = false;
if (canExport) {
if (entry != null) {
isExported = (entry.getFlags() & ICSettingEntry.EXPORTED) == ICSettingEntry.EXPORTED;
} else if (entries != null) {
for (ICLanguageSettingEntry ent : entries) {
isExported = (ent.getFlags() & ICSettingEntry.EXPORTED) == ICSettingEntry.EXPORTED;
// in case of mixed exports suggest to "Export"
if (!isExported) {
break;
}
}
}
}
return !isExported;
}
/** /**
* Updates state for all buttons. Called when table selection changes. * Updates state for all buttons. Called when table selection changes.
*/ */
@ -517,6 +552,8 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
boolean canEdit = isAllowedToEdit && isEntrySelected; boolean canEdit = isAllowedToEdit && isEntrySelected;
boolean canDelete = isAllowedToEdit && isEntrySelected; boolean canDelete = isAllowedToEdit && isEntrySelected;
boolean canClear = isAllowedToClear && isProviderSelected && entries != null && entries.size() > 0; boolean canClear = isAllowedToClear && isProviderSelected && entries != null && entries.size() > 0;
boolean canExport = isAllowedToEdit && entries != null && entries.size() > 0;
boolean suggestExport = isExportMode(provider, entry);
boolean canMoveUp = false; boolean canMoveUp = false;
boolean canMoveDown = false; boolean canMoveDown = false;
@ -531,10 +568,12 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
} }
buttonSetText(BUTTON_DELETE, isProviderSelected ? CLEAR_STR : DEL_STR); buttonSetText(BUTTON_DELETE, isProviderSelected ? CLEAR_STR : DEL_STR);
buttonSetText(BUTTON_EXPORT, suggestExport ? EXPORT_STR : UNEXPORT_STR);
buttonSetEnabled(BUTTON_ADD, canAdd); buttonSetEnabled(BUTTON_ADD, canAdd);
buttonSetEnabled(BUTTON_EDIT, canEdit); buttonSetEnabled(BUTTON_EDIT, canEdit);
buttonSetEnabled(BUTTON_DELETE, canDelete || canClear); buttonSetEnabled(BUTTON_DELETE, canDelete || canClear);
buttonSetEnabled(BUTTON_EXPORT, canExport);
buttonSetEnabled(BUTTON_MOVE_UP, canMoveUp); buttonSetEnabled(BUTTON_MOVE_UP, canMoveUp);
buttonSetEnabled(BUTTON_MOVE_DOWN, canMoveDown); buttonSetEnabled(BUTTON_MOVE_DOWN, canMoveDown);
@ -583,6 +622,9 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
case BUTTON_DELETE: case BUTTON_DELETE:
performDelete(selectedProvider, selectedEntry); performDelete(selectedProvider, selectedEntry);
break; break;
case BUTTON_EXPORT:
performExport(selectedProvider, selectedEntry);
break;
case BUTTON_MOVE_UP: case BUTTON_MOVE_UP:
performMoveUp(selectedProvider, selectedEntry); performMoveUp(selectedProvider, selectedEntry);
break; break;
@ -682,11 +724,9 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
ICLanguageSettingEntry selectedEntry = getSelectedEntry(); ICLanguageSettingEntry selectedEntry = getSelectedEntry();
int pos = getExactIndex(entries, selectedEntry); int pos = getExactIndex(entries, selectedEntry);
entries.add(pos+1, entry); entries.add(pos+1, entry);
saveEntries(provider, entries);
updateTreeForEntries(); saveEntries(provider, entries);
selectItem(providerId, entry); updateTreeForEntries(providerId, entry);
updateButtons();
} }
} }
@ -802,9 +842,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
} }
ICLanguageSettingEntry entryToSelect = (pos >= 0) ? entries.get(pos) : null; ICLanguageSettingEntry entryToSelect = (pos >= 0) ? entries.get(pos) : null;
updateTreeForEntries(); updateTreeForEntries(providerId, entryToSelect);
selectItem(providerId, entryToSelect);
updateButtons();
} }
} }
@ -818,11 +856,9 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
List<ICLanguageSettingEntry> entries = getEntriesShownToUser(provider); List<ICLanguageSettingEntry> entries = getEntriesShownToUser(provider);
int pos = getExactIndex(entries, oldEntry); int pos = getExactIndex(entries, oldEntry);
entries.set(pos, newEntry); entries.set(pos, newEntry);
saveEntries(provider, entries);
updateTreeForEntries(); saveEntries(provider, entries);
selectItem(providerId, newEntry); updateTreeForEntries(providerId, newEntry);
updateButtons();
} }
} }
@ -834,10 +870,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
String providerId = provider.getId(); String providerId = provider.getId();
List<ICLanguageSettingEntry> empty = new ArrayList<ICLanguageSettingEntry>(); List<ICLanguageSettingEntry> empty = new ArrayList<ICLanguageSettingEntry>();
saveEntries(provider, empty); saveEntries(provider, empty);
updateTreeForEntries(providerId, null);
updateTreeForEntries();
selectItem(providerId, null);
updateButtons();
} }
} }
@ -855,6 +888,64 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
} }
} }
/**
* Change "Export" flag of provider's entry and update UI.
*/
private void exportEntry(ILanguageSettingsProvider provider, ICLanguageSettingEntry entry, boolean isExport) {
if (provider instanceof ILanguageSettingsEditableProvider && entry != null) {
int flags = entry.getFlags();
if (isExport) {
flags |= ICSettingEntry.EXPORTED;
} else {
flags &= ~ICSettingEntry.EXPORTED;
}
ICLanguageSettingEntry newEntry = CDataUtil.createEntry(entry, flags);
if (newEntry != null) {
provider = getWorkingCopy((ILanguageSettingsEditableProvider)provider);
replaceEntry(provider, entry, newEntry);
}
}
}
/**
* Change "Export" flag of all provider's entries and update UI.
*/
private void exportAllEntries(ILanguageSettingsProvider provider, boolean isExport) {
if (provider instanceof ILanguageSettingsEditableProvider) {
List<ICLanguageSettingEntry> entries = getEntriesShownToUser(provider);
if (entries.size() > 0) {
provider = getWorkingCopy((ILanguageSettingsEditableProvider)provider);
for (int i = 0; i < entries.size() ; i++) {
ICLanguageSettingEntry entry = entries.get(i);
int flags = entry.getFlags();
if (isExport) {
flags |= ICSettingEntry.EXPORTED;
} else {
flags &= ~ICSettingEntry.EXPORTED;
}
ICLanguageSettingEntry newEntry = CDataUtil.createEntry(entry, flags);
entries.set(i, newEntry);
}
saveEntries(provider, entries);
updateTreeForEntries(provider.getId(), null);
}
}
}
/**
* Export or un-export provider's entry or entries.
*/
private void performExport(ILanguageSettingsProvider selectedProvider, ICLanguageSettingEntry selectedEntry) {
if (selectedProvider instanceof ILanguageSettingsEditableProvider) {
boolean isExport = isExportMode(selectedProvider, selectedEntry);
if (selectedEntry != null) {
exportEntry(selectedProvider, selectedEntry, isExport);
} else {
exportAllEntries(selectedProvider, isExport);
}
}
}
/** /**
* Move provider's entry up or down. * Move provider's entry up or down.
*/ */
@ -868,9 +959,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
Collections.swap(entries, pos, newPos); Collections.swap(entries, pos, newPos);
saveEntries(provider, entries); saveEntries(provider, entries);
updateTreeForEntries(); updateTreeForEntries(providerId, entry);
selectItem(providerId, entry);
updateButtons();
} }
} }
@ -920,10 +1009,42 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
/** /**
* Re-reads and refreshes the entries tree. * Re-reads and refreshes the entries tree.
*
* @param selectedProviderId - provider of the entry to select after update.
* If the entry is {@code null} the provider itself will be selected.
* @param selectedEntry - entry to select in the tree after update.
*/ */
private void updateTreeForEntries() { private void updateTreeForEntries(String selectedProviderId, ICLanguageSettingEntry selectedEntry) {
Object[] expandedElements = treeEntriesViewer.getExpandedElements();
List<ILanguageSettingsProvider> tableItems = getProviders(currentLanguageId); List<ILanguageSettingsProvider> tableItems = getProviders(currentLanguageId);
treeEntriesViewer.getControl().setRedraw(false);
treeEntriesViewer.setInput(tableItems.toArray(new Object[tableItems.size()])); treeEntriesViewer.setInput(tableItems.toArray(new Object[tableItems.size()]));
// set selection and restore expansion states
if (selectedProviderId != null) {
selectItem(selectedProviderId, selectedEntry);
// find the provider that will replace selected one and replace it in expandedElements[]
for (ILanguageSettingsProvider provider : tableItems) {
if (provider.getId().equals(selectedProviderId)) {
for (int i = 0; i < expandedElements.length; i++) {
if (expandedElements[i] instanceof ILanguageSettingsProvider) {
if (((ILanguageSettingsProvider) expandedElements[i]).getId().equals(selectedProviderId)) {
expandedElements[i] = provider;
break;
}
}
}
break;
}
}
}
treeEntriesViewer.setExpandedElements(expandedElements);
treeEntriesViewer.getControl().setRedraw(true);
treeEntriesViewer.getControl().redraw();
updateStatusLine(); updateStatusLine();
updateButtons(); updateButtons();
} }
@ -1018,7 +1139,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
} }
updateTreeForLanguages(rcDes); updateTreeForLanguages(rcDes);
updateTreeForEntries(); updateTreeForEntries(null, null);
if (masterPropertyPage != null) { if (masterPropertyPage != null) {
boolean enabled = masterPropertyPage.isLanguageSettingsProvidersEnabled(); boolean enabled = masterPropertyPage.isLanguageSettingsProvidersEnabled();
@ -1075,7 +1196,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
} }
if (changed) { if (changed) {
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(newProviders); ((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(newProviders);
updateTreeForEntries(); updateTreeForEntries(null, null);
} }
} }
} }

View file

@ -106,30 +106,38 @@ public class LanguageSettingsImages {
boolean isProjectRelative = isProjectRelative(entry); boolean isProjectRelative = isProjectRelative(entry);
String imageKey = getImageKey(kind, flags, isProjectRelative); String imageKey = getImageKey(kind, flags, isProjectRelative);
Image image = null;
if (imageKey != null) { if (imageKey != null) {
if ((flags & ICSettingEntry.UNDEFINED) != 0) { String[] overlayKeys = new String[5];
return CDTSharedImages.getImageOverlaid(imageKey, CDTSharedImages.IMG_OVR_INACTIVE, IDecoration.BOTTOM_LEFT);
}
String overlayKey=null; if ((flags & ICSettingEntry.UNDEFINED) != 0) {
image = CDTSharedImages.getImageOverlaid(imageKey, CDTSharedImages.IMG_OVR_INACTIVE, IDecoration.BOTTOM_LEFT);
} else {
String overlayKeyStatus=null;
IStatus status = getStatus(entry, cfgDescription); IStatus status = getStatus(entry, cfgDescription);
switch (status.getSeverity()) { switch (status.getSeverity()) {
case IStatus.ERROR: case IStatus.ERROR:
overlayKey = CDTSharedImages.IMG_OVR_ERROR; overlayKeyStatus = CDTSharedImages.IMG_OVR_ERROR;
break; break;
case IStatus.WARNING: case IStatus.WARNING:
overlayKey = CDTSharedImages.IMG_OVR_WARNING; overlayKeyStatus = CDTSharedImages.IMG_OVR_WARNING;
break; break;
case IStatus.INFO: case IStatus.INFO:
overlayKey = CDTSharedImages.IMG_OVR_WARNING; overlayKeyStatus = CDTSharedImages.IMG_OVR_WARNING;
break; break;
} }
if (overlayKey != null) { if (overlayKeyStatus != null) {
return CDTSharedImages.getImageOverlaid(imageKey, overlayKey, IDecoration.BOTTOM_LEFT); overlayKeys[IDecoration.BOTTOM_LEFT]=overlayKeyStatus;
} }
return CDTSharedImages.getImage(imageKey);
if ((flags & ICSettingEntry.EXPORTED) != 0) {
overlayKeys[IDecoration.BOTTOM_RIGHT]=CDTSharedImages.IMG_OVR_EXPORTED;
} }
return null;
image = CDTSharedImages.getImageOverlaid(imageKey, overlayKeys);
}
}
return image;
} }
/** /**

View file

@ -183,6 +183,8 @@ public class CDTSharedImages {
public static final String IMG_OVR_EDITED = "icons/ovr16/edited_ovr.gif"; //$NON-NLS-1$ public static final String IMG_OVR_EDITED = "icons/ovr16/edited_ovr.gif"; //$NON-NLS-1$
/** @since 5.4 */ /** @since 5.4 */
public static final String IMG_OVR_USER = "icons/ovr16/person_ovr.gif"; //$NON-NLS-1$ public static final String IMG_OVR_USER = "icons/ovr16/person_ovr.gif"; //$NON-NLS-1$
/** @since 5.7 */
public static final String IMG_OVR_EXPORTED = "icons/ovr16/exported_ovr.gif"; //$NON-NLS-1$
// Pin & Clone // Pin & Clone
public static final String IMG_THREAD_SUSPENDED_R_PINNED = "icons/obj16/threads_obj_r.gif"; //$NON-NLS-1$ public static final String IMG_THREAD_SUSPENDED_R_PINNED = "icons/obj16/threads_obj_r.gif"; //$NON-NLS-1$