Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Rennie2008-08-27 16:36:11 +0000
committerMichael Rennie2008-08-27 16:36:11 +0000
commitc3ad6a8d57a16a697a2c28e850204df7e3da817f (patch)
tree04023dc93e4ec671c7cbd3bfca6db24584fddbc8 /org.eclipse.ui.console
parentec30b66bd9585594f260427ec05cf0cd529f88ae (diff)
downloadeclipse.platform.debug-c3ad6a8d57a16a697a2c28e850204df7e3da817f.tar.gz
eclipse.platform.debug-c3ad6a8d57a16a697a2c28e850204df7e3da817f.tar.xz
eclipse.platform.debug-c3ad6a8d57a16a697a2c28e850204df7e3da817f.zip
Bug 244566 [Contexts] NullPointerExceptions in eclipse core plugin
Diffstat (limited to 'org.eclipse.ui.console')
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
index 61a0c5f4a..4c465cfc0 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
@@ -343,7 +343,10 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
*/
public void dispose() {
super.dispose();
- getViewSite().getPage().removePartListener((IPartListener2)this);
+ IViewSite site = getViewSite();
+ if(site != null) {
+ site.getPage().removePartListener((IPartListener2)this);
+ }
ConsoleManager consoleManager = (ConsoleManager) ConsolePlugin.getDefault().getConsoleManager();
consoleManager.removeConsoleListener(this);
consoleManager.unregisterConsoleView(this);
@@ -628,8 +631,10 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
if (isThisPart(partRef)) {
fActive = true;
IContextService contextService = (IContextService)getSite().getService(IContextService.class);
- fActivatedContext = contextService.activateContext(IConsoleConstants.ID_CONSOLE_VIEW);
- activateParticipants(fActiveConsole);
+ if(contextService != null) {
+ fActivatedContext = contextService.activateContext(IConsoleConstants.ID_CONSOLE_VIEW);
+ activateParticipants(fActiveConsole);
+ }
}
}
@@ -652,15 +657,23 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
if (isThisPart(partRef)) {
fActive = false;
IContextService contextService = (IContextService)getSite().getService(IContextService.class);
- contextService.deactivateContext(fActivatedContext);
- deactivateParticipants(fActiveConsole);
+ if(contextService != null) {
+ contextService.deactivateContext(fActivatedContext);
+ deactivateParticipants(fActiveConsole);
+ }
}
}
+ /**
+ * Returns if the specified part reference is to this view part (if the part
+ * reference is the console view or not)
+ * @param partRef
+ * @return true if the specified part reference is the console view
+ */
protected boolean isThisPart(IWorkbenchPartReference partRef) {
if (partRef instanceof IViewReference) {
IViewReference viewRef = (IViewReference) partRef;
- if (viewRef.getId().equals(getViewSite().getId())) {
+ if (getViewSite() != null && viewRef.getId().equals(getViewSite().getId())) {
String secId = viewRef.getSecondaryId();
String mySec = null;
if (getSite() instanceof IViewSite) {

Back to the top