1 11 package org.eclipse.debug.internal.ui; 12 13 14 import org.eclipse.core.runtime.IAdapterFactory; 15 import org.eclipse.debug.core.model.IDebugElement; 16 import org.eclipse.debug.core.model.IProcess; 17 import org.eclipse.debug.ui.DebugUITools; 18 import org.eclipse.debug.ui.IDebugModelPresentation; 19 import org.eclipse.jface.resource.ImageDescriptor; 20 import org.eclipse.ui.model.IWorkbenchAdapter; 21 22 27 class DebugUIPropertiesAdapterFactory implements IAdapterFactory { 28 29 class DebugUIPropertiesAdapter implements IWorkbenchAdapter { 30 31 34 public Object [] getChildren(Object o) { 35 return new Object [0]; 36 } 37 38 41 public ImageDescriptor getImageDescriptor(Object object) { 42 return DebugUITools.getDefaultImageDescriptor(object); 43 } 44 45 48 public String getLabel(Object o) { 49 IDebugModelPresentation presentation= DebugUIPlugin.getModelPresentation(); 50 return presentation.getText(o); 51 } 52 53 56 public Object getParent(Object o) { 57 return null; 58 } 59 } 60 61 64 public Object getAdapter(Object obj, Class adapterType) { 65 if (adapterType.isInstance(obj)) { 66 return obj; 67 } 68 if (adapterType == IWorkbenchAdapter.class) { 69 if (obj instanceof IDebugElement) { 70 return new DebugUIPropertiesAdapter(); 71 } 72 if (obj instanceof IProcess) { 73 return new DebugUIPropertiesAdapter(); 74 } 75 } 76 return null; 77 } 78 79 82 public Class [] getAdapterList() { 83 return new Class [] { 84 IWorkbenchAdapter.class 85 }; 86 } 87 } 88 89 | Popular Tags |