diff --git a/core/org.eclipse.cdt.ui/icons/ovr16/external_file.gif b/core/org.eclipse.cdt.ui/icons/ovr16/external_file.gif new file mode 100644 index 00000000000..4a637db8e90 Binary files /dev/null and b/core/org.eclipse.cdt.ui/icons/ovr16/external_file.gif differ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java index c41ce010512..578cf9c52da 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. + * Copyright (c) 2005, 2008 IBM Corporation 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 @@ -268,10 +268,12 @@ public class CPluginImages { public static final ImageDescriptor DESC_OVR_READ_ACCESS= create(T_OVR, "read.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_READ_WRITE_ACCESS= create(T_OVR, "readwrite.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_WRITE_ACCESS= create(T_OVR, "write.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_OVR_EXTERNAL_FILE= create(T_OVR, "external_file.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_WARNING= create(T_OVR, "warning_co.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_OVR_ERROR= create(T_OVR, "error_co.gif"); //$NON-NLS-1$ + public static final ImageDescriptor DESC_WIZABAN_NEW_PROJ= create(T_WIZBAN, "newcprj_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZBAN_NEWCLASS= create(T_WIZBAN, "newclass_wiz.gif"); //$NON-NLS-1$ public static final ImageDescriptor DESC_WIZABAN_C_APP= create(T_WIZBAN, "c_app_wiz.gif"); //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorErrorTickUpdater.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorErrorTickUpdater.java index 8e6d8ab2014..fce33223827 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorErrorTickUpdater.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditorErrorTickUpdater.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. + * Copyright (c) 2000, 2008 QNX Software Systems 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 @@ -7,22 +7,26 @@ * * Contributors: * QNX Software Systems - Initial API and implementation + * Anton Leherbauer (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.internal.ui.editor; -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.internal.ui.util.IProblemChangedListener; -import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider; -import org.eclipse.cdt.internal.ui.viewsupport.CUILabelProvider; -import org.eclipse.cdt.internal.ui.viewsupport.ProblemsLabelDecorator; -import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.Assert; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IEditorInput; +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.ITranslationUnit; +import org.eclipse.cdt.ui.CUIPlugin; + +import org.eclipse.cdt.internal.ui.util.IProblemChangedListener; +import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider; +import org.eclipse.cdt.internal.ui.viewsupport.CUILabelProvider; +import org.eclipse.cdt.internal.ui.viewsupport.ProblemsLabelDecorator; + /** * The JavaEditorErrorTickUpdater will register as a AnnotationModelListener * on the annotation model of a Java Editor and update the title images when the annotation @@ -30,13 +34,35 @@ import org.eclipse.ui.IEditorInput; */ public class CEditorErrorTickUpdater implements IProblemChangedListener { + /** + * Provider for the editor title image. Marks external files with a folder overlay. + * + * @since 5.0 + */ + private static class CEditorImageProvider extends CUILabelProvider { + CEditorImageProvider() { + super(0, CElementImageProvider.SMALL_ICONS); + } + @Override + protected int evaluateImageFlags(Object element) { + int flags= getImageFlags(); + if (element instanceof ITranslationUnit) { + ITranslationUnit tUnit= (ITranslationUnit) element; + if (tUnit.getResource() == null) { + flags |= CElementImageProvider.OVERLAY_EXTERNAL; + } + } + return flags; + } + } + protected CEditor fCEditor; private CUILabelProvider fLabelProvider; public CEditorErrorTickUpdater(CEditor editor) { Assert.isNotNull(editor); fCEditor= editor; - fLabelProvider= new CUILabelProvider(0, CElementImageProvider.SMALL_ICONS); + fLabelProvider= new CEditorImageProvider(); fLabelProvider.addLabelDecorator(new ProblemsLabelDecorator(null)); CUIPlugin.getDefault().getProblemMarkerManager().addListener(this); } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementImageProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementImageProvider.java index 733e116b1a2..7e4969fea46 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementImageProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/CElementImageProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. + * Copyright (c) 2005, 2008 IBM Corporation 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 @@ -89,6 +89,11 @@ public class CElementImageProvider { */ public final static int OVERLAY_IMPLEMENTS= 0x40; + /** + * Show external file overlay. + */ + public final static int OVERLAY_EXTERNAL= 0x80; + public static final Point SMALL_SIZE= new Point(16, 16); public static final Point BIG_SIZE= new Point(22, 16); @@ -480,6 +485,9 @@ public class CElementImageProvider { // if ((renderFlags & OVERLAY_IMPLEMENTS) !=0) { // flags |= CElementImageDescriptor.IMPLEMENTS; // } + if ((renderFlags & OVERLAY_EXTERNAL) != 0) { + flags |= CElementImageDescriptor.EXTERNAL_FILE; + } return flags; } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementImageDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementImageDescriptor.java index a9906412995..2070af54955 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementImageDescriptor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CElementImageDescriptor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation 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 @@ -9,6 +9,7 @@ * IBM Corporation - initial API and implementation * QNX Software System * Markus Schorn (Wind River Systems) + * Anton Leherbauer (Wind River Systems) *******************************************************************************/ package org.eclipse.cdt.ui; @@ -54,7 +55,7 @@ public class CElementImageDescriptor extends CompositeImageDescriptor { */ public final static int RUNNABLE= 0x010; - /** Flag to render the waring adornment */ + /** Flag to render the warning adornment */ public final static int WARNING= 0x020; /** Flag to render the error adornment */ @@ -97,6 +98,9 @@ public class CElementImageDescriptor extends CompositeImageDescriptor { /** Flag to render the 'read access' adornment for references to variables or fields */ public static final int WRITE_ACCESS = 0x20000; + /** Flag to render the 'external file' adornment for translation units */ + public static final int EXTERNAL_FILE = 0x40000; + private ImageDescriptor fBaseImage; private int fFlags; private Point fSize; @@ -292,7 +296,12 @@ public class CElementImageDescriptor extends CompositeImageDescriptor { data= CPluginImages.DESC_OVR_WRITE_ACCESS.getImageData(); drawImage(data, 0, 0); } - } + + if ((fFlags & EXTERNAL_FILE) != 0) { + data= CPluginImages.DESC_OVR_EXTERNAL_FILE.getImageData(); + drawImage(data, 0, 0); + } + } private void drawBottomLeft() { Point size= getSize();