Bug 486267 - Use HandlerUtil.getCurrentStructuredSelection instead of
HandlerUtil.getCurrentSelection plus cast

Change-Id: I5e2b9ad83c84be501697f9bb300b52934ae4f71f
Signed-off-by: Mike Majewski <mike.majewski@email.de>
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/handlers/ShowInSystemExplorerHandler.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/handlers/ShowInSystemExplorerHandler.java
index 3e24784..844d7e6 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/handlers/ShowInSystemExplorerHandler.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/handlers/ShowInSystemExplorerHandler.java
@@ -31,7 +31,6 @@
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.e4.core.services.statusreporter.StatusReporter;
 import org.eclipse.jface.util.Util;
-import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorPart;
@@ -140,13 +139,12 @@
 	}
 
 	private IResource getSelectionResource(ExecutionEvent event) {
-		ISelection selection = HandlerUtil.getCurrentSelection(event);
-		if ((selection == null) || (selection.isEmpty())
-				|| (!(selection instanceof IStructuredSelection))) {
+		IStructuredSelection selection = HandlerUtil.getCurrentStructuredSelection(event);
+		if ((selection == null) || (selection.isEmpty())) {
 			return null;
 		}
 
-		Object selectedObject = ((IStructuredSelection) selection)
+		Object selectedObject = selection
 				.getFirstElement();
 		IResource item = Adapters.adapt(selectedObject, IResource.class);
 		return item;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PropertyDialogHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PropertyDialogHandler.java
index 7cafa35..e438cbf 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PropertyDialogHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/PropertyDialogHandler.java
@@ -18,7 +18,6 @@
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IWorkbenchWindow;
@@ -36,16 +35,11 @@
 	public Object execute(ExecutionEvent event) throws ExecutionException {
 		PreferenceDialog dialog;
 		Object element = null;
-		ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
+		IStructuredSelection currentSelection = HandlerUtil.getCurrentStructuredSelection(event);
 		IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
 		Shell shell;
 
-		if (currentSelection instanceof IStructuredSelection) {
-			element = ((IStructuredSelection) currentSelection)
-					.getFirstElement();
-		} else {
-			return null;
-		}
+		element = currentSelection.getFirstElement();
 
 		if (activeWorkbenchWindow != null){
 			shell = activeWorkbenchWindow.getShell();