| /****************************************************************************** |
| * Copyright (c) 2004 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 |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| ****************************************************************************/ |
| |
| package org.eclipse.gmf.runtime.emf.ui.properties.internal; |
| |
| import org.eclipse.ui.IWorkbenchPage; |
| import org.eclipse.ui.IWorkbenchWindow; |
| import org.eclipse.ui.PlatformUI; |
| import org.eclipse.ui.plugin.AbstractUIPlugin; |
| |
| /** |
| * The main plugin class to be used in the desktop. |
| */ |
| public class EMFPropertiesPlugin |
| extends AbstractUIPlugin { |
| |
| // The shared instance. |
| private static EMFPropertiesPlugin INSTANCE; |
| |
| /** |
| * Creates new plug-in runtime object. |
| */ |
| public EMFPropertiesPlugin() { |
| super(); |
| INSTANCE = this; |
| } |
| |
| /** |
| * Retrieves this plug-in's shared instance. |
| * |
| * @return This plug-in's shared instance. |
| */ |
| public static EMFPropertiesPlugin getDefault() { |
| return INSTANCE; |
| } |
| |
| /** |
| * Retrieves the unique identifier of this plug-in. |
| * |
| * @return A non-empty string which is unique within the plug-in registry. |
| */ |
| public static String getPluginId() { |
| return getDefault().getBundle().getSymbolicName(); |
| } |
| |
| /** |
| * Returns the currently active window for the workbench (if any). |
| * |
| * @return The active workbench window, or null if the currently active |
| * window is not a workbench window |
| */ |
| public static IWorkbenchWindow getActiveWorkbenchWindow() { |
| return PlatformUI.getWorkbench().getActiveWorkbenchWindow(); |
| } |
| |
| /** |
| * Returns the currently active page for the active workbench window. |
| * |
| * @return The active page, or null if none |
| */ |
| public static IWorkbenchPage getActivePage() { |
| IWorkbenchWindow window = getActiveWorkbenchWindow(); |
| if (window == null) { |
| return null; |
| } |
| return window.getActivePage(); |
| } |
| |
| } |