1 11 package org.eclipse.ui.internal.ide.model; 12 13 import org.eclipse.core.resources.IFile; 14 import org.eclipse.core.resources.IResource; 15 import org.eclipse.core.runtime.content.IContentType; 16 import org.eclipse.jface.resource.ImageDescriptor; 17 import org.eclipse.ui.ISharedImages; 18 import org.eclipse.ui.PlatformUI; 19 import org.eclipse.ui.ide.IDE; 20 21 24 public class WorkbenchFile extends WorkbenchResource { 25 26 31 protected ImageDescriptor getBaseImage(IResource resource) { 32 IContentType contentType = null; 33 if (resource instanceof IFile) { 35 contentType = IDE.guessContentType((IFile)resource); 36 } 37 ImageDescriptor image = PlatformUI.getWorkbench().getEditorRegistry() 39 .getImageDescriptor(resource.getName(), contentType); 40 if (image == null) { 41 image = PlatformUI.getWorkbench().getSharedImages() 42 .getImageDescriptor(ISharedImages.IMG_OBJ_FILE); 43 } 44 return image; 45 } 46 } 47 | Popular Tags |