From 7eb5d01dedf68c39449657ca8941a6866f2be637 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Thu, 5 Jan 2012 20:49:11 -0500 Subject: [PATCH] bug 279502: User friendly icons for Paths&Symbols --- .../model/ACExclusionFilterEntry.java | 5 +- .../cdt/core/settings/model/ACPathEntry.java | 8 +- .../core/settings/model/ACSettingEntry.java | 31 +-- .../cdt/core/settings/model/CMacroEntry.java | 21 +- .../icons/obj16/frameworks.png | Bin 0 -> 521 bytes .../ui/newui/LanguageSettingsImages.java | 179 ++++++++++++++++++ .../cdt/internal/ui/newui/Messages.java | 3 + .../cdt/internal/ui/newui/Messages.properties | 3 + .../internal/ui/newui/StatusMessageLine.java | 81 ++++++++ .../org/eclipse/cdt/ui/CDTSharedImages.java | 16 +- .../cdt/ui/newui/AbstractLangsListTab.java | 109 ++++++----- 11 files changed, 379 insertions(+), 77 deletions(-) create mode 100644 core/org.eclipse.cdt.ui/icons/obj16/frameworks.png create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/LanguageSettingsImages.java create mode 100644 core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/StatusMessageLine.java diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACExclusionFilterEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACExclusionFilterEntry.java index 098b5c62313..fb5909ff556 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACExclusionFilterEntry.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACExclusionFilterEntry.java @@ -36,8 +36,11 @@ public abstract class ACExclusionFilterEntry extends ACPathEntry implements ICEx this.exclusionPatterns = exclusionPatterns != null ? (IPath[])exclusionPatterns.clone() : new IPath[0]; } + /** + * @since 5.4 + */ @Override - protected final boolean isFile() { + public final boolean isFile() { return false; } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACPathEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACPathEntry.java index 3835d6e878b..bf67bc52176 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACPathEntry.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACPathEntry.java @@ -15,8 +15,7 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; -public abstract class ACPathEntry extends ACSettingEntry - implements ICPathEntry { +public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry { // IPath fFullPath; // IPath fLocation; // private IPath fPath; @@ -68,7 +67,10 @@ public abstract class ACPathEntry extends ACSettingEntry return null; } - protected abstract boolean isFile(); + /** + * @since 5.4 + */ + public abstract boolean isFile(); @Override public IPath getLocation() { diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACSettingEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACSettingEntry.java index 840047ff044..0c2dc98335d 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACSettingEntry.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACSettingEntry.java @@ -56,30 +56,31 @@ public abstract class ACSettingEntry implements ICSettingEntry { } @Override - public boolean equals(Object other){ - if(other == this) + public boolean equals(Object obj) { + if (this == obj) return true; - - if(!(other instanceof ACSettingEntry)) + if (obj == null) return false; - - ACSettingEntry e = (ACSettingEntry)other; - - if(getKind() != e.getKind()) + if (getClass() != obj.getClass()) return false; - - if(fFlags != e.fFlags) + ACSettingEntry other = (ACSettingEntry) obj; + if (fFlags != other.fFlags) return false; - - if(!fName.equals(e.fName)) + if (fName == null) { + if (other.fName != null) + return false; + } else if (!fName.equals(other.fName)) return false; - return true; } @Override - public int hashCode(){ - return getKind() + fFlags + fName.hashCode(); + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + fFlags; + result = prime * result + ((fName == null) ? 0 : fName.hashCode()); + return result; } @Override diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CMacroEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CMacroEntry.java index df0c903803d..078b70c1597 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CMacroEntry.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CMacroEntry.java @@ -35,15 +35,28 @@ public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry{ } @Override - public boolean equals(Object other) { - if(!super.equals(other)) + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) return false; - return fValue.equals(((CMacroEntry)other).fValue); + if (getClass() != obj.getClass()) + return false; + CMacroEntry other = (CMacroEntry) obj; + if (fValue == null) { + if (other.fValue != null) + return false; + } else if (!fValue.equals(other.fValue)) + return false; + return true; } @Override public int hashCode() { - return super.hashCode() + fValue.hashCode(); + final int prime = 31; + int result = super.hashCode(); + result = prime * result + ((fValue == null) ? 0 : fValue.hashCode()); + return result; } @Override diff --git a/core/org.eclipse.cdt.ui/icons/obj16/frameworks.png b/core/org.eclipse.cdt.ui/icons/obj16/frameworks.png new file mode 100644 index 0000000000000000000000000000000000000000..c236fbe6096d258e336d7d5f2314273650555294 GIT binary patch literal 521 zcmV+k0`~ohP)Px#0%A)?L;(MXkIcUS000SaNLh0L01m?d01m?e$8V@)00007bV*G`2iyS$00|6f zSNHk=00E6jL_t(2&wY#!3rOkU+$k%F03;(Mn7! zD59b)v6ny)1QAlEQ7i;O3k$(|)kc&=bP6RCf;*e}|IhyxyQr1-Hjm5Uy>}(@e+d9{ zwErXpFa8A*0NTArtyW4(T~1xO)5Kr%e>a?=&9UK_n#?5HeCK@W2OdG#5H7r4+_%;2 zkO^R@M|UHZwe^{sitd=K4!cHBCp7AZ%e;zCyj0?3d=gOz)U3Ah^!v#lPv6hJWnycs z_bm<7i2w=?tEUI`sh4->XKoxEAS zK 0) { + entry = entries[0]; + } + } + + ACPathEntry acEntry = (ACPathEntry)entry; + String acEntryName = acEntry.getName(); + IPath path = new Path(acEntryName); + if (!path.isAbsolute()) { + return new Status(IStatus.INFO, CUIPlugin.PLUGIN_ID, Messages.LanguageSettingsImages_UsingRelativePathsNotRecommended); + } + if (!isLocationOk(acEntry)) { + if (acEntry.isFile()) { + return new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, Messages.LanguageSettingsImages_FileDoesNotExist); + } else { + return new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, Messages.LanguageSettingsImages_FolderDoesNotExist); + } + } + + } + return Status.OK_STATUS; + } + +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/Messages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/Messages.java index fe48a3b97b8..c6f86743b89 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/Messages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/Messages.java @@ -186,6 +186,9 @@ public class Messages extends NLS { public static String IncludeTab_2; public static String IncludeTab_export; public static String IncludeTab_import; + public static String LanguageSettingsImages_FileDoesNotExist; + public static String LanguageSettingsImages_FolderDoesNotExist; + public static String LanguageSettingsImages_UsingRelativePathsNotRecommended; public static String LanguagesTab_0; public static String LanguagesTab_1; public static String LibraryPathTab_1; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/Messages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/Messages.properties index 80f166a65c7..8da3b3582fc 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/Messages.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/Messages.properties @@ -166,6 +166,9 @@ IncludeDialog_0=Directory: IncludeDialog_1=File: IncludeDialog_2=Add to all configurations IncludeDialog_3=Add to all languages +LanguageSettingsImages_FileDoesNotExist=The selected file does not exist or not accessible. +LanguageSettingsImages_FolderDoesNotExist=The selected folder does not exist or not accessible. +LanguageSettingsImages_UsingRelativePathsNotRecommended=Using relative paths is ambiguous and not recommended. It can cause unexpected effects. LanguagesTab_0=Content type LanguagesTab_1=Language LibraryPathTab_1=Add... diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/StatusMessageLine.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/StatusMessageLine.java new file mode 100644 index 00000000000..aacedf2cbcb --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/StatusMessageLine.java @@ -0,0 +1,81 @@ +/******************************************************************************* + * Copyright (c) 2010 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.newui; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CLabel; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; + +/** + * A message line displaying a status. + * See also org.eclipse.jface.dialogs.StatusDialog.MessageLine. + */ +public class StatusMessageLine { + private CLabel fLabel; + + /** + * Constructor. + * + * @param parent - parent element. + * @param style - the style of the control. Refer to {@link CLabel#CLabel(Composite, int)}. + * @param span - how many columns it should span. + */ + public StatusMessageLine(Composite parent, int style, int span) { + fLabel = new CLabel(parent, style); + if (span!=1) { + GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false); + gd.horizontalSpan = span; + fLabel.setLayoutData(gd); + } + } + + /** + * Find an image associated with the status. + */ + private Image findImage(IStatus status) { + if (status.isOK()) { + return null; + } else if (status.matches(IStatus.ERROR)) { + return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); + } else if (status.matches(IStatus.WARNING)) { + return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); + } else if (status.matches(IStatus.INFO)) { + return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); + } + return null; + } + + /** + * Assign {@link IStatus} object to the message line. The status should provide + * severity for the icon and message to display. + * + * @param status - status object for the message line. + */ + public void setErrorStatus(IStatus status) { + if (status != null && !status.isOK()) { + String message = status.getMessage(); + if (message != null && message.length() > 0) { + fLabel.setText(message); + fLabel.setImage(findImage(status)); + fLabel.layout(); + return; + } + } + fLabel.setText(""); //$NON-NLS-1$ + fLabel.setImage(null); + } +} \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CDTSharedImages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CDTSharedImages.java index 73cbf49068b..adf97abc88d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CDTSharedImages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CDTSharedImages.java @@ -47,7 +47,7 @@ import org.eclipse.swt.graphics.Image; * * @noextend This class is not intended to be subclassed by clients. * @noinstantiate This class is not intended to be instantiated by clients. - * + * * @since 5.3 */ public class CDTSharedImages { @@ -116,6 +116,8 @@ public class CDTSharedImages { public static final String IMG_OBJS_INCLUDES_FOLDER_WORKSPACE = "icons/obj16/wsp_includefolder.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_QUOTE_INCLUDES_FOLDER = "icons/obj16/hfolder_quote_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_INCLUDES_FOLDER_SYSTEM = "icons/obj16/fldr_sys_obj.gif"; //$NON-NLS-1$ + /** @since 5.4 */ + public static final String IMG_OBJS_FRAMEWORKS_FOLDER = "icons/obj16/frameworks.png"; //$NON-NLS-1$ public static final String IMG_OBJS_MACROS_FILE= "icons/obj16/macros_file.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_LIBRARY_FOLDER= "icons/obj16/fldr_lib_obj.gif"; // $NON-NLS-1$ //$NON-NLS-1$ public static final String IMG_OBJS_ORDER = "icons/obj16/cp_order_obj.gif"; //$NON-NLS-1$ @@ -184,21 +186,21 @@ public class CDTSharedImages { public static final String IMG_OVR_ERROR = "icons/ovr16/error_co.gif"; //$NON-NLS-1$ public static final String IMG_OVR_SETTING = "icons/ovr16/setting_nav.gif"; //$NON-NLS-1$ public static final String IMG_OVR_INACTIVE = "icons/ovr16/inactive_co.gif"; //$NON-NLS-1$ - + // 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_G_PINNED = "icons/obj16/threads_obj_g.gif"; //$NON-NLS-1$ public static final String IMG_THREAD_SUSPENDED_B_PINNED = "icons/obj16/threads_obj_b.gif"; //$NON-NLS-1$ - + public static final String IMG_THREAD_RUNNING_R_PINNED = "icons/obj16/thread_obj_r.gif"; //$NON-NLS-1$ public static final String IMG_THREAD_RUNNING_G_PINNED = "icons/obj16/thread_obj_g.gif"; //$NON-NLS-1$ - public static final String IMG_THREAD_RUNNING_B_PINNED = "icons/obj16/thread_obj_b.gif"; //$NON-NLS-1$ - + public static final String IMG_THREAD_RUNNING_B_PINNED = "icons/obj16/thread_obj_b.gif"; //$NON-NLS-1$ + public static final String IMG_CONTAINER_SUSPENDED_R_PINNED = "icons/obj16/debugts_obj_r.gif"; //$NON-NLS-1$ public static final String IMG_CONTAINER_SUSPENDED_G_PINNED = "icons/obj16/debugts_obj_g.gif"; //$NON-NLS-1$ public static final String IMG_CONTAINER_SUSPENDED_B_PINNED = "icons/obj16/debugts_obj_b.gif"; //$NON-NLS-1$ - - public static final String IMG_CONTAINER_RUNNING_R_PINNED = "icons/obj16/debugt_obj_r.gif"; //$NON-NLS-1$ + + public static final String IMG_CONTAINER_RUNNING_R_PINNED = "icons/obj16/debugt_obj_r.gif"; //$NON-NLS-1$ public static final String IMG_CONTAINER_RUNNING_G_PINNED = "icons/obj16/debugt_obj_g.gif"; //$NON-NLS-1$ public static final String IMG_CONTAINER_RUNNING_B_PINNED = "icons/obj16/debugt_obj_b.gif"; //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java index 3dde6555933..63e0fe4ec34 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractLangsListTab.java @@ -9,6 +9,7 @@ * Intel Corporation - initial API and implementation * IBM Corporation * Markus Schorn (Wind River Systems) + * Andrew Gvozdev *******************************************************************************/ package org.eclipse.cdt.ui.newui; @@ -18,6 +19,7 @@ import java.util.Comparator; import java.util.LinkedList; import java.util.List; +import org.eclipse.core.resources.IProject; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.viewers.IFontProvider; import org.eclipse.jface.viewers.IStructuredContentProvider; @@ -65,9 +67,10 @@ import org.eclipse.cdt.core.settings.model.ICSettingBase; import org.eclipse.cdt.core.settings.model.ICSettingEntry; import org.eclipse.cdt.core.settings.model.MultiLanguageSetting; import org.eclipse.cdt.core.settings.model.util.CDataUtil; -import org.eclipse.cdt.ui.CDTSharedImages; +import org.eclipse.cdt.internal.ui.newui.LanguageSettingsImages; import org.eclipse.cdt.internal.ui.newui.Messages; +import org.eclipse.cdt.internal.ui.newui.StatusMessageLine; public abstract class AbstractLangsListTab extends AbstractCPropertyTab { protected Table table; @@ -77,6 +80,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab { protected Button showBIButton; protected boolean toAllCfgs = false; protected boolean toAllLang = false; + private StatusMessageLine fStatusLine; + /** @deprecated as of CDT 8.0. {@code linkStringListMode} is used instead. */ @Deprecated protected Label lb1, lb2; @@ -120,12 +125,6 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab { private static final Comparator comp = CDTListComparator.getInstance(); private static String selectedLanguage; - private final static Image IMG_FOLDER = CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_FOLDER); - private final static Image IMG_INCLUDES_FOLDER = CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER); - private final static Image IMG_BUILTIN_FOLDER = CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER_SYSTEM); - private final static Image IMG_WORKSPACE = CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_WORKSPACE); - private final static Image IMG_INCLUDES_FOLDER_WORKSPACE = CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER_WORKSPACE); - private final static Image IMG_MACRO = CDTSharedImages.getImage(CDTSharedImages.IMG_OBJS_MACRO); private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 10, 30 }; @Override @@ -186,11 +185,12 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab { public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} }); - tv.setLabelProvider(new RichLabelProvider()); + tv.setLabelProvider(new LanguageSettingsEntriesLabelProvider()); table.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { + updateStatusLine(); updateButtons(); } @@ -211,6 +211,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab { setColumnToFit(); }}); + fStatusLine = new StatusMessageLine(usercomp, SWT.LEFT, 2); + showBIButton = setupCheck(usercomp, Messages.AbstractLangsListTab_ShowBuiltin, 1, GridData.GRAB_HORIZONTAL); gd = (GridData) showBIButton.getLayoutData(); showBIButton.addSelectionListener(new SelectionAdapter() { @@ -233,6 +235,17 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab { updateData(getResDesc()); } + /** + * @return selected entry when only one is selected or {@code null}. + */ + private ICLanguageSettingEntry getSelectedEntry() { + int index = table.getSelectionIndex(); + if (index<0 || table.getSelectionIndices().length!=1) + return null; + + return (ICLanguageSettingEntry)(table.getItem(index).getData()); + } + /** * Used to display UI control for multiple configurations string list mode * (see Multiple Configurations Edit Preference page). @@ -243,6 +256,14 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab { stringListModeControl.updateStringListModeControl(); } + /** + * Displays warning message - if any - for selected language settings entry. + * Multiline selection is not supported. + */ + private void updateStatusLine() { + fStatusLine.setErrorStatus(LanguageSettingsImages.getStatus(getSelectedEntry(), getResDesc().getConfiguration())); + } + /** * Updates state for all buttons * Called when table selection changes. @@ -351,6 +372,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab { } updateStringListModeControl(); + updateStatusLine(); updateButtons(); } @@ -698,70 +720,63 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab { } // Extended label provider - private class RichLabelProvider extends LabelProvider implements IFontProvider, ITableLabelProvider /*, IColorProvider*/{ - public RichLabelProvider(){} + private class LanguageSettingsEntriesLabelProvider extends LabelProvider implements IFontProvider, ITableLabelProvider /*, IColorProvider*/{ @Override public Image getImage(Object element) { return getColumnImage(element, 0); } + @Override public Image getColumnImage(Object element, int columnIndex) { - if (columnIndex > 0) return null; - if (! (element instanceof ICLanguageSettingEntry)) return null; - - ICLanguageSettingEntry le = (ICLanguageSettingEntry) element; - if (le.getKind() == ICSettingEntry.MACRO) - return IMG_MACRO; - if ((le.getFlags() & ICSettingEntry.BUILTIN) != 0) - return IMG_BUILTIN_FOLDER; - - boolean isWorkspacePath = (le.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0; - if (le.getKind() == ICSettingEntry.INCLUDE_PATH || le.getKind() == ICSettingEntry.INCLUDE_FILE) { - if (isWorkspacePath) - return IMG_INCLUDES_FOLDER_WORKSPACE; - else - return IMG_INCLUDES_FOLDER; - } else { - if (isWorkspacePath) - return IMG_WORKSPACE; - else - return IMG_FOLDER; + if (columnIndex==0 && (element instanceof ICLanguageSettingEntry)) { + ICConfigurationDescription cfg = getResDesc().getConfiguration(); + IProject project = cfg.getProjectDescription().getProject(); + return LanguageSettingsImages.getImage((ICLanguageSettingEntry) element, project.getName(), cfg); } + return null; } + @Override public String getText(Object element) { return getColumnText(element, 0); } + @Override public String getColumnText(Object element, int columnIndex) { - if (! (element instanceof ICLanguageSettingEntry)) { - return (columnIndex == 0) ? element.toString() : EMPTY_STR; - } - ICLanguageSettingEntry le = (ICLanguageSettingEntry) element; - if (columnIndex == 0) { - String s = le.getName(); - if (exported.contains(resolve(le))) - s = s + Messages.AbstractLangsListTab_ExportIndicator; - return s; - } - if (le.getKind() == ICSettingEntry.MACRO) { + if (element instanceof ICLanguageSettingEntry) { + ICLanguageSettingEntry entry = (ICLanguageSettingEntry) element; switch (columnIndex) { - case 1: return le.getValue(); + case 0: + String name = entry.getName(); + if (exported.contains(resolve(entry))) + name = name + Messages.AbstractLangsListTab_ExportIndicator; + return name; + case 1: + if (entry.getKind() == ICSettingEntry.MACRO) { + return entry.getValue(); } + return null; + } + } else if (columnIndex == 0) { + return element.toString(); } - return EMPTY_STR; + + return null; } @Override public Font getFont(Object element) { - if (! (element instanceof ICLanguageSettingEntry)) return null; - ICLanguageSettingEntry le = (ICLanguageSettingEntry) element; - if (le.isBuiltIn()) return null; // built in - if (le.isReadOnly()) // read only + if (element instanceof ICLanguageSettingEntry) { + ICLanguageSettingEntry entry = (ICLanguageSettingEntry) element; + if (entry.isBuiltIn()) + return null; + if (entry.isReadOnly()) return JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT); // normal return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); } + return null; + } } public ICLanguageSetting[] getLangSetting(ICResourceDescription rcDes) {