Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJared Burns2002-03-18 14:31:30 +0000
committerJared Burns2002-03-18 14:31:30 +0000
commita585863d50972ad39661bc1e9b0f91e6cfe8162f (patch)
tree0a265f8b65ac93cd08571f9591750300257eac79 /org.eclipse.debug.ui
parent46f9adc1aa7ae5e52d3a3d349be5b86abf7b7186 (diff)
downloadeclipse.platform.debug-a585863d50972ad39661bc1e9b0f91e6cfe8162f.tar.gz
eclipse.platform.debug-a585863d50972ad39661bc1e9b0f91e6cfe8162f.tar.xz
eclipse.platform.debug-a585863d50972ad39661bc1e9b0f91e6cfe8162f.zip
Bug 10162 - Console View to front on error output only
Diffstat (limited to 'org.eclipse.debug.ui')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsolePreferencePage.java7
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPreferencePage.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java40
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugPreferenceConstants.java9
5 files changed, 40 insertions, 21 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsolePreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsolePreferencePage.java
index 12f3bfbf8..08bb6d8de 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsolePreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/ConsolePreferencePage.java
@@ -5,10 +5,12 @@ package org.eclipse.debug.internal.ui;
* All Rights Reserved.
*/
+import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.ColorFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.RGB;
@@ -45,6 +47,9 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements
* Create all field editors for this page
*/
public void createFieldEditors() {
+
+ addField(new BooleanFieldEditor(CONSOLE_OPEN_ON_OUT, DebugUIMessages.getString("DebugPreferencePage.Show_&Console_View_when_there_is_program_output_3"), SWT.NONE, getFieldEditorParent())); //$NON-NLS-1$ addField(new BooleanFieldEditor(CONSOLE_OPEN_ON_OUT, DebugUIMessages.getString("DebugPreferencePage.Show_&Console_View_when_there_is_program_output_3"), SWT.NONE, getFieldEditorParent())); //$NON-NLS-1$
+ addField(new BooleanFieldEditor(CONSOLE_OPEN_ON_ERR, DebugUIMessages.getString("DebugPreferencePage.Show_&Console_View_when_there_is_program_error_3"), SWT.NONE, getFieldEditorParent())); //$NON-NLS-1$
// Note: first String value is the key for the preference bundle and second the
// second String value is the label displayed in front of the editor.
@@ -87,6 +92,8 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements
}
protected static void initDefaults(IPreferenceStore store) {
+ store.setDefault(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT, true);
+ store.setDefault(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR, true);
WorkbenchChainedTextFontFieldEditor.startPropagate(store, CONSOLE_FONT);
PreferenceConverter.setDefault(store, CONSOLE_SYS_OUT_RGB, new RGB(0, 0, 255));
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPreferencePage.java
index 8ed11623a..b9c0be95b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugPreferencePage.java
@@ -54,7 +54,6 @@ public class DebugPreferencePage extends FieldEditorPreferencePage implements IW
addField(new BooleanFieldEditor(IDebugUIConstants.PREF_SINGLE_CLICK_LAUNCHING, DebugUIMessages.getString("Enable_&single-click_launching_1"), SWT.NONE, getFieldEditorParent())); //$NON-NLS-1$
addField(new BooleanFieldEditor(IDebugUIConstants.PREF_AUTO_SHOW_DEBUG_VIEW, DebugUIMessages.getString("DebugPreferencePage.Show_Debug_Perspective_when_a_program_is_launched_in_de&bug_mode_1"), SWT.NONE, getFieldEditorParent())); //$NON-NLS-1$
addField(new BooleanFieldEditor(IDebugUIConstants.PREF_AUTO_SHOW_PROCESS_VIEW, DebugUIMessages.getString("DebugPreferencePage.Show_Debug_Perspective_when_a_program_is_launched_in_&run_mode_2"), SWT.NONE, getFieldEditorParent())); //$NON-NLS-1$
- addField(new BooleanFieldEditor(CONSOLE_OPEN, DebugUIMessages.getString("DebugPreferencePage.Show_&Console_View_when_there_is_program_output_3"), SWT.NONE, getFieldEditorParent())); //$NON-NLS-1$
addField(new BooleanFieldEditor(IDebugUIConstants.PREF_SHOW_VARIABLE_VALUE_CHANGES, DebugUIMessages.getString("DebugPreferencePage.Sho&w_variable_value_changes_in_Variables_and_Expressions_Views_1"), SWT.NONE, getFieldEditorParent())); //$NON-NLS-1$
addField(new BooleanFieldEditor(IDebugUIConstants.PREF_AUTO_REMOVE_OLD_LAUNCHES, DebugUIMessages.getString("DebugPreferencePage.Remove_terminated_launches_when_a_new_launch_is_created_1"), SWT.NONE, getFieldEditorParent())); //$NON-NLS-1$
addField(new RadioGroupFieldEditor(IDebugPreferenceConstants.VARIABLES_DETAIL_PANE_ORIENTATION,
@@ -79,7 +78,6 @@ public class DebugPreferencePage extends FieldEditorPreferencePage implements IW
store.setDefault(IDebugUIConstants.PREF_SINGLE_CLICK_LAUNCHING, false);
store.setDefault(IDebugUIConstants.PREF_AUTO_SHOW_DEBUG_VIEW, true);
store.setDefault(IDebugUIConstants.PREF_AUTO_SHOW_PROCESS_VIEW, true);
- store.setDefault(IDebugPreferenceConstants.CONSOLE_OPEN, true);
store.setDefault(IDebugUIConstants.PREF_AUTO_REMOVE_OLD_LAUNCHES, false);
store.setDefault(IDebugUIConstants.PREF_SHOW_VARIABLE_VALUE_CHANGES, true);
store.setDefault(IDebugPreferenceConstants.VARIABLES_DETAIL_PANE_ORIENTATION, IDebugPreferenceConstants.VARIABLES_DETAIL_PANE_UNDERNEATH);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
index a7889a1a3..b6e1cbd12 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties
@@ -26,7 +26,8 @@ ConsoleView.Select_&All@Ctrl+A_12=Select &All@Ctrl+A
ConsoleView.Select_All_13=Select All
ConsoleView.Select_All_14=Select All
DebugPreferencePage.auto_build_before_launch=Build (if required) before &launching
-DebugPreferencePage.Show_&Console_View_when_there_is_program_output_3=Show &Console View when there is program output
+DebugPreferencePage.Show_&Console_View_when_there_is_program_output_3=Show &Console View when there is program output
+DebugPreferencePage.Show_&Console_View_when_there_is_program_error_3=Show &Console View when there is program error
DebugPreferencePage.Show_Debug_Perspective_when_a_program_is_launched_in_&run_mode_2=Show Debug Perspective when a program is launched in &run mode
DebugPreferencePage.Show_Debug_Perspective_when_a_program_is_launched_in_de&bug_mode_1=Show Debug Perspective when a program is launched in de&bug mode
DebugPreferencePage.Orientation_of_detail_pane_in_variables_view_1=Orientation of detail pane in variables view
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
index 45e7b2a00..fc9f9ed7b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
@@ -94,8 +94,7 @@ import org.xml.sax.SAXException;
* The Debug UI Plugin.
*
*/
-public class DebugUIPlugin extends AbstractUIPlugin implements IDocumentListener,
- ILaunchListener,
+public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener,
IResourceChangeListener,
IPropertyChangeListener,
ILaunchConfigurationListener {
@@ -389,7 +388,6 @@ public class DebugUIPlugin extends AbstractUIPlugin implements IDocumentListener
Iterator docs= fConsoleDocuments.values().iterator();
while (docs.hasNext()) {
ConsoleDocument doc= (ConsoleDocument)docs.next();
- doc.removeDocumentListener(this);
doc.close();
}
try {
@@ -501,14 +499,31 @@ public class DebugUIPlugin extends AbstractUIPlugin implements IDocumentListener
}
/**
- * @see IDocumentListener#documentAboutToBeChanged(DocumentEvent)
+ * Notifies the DebugUIPlugin that system out is about to be written
+ * to the console. The plugin will open the console if the preference is
+ * set to show the console on system out.
+ */
+ public void aboutToWriteSystemOut() {
+ if (getPreferenceStore().getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT)) {
+ showConsole();
+ }
+ }
+
+ /**
+ * Notifies the DebugUIPlugin that system err is about to be written
+ * to the console. The plugin will open the console if the preference is
+ * set to show the console on system err.
*/
- public void documentAboutToBeChanged(final DocumentEvent e) {
- // if the prefence is set, show the conosle
- if (!getPreferenceStore().getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN)) {
- return;
+ public void aboutToWriteSystemErr() {
+ if (getPreferenceStore().getBoolean(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR)) {
+ showConsole();
}
-
+ }
+
+ /**
+ * Opens the console view. If the view is already open, it is brought to the front.
+ */
+ protected void showConsole() {
getStandardDisplay().asyncExec(new Runnable() {
public void run() {
IWorkbenchWindow window = getActiveWorkbenchWindow();
@@ -544,13 +559,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements IDocumentListener
return fCurrentProcess;
}
private void setCurrentProcess(IProcess process) {
- if (fCurrentProcess != null) {
- getConsoleDocument(fCurrentProcess).removeDocumentListener(this);
- }
fCurrentProcess= process;
- if (fCurrentProcess != null) {
- getConsoleDocument(fCurrentProcess).addDocumentListener(this);
- }
}
/**
@@ -585,7 +594,6 @@ public class DebugUIPlugin extends AbstractUIPlugin implements IDocumentListener
for (int i= 0; i < processes.length; i++) {
ConsoleDocument doc= (ConsoleDocument)getConsoleDocument(processes[i]);
if (doc != null) {
- doc.removeDocumentListener(DebugUIPlugin.this);
doc.close();
setConsoleDocument(processes[i], null);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugPreferenceConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugPreferenceConstants.java
index 8db2c5d72..eb97d7614 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugPreferenceConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IDebugPreferenceConstants.java
@@ -34,9 +34,14 @@ public interface IDebugPreferenceConstants {
/**
* (boolean) Whether or not the console view is shown
- * when there is program ouptut.
+ * when there is program output.
*/
- public static final String CONSOLE_OPEN= "DEBUG.consoleOpen"; //$NON-NLS-1$
+ public static final String CONSOLE_OPEN_ON_OUT= "DEBUG.consoleOpenOnOut"; //$NON-NLS-1$
+ /**
+ * (boolean) Whether or not the console view is shown
+ * when there is program error.
+ */
+ public static final String CONSOLE_OPEN_ON_ERR= "DEBUG.consoleOpenOnErr"; //$NON-NLS-1$
/**
* The orientation of the detail view in the VariablesView

Back to the top