From dc3a09bbcead52e0a8653ba6bfe67b76d68308b4 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Thu, 28 Aug 2014 13:38:17 +0200 Subject: [PATCH] Bug 440057: Fix ClassCastException invoking C/C++ Project Settings Import Wizard. --- .../ui/wizards/settingswizards/ProjectSettingsWizard.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/ProjectSettingsWizard.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/ProjectSettingsWizard.java index 5b8efe114de..439c2cf3435 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/ProjectSettingsWizard.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/settingswizards/ProjectSettingsWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 IBM Corporation and others. + * Copyright (c) 2008, 2014 IBM Corporation 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 @@ -35,8 +35,10 @@ public abstract class ProjectSettingsWizard extends Wizard { // happens if the user invoked the wizard by right clicking on a project element if(selection != null) { - IProject project = (IProject)selection.getFirstElement(); - mainPage.setInitialProject(project); + final Object firstElement = selection.getFirstElement(); + if (firstElement instanceof IProject) { + mainPage.setInitialProject((IProject)firstElement); + } } addPage(mainPage);