1 11 package org.eclipse.jdt.internal.debug.ui.console; 12 13 import org.eclipse.jface.action.IAction; 14 import org.eclipse.jface.viewers.ISelection; 15 import org.eclipse.ui.IViewActionDelegate; 16 import org.eclipse.ui.IViewPart; 17 import org.eclipse.ui.console.IConsole; 18 import org.eclipse.ui.console.IConsoleView; 19 20 public class FormatStackTraceActionDelegate implements IViewActionDelegate { 21 22 private JavaStackTraceConsole fConsole; 23 private IConsoleView fView; 24 25 public FormatStackTraceActionDelegate() {} 26 27 public FormatStackTraceActionDelegate(JavaStackTraceConsole console) { 28 fConsole = console; 29 } 30 31 34 public void init(IViewPart view) { 35 if (view instanceof IConsoleView) { 36 fView = (IConsoleView) view; 37 } 38 } 39 40 43 public void run(IAction action) { 44 if (fConsole != null) { 45 fConsole.format(); 46 } 47 else if (fView != null) { 48 IConsole console = fView.getConsole(); 49 if (console instanceof JavaStackTraceConsole) { 50 fConsole = (JavaStackTraceConsole) console; 51 fConsole.format(); 52 } 53 } 54 } 55 56 59 public void selectionChanged(IAction action, ISelection selection) {} 60 } 61 | Popular Tags |