org.eclipse.net4j.util.ui

## Class UIUtil

- java.lang.Object
- - org.eclipse.net4j.util.ui.UIUtil

-     public final class UIUtil
      extends java.lang.Object

  Author:
    Eike Stepper

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `ERROR_LOG_ID`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> T` | `adaptElement(ISelection selection, java.lang.Class<T> type)` Like `getElement(ISelection, Class)` except that it attempts to adapt `IAdaptable`s to the required `type`, if necessary.
    `static <T> java.util.List<T>` | `adaptElements(ISelection selection, java.lang.Class<T> type)` Like `getElements(ISelection, Class)` except that it attempts to adapt `IAdaptable`s to the required `type`, if necessary.
    `static void` | `addDecorationMargin(Control control)`
    `static void` | `addDragSupport(StructuredViewer viewer)`
    `static void` | `copyToClipboard(Display display, java.lang.String text)`
    `static GridData` | `createEmptyGridData()`
    `static Composite` | `createGridComposite(Composite parent, int columns)`
    `static GridData` | `createGridData()`
    `static GridData` | `createGridData(boolean grabHorizontal, boolean grabVertical)`
    `static GridData` | `createGridData(int horizontalSpan, int verticalSpan)`
    `static GridLayout` | `createGridLayout(int columns)`
    `static IPasswordCredentialsProvider` | `createInteractiveCredentialsProvider()`
    `static void` | `dispose(Color color)`
    `static void` | `dispose(Font font)`
    `static void` | `dispose(Widget widget)`
    `static IWorkbenchPage` | `getActiveWorkbenchPage()`
    `static IWorkbenchPart` | `getActiveWorkbenchPart()`
    `static IWorkbenchWindow` | `getActiveWorkbenchWindow()`
    `static Font` | `getBoldFont(Control control)`
    `static Display` | `getDisplay()`
    `static java.lang.Object` | `getElement(ISelection selection)`
    `static <T> T` | `getElement(ISelection selection, java.lang.Class<T> type)`
    `static java.lang.Object` | `getElementIfOne(ISelection selection)`
    `static java.util.List<java.lang.Object>` | `getElements(ISelection selection)`
    `static <T> java.util.List<T>` | `getElements(ISelection selection, java.lang.Class<T> type)`
    `static Font` | `getItalicFont(Control control)`
    `static Shell` | `getShell()`
    `static IWorkbench` | `getWorkbench()`
    `static void` | `preserveViewerState(Viewer viewer, java.lang.Runnable runnable)`
    `static void` | `refreshElement(StructuredViewer viewer, java.lang.Object element, boolean updateLabels)`
    `static void` | `refreshViewer(Viewer viewer)`
    `static void` | `runWithProgress(IRunnableWithProgress runnable)`
    `static void` | `setIndentation(Control control, int horizontalIndent, int verticalIndent)` Adds indentation to the control.
    `static void` | `setStatusBarMessage(java.lang.String message, Image image)` Shows a message in the StatusBar.
    `static int` | `setValidationContext(Control control, ValidationContext context)`
    `static void` | `syncExec(Display display, java.lang.Runnable runnable)`
    `static void` | `syncExec(java.lang.Runnable runnable)`
    `static void` | `updateElements(StructuredViewer viewer, java.lang.Object element)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ERROR_LOG_ID

          public static final java.lang.String ERROR_LOG_ID

      Since:
        3.1
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### copyToClipboard

          public static void copyToClipboard(Display display,
                                             java.lang.String text)

      Since:
        3.1

    - #### dispose

          public static void dispose(Font font)

    - #### dispose

          public static void dispose(Color color)

    - #### dispose

          public static void dispose(Widget widget)

    - #### getItalicFont

          public static Font getItalicFont(Control control)

      Since:
        3.3

    - #### getBoldFont

          public static Font getBoldFont(Control control)

    - #### getDisplay

          public static Display getDisplay()

    - #### getShell

          public static Shell getShell()

      Since:
        3.5

    - #### getWorkbench

          public static IWorkbench getWorkbench()

      Since:
        2.0

    - #### getActiveWorkbenchWindow

          public static IWorkbenchWindow getActiveWorkbenchWindow()

      Since:
        2.0

    - #### getActiveWorkbenchPage

          public static IWorkbenchPage getActiveWorkbenchPage()

      Since:
        2.0

    - #### getActiveWorkbenchPart

          public static IWorkbenchPart getActiveWorkbenchPart()

      Since:
        2.0

    - #### getElementIfOne

          public static java.lang.Object getElementIfOne(ISelection selection)

      Since:
        3.0

    - #### getElement

          public static java.lang.Object getElement(ISelection selection)

      Since:
        2.0

    - #### getElement

          public static <T> T getElement(ISelection selection,
                                         java.lang.Class<T> type)

      Since:
        2.0

    - #### getElements

          public static java.util.List<java.lang.Object> getElements(ISelection selection)

      Since:
        3.5

    - #### getElements

          public static <T> java.util.List<T> getElements(ISelection selection,
                                                          java.lang.Class<T> type)

      Since:
        2.0

    - #### adaptElement

          public static <T> T adaptElement(ISelection selection,
                                           java.lang.Class<T> type)

      Like `getElement(ISelection, Class)` except that it attempts to adapt `IAdaptable`s to the required `type`, if necessary.
      Since:
        3.4

    - #### adaptElements

          public static <T> java.util.List<T> adaptElements(ISelection selection,
                                                            java.lang.Class<T> type)

      Like `getElements(ISelection, Class)` except that it attempts to adapt `IAdaptable`s to the required `type`, if necessary.
      Since:
        3.5

    - #### setValidationContext

          public static int setValidationContext(Control control,
                                                 ValidationContext context)

      Since:
        3.1

    - #### createInteractiveCredentialsProvider

          public static IPasswordCredentialsProvider createInteractiveCredentialsProvider()

    - #### createGridComposite

          public static Composite createGridComposite(Composite parent,
                                                      int columns)

    - #### createGridLayout

          public static GridLayout createGridLayout(int columns)

    - #### createGridData

          public static GridData createGridData()

    - #### createGridData

          public static GridData createGridData(boolean grabHorizontal,
                                                boolean grabVertical)

    - #### createGridData

          public static GridData createGridData(int horizontalSpan,
                                                int verticalSpan)

      Since:
        3.4

    - #### createEmptyGridData

          public static GridData createEmptyGridData()

      Since:
        3.0

    - #### addDecorationMargin

          public static void addDecorationMargin(Control control)

    - #### setIndentation

          public static void setIndentation(Control control,
                                            int horizontalIndent,
                                            int verticalIndent)

      Adds indentation to the control. if indent value is < 0, the control indentation is left unchanged.
      Since:
        2.0

    - #### syncExec

          public static void syncExec(java.lang.Runnable runnable)

      Since:
        3.5

    - #### syncExec

          public static void syncExec(Display display,
                                      java.lang.Runnable runnable)

      Since:
        3.5

    - #### runWithProgress

          public static void runWithProgress(IRunnableWithProgress runnable)

      Since:
        3.3

    - #### preserveViewerState

          public static void preserveViewerState(Viewer viewer,
                                                 java.lang.Runnable runnable)

      Since:
        3.3

    - #### refreshViewer

          public static void refreshViewer(Viewer viewer)

      Since:
        2.0

    - #### refreshElement

          public static void refreshElement(StructuredViewer viewer,
                                            java.lang.Object element,
                                            boolean updateLabels)

      Since:
        3.3

    - #### updateElements

          public static void updateElements(StructuredViewer viewer,
                                            java.lang.Object element)

      Since:
        3.5

    - #### setStatusBarMessage

          public static void setStatusBarMessage(java.lang.String message,
                                                 Image image)

      Shows a message in the StatusBar. Image can be omitted by passing a null parameter
      Since:
        2.0

    - #### addDragSupport

          public static void addDragSupport(StructuredViewer viewer)

      Since:
        3.5

Copyright (c) 2004-2019 Eike Stepper (Loehne, Germany) 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