1 8 package com.mountainminds.eclemma.internal.ui; 9 10 import org.eclipse.core.runtime.IAdapterFactory; 11 import org.eclipse.jface.resource.ImageDescriptor; 12 import org.eclipse.ui.model.IWorkbenchAdapter; 13 14 import com.mountainminds.eclemma.core.ICoverageSession; 15 16 23 public class WorkbenchAdapterFactory implements IAdapterFactory { 24 25 private static final IWorkbenchAdapter SESSIONADAPTER = new IWorkbenchAdapter() { 26 27 public ImageDescriptor getImageDescriptor(Object object) { 28 return EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.OBJ_SESSION); 29 } 30 31 public String getLabel(Object o) { 32 return ((ICoverageSession) o).getDescription(); 33 } 34 35 public Object [] getChildren(Object o) { 36 return new Object [0]; 37 } 38 39 public Object getParent(Object o) { 40 return null; 41 } 42 43 }; 44 45 public Object getAdapter(Object adaptableObject, Class adapterType) { 46 if (adaptableObject instanceof ICoverageSession) { 47 return SESSIONADAPTER; 48 } 49 return null; 50 } 51 52 public Class [] getAdapterList() { 53 return new Class [] { IWorkbenchAdapter.class }; 54 } 55 56 } 57 | Popular Tags |