@SuppressWarnings("rawtypes")
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (!(adaptableObject instanceof GdbLaunch)) return null;
GdbLaunch launch = (GdbLaunch)adaptableObject;
// Check for valid session.
// Note: even if the session is no longer active, the adapter set
// should still be returned. This is because the view model may still
// need to show elements representing a terminated process/thread/etc.
DsfSession session = launch.getSession();
if (session == null) return null;
// Find the correct set of adapters based on the launch session-ID. If not found
// it means that we have a new launch and new session, and we have to create a
// new set of adapters.