diff options
| author | Ewgeni Grigorov | 2012-11-20 17:31:31 +0000 |
|---|---|---|
| committer | Curtis Windatt | 2012-11-20 17:31:31 +0000 |
| commit | 07c5f52b120128c0562ef7dc7ed2aed8388a2e68 (patch) | |
| tree | 822c13c966af3b8d274c186d25119662476064bb | |
| parent | 1e783a378a474f3a2183cc6d7555c3ea92d6a925 (diff) | |
| download | eclipse.jdt.debug-07c5f52b120128c0562ef7dc7ed2aed8388a2e68.tar.gz eclipse.jdt.debug-07c5f52b120128c0562ef7dc7ed2aed8388a2e68.tar.xz eclipse.jdt.debug-07c5f52b120128c0562ef7dc7ed2aed8388a2e68.zip | |
Bug 343023 - Clear the initial stack trace console message on the first
edit
| -rw-r--r-- | org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceConsole.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceConsole.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceConsole.java index 26181256f..d072701c2 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceConsole.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/console/JavaStackTraceConsole.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,7 +28,9 @@ import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jdt.internal.debug.ui.IJavaDebugHelpContextIds; import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.text.DocumentEvent; import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IDocumentListener; import org.eclipse.jface.text.rules.FastPartitioner; import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; import org.eclipse.jface.util.IPropertyChangeListener; @@ -47,6 +49,21 @@ import org.eclipse.ui.progress.WorkbenchJob; public class JavaStackTraceConsole extends TextConsole { /** + * Removes the stack trace console hint text displayed when + * the view is first opened. Should be called when content is + * first entered into the console. + */ + private static class JavaStackTraceConsoleCleaner implements IDocumentListener { + + public void documentAboutToBeChanged(DocumentEvent event) {/*nothing to do here*/} + + public void documentChanged(DocumentEvent event) { + event.fDocument.removeDocumentListener(this); + event.fDocument.set(event.fText); + } + } + + /** * Provides a partitioner for this console type */ class JavaStackTraceConsolePartitioner extends FastPartitioner implements IConsoleDocumentPartitioner { @@ -93,6 +110,7 @@ public class JavaStackTraceConsole extends TextConsole { * inits the document backing this console */ void initializeDocument() { + File file = new File(FILE_NAME); if (file.exists()) { try { @@ -108,7 +126,9 @@ public class JavaStackTraceConsole extends TextConsole { } catch (IOException e) { } } else { - getDocument().set(ConsoleMessages.JavaStackTraceConsole_0); + IDocument doc = getDocument(); + doc.set(ConsoleMessages.JavaStackTraceConsole_0); + doc.addDocumentListener(new JavaStackTraceConsoleCleaner()); } } |
