1 11 package org.eclipse.ui.internal.activities.ws; 12 13 import org.eclipse.jface.viewers.LabelProvider; 14 import org.eclipse.swt.graphics.Image; 15 import org.eclipse.ui.activities.IActivity; 16 import org.eclipse.ui.activities.IActivityManager; 17 import org.eclipse.ui.activities.NotDefinedException; 18 19 26 public class ActivityLabelProvider extends LabelProvider { 27 28 private IActivityManager activityManager; 29 30 36 public ActivityLabelProvider(IActivityManager activityManager) { 37 this.activityManager = activityManager; 38 } 39 40 44 private String getActivityText(IActivity activity) { 45 try { 46 return activity.getName(); 47 } catch (NotDefinedException e) { 48 return activity.getId(); 49 } 50 } 51 52 57 public Image getImage(Object element) { 58 return null; 59 } 60 61 66 public String getText(Object element) { 67 if (element instanceof String ) { 68 return getActivityText(activityManager 69 .getActivity((String ) element)); 70 } else if (element instanceof IActivity) { 71 return getActivityText((IActivity) element); 72 } else { 73 throw new IllegalArgumentException (); 74 } 75 } 76 } 77 | Popular Tags |