mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 16:55:38 +02:00
196421: [Editor] cannot visually distinguish workspace files from externals
This commit is contained in:
parent
4e91bb54ab
commit
879d4c3661
5 changed files with 58 additions and 13 deletions
BIN
core/org.eclipse.cdt.ui/icons/ovr16/external_file.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/ovr16/external_file.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 873 B |
|
@ -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$
|
||||
|
|
|
@ -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 <code>JavaEditorErrorTickUpdater</code> 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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue