public Object getAdapter(Class adapter) { AdapterDebug.print(this, adapter); // Not really sure what to do here, but I am trying if (adapter.equals(ILaunch.class)) { return launch; } else if (adapter.equals(IResource.class)) { // used by Variable ContextManager, and Project:Properties menu item if (file != null) { IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(file[0]); if (files != null && files.length > 0) { return files[0]; } else { return null; } } } else if (adapter.equals(org.eclipse.debug.ui.actions.IRunToLineTarget.class)) { return this.getRunToLineTarget(); } else if (adapter.equals(IPropertySource.class)) { return launch.getAdapter(adapter); } else if (adapter.equals(ITaskListResourceAdapter.class) || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class)) { return super.getAdapter(adapter); } AdapterDebug.printDontKnow(this, adapter); return super.getAdapter(adapter); }
public Object getAdapter(Class adapter) { AdapterDebug.print(this, adapter); if (adapter.equals(ILaunch.class)) { return target.getAdapter(adapter); } else if (adapter.equals(org.eclipse.debug.ui.actions.IRunToLineTarget.class)) { return this.target.getRunToLineTarget(); } else if (adapter.equals(IPropertySource.class) || adapter.equals(ITaskListResourceAdapter.class) || adapter.equals(org.eclipse.ui.IContributorResourceAdapter.class) || adapter.equals(org.eclipse.ui.IActionFilter.class) || adapter.equals(org.eclipse.ui.model.IWorkbenchAdapter.class) || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class) || adapter.equals(IResource.class) || adapter.equals(org.eclipse.core.resources.IFile.class)) return super.getAdapter(adapter); // ongoing, I do not fully understand all the interfaces they'd like me to support // so I print them out as errors if (adapter.equals(IDeferredWorkbenchAdapter.class)) { return new DeferredWorkbenchAdapter(this); } // cannot check for the actual interface because it may not be available on eclipse 3.2 (it's // only available // from 3.3 onwards... and this is only a hack for it to work with eclipse 3.4) if (adapter .toString() .endsWith( "org.eclipse.debug.internal.ui.viewers.model.provisional.IElementContentProvider")) { return new PyVariableContentProviderHack(); } AdapterDebug.printDontKnow(this, adapter); return super.getAdapter(adapter); }