mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
bug 416628: "Export" of entries of language settings providers to referencing projects - added capability
This commit is contained in:
parent
90d35a99f0
commit
da95189bb4
9 changed files with 250 additions and 48 deletions
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -388,6 +388,13 @@
|
|||
kind="includePath"
|
||||
name="/test/include/path">
|
||||
</entry>
|
||||
<entry
|
||||
kind="includePath"
|
||||
name="/test/include/exported">
|
||||
<flag
|
||||
value="EXPORTED">
|
||||
</flag>
|
||||
</entry>
|
||||
<entry
|
||||
kind="includePath"
|
||||
name="/test/workspace/include/path">
|
||||
|
|
|
@ -79,6 +79,15 @@ public interface ICSettingEntry {
|
|||
*/
|
||||
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_FILE = 1 << 1;
|
||||
int MACRO = 1 << 2;
|
||||
|
|
|
@ -54,6 +54,7 @@ public class LanguageSettingEntriesSerializer {
|
|||
public static final String RESOLVED = "RESOLVED"; //$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 EXPORTED = "EXPORTED"; //$NON-NLS-1$
|
||||
|
||||
public static final String FLAGS_SEPARATOR = "|"; //$NON-NLS-1$
|
||||
|
||||
|
@ -270,6 +271,12 @@ public class LanguageSettingEntriesSerializer {
|
|||
|
||||
buf.append(FRAMEWORK);
|
||||
}
|
||||
if ((flags & ICLanguageSettingEntry.EXPORTED) != 0) {
|
||||
if (buf.length() != 0)
|
||||
buf.append(FLAGS_SEPARATOR);
|
||||
|
||||
buf.append(EXPORTED);
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
@ -299,6 +306,8 @@ public class LanguageSettingEntriesSerializer {
|
|||
flags |= ICSettingEntry.UNDEFINED;
|
||||
if (FRAMEWORK.equals(f))
|
||||
flags |= ICSettingEntry.FRAMEWORKS_MAC;
|
||||
if (EXPORTED.equals(f))
|
||||
flags |= ICSettingEntry.EXPORTED;
|
||||
}
|
||||
|
||||
return flags;
|
||||
|
|
|
@ -202,6 +202,7 @@ The value "true" of this attribute is meaningful only for providers ca
|
|||
<br>- <samp>RESOLVED</samp> : Indicates that the entries do not need to be resolved such as expansion of environment variables, normalizing the path against build working directory etc.
|
||||
<br>- <samp>VALUE_WORKSPACE_PATH</samp> : is used to indicate that the entry is a resource managed by eclipse in the workspace. The path is rooted in the workspace root.
|
||||
<br>- <samp>UNDEFINED</samp> : indicates that the entry should not be defined, corresponds to <samp>-U</samp> 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.
|
||||
<br>- <samp>EXPORTED</samp> : 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>
|
||||
</annotation>
|
||||
<simpleType>
|
||||
|
@ -216,6 +217,8 @@ The value "true" of this attribute is meaningful only for providers ca
|
|||
</enumeration>
|
||||
<enumeration value="UNDEFINED">
|
||||
</enumeration>
|
||||
<enumeration value="EXPORTED">
|
||||
</enumeration>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
</attribute>
|
||||
|
|
BIN
core/org.eclipse.cdt.ui/icons/ovr16/exported_ovr.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/ovr16/exported_ovr.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 860 B |
|
@ -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.ICResourceDescription;
|
||||
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.CUIPlugin;
|
||||
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.
|
||||
*/
|
||||
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 SashForm sashFormEntries;
|
||||
|
@ -91,15 +95,17 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
private static final int BUTTON_ADD = 0;
|
||||
private static final int BUTTON_EDIT = 1;
|
||||
private static final int BUTTON_DELETE = 2;
|
||||
// there is a separator instead of button #3
|
||||
private static final int BUTTON_MOVE_UP = 4;
|
||||
private static final int BUTTON_MOVE_DOWN = 5;
|
||||
private static final int BUTTON_EXPORT = 3;
|
||||
// there is a separator instead of button #4
|
||||
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_EDIT] = EDIT_STR;
|
||||
BUTTON_LABELS[BUTTON_DELETE] = DEL_STR;
|
||||
BUTTON_LABELS[BUTTON_EXPORT] = EXPORT_STR;
|
||||
BUTTON_LABELS[BUTTON_MOVE_UP] = MOVEUP_STR;
|
||||
BUTTON_LABELS[BUTTON_MOVE_DOWN] = MOVEDOWN_STR;
|
||||
}
|
||||
|
@ -341,7 +347,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
if (items.length > 0) {
|
||||
currentLanguageId = (String) items[0].getData();
|
||||
currentLanguageIdGlobal = currentLanguageId;
|
||||
updateTreeForEntries();
|
||||
updateTreeForEntries(null, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -440,7 +446,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
builtInCheckBox.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
updateTreeForEntries();
|
||||
updateTreeForEntries(null, null);
|
||||
}
|
||||
});
|
||||
builtInCheckBox.setSelection(true);
|
||||
|
@ -485,16 +491,45 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
buttoncomp.setEnabled(enable);
|
||||
|
||||
if (enable) {
|
||||
updateTreeForEntries();
|
||||
updateTreeForEntries(null, null);
|
||||
} else {
|
||||
buttonSetEnabled(BUTTON_ADD, false);
|
||||
buttonSetEnabled(BUTTON_EDIT, false);
|
||||
buttonSetEnabled(BUTTON_DELETE, false);
|
||||
buttonSetEnabled(BUTTON_EXPORT, false);
|
||||
buttonSetEnabled(BUTTON_MOVE_UP, 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.
|
||||
*/
|
||||
|
@ -517,6 +552,8 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
boolean canEdit = isAllowedToEdit && isEntrySelected;
|
||||
boolean canDelete = isAllowedToEdit && isEntrySelected;
|
||||
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 canMoveDown = false;
|
||||
|
@ -531,10 +568,12 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
}
|
||||
|
||||
buttonSetText(BUTTON_DELETE, isProviderSelected ? CLEAR_STR : DEL_STR);
|
||||
buttonSetText(BUTTON_EXPORT, suggestExport ? EXPORT_STR : UNEXPORT_STR);
|
||||
|
||||
buttonSetEnabled(BUTTON_ADD, canAdd);
|
||||
buttonSetEnabled(BUTTON_EDIT, canEdit);
|
||||
buttonSetEnabled(BUTTON_DELETE, canDelete || canClear);
|
||||
buttonSetEnabled(BUTTON_EXPORT, canExport);
|
||||
|
||||
buttonSetEnabled(BUTTON_MOVE_UP, canMoveUp);
|
||||
buttonSetEnabled(BUTTON_MOVE_DOWN, canMoveDown);
|
||||
|
@ -583,6 +622,9 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
case BUTTON_DELETE:
|
||||
performDelete(selectedProvider, selectedEntry);
|
||||
break;
|
||||
case BUTTON_EXPORT:
|
||||
performExport(selectedProvider, selectedEntry);
|
||||
break;
|
||||
case BUTTON_MOVE_UP:
|
||||
performMoveUp(selectedProvider, selectedEntry);
|
||||
break;
|
||||
|
@ -682,11 +724,9 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
ICLanguageSettingEntry selectedEntry = getSelectedEntry();
|
||||
int pos = getExactIndex(entries, selectedEntry);
|
||||
entries.add(pos+1, entry);
|
||||
saveEntries(provider, entries);
|
||||
|
||||
updateTreeForEntries();
|
||||
selectItem(providerId, entry);
|
||||
updateButtons();
|
||||
saveEntries(provider, entries);
|
||||
updateTreeForEntries(providerId, entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -802,9 +842,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
}
|
||||
ICLanguageSettingEntry entryToSelect = (pos >= 0) ? entries.get(pos) : null;
|
||||
|
||||
updateTreeForEntries();
|
||||
selectItem(providerId, entryToSelect);
|
||||
updateButtons();
|
||||
updateTreeForEntries(providerId, entryToSelect);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -818,11 +856,9 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
List<ICLanguageSettingEntry> entries = getEntriesShownToUser(provider);
|
||||
int pos = getExactIndex(entries, oldEntry);
|
||||
entries.set(pos, newEntry);
|
||||
saveEntries(provider, entries);
|
||||
|
||||
updateTreeForEntries();
|
||||
selectItem(providerId, newEntry);
|
||||
updateButtons();
|
||||
saveEntries(provider, entries);
|
||||
updateTreeForEntries(providerId, newEntry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -834,10 +870,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
String providerId = provider.getId();
|
||||
List<ICLanguageSettingEntry> empty = new ArrayList<ICLanguageSettingEntry>();
|
||||
saveEntries(provider, empty);
|
||||
|
||||
updateTreeForEntries();
|
||||
selectItem(providerId, null);
|
||||
updateButtons();
|
||||
updateTreeForEntries(providerId, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -868,9 +959,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
Collections.swap(entries, pos, newPos);
|
||||
saveEntries(provider, entries);
|
||||
|
||||
updateTreeForEntries();
|
||||
selectItem(providerId, entry);
|
||||
updateButtons();
|
||||
updateTreeForEntries(providerId, entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -920,10 +1009,42 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
|
||||
/**
|
||||
* 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);
|
||||
treeEntriesViewer.getControl().setRedraw(false);
|
||||
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();
|
||||
updateButtons();
|
||||
}
|
||||
|
@ -1018,7 +1139,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
}
|
||||
|
||||
updateTreeForLanguages(rcDes);
|
||||
updateTreeForEntries();
|
||||
updateTreeForEntries(null, null);
|
||||
|
||||
if (masterPropertyPage != null) {
|
||||
boolean enabled = masterPropertyPage.isLanguageSettingsProvidersEnabled();
|
||||
|
@ -1075,7 +1196,7 @@ public class LanguageSettingsEntriesTab extends AbstractCPropertyTab {
|
|||
}
|
||||
if (changed) {
|
||||
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(newProviders);
|
||||
updateTreeForEntries();
|
||||
updateTreeForEntries(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,30 +106,38 @@ public class LanguageSettingsImages {
|
|||
boolean isProjectRelative = isProjectRelative(entry);
|
||||
|
||||
String imageKey = getImageKey(kind, flags, isProjectRelative);
|
||||
Image image = null;
|
||||
if (imageKey != null) {
|
||||
if ((flags & ICSettingEntry.UNDEFINED) != 0) {
|
||||
return CDTSharedImages.getImageOverlaid(imageKey, CDTSharedImages.IMG_OVR_INACTIVE, IDecoration.BOTTOM_LEFT);
|
||||
}
|
||||
String[] overlayKeys = new String[5];
|
||||
|
||||
String overlayKey=null;
|
||||
IStatus status = getStatus(entry, cfgDescription);
|
||||
switch (status.getSeverity()) {
|
||||
case IStatus.ERROR:
|
||||
overlayKey = CDTSharedImages.IMG_OVR_ERROR;
|
||||
break;
|
||||
case IStatus.WARNING:
|
||||
overlayKey = CDTSharedImages.IMG_OVR_WARNING;
|
||||
break;
|
||||
case IStatus.INFO:
|
||||
overlayKey = CDTSharedImages.IMG_OVR_WARNING;
|
||||
break;
|
||||
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);
|
||||
switch (status.getSeverity()) {
|
||||
case IStatus.ERROR:
|
||||
overlayKeyStatus = CDTSharedImages.IMG_OVR_ERROR;
|
||||
break;
|
||||
case IStatus.WARNING:
|
||||
overlayKeyStatus = CDTSharedImages.IMG_OVR_WARNING;
|
||||
break;
|
||||
case IStatus.INFO:
|
||||
overlayKeyStatus = CDTSharedImages.IMG_OVR_WARNING;
|
||||
break;
|
||||
}
|
||||
if (overlayKeyStatus != null) {
|
||||
overlayKeys[IDecoration.BOTTOM_LEFT]=overlayKeyStatus;
|
||||
}
|
||||
|
||||
if ((flags & ICSettingEntry.EXPORTED) != 0) {
|
||||
overlayKeys[IDecoration.BOTTOM_RIGHT]=CDTSharedImages.IMG_OVR_EXPORTED;
|
||||
}
|
||||
|
||||
image = CDTSharedImages.getImageOverlaid(imageKey, overlayKeys);
|
||||
}
|
||||
if (overlayKey != null) {
|
||||
return CDTSharedImages.getImageOverlaid(imageKey, overlayKey, IDecoration.BOTTOM_LEFT);
|
||||
}
|
||||
return CDTSharedImages.getImage(imageKey);
|
||||
}
|
||||
return null;
|
||||
return image;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -183,6 +183,8 @@ public class CDTSharedImages {
|
|||
public static final String IMG_OVR_EDITED = "icons/ovr16/edited_ovr.gif"; //$NON-NLS-1$
|
||||
/** @since 5.4 */
|
||||
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
|
||||
public static final String IMG_THREAD_SUSPENDED_R_PINNED = "icons/obj16/threads_obj_r.gif"; //$NON-NLS-1$
|
||||
|
|
Loading…
Add table
Reference in a new issue