Do not assume getSelectedPage() returns IEditorPart

Add check that selected page is actually an IEditorPart to avoid classcast exception