Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2008-01-15 09:12:57 +0000
committerAnton Leherbauer2008-01-15 09:12:57 +0000
commitb127b4265f02c42c44b70a0d101903b0a280360e (patch)
treec05c63521cacfe9a9a6f104b17a924692c31a17d /debug/org.eclipse.cdt.debug.mi.ui/src/org
parentb90fcb3b0c2d2e1c62f7df53030837111e1cf08c (diff)
downloadorg.eclipse.cdt-b127b4265f02c42c44b70a0d101903b0a280360e.tar.gz
org.eclipse.cdt-b127b4265f02c42c44b70a0d101903b0a280360e.tar.xz
org.eclipse.cdt-b127b4265f02c42c44b70a0d101903b0a280360e.zip
Patch by Alena Laskavaia for 186172: NullPointerException in debugger console
Diffstat (limited to 'debug/org.eclipse.cdt.debug.mi.ui/src/org')
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/MiConsolePageParticipant.java29
-rw-r--r--debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleVerboseModeAction.java34
2 files changed, 42 insertions, 21 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/MiConsolePageParticipant.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/MiConsolePageParticipant.java
index 94564d86888..78010df0700 100644
--- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/MiConsolePageParticipant.java
+++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/MiConsolePageParticipant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 STMicroelectronics.
+ * Copyright (c) 2006, 2008 STMicroelectronics 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
@@ -7,6 +7,7 @@
*
* Contributors:
* STMicroelectronics - Process console enhancements
+ * Alena Laskavaia (QNX) - Fix for 186172
*******************************************************************************/
package org.eclipse.cdt.debug.mi.ui.console;
@@ -14,6 +15,7 @@ import java.util.Observable;
import java.util.Observer;
import org.eclipse.cdt.debug.mi.core.GDBProcess;
+import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.ui.console.actions.MiConsoleSaveAction;
import org.eclipse.cdt.debug.mi.ui.console.actions.MiConsoleVerboseModeAction;
import org.eclipse.debug.core.DebugEvent;
@@ -44,7 +46,7 @@ public class MiConsolePageParticipant implements IConsolePageParticipant, IDebug
}
public void dispose() {
- if(GDBProcess != null) {
+ if (GDBProcess != null) {
DebugPlugin.getDefault().removeDebugEventListener(this);
}
fSaveConsole = null;
@@ -73,9 +75,13 @@ public class MiConsolePageParticipant implements IConsolePageParticipant, IDebug
// add a debug event listener
DebugPlugin.getDefault().addDebugEventListener(this);
-
- // register this object as MISession observer
- GDBProcess.getTarget().getMISession().addObserver(this);
+ // if we miss change event update enablement manually
+ fVerboseMode.updateStateAndEnablement();
+ Target target = GDBProcess.getTarget();
+ if (target != null) {
+ // register this object as MISession observer
+ target.getMISession().addObserver(this);
+ }
}
}
}
@@ -89,7 +95,12 @@ public class MiConsolePageParticipant implements IConsolePageParticipant, IDebug
DebugEvent event = events[i];
if (event.getSource().equals(GDBProcess)) {
if (fVerboseMode != null) {
- fVerboseMode.setEnabled(!GDBProcess.isTerminated());
+ fVerboseMode.updateStateAndEnablement();
+ Target target = GDBProcess.getTarget();
+ if (target != null) {
+ // register this object as MISession observer
+ target.getMISession().addObserver(this);
+ }
}
}
}
@@ -101,9 +112,9 @@ public class MiConsolePageParticipant implements IConsolePageParticipant, IDebug
public void update(Observable arg0, Object arg1) {
if((arg1!=null) && (arg1 instanceof VerboseModeChangedEvent) && (fVerboseMode != null)) {
try {
- fVerboseMode.setChecked(GDBProcess.getTarget().isVerboseModeEnabled());
- } catch (Exception e) {
- }
+ fVerboseMode.updateStateAndEnablement();
+ } catch (Exception e) {
+ }
}
}
diff --git a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleVerboseModeAction.java b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleVerboseModeAction.java
index 205445b2876..6fe1ad28f1a 100644
--- a/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleVerboseModeAction.java
+++ b/debug/org.eclipse.cdt.debug.mi.ui/src/org/eclipse/cdt/debug/mi/ui/console/actions/MiConsoleVerboseModeAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 STMicroelectronics.
+ * Copyright (c) 2006, 2008 STMicroelectronics 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
@@ -7,35 +7,45 @@
*
* Contributors:
* STMicroelectronics - Process console enhancements
+ * Alena Laskavaia (QNX) - Fix for 186172
*******************************************************************************/
package org.eclipse.cdt.debug.mi.ui.console.actions;
import org.eclipse.cdt.debug.mi.core.GDBProcess;
+import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.internal.ui.MIUIPlugin;
import org.eclipse.debug.ui.console.IConsole;
import org.eclipse.jface.action.Action;
/**
* Verbose console mode switcher
- *
+ *
*/
public class MiConsoleVerboseModeAction extends Action {
-
private IConsole fConsole;
-
+
public MiConsoleVerboseModeAction(IConsole console) {
- super();
- setToolTipText(MiConsoleMessages.verboseActionTooltip);
- setImageDescriptor(MIUIPlugin.imageDescriptorFromPlugin(MIUIPlugin.PLUGIN_ID,IMiConsoleImagesConst.IMG_VERBOSE_CONSOLE));
- fConsole = console;
- GDBProcess fProcess = (GDBProcess) fConsole.getProcess();
- setChecked(fProcess.getTarget().getMISession().isVerboseModeEnabled());
+ super();
+ setToolTipText(MiConsoleMessages.verboseActionTooltip);
+ setImageDescriptor(MIUIPlugin.imageDescriptorFromPlugin(MIUIPlugin.PLUGIN_ID, IMiConsoleImagesConst.IMG_VERBOSE_CONSOLE));
+ fConsole = console;
}
-
+
+ public void updateStateAndEnablement() {
+ // initialize button
+ GDBProcess gdbProcess = (GDBProcess) fConsole.getProcess();
+ setEnabled(!gdbProcess.isTerminated());
+ Target target = gdbProcess.getTarget();
+ if (target != null) {
+ setChecked(target.isVerboseModeEnabled());
+ } else {
+ setChecked(false);
+ }
+ }
+
public void run() {
GDBProcess fProcess = (GDBProcess) fConsole.getProcess();
fProcess.getTarget().enableVerboseMode(isChecked());
}
-
}

Back to the top