Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.debug.ui
Class DebugUITools

    java.lang.Object
      org.eclipse.debug.ui.DebugUITools

public class DebugUITools
extends Object

This class provides utilities for clients of the debug UI.

Images retrieved from this facility should not be disposed. The images will be disposed when this plugin is shutdown.

This class is not intended to be subclassed or instantiated.

Constructor Summary
`DebugUITools()`

Method Summary
`static ILaunch` | `buildAndLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor)` Builds the workspace according to current preference settings, and launches the given configuration in the specified mode, returning the resulting launch object.
`static IConsole` | `getConsole(IDebugElement element)` Returns the console associated with the given debug element, or `null` if none.
`static IConsole` | `getConsole(IProcess process)` Returns the console associated with the given process, or `null` if none.
`static IProcess` | `getCurrentProcess()` Returns the process associated with the current debug context.
`static IAdaptable` | `getDebugContext()` Returns the currently selected element in the debug view of the current workbench page, or `null` if there is no current debug context, or if not called from the UI thread.
`static ImageDescriptor` | `getDefaultImageDescriptor(Object element)` Returns the default image descriptor for the given element or `null` if none is defined.
`static Image` | `getImage(String key)` Returns the shared image managed under the given key, or `null` if none.
`static ImageDescriptor` | `getImageDescriptor(String key)` Returns the shared image descriptor managed under the given key, or `null` if none.
`static ILaunchGroup` | `getLaunchGroup(ILaunchConfiguration configuration, String mode)` Returns the launch group that the given launch configuration belongs to, for the specified mode, or `null` if none.
`static ILaunchGroup[]` | `getLaunchGroups()` Returns all registered launch group extensions.
`static String` | `getLaunchPerspective(ILaunchConfigurationType type, String mode)` Returns the perspective to switch to when a configuration of the given type is launched in the given mode, or `null` if no switch should take place.
`static IPreferenceStore` | `getPreferenceStore()` Returns the preference store for the debug UI plugin.
`static IResource` | `getSelectedResource()` Returns the currently selected resource in the active workbench window, or `null` if none.
`static boolean` | `isPrivate(ILaunchConfiguration configuration)` Returns whether the given launch configuraiton is private.
`static boolean` | `isUseStepFilters()` Returns whether step filters are applied to step commands.
`static void` | `launch(ILaunchConfiguration configuration, String mode)` Saves and builds the workspace according to current preference settings, and launches the given launch configuration in the specified mode.
`static IDebugModelPresentation` | `newDebugModelPresentation()` Returns a new debug model presentation that delegates to appropriate debug models.
`static IDebugModelPresentation` | `newDebugModelPresentation(String identifier)` Returns a new debug model presentation for specified debug model, or `null` if a presentation does not exist.
`static int` | `openLaunchConfigurationDialog(Shell shell, ILaunchConfiguration configuration, String groupIdentifier, IStatus status)` Open the launch configuration dialog on the specified launch configuration.
`static int` | `openLaunchConfigurationDialog(Shell shell, IStructuredSelection selection, String mode)` Deprecated. use openLaunchConfigurationDialogOnGroup(Shell, IStructuredSelection, String) to specify the launch group that the dialog should be opened on. This method will open on the launch group with the specified mode and a `null` category
`static int` | `openLaunchConfigurationDialogOnGroup(Shell shell, IStructuredSelection selection, String groupIdentifier)` Open the launch configuration dialog with the specified initial selection.
`static int` | `openLaunchConfigurationDialogOnGroup(Shell shell, IStructuredSelection selection, String groupIdentifier, IStatus status)` Open the launch configuration dialog with the specified initial selection.
`static int` | `openLaunchConfigurationPropertiesDialog(Shell shell, ILaunchConfiguration configuration, String groupIdentifier)` Open the launch configuration properties dialog on the specified launch configuration.
`static int` | `openLaunchConfigurationPropertiesDialog(Shell shell, ILaunchConfiguration configuration, String groupIdentifier, IStatus status)` Open the launch configuration properties dialog on the specified launch configuration.
`static boolean` | `saveAndBuildBeforeLaunch()` Saves all dirty editors and builds the workspace according to current preference settings, and returns whether a launch should proceed.
`static boolean` | `saveBeforeLaunch()` Saves all dirty editors according to current preference settings, and returns whether a launch should proceed.
`static void` | `setLaunchPerspective(ILaunchConfigurationType type, String mode, String perspective)` Sets the perspective to switch to when a configuration of the given type is launched in the given mode.
`static void` | `setUseStepFilters(boolean useStepFilters)` Sets whether step filters should be applied to step commands.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DebugUITools

    public DebugUITools()

Method Detail

### getImage

    public static Image getImage(String key)

  Returns the shared image managed under the given key, or `null` if none.

  Note that clients MUST NOT dispose the image returned by this method.

  See `IDebugUIConstants` for available images.

  Parameters:
    `key` - the image key
  Returns:
    the image, or `null` if none
  See Also:
    `IDebugUIConstants`

### getImageDescriptor

    public static ImageDescriptor getImageDescriptor(String key)

  Returns the shared image descriptor managed under the given key, or `null` if none.

  See `IDebugUIConstants` for available image descriptors.

  Parameters:
    `key` - the image descriptor key
  Returns:
    the image descriptor, or `null` if none
  See Also:
    `IDebugUIConstants`

### getDefaultImageDescriptor

    public static ImageDescriptor getDefaultImageDescriptor(Object element)

  Returns the default image descriptor for the given element or `null` if none is defined.

### getPreferenceStore

    public static IPreferenceStore getPreferenceStore()

  Returns the preference store for the debug UI plugin.

  Returns:
    preference store

### newDebugModelPresentation

    public static IDebugModelPresentation newDebugModelPresentation()

  Returns a new debug model presentation that delegates to appropriate debug models.

  It is the client's responsibility dispose the presentation.

  Returns:
    a debug model presentation
  Since:
    2.0
  See Also:
    `IBaseLabelProvider.dispose()`

### newDebugModelPresentation

    public static IDebugModelPresentation newDebugModelPresentation(String identifier)

  Returns a new debug model presentation for specified debug model, or `null` if a presentation does not exist.

  It is the client's responsibility dispose the presentation.

  Parameters:
    `identifier` - debug model identifier
  Returns:
    a debug model presentation, or `null`
  Since:
    2.0
  See Also:
    `IBaseLabelProvider.dispose()`

### getDebugContext

    public static IAdaptable getDebugContext()

  Returns the currently selected element in the debug view of the current workbench page, or `null` if there is no current debug context, or if not called from the UI thread.

  Returns:
    the currently selected debug context, or `null`
  Since:
    2.0

### getSelectedResource

    public static IResource getSelectedResource()

  Returns the currently selected resource in the active workbench window, or `null` if none. If an editor is active, the resource adapater assocaited with the editor is returned, if any.

  Returns:
    selected resource or `null`
  Since:
    3.0

### getCurrentProcess

    public static IProcess getCurrentProcess()

  Returns the process associated with the current debug context. If there is no debug context currently, the most recently launched process is returned. If there is no current process `null` is returned.

  Returns:
    the current process, or `null`
  Since:
    2.0

### openLaunchConfigurationDialog

    public static int openLaunchConfigurationDialog(Shell shell,
                                                    IStructuredSelection selection,
                                                    String mode)

  Deprecated. use openLaunchConfigurationDialogOnGroup(Shell, IStructuredSelection, String) to specify the launch group that the dialog should be opened on. This method will open on the launch group with the specified mode and a `null` category

  Open the launch configuration dialog with the specified initial selection. The selection may be `null`, or contain any mix of `ILaunchConfiguration` or `ILaunchConfigurationType` elements.

  Before opening a new dialog, this method checks if there is an existing open launch configuration dialog. If there is, this dialog is used with the specified selection. If there is no existing dialog, a new one is created.

  Note that if an existing dialog is reused, the `mode` argument is ignored and the existing dialog keeps its original mode.

  Parameters:
    `shell` - the parent shell for the launch configuration dialog
    `selection` - the initial selection for the dialog
    `mode` - the mode (run or debug) in which to open the launch configuration dialog. This should be one of the constants defined in `ILaunchManager`.
  Returns:
    the return code from opening the launch configuration dialog - one of `Window.OK` or `Window.CANCEL`
  Since:
    2.0

### openLaunchConfigurationDialogOnGroup

    public static int openLaunchConfigurationDialogOnGroup(Shell shell,
                                                           IStructuredSelection selection,
                                                           String groupIdentifier)

  Open the launch configuration dialog with the specified initial selection. The selection may be `null`, or contain any mix of `ILaunchConfiguration` or `ILaunchConfigurationType` elements.

  Before opening a new dialog, this method checks if there is an existing open launch configuration dialog. If there is, this dialog is used with the specified selection. If there is no existing dialog, a new one is created.

  Note that if an existing dialog is reused, the `mode` argument is ignored and the existing dialog keeps its original mode.

  Parameters:
    `shell` - the parent shell for the launch configuration dialog
    `selection` - the initial selection for the dialog
    `groupIdentifier` - the identifier of the launch group to display (corresponds to the identifier of a launch group extension)
  Returns:
    the return code from opening the launch configuration dialog - one of `Window.OK` or `Window.CANCEL`
  Since:
    2.1

### openLaunchConfigurationDialogOnGroup

    public static int openLaunchConfigurationDialogOnGroup(Shell shell,
                                                           IStructuredSelection selection,
                                                           String groupIdentifier,
                                                           IStatus status)

  Open the launch configuration dialog with the specified initial selection. The selection may be `null`, or contain any mix of `ILaunchConfiguration` or `ILaunchConfigurationType` elements.

  Before opening a new dialog, this method checks if there is an existing open launch configuration dialog. If there is, this dialog is used with the specified selection. If there is no existing dialog, a new one is created.

  Note that if an existing dialog is reused, the `mode` argument is ignored and the existing dialog keeps its original mode.

  If a status is specified, a status handler is consulted to handle the status. The status handler is passed the instance of the launch configuration dialog that is opened. This gives the status handler an opportunity to perform error handling/initialization as required.

  Parameters:
    `shell` - the parent shell for the launch configuration dialog
    `selection` - the initial selection for the dialog
    `groupIdentifier` - the identifier of the launch group to display (corresponds to the identifier of a launch group extension)
    `status` - the status to display in the dialog, or `null` if none
  Returns:
    the return code from opening the launch configuration dialog - one of `Window.OK` or `Window.CANCEL`
  Since:
    2.1
  See Also:
    `IStatusHandler`

### openLaunchConfigurationPropertiesDialog

    public static int openLaunchConfigurationPropertiesDialog(Shell shell,
                                                              ILaunchConfiguration configuration,
                                                              String groupIdentifier)

  Open the launch configuration properties dialog on the specified launch configuration.

  Parameters:
    `shell` - the parent shell for the launch configuration dialog
    `configuration` - the configuration to display
    `groupIdentifier` - group identifier of the launch group the launch configuration belongs to
  Returns:
    the return code from opening the launch configuration dialog - one of `Window.OK` or `Window.CANCEL`
  Since:
    2.1

### openLaunchConfigurationPropertiesDialog

    public static int openLaunchConfigurationPropertiesDialog(Shell shell,
                                                              ILaunchConfiguration configuration,
                                                              String groupIdentifier,
                                                              IStatus status)

  Open the launch configuration properties dialog on the specified launch configuration.

  Parameters:
    `shell` - the parent shell for the launch configuration dialog
    `configuration` - the configuration to display
    `groupIdentifier` - group identifier of the launch group the launch configuration belongs to
    `status` - the status to display, or `null` if none
  Returns:
    the return code from opening the launch configuration dialog - one of `Window.OK` or `Window.CANCEL`
  Since:
    3.0

### openLaunchConfigurationDialog

    public static int openLaunchConfigurationDialog(Shell shell,
                                                    ILaunchConfiguration configuration,
                                                    String groupIdentifier,
                                                    IStatus status)

  Open the launch configuration dialog on the specified launch configuration. The dialog displays the tabs for a single configuration only (a tree of launch configuration is not displayed), and provides a launch (run or debug) button.

  If a status is specified, a status handler is consulted to handle the status. The status handler is passed the instance of the launch configuration dialog that is opened. This gives the status handler an opportunity to perform error handling/initialization as required.

  Parameters:
    `shell` - the parent shell for the launch configuration dialog
    `configuration` - the configuration to display
    `groupIdentifier` - group identifier of the launch group the launch configuration belongs to
    `status` - the status to display, or `null` if none
  Returns:
    the return code from opening the launch configuration dialog - one of `Window.OK` or `Window.CANCEL`
  Since:
    2.1

### saveAndBuildBeforeLaunch

    public static boolean saveAndBuildBeforeLaunch()

  Saves all dirty editors and builds the workspace according to current preference settings, and returns whether a launch should proceed.

  The following preferences effect whether dirty editors are saved, and/or if the user is prompted to save dirty edtiors:

  - PREF_NEVER_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH
  - PREF_PROMPT_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH
  - PREF_AUTOSAVE_DIRTY_EDITORS_BEFORE_LAUNCH
  The following preference effects whether a build is performed before launching (if required):
  - PREF_BUILD_BEFORE_LAUNCH

  Returns:
    whether a launch should proceed
  Since:
    2.0

### saveBeforeLaunch

    public static boolean saveBeforeLaunch()

  Saves all dirty editors according to current preference settings, and returns whether a launch should proceed.

  The following preferences effect whether dirty editors are saved, and/or if the user is prompted to save dirty edtiors:

  - PREF_NEVER_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH
  - PREF_PROMPT_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH
  - PREF_AUTOSAVE_DIRTY_EDITORS_BEFORE_LAUNCH

  Returns:
    whether a launch should proceed
  Since:
    2.1

### launch

    public static void launch(ILaunchConfiguration configuration,
                              String mode)

  Saves and builds the workspace according to current preference settings, and launches the given launch configuration in the specified mode.

  Parameters:
    `configuration` - the configuration to launch
    `mode` - launch mode - run or debug
  Since:
    2.1

### buildAndLaunch

    public static ILaunch buildAndLaunch(ILaunchConfiguration configuration,
                                         String mode,
                                         IProgressMonitor monitor)
                                  throws CoreException

  Builds the workspace according to current preference settings, and launches the given configuration in the specified mode, returning the resulting launch object.

  The following preference effects whether a build is performed before launching (if required):

  - PREF_BUILD_BEFORE_LAUNCH

  Parameters:
    `configuration` - the configuration to launch
    `mode` - the mode to launch in
    `monitor` - progress monitor
  Returns:
    the resulting launch object
  Throws:
    `CoreException` - if building or launching fails
  Since:
    2.1

### getLaunchPerspective

    public static String getLaunchPerspective(ILaunchConfigurationType type,
                                              String mode)

  Returns the perspective to switch to when a configuration of the given type is launched in the given mode, or `null` if no switch should take place.

  Parameters:
    `type` - launch configuration type
    `mode` - launch mode identifier
  Returns:
    perspective identifier or `null`
  Since:
    3.0

### setLaunchPerspective

    public static void setLaunchPerspective(ILaunchConfigurationType type,
                                            String mode,
                                            String perspective)

  Sets the perspective to switch to when a configuration of the given type is launched in the given mode. `PERSPECTIVE_NONE` indicates no perspective switch should take place. `PERSPECTIVE_DEFAULT` indicates a default perspective switch should take place, as defined by the associated launch tab group extension.

  Parameters:
    `type` - launch configuration type
    `mode` - launch mode identifier
    `perspective` - identifier, `PERSPECTIVE_NONE`, or `PERSPECTIVE_DEFAULT`
  Since:
    3.0

### isPrivate

    public static boolean isPrivate(ILaunchConfiguration configuration)

  Returns whether the given launch configuraiton is private. Generally, private launch configurations should not be displayed to the user. The private status of a launch configuration is determined by the `IDebugUIConstants.ATTR_PRIVATE` attribute.

  Parameters:
    `configuration` - launch configuration
  Returns:
    whether the given launch configuration is private
  Since:
    3.0

### setUseStepFilters

    public static void setUseStepFilters(boolean useStepFilters)

  Sets whether step filters should be applied to step commands. This setting is a global option applied to all registered debug targets.

  Parameters:
    `useStepFilters` - whether step filters should be applied to step commands
  Since:
    3.0
  See Also:
    `IStepFilters`

### isUseStepFilters

    public static boolean isUseStepFilters()

  Returns whether step filters are applied to step commands.

  Returns:
    whether step filters are applied to step commands
  Since:
    3.0
  See Also:
    `IStepFilters`

### getConsole

    public static IConsole getConsole(IProcess process)

  Returns the console associated with the given process, or `null` if none.

  Parameters:
    `process` - a process
  Returns:
    console associated with the given process, or `null` if none
  Since:
    3.0

### getConsole

    public static IConsole getConsole(IDebugElement element)

  Returns the console associated with the given debug element, or `null` if none.

  Parameters:
    `element` - a debug model element
  Returns:
    console associated with the given element, or `null` if none
  Since:
    3.0

### getLaunchGroups

    public static ILaunchGroup[] getLaunchGroups()

  Returns all registered launch group extensions.

  Returns:
    all registered launch group extensions
  Since:
    3.0

### getLaunchGroup

    public static ILaunchGroup getLaunchGroup(ILaunchConfiguration configuration,
                                              String mode)

  Returns the launch group that the given launch configuration belongs to, for the specified mode, or `null` if none.

  Parameters:
    `configuration` -
    `mode` -
  Returns:
    the launch group the given launch configuration belongs to, for the specified mode, or `null` if none

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.