154735 [refactoring scripts] Refactoring History Property page showing in weird places
diff --git a/org.eclipse.ltk.ui.refactoring/src/org/eclipse/ltk/internal/ui/refactoring/history/RefactoringPropertyPage.java b/org.eclipse.ltk.ui.refactoring/src/org/eclipse/ltk/internal/ui/refactoring/history/RefactoringPropertyPage.java index bb08c48..1e5fa8a 100644 --- a/org.eclipse.ltk.ui.refactoring/src/org/eclipse/ltk/internal/ui/refactoring/history/RefactoringPropertyPage.java +++ b/org.eclipse.ltk.ui.refactoring/src/org/eclipse/ltk/internal/ui/refactoring/history/RefactoringPropertyPage.java
@@ -15,6 +15,7 @@ import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -196,6 +197,11 @@ */ protected Control createContents(final Composite parent) { initializeDialogUnits(parent); + + IProject currentProject= getCurrentProject(); + if (currentProject == null) { + return new Composite(parent, SWT.NONE); + } final IPreferencePageContainer container= getContainer(); if (container instanceof IWorkbenchPreferenceContainer) @@ -314,7 +320,13 @@ * @return the currently associated project, or <code>null</code> */ private IProject getCurrentProject() { - return (IProject) getElement().getAdapter(IProject.class); + IAdaptable elem= getElement(); + if (elem == null) + return null; + IProject project= (IProject) elem.getAdapter(IProject.class); + if (project != null && project.isAccessible()) + return project; + return null; } /**