1 11 12 package org.eclipse.ui.views.tasklist; 13 14 import org.eclipse.core.resources.IFile; 15 import org.eclipse.core.resources.IResource; 16 import org.eclipse.core.runtime.IAdaptable; 17 18 23 class DefaultTaskListResourceAdapter implements ITaskListResourceAdapter { 24 25 private static ITaskListResourceAdapter singleton; 26 27 30 DefaultTaskListResourceAdapter() { 31 super(); 32 } 33 34 37 static ITaskListResourceAdapter getDefault() { 38 if (singleton == null) { 39 singleton = new DefaultTaskListResourceAdapter(); 40 } 41 return singleton; 42 } 43 44 47 public IResource getAffectedResource(IAdaptable adaptable) { 48 49 IResource resource = (IResource) adaptable.getAdapter(IResource.class); 50 if (resource == null) { 51 return (IFile) adaptable.getAdapter(IFile.class); 52 } else { 53 return resource; 54 } 55 56 } 57 58 } 59 | Popular Tags |