Package com._1c.g5.v8.dt.common.ui
Class CommonUI
- java.lang.Object
-
- org.eclipse.core.runtime.Plugin
-
- org.eclipse.ui.plugin.AbstractUIPlugin
-
- com._1c.g5.v8.dt.common.ui.CommonUI
-
- All Implemented Interfaces:
org.osgi.framework.BundleActivator
public class CommonUI extends org.eclipse.ui.plugin.AbstractUIPlugin
Activator.- See Also:
AbstractUIPlugin
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CommonUI.CheckState
States of checkbox
-
Field Summary
-
Constructor Summary
Constructors Constructor Description CommonUI()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
asyncExec(Viewer viewer, Runnable runnable)
Executes the given runnable asynchronously on a UI thread associated with the given viewer.static void
asyncRefresh(StructuredViewer viewer, Object element)
Asynchronously refreshes the element of given viewer.static void
asyncRefresh(Viewer viewer)
Asynchronously refreshes the given viewer.static void
clearSelectionOnRightClick(org.eclipse.swt.widgets.Control control)
Adds a mouse listener that clears selection for the given control if the mouse down event coordinates corresponds to empty space of the control.static org.eclipse.core.runtime.IStatus
createErrorStatus(String msg, Throwable e)
static org.eclipse.ui.navigator.INavigatorContentService
createNavigatorContentService()
Creates DT navigator content service.static org.eclipse.ui.navigator.INavigatorContentService
createNavigatorContentService(StructuredViewer viewer)
Creates DT navigator content service for the given viewer.static org.eclipse.core.runtime.IStatus
createWarningStatus(String msg)
org.eclipse.swt.graphics.Image
getBundledImage(String path)
static org.eclipse.swt.graphics.Image
getCheckedStateImage(CommonUI.CheckState checkState)
Gets check state image.static org.eclipse.swt.graphics.Image
getCheckedStateImage(Boolean state)
Gets the check state image fromBoolean
.org.eclipse.swt.graphics.Color
getColor(org.eclipse.swt.graphics.RGB rgb)
Returns color for given rgb.static org.eclipse.swt.graphics.Image
getImage(String path)
static CommonUI
getInstance()
protected void
initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry reg)
static void
log(org.eclipse.core.runtime.IStatus status)
static void
runDeferredLayouts(org.eclipse.swt.widgets.Display display)
Runs deferred layout for the given display.void
start(org.osgi.framework.BundleContext context)
void
stop(org.osgi.framework.BundleContext context)
static void
syncExec(Viewer viewer, Runnable runnable)
Executes the given runnable synchronously on the UI thread associated with the given viewer.static void
syncRefresh(Viewer viewer)
Synchronously refreshes the given viewer.static void
syncUpdateSelection(Viewer viewer, ISelection selection)
Synchronously updates the selection of the given viewer.-
Methods inherited from class org.eclipse.ui.plugin.AbstractUIPlugin
createImageRegistry, getDialogSettings, getImageRegistry, getPreferenceStore, getWorkbench, imageDescriptorFromPlugin, initializeDefaultPluginPreferences, initializeDefaultPreferences, loadDialogSettings, loadPreferenceStore, refreshPluginActions, saveDialogSettings, savePreferenceStore, shutdown, startup
-
-
-
-
Field Detail
-
PLUGIN_ID
public static final String PLUGIN_ID
- See Also:
- Constant Field Values
-
IMG_3_DOTS
public static final String IMG_3_DOTS
3 dots 16x16 image resource used to show on dialog selection buttons- See Also:
- Constant Field Values
-
IMG_ARROW_DOWN
public static final String IMG_ARROW_DOWN
Arrow down 16x16 image resource used to show on combo buttons- See Also:
- Constant Field Values
-
IMG_SEARCH
public static final String IMG_SEARCH
Search 16x16 image resource used to show on search buttons- See Also:
- Constant Field Values
-
IMG_CLEAR
public static final String IMG_CLEAR
- See Also:
- Constant Field Values
-
IMG_ARROW_DOWN_SMALL
public static final String IMG_ARROW_DOWN_SMALL
- See Also:
- Constant Field Values
-
IMG_TYPE
public static final String IMG_TYPE
- See Also:
- Constant Field Values
-
IMG_REFRESH
public static final String IMG_REFRESH
- See Also:
- Constant Field Values
-
V8_ICONS
public static final String V8_ICONS
- See Also:
- Constant Field Values
-
IMG_FORM_CMD
public static final String IMG_FORM_CMD
- See Also:
- Constant Field Values
-
IMG_FORM_PARAM
public static final String IMG_FORM_PARAM
- See Also:
- Constant Field Values
-
IMG_FORM_ELEMENT
public static final String IMG_FORM_ELEMENT
- See Also:
- Constant Field Values
-
IMG_GROUP_ELEMENT
public static final String IMG_GROUP_ELEMENT
- See Also:
- Constant Field Values
-
IMG_COMMANDBAR_ELEMENT
public static final String IMG_COMMANDBAR_ELEMENT
- See Also:
- Constant Field Values
-
IMG_CONTEXT_MENU
public static final String IMG_CONTEXT_MENU
- See Also:
- Constant Field Values
-
IMG_BUTTON_ELEMENT
public static final String IMG_BUTTON_ELEMENT
- See Also:
- Constant Field Values
-
IMG_FIELD_ELEMENT
public static final String IMG_FIELD_ELEMENT
- See Also:
- Constant Field Values
-
IMG_ADDITION_ELEMENT
public static final String IMG_ADDITION_ELEMENT
- See Also:
- Constant Field Values
-
IMG_ADDITION_SEARCH_STRING_ELEMENT
public static final String IMG_ADDITION_SEARCH_STRING_ELEMENT
- See Also:
- Constant Field Values
-
IMG_ADDITION_SEARCH_CONTROL_ELEMENT
public static final String IMG_ADDITION_SEARCH_CONTROL_ELEMENT
- See Also:
- Constant Field Values
-
IMG_ADDITION_VIEWSTATUS_ELEMENT
public static final String IMG_ADDITION_VIEWSTATUS_ELEMENT
- See Also:
- Constant Field Values
-
IMG_DECORATION_ELEMENT
public static final String IMG_DECORATION_ELEMENT
- See Also:
- Constant Field Values
-
IMG_TABLE_ELEMENT
public static final String IMG_TABLE_ELEMENT
- See Also:
- Constant Field Values
-
IMG_DELETE_BUTTON
public static final String IMG_DELETE_BUTTON
- See Also:
- Constant Field Values
-
T_OBJ16
public static final String T_OBJ16
- See Also:
- Constant Field Values
-
T_WIZBAN
public static final String T_WIZBAN
- See Also:
- Constant Field Values
-
IMG_OBJ_PROPERTY
public static final String IMG_OBJ_PROPERTY
- See Also:
- Constant Field Values
-
IMG_OBJ_COMPONENT
public static final String IMG_OBJ_COMPONENT
- See Also:
- Constant Field Values
-
IMG_EXTENDED_TOOLTIP
public static final String IMG_EXTENDED_TOOLTIP
- See Also:
- Constant Field Values
-
IMG_FORM_USAGE_PROPERTY
public static final String IMG_FORM_USAGE_PROPERTY
- See Also:
- Constant Field Values
-
IMG_FORM_REGISTRED_ELEMENT
public static final String IMG_FORM_REGISTRED_ELEMENT
- See Also:
- Constant Field Values
-
MD_WIZARD_OPEN_LOCALIZED_DIALOG
public static final String MD_WIZARD_OPEN_LOCALIZED_DIALOG
- See Also:
- Constant Field Values
-
IMG_NEW_WIZ
public static final String IMG_NEW_WIZ
- See Also:
- Constant Field Values
-
OVR_FIELD_ERR
public static final String OVR_FIELD_ERR
- See Also:
- Constant Field Values
-
OVR_FIELD_WARN
public static final String OVR_FIELD_WARN
- See Also:
- Constant Field Values
-
SHOT
public static final String SHOT
- See Also:
- Constant Field Values
-
OBJS_CHECK_STATE_ENABLE_SELECTED
public static final String OBJS_CHECK_STATE_ENABLE_SELECTED
- See Also:
- Constant Field Values
-
OBJS_CHECK_STATE_DISABLE_SELECTED
public static final String OBJS_CHECK_STATE_DISABLE_SELECTED
- See Also:
- Constant Field Values
-
OBJS_CHECK_STATE_ENABLE_UNSELECTED
public static final String OBJS_CHECK_STATE_ENABLE_UNSELECTED
- See Also:
- Constant Field Values
-
OBJS_CHECK_STATE_DISABLE_UNSELECTED
public static final String OBJS_CHECK_STATE_DISABLE_UNSELECTED
- See Also:
- Constant Field Values
-
OBJS_CHECK_STATE_ENABLE_GRAYED
public static final String OBJS_CHECK_STATE_ENABLE_GRAYED
- See Also:
- Constant Field Values
-
OBJS_CHECK_STATE_DISABLE_GRAYED
public static final String OBJS_CHECK_STATE_DISABLE_GRAYED
- See Also:
- Constant Field Values
-
IMG_ARRAW_ADD
public static final String IMG_ARRAW_ADD
- See Also:
- Constant Field Values
-
IMG_ARRAW_ADD_ALL
public static final String IMG_ARRAW_ADD_ALL
- See Also:
- Constant Field Values
-
IMG_ARRAW_REMOVE
public static final String IMG_ARRAW_REMOVE
- See Also:
- Constant Field Values
-
IMG_ARRAW_REMOVE_ALL
public static final String IMG_ARRAW_REMOVE_ALL
- See Also:
- Constant Field Values
-
IMG_MOVE_UP
public static final String IMG_MOVE_UP
- See Also:
- Constant Field Values
-
IMG_MOVE_DOWN
public static final String IMG_MOVE_DOWN
- See Also:
- Constant Field Values
-
IMG_VIEW_MESSAGE_ERROR
public static final String IMG_VIEW_MESSAGE_ERROR
- See Also:
- Constant Field Values
-
IMG_VIEW_MESSAGE_INFO
public static final String IMG_VIEW_MESSAGE_INFO
- See Also:
- Constant Field Values
-
IMG_VIEW_MESSAGE_WARNING
public static final String IMG_VIEW_MESSAGE_WARNING
- See Also:
- Constant Field Values
-
IMG_VIEW_MESSAGE_DONE
public static final String IMG_VIEW_MESSAGE_DONE
- See Also:
- Constant Field Values
-
instance
public static CommonUI instance
-
-
Method Detail
-
log
public static void log(org.eclipse.core.runtime.IStatus status)
-
createErrorStatus
public static org.eclipse.core.runtime.IStatus createErrorStatus(String msg, Throwable e)
-
createWarningStatus
public static org.eclipse.core.runtime.IStatus createWarningStatus(String msg)
-
start
public void start(org.osgi.framework.BundleContext context) throws Exception
- Specified by:
start
in interfaceorg.osgi.framework.BundleActivator
- Overrides:
start
in classorg.eclipse.ui.plugin.AbstractUIPlugin
- Throws:
Exception
-
stop
public void stop(org.osgi.framework.BundleContext context) throws Exception
- Specified by:
stop
in interfaceorg.osgi.framework.BundleActivator
- Overrides:
stop
in classorg.eclipse.ui.plugin.AbstractUIPlugin
- Throws:
Exception
-
getBundledImage
public org.eclipse.swt.graphics.Image getBundledImage(String path)
-
getImage
public static org.eclipse.swt.graphics.Image getImage(String path)
-
getInstance
public static CommonUI getInstance()
-
initializeImageRegistry
protected void initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry reg)
- Overrides:
initializeImageRegistry
in classorg.eclipse.ui.plugin.AbstractUIPlugin
-
syncRefresh
public static void syncRefresh(Viewer viewer)
Synchronously refreshes the given viewer.- Parameters:
viewer
- the viewer to refresh.
-
asyncRefresh
public static void asyncRefresh(Viewer viewer)
Asynchronously refreshes the given viewer.- Parameters:
viewer
- the viewer to refresh.
-
asyncRefresh
public static void asyncRefresh(StructuredViewer viewer, Object element)
Asynchronously refreshes the element of given viewer.- Parameters:
viewer
- the viewer to refresh the element of.element
- the element to refresh.
-
syncUpdateSelection
public static void syncUpdateSelection(Viewer viewer, ISelection selection)
Synchronously updates the selection of the given viewer.- Parameters:
viewer
- the viewer to update the selection of.selection
- the new selection.
-
asyncExec
public static void asyncExec(Viewer viewer, Runnable runnable)
Executes the given runnable asynchronously on a UI thread associated with the given viewer. Execution request is ignored if the viewer's control is disposed or workbench is not running.- Parameters:
viewer
- the viewer to obtain a UI thread from.runnable
- the runnable to execute.
-
syncExec
public static void syncExec(Viewer viewer, Runnable runnable)
Executes the given runnable synchronously on the UI thread associated with the given viewer. Execution request is ignored if the viewer's control is disposed or workbench is not running.- Parameters:
viewer
- the viewer to obtain a UI thread from.runnable
- the runnable to execute.
-
createNavigatorContentService
public static org.eclipse.ui.navigator.INavigatorContentService createNavigatorContentService()
Creates DT navigator content service. Each invocation creates a new content service instance which must be disposed when no longer needed. Content and label providers created via the returned service must be disposed as well.- Returns:
- the created content service.
-
createNavigatorContentService
public static org.eclipse.ui.navigator.INavigatorContentService createNavigatorContentService(StructuredViewer viewer)
Creates DT navigator content service for the given viewer. Each invocation creates a new content service instance which must be disposed when no longer needed. Content and label providers created via the returned service must be disposed as well.- Returns:
- the created content service.
-
runDeferredLayouts
public static void runDeferredLayouts(org.eclipse.swt.widgets.Display display)
Runs deferred layout for the given display. Use it as a workaround for the following Eclipse layout bug:- User presses the mouse button on Navigator to select something in it. Eclipse makes call to Shell.setLayoutDeferred(true) to reduce the flickering of the toolbar while updating toolbar actions.
- While updating actions Eclipse also calls layout procedure with SWT.DEFER flag, that increases the number of deferred layout operations for the Shell.
- After that, subsequent call to Shell.setLayoutDeferred(false) will not trigger the replay of deferred layout operations since there were calls with SWT.DEFER flag. Such calls are replayed internally by the Display.runDeferredLayouts() on each attempt to process Display event queue events.
- DND subsystem disables the event processing while the mouse button is down. So the Display.runDeferredLayouts() call will not be made until user will release the mouse button.
- Eclipse totally disables the layout processing while user holds the mouse button down.
- Parameters:
display
- display to run deferred layouts for.
-
getCheckedStateImage
public static org.eclipse.swt.graphics.Image getCheckedStateImage(CommonUI.CheckState checkState)
Gets check state image.- Parameters:
checkState
- the check state- Returns:
- the image, may be
null
-
getCheckedStateImage
public static org.eclipse.swt.graphics.Image getCheckedStateImage(Boolean state)
Gets the check state image fromBoolean
.- Parameters:
state
-true
to get the checked image,false
to get the unchecked image,null
to get the grayed/mixed/indeterminate image.- Returns:
- the image, may not be
null
-
clearSelectionOnRightClick
public static void clearSelectionOnRightClick(org.eclipse.swt.widgets.Control control)
Adds a mouse listener that clears selection for the given control if the mouse down event coordinates corresponds to empty space of the control.- Parameters:
control
- the control, can beTable
orTree
instance only.- Throws:
IllegalArgumentException
- if the given control is notTable
orTree
.
-
getColor
public org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.graphics.RGB rgb)
Returns color for given rgb. User should not dispose returned color.- Parameters:
rgb
- - rgb to get color.- Returns:
- color for given rgb. Can't return
null
.
-
-