1 11 package org.eclipse.debug.internal.ui.contexts; 12 13 import java.util.HashMap ; 14 import java.util.Map ; 15 16 import org.eclipse.core.runtime.IAdapterFactory; 17 import org.eclipse.debug.core.ILaunch; 18 import org.eclipse.debug.ui.contexts.ISuspendTrigger; 19 20 23 public class SuspendTriggerAdapterFactory implements IAdapterFactory { 24 25 private Map fSuspendTriggers = new HashMap (); 26 27 30 public synchronized Object getAdapter(Object adaptableObject, Class adapterType) { 31 if (adapterType.equals(ISuspendTrigger.class)) { 32 if (adaptableObject instanceof ILaunch) { 33 Object trigger = fSuspendTriggers.get(adaptableObject); 34 if (trigger == null) { 35 trigger = new LaunchSuspendTrigger((ILaunch) adaptableObject, this); 36 fSuspendTriggers.put(adaptableObject, trigger); 37 } 38 return trigger; 39 } 40 } 41 return null; 42 } 43 44 47 public Class [] getAdapterList() { 48 return new Class []{ISuspendTrigger.class}; 49 } 50 51 public synchronized void dispose(LaunchSuspendTrigger trigger) { 52 fSuspendTriggers.remove(trigger.getLaunch()); 53 } 54 55 } 56 | Popular Tags |