1 11 package org.eclipse.debug.internal.ui.sourcelookup; 12 13 import java.util.HashMap ; 14 import java.util.Map ; 15 16 import org.eclipse.ui.IWindowListener; 17 import org.eclipse.ui.IWorkbench; 18 import org.eclipse.ui.IWorkbenchPage; 19 import org.eclipse.ui.IWorkbenchWindow; 20 import org.eclipse.ui.PlatformUI; 21 22 27 public class SourceLookupManager implements IWindowListener { 28 29 private static SourceLookupManager fgDefault; 30 31 34 private Map fServices = new HashMap (); 35 36 private SourceLookupManager() { 37 IWorkbench workbench = PlatformUI.getWorkbench(); 38 IWorkbenchWindow[] workbenchWindows = workbench.getWorkbenchWindows(); 39 for (int i = 0; i < workbenchWindows.length; i++) { 40 IWorkbenchWindow window = workbenchWindows[i]; 41 windowOpened(window); 42 } 43 workbench.addWindowListener(this); 44 } 45 46 51 public static SourceLookupManager getDefault() { 52 if (fgDefault == null) { 53 fgDefault = new SourceLookupManager(); 54 } 55 return fgDefault; 56 } 57 58 61 public void windowActivated(IWorkbenchWindow window) { 62 } 63 64 67 public void windowDeactivated(IWorkbenchWindow window) { 68 } 69 70 73 public void windowClosed(IWorkbenchWindow window) { 74 SourceLookupService service = (SourceLookupService) fServices.get(window); 75 if (service != null) { 76 service.dispose(); 77 } 78 } 79 80 83 public void windowOpened(IWorkbenchWindow window) { 84 SourceLookupService service = new SourceLookupService(window); 85 fServices.put(window, service); 86 } 87 88 91 public void displaySource(Object context, IWorkbenchPage page, boolean forceSourceLookup) { 92 IWorkbenchWindow window = page.getWorkbenchWindow(); 93 SourceLookupService service = (SourceLookupService) fServices.get(window); 94 if (service != null) { 95 service.displaySource(context, page, forceSourceLookup); 96 } 97 } 98 } 99 | Popular Tags |