1 11 package org.eclipse.ui.internal.console; 12 13 import org.eclipse.jface.action.Action; 14 import org.eclipse.ui.PlatformUI; 15 import org.eclipse.ui.console.IHyperlink; 16 import org.eclipse.ui.console.TextConsoleViewer; 17 18 23 public class FollowHyperlinkAction extends Action { 24 25 private TextConsoleViewer viewer; 26 27 30 public FollowHyperlinkAction(TextConsoleViewer consoleViewer) { 31 super(ConsoleMessages.FollowHyperlinkAction_0); 32 setToolTipText(ConsoleMessages.FollowHyperlinkAction_1); 33 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_OPEN_LINK_ACTION); 34 this.viewer = consoleViewer; 35 } 36 37 40 public boolean isEnabled() { 41 return viewer.getHyperlink() != null; 42 } 43 44 48 public void run() { 49 IHyperlink link = viewer.getHyperlink(); 50 if (link != null) { 51 link.linkActivated(); 52 } 53 } 54 55 } 56 | Popular Tags |