Bug 540227 - NullPointerException in JavaInformationProvider.update
Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
diff --git a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/java/hover/JavaInformationProvider.java b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/java/hover/JavaInformationProvider.java
index 40d3498..3164376 100644
--- a/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/java/hover/JavaInformationProvider.java
+++ b/bundles/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/java/hover/JavaInformationProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
@@ -34,14 +34,10 @@
import org.eclipse.wst.jsdt.ui.PreferenceConstants;
import org.eclipse.wst.jsdt.ui.text.java.hover.IJavaEditorTextHover;
-
public class JavaInformationProvider implements IInformationProvider, IInformationProviderExtension2 {
-
/**
* Control creator.
- *
- *
*/
private static final class ControlCreator extends AbstractReusableInformationControlCreator {
/*
@@ -59,7 +55,6 @@
return new DefaultInformationControl(parent, shellStyle, style, new HTMLTextPresenter(false));
}
}
-
class EditorWatcher implements IPartListener {
@@ -105,13 +100,9 @@
/**
* The presentation control creator.
- *
- *
*/
private IInformationControlCreator fPresenterControlCreator;
-
-
public JavaInformationProvider(IEditorPart editor) {
fEditor= editor;
@@ -127,21 +118,18 @@
}
protected void update() {
+ IWorkbenchWindow window = fEditor.getSite().getWorkbenchWindow();
+ IWorkbenchPage page = window != null ? window.getActivePage() : null;
+ IPerspectiveDescriptor perspective = page != null ? page.getPerspective() : null;
- IWorkbenchWindow window= fEditor.getSite().getWorkbenchWindow();
- IWorkbenchPage page= window.getActivePage();
- if (page != null) {
+ if (perspective != null) {
+ String perspectiveId= perspective.getId();
- IPerspectiveDescriptor perspective= page.getPerspective();
- if (perspective != null) {
- String perspectiveId= perspective.getId();
+ if (fCurrentPerspective == null || fCurrentPerspective != perspectiveId) {
+ fCurrentPerspective= perspectiveId;
- if (fCurrentPerspective == null || fCurrentPerspective != perspectiveId) {
- fCurrentPerspective= perspectiveId;
-
- fImplementation= new JavaTypeHover();
- fImplementation.setEditor(fEditor);
- }
+ fImplementation= new JavaTypeHover();
+ fImplementation.setEditor(fEditor);
}
}
}