Community
Participate
Working Groups
});
}
/* (non-Javadoc)
* @see org.eclipse.ui.console.IConsoleFactory#openConsole()
*/
fConsoleManager.showConsoleView(fConsole);
public void openConsole(String initialText) {
if (fConsole == null) {
fConsole = new JavaStackTraceConsole();
fConsole.initializeDocument();
fConsole.getDocument().set(initialText);
fConsoleManager.addConsoles(new IConsole[]{fConsole});
final Action importLogAction = createImportLogAction();
toolBarManager.add(importLogAction);
toolBarManager.add(new Separator());
toolBarManager.add(new Separator("additions"));
final Action clearAction = createClearAction();
toolBarManager.add(clearAction);
</menuContribution>
-->
</extension>
<extension
point="org.eclipse.ui.viewActions">
<viewContribution
id="org.eclipse.pde.ui.logViewActions"
targetID="org.eclipse.pde.runtime.LogView">
<action
class="org.eclipse.pde.internal.ui.ShowErrorInStackTraceConsoleAction"
disabledIcon="$nl$/icons/obj16/open_artifact_obj.gif"
enablesFor="+"
hoverIcon="$nl$/icons/obj16/open_artifact_obj.gif"
icon="$nl$/icons/obj16/open_artifact_obj.gif"
id="org.eclipse.jdt.debug.ui.LogViewActions.showStackTrace"
label="Show in Stack Trace Console View"
toolbarPath="additions"
tooltip="Display the stack trace from the currently selected error in the java stack trace console">
</action>
</viewContribution>
</plugin>
package org.eclipse.pde.internal.ui;
import org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceConsoleFactory;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.internal.views.log.LogEntry;
public class ShowErrorInStackTraceConsoleAction implements IViewActionDelegate {
String fSelectedStack;
public void init(IViewPart view) {
public void run(IAction action) {
if (fSelectedStack != null) {
JavaStackTraceConsoleFactory factory = new JavaStackTraceConsoleFactory();
factory.openConsole(fSelectedStack);
public void selectionChanged(IAction action, ISelection selection) {
fSelectedStack = null;
action.setEnabled(false);
if (selection instanceof IStructuredSelection) {
Object firstObject = ((IStructuredSelection) selection).getFirstElement();
if (firstObject instanceof LogEntry) {
String stack = ((LogEntry) firstObject).getStack();
if (stack != null && stack.length() > 0) {
action.setEnabled(true);
fSelectedStack = stack;