org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/UIUtils.java
changeset 461 7a8f9fa8d278
parent 460 c0bff5ed874c
child 462 cdc4995b1677
--- a/org.symbian.tools.mtw.ui/src/org/symbian/tools/mtw/ui/UIUtils.java	Thu Jul 29 15:59:01 2010 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/**
- * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
- * All rights reserved.
- * This component and the accompanying materials are made available
- * under the terms of the License "Eclipse Public License v1.0"
- * which accompanies this distribution, and is available
- * at the URL "http://www.eclipse.org/legal/epl-v10.html".
- *
- * Initial Contributors:
- * Symbian Foundation - initial contribution.
- * Contributors:
- * Description:
- * Overview:
- * Details:
- * Platforms/Drives/Compatibility:
- * Assumptions/Requirement/Pre-requisites:
- * Failures and causes:
- */
-package org.symbian.tools.mtw.ui;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.symbian.tools.mtw.core.MTWCore;
-import org.symbian.tools.mtw.core.projects.IMTWProject;
-
-public class UIUtils {
-    public static IMTWProject getProjectFromCommandContext(ExecutionEvent event) {
-        IResource resource = null;
-        IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
-        if (activePart instanceof IEditorPart) {
-            resource = (IResource) ((IEditorPart) activePart).getEditorInput().getAdapter(IResource.class);
-        } else {
-            ISelection selection = HandlerUtil.getCurrentSelection(event);
-            if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
-                Object[] array = ((IStructuredSelection) selection).toArray();
-                if (array.length == 1 && array[0] instanceof IAdaptable) {
-                    resource = (IResource) ((IAdaptable) array[0]).getAdapter(IResource.class);
-                }
-            }
-        }
-        if (resource != null) {
-            IProject project = resource.getProject();
-            return MTWCore.getDefault().create(project);
-        }
-        return null;
-    }
-}