/******************************************************************************* * Copyright (c) 2005-2012 eBay Inc. * 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 * http://www.eclipse.org/legal/epl-v10.html * *******************************************************************************/ package org.eclipse.vjet.eclipsetestutils; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; /** * Used for common workbench utils. * * @author ddodd * */ public class WorkbenchUtils { public static transient IWorkbenchPage s_workbenchPage; public static IWorkbenchPage getActivePage() { final IWorkbenchWindow activeWorkbenchWindow = PlatformUI .getWorkbench().getActiveWorkbenchWindow(); if (activeWorkbenchWindow == null) { return s_workbenchPage; } final IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage(); if (activePage == null) { return s_workbenchPage; } s_workbenchPage = activePage; return activePage; } }