diff options
Diffstat (limited to 'bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MessageLine.java')
-rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MessageLine.java | 81 |
1 files changed, 39 insertions, 42 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MessageLine.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MessageLine.java index 5ab3715c87b..61e2209ec1e 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MessageLine.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MessageLine.java @@ -27,51 +27,48 @@ import org.eclipse.ui.PlatformUI; */ public class MessageLine extends CLabel { - /** - * Creates a new message line as a child of the given parent. - */ - public MessageLine(Composite parent) { - this(parent, SWT.LEFT); - } + /** + * Creates a new message line as a child of the given parent. + */ + public MessageLine(Composite parent) { + this(parent, SWT.LEFT); + } - /** - * Creates a new message line as a child of the parent and with the given SWT stylebits. - */ - public MessageLine(Composite parent, int style) { - super(parent, style); - } + /** + * Creates a new message line as a child of the parent and with the given SWT + * stylebits. + */ + public MessageLine(Composite parent, int style) { + super(parent, style); + } - private Image findImage(IStatus status) { - if (status.isOK()) { - return null; - } else if (status.matches(IStatus.ERROR)) { - return PlatformUI.getWorkbench().getSharedImages().getImage( - ISharedImages.IMG_OBJS_ERROR_TSK); - } else if (status.matches(IStatus.WARNING)) { - return PlatformUI.getWorkbench().getSharedImages().getImage( - ISharedImages.IMG_OBJS_WARN_TSK); - } else if (status.matches(IStatus.INFO)) { - return PlatformUI.getWorkbench().getSharedImages().getImage( - ISharedImages.IMG_OBJS_INFO_TSK); - } - return null; - } + private Image findImage(IStatus status) { + if (status.isOK()) { + return null; + } else if (status.matches(IStatus.ERROR)) { + return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK); + } else if (status.matches(IStatus.WARNING)) { + return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK); + } else if (status.matches(IStatus.INFO)) { + return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK); + } + return null; + } - /** - * Sets the message and image to the given status. - * <code>null</code> is a valid argument and will set the empty text and no image - */ - public void setErrorStatus(IStatus status) { - if (status != null) { - String message = status.getMessage(); - if (message != null && message.length() > 0) { - setText(message); - setImage(findImage(status)); - return; - } - } + /** + * Sets the message and image to the given status. <code>null</code> is a valid + * argument and will set the empty text and no image + */ + public void setErrorStatus(IStatus status) { + if (status != null) { + String message = status.getMessage(); + if (message != null && message.length() > 0) { + setText(message); + setImage(findImage(status)); + return; + } + } setText(""); //$NON-NLS-1$ - setImage(null); + setImage(null); } } - |