1 11 package org.eclipse.ui.texteditor.link; 12 13 import org.eclipse.jface.text.ITextViewer; 14 import org.eclipse.jface.text.link.LinkedModeModel; 15 import org.eclipse.jface.text.link.LinkedModeUI; 16 import org.eclipse.jface.text.link.LinkedPosition; 17 18 import org.eclipse.ui.IEditorPart; 19 import org.eclipse.ui.IWorkbenchPage; 20 import org.eclipse.ui.IWorkbenchWindow; 21 import org.eclipse.ui.PlatformUI; 22 23 29 public class EditorLinkedModeUI extends LinkedModeUI { 30 31 36 private static class EditorHistoryUpdater implements ILinkedModeUIFocusListener { 37 38 41 public void linkingFocusLost(LinkedPosition position, LinkedModeUITarget target) { 42 IWorkbenchWindow win= PlatformUI.getWorkbench().getActiveWorkbenchWindow(); 44 if (win != null) { 45 IWorkbenchPage page= win.getActivePage(); 46 if (page != null) { 47 IEditorPart part= page.getActiveEditor(); 48 page.getNavigationHistory().markLocation(part); 49 } 50 } 51 } 52 53 56 public void linkingFocusGained(LinkedPosition position, LinkedModeUITarget target) { 57 } 59 } 60 61 62 66 public EditorLinkedModeUI(LinkedModeModel model, ITextViewer viewer) { 67 super(model, viewer); 68 setPositionListener(new EditorHistoryUpdater()); 69 } 70 71 75 public EditorLinkedModeUI(LinkedModeModel model, ITextViewer[] viewers) { 76 super(model, viewers); 77 setPositionListener(new EditorHistoryUpdater()); 78 } 79 80 84 public EditorLinkedModeUI(LinkedModeModel model, LinkedModeUITarget target) { 85 super(model, target); 86 setPositionListener(new EditorHistoryUpdater()); 87 } 88 89 93 public EditorLinkedModeUI(LinkedModeModel model, LinkedModeUITarget[] targets) { 94 super(model, targets); 95 setPositionListener(new EditorHistoryUpdater()); 96 } 97 } 98 | Popular Tags |