org.eclipse.actf.ui.util
Class PlatformUIUtil

java.lang.Object
  extended by org.eclipse.actf.ui.util.PlatformUIUtil

public class PlatformUIUtil
extends Object

Utility class to provide frequently used methods related to PlatformUI


Constructor Summary
PlatformUIUtil()
           
 
Method Summary
static org.eclipse.ui.IEditorPart getActiveEditor()
          Get active Editor
static org.eclipse.ui.IWorkbenchPage getActivePage()
          Get active workbench page
static String getActivePerspectiveId()
          Get active perspective ID
static org.eclipse.ui.IWorkbenchWindow getActiveWindow()
          Get active workbench window
static org.eclipse.jface.action.IAction getGlobalActionHandler(String viewId, String actionId)
          Get global action handler
static org.eclipse.ui.help.IWorkbenchHelpSystem getHelpSystem()
          Get Help System
static org.eclipse.jface.resource.ImageDescriptor getSharedImageDescriptor(String symbolicName)
          Get ImageDescriptor from Shared Images
static org.eclipse.ui.ISharedImages getSharedImages()
          Get SharedImages for the workbench
static org.eclipse.swt.widgets.Shell getShell()
          Get Active Workbench Window's shell
static boolean isViewVisible(String viewId)
          Check if view is visible or not
static URL resolveHelpURL(String href, boolean documentOnly)
          Resolve the help resource href
static org.eclipse.ui.IWorkbenchPage showPerspective(String perspectiveId)
          Show the specified perspective
static org.eclipse.ui.IViewPart showView(String viewId)
          Show specified View
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlatformUIUtil

public PlatformUIUtil()
Method Detail

getActiveWindow

public static org.eclipse.ui.IWorkbenchWindow getActiveWindow()
Get active workbench window

Returns:
current active workbench window, or null if not available

getActivePage

public static org.eclipse.ui.IWorkbenchPage getActivePage()
Get active workbench page

Returns:
current active workbench page, or null if not available

getShell

public static org.eclipse.swt.widgets.Shell getShell()
Get Active Workbench Window's shell

Returns:
Shell, or null if the shell has not been created yet or if the window has been closed
See Also:
IWorkbenchWindow

getActivePerspectiveId

public static String getActivePerspectiveId()
Get active perspective ID

Returns:
ID of current active perspective, or null if not available

showPerspective

public static org.eclipse.ui.IWorkbenchPage showPerspective(String perspectiveId)
Show the specified perspective

Parameters:
perspectiveId - target perspective ID to show
Returns:
IWorkbenchPage, or null if not available
See Also:
IWorkbench

getActiveEditor

public static org.eclipse.ui.IEditorPart getActiveEditor()
Get active Editor

Returns:
current active Editor, or null if not available

isViewVisible

public static boolean isViewVisible(String viewId)
Check if view is visible or not

Parameters:
viewId - target view ID to check the visibility
Returns:
true if the target view is visible

showView

public static org.eclipse.ui.IViewPart showView(String viewId)
Show specified View

Parameters:
viewId - target view ID to show
Returns:
IViewPart, or null if not available

getGlobalActionHandler

public static org.eclipse.jface.action.IAction getGlobalActionHandler(String viewId,
                                                                      String actionId)
Get global action handler

Parameters:
viewId - target view ID
actionId - target action ID
Returns:
the global action handler of target view for the action with the given id, or null if not available

getHelpSystem

public static org.eclipse.ui.help.IWorkbenchHelpSystem getHelpSystem()
Get Help System

Returns:
IWorkbenchHelpSystem, or null if not available

resolveHelpURL

public static URL resolveHelpURL(String href,
                                 boolean documentOnly)
Resolve the help resource href

Parameters:
href - target URL
documentOnly - if true, the resulting URL must point at the document referenced by href. Otherwise, it can be a URL that contains additional elements like navigation that the help system adds to the document.
Returns:
the resolved URL, or null if no help UI is available
See Also:
IWorkbenchHelpSystem

getSharedImages

public static org.eclipse.ui.ISharedImages getSharedImages()
Get SharedImages for the workbench

Returns:
ISharedImages, or null if not available

getSharedImageDescriptor

public static org.eclipse.jface.resource.ImageDescriptor getSharedImageDescriptor(String symbolicName)
Get ImageDescriptor from Shared Images

Parameters:
symbolicName - the symbolic name of the image; there are constants declared in this interface for build-in images that come with the workbench
Returns:
ImageDescriptor, or null if not found
See Also:
ISharedImages