1 19 20 package org.netbeans.modules.debugger.jpda; 21 22 import java.util.Map ; 23 import org.netbeans.api.debugger.jpda.AttachingDICookie; 24 import org.netbeans.api.debugger.jpda.JPDADebugger; 25 import org.netbeans.spi.debugger.SessionProvider; 26 import org.netbeans.spi.debugger.ContextProvider; 27 import org.openide.util.NbBundle; 28 29 30 34 public class AttachingSessionProvider extends SessionProvider { 35 36 private ContextProvider contextProvider; 37 private AttachingDICookie sadic; 38 39 public AttachingSessionProvider (ContextProvider contextProvider) { 40 this.contextProvider = contextProvider; 41 sadic = (AttachingDICookie) contextProvider.lookupFirst 42 (null, AttachingDICookie.class); 43 }; 44 45 public String getSessionName () { 46 Map arguments = (Map ) contextProvider.lookupFirst 47 (null, Map .class); 48 if (arguments != null) { 49 String processName = (String ) arguments.get ("name"); 50 if (processName != null) 51 return LaunchingSessionProvider.findUnique (processName); 52 } 53 if (sadic.getHostName () != null) 54 return sadic.getHostName () + ":" + sadic.getPortNumber (); 55 return LaunchingSessionProvider.findUnique 56 (sadic.getSharedMemoryName ()); 57 }; 58 59 public String getLocationName () { 60 if (sadic.getHostName () != null) 61 return sadic.getHostName (); 62 return NbBundle.getMessage 63 (AttachingSessionProvider.class, "CTL_Localhost"); 64 } 65 66 public String getTypeID () { 67 return JPDADebugger.SESSION_ID; 68 } 69 70 public Object [] getServices () { 71 return new Object [0]; 72 } 73 } 74 75 | Popular Tags |