testdev/ite/test/com.nokia.testfw.test/src/com/nokia/testfw/test/utils/WorkbenchUtils.java
changeset 1 96906a986c3b
equal deleted inserted replaced
0:f1112f777ce9 1:96906a986c3b
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Symbian Foundation License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 package com.nokia.testfw.test.utils;
       
    18 
       
    19 import org.eclipse.ui.IViewPart;
       
    20 import org.eclipse.ui.IViewReference;
       
    21 import org.eclipse.ui.PlatformUI;
       
    22 
       
    23 /**
       
    24  * @author xiaoma
       
    25  *
       
    26  */
       
    27 public class WorkbenchUtils {
       
    28 	
       
    29 	/**
       
    30 	 * get view by view id
       
    31 	 * @param id
       
    32 	 * @return
       
    33 	 */
       
    34 	public static IViewPart getView(String id) {
       
    35 		IViewReference viewReferences[] = PlatformUI.getWorkbench()
       
    36 				.getActiveWorkbenchWindow().getActivePage().getViewReferences();
       
    37 		for (int i = 0; i < viewReferences.length; i++) {
       
    38 			if (id.equals(viewReferences[i].getId())) {
       
    39 				return viewReferences[i].getView(false);
       
    40 			}
       
    41 		}
       
    42 		return null;
       
    43 	}
       
    44 }