List of usage examples for org.eclipse.jface.dialogs Dialog DLG_IMG_MESSAGE_INFO
String DLG_IMG_MESSAGE_INFO
To view the source code for org.eclipse.jface.dialogs Dialog DLG_IMG_MESSAGE_INFO.
Click Source Link
"dialog_messasge_info_image"
). From source file:org.eclipse.xtext.xtext.ui.wizard.project.StatusWidget.java
License:Open Source License
private Image imageFor(final int type) { Image _switchResult = null;/* ww w . j ava2s .co m*/ switch (type) { case IMessageProvider.NONE: _switchResult = null; break; case IMessageProvider.INFORMATION: _switchResult = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); break; case IMessageProvider.WARNING: _switchResult = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); break; case IMessageProvider.ERROR: _switchResult = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); break; } return _switchResult; }
From source file:org.jkiss.dbeaver.ui.controls.resultset.StatusLabel.java
License:Apache License
public StatusLabel(@NotNull Composite parent, int style, @Nullable final ResultSetViewer viewer) { super(parent, SWT.BORDER); this.viewer = viewer; setBackgroundMode(SWT.INHERIT_FORCE); final GridLayout layout = new GridLayout(3, false); layout.marginHeight = 0;/*from ww w.ja v a 2s .c om*/ layout.marginWidth = 2; layout.horizontalSpacing = 3; setLayout(layout); colorDefault = getForeground(); colorError = JFaceColors.getErrorText(Display.getDefault()); colorWarning = colorDefault; final Image statusImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); statusIcon = new Label(this, SWT.NONE); statusIcon.setImage(statusImage); statusIcon.setToolTipText("Status information"); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); statusIcon.setLayoutData(gd); statusText = new Text(this, SWT.SINGLE | SWT.READ_ONLY); if (RuntimeUtils.isPlatformWindows()) { statusText.setBackground(null); } else { statusText.setBackground(parent.getBackground()); } gd = new GridData(GridData.FILL_HORIZONTAL); gd.minimumHeight = statusImage.getBounds().height; statusText.setLayoutData(gd); UIUtils.enableHostEditorKeyBindingsSupport(viewer.getSite(), this.statusText); UIUtils.addFocusTracker(viewer.getSite(), UIUtils.INLINE_WIDGET_EDITOR_ID, this.statusText); this.statusText.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { // Unregister from focus service UIUtils.removeFocusTracker(viewer.getSite(), statusText); } }); final ToolBar tb = new ToolBar(this, SWT.HORIZONTAL); final ToolItem detailsIcon = new ToolItem(tb, SWT.NONE); detailsIcon.setImage(DBeaverIcons.getImage(UIIcon.TEXTFIELD)); tb.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); detailsIcon.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { showDetails(); } }); statusText.addTraverseListener(new TraverseListener() { @Override public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_RETURN) { showDetails(); } } }); }
From source file:org.jkiss.dbeaver.ui.controls.resultset.StatusLabel.java
License:Apache License
public void setStatus(String message, DBPMessageType messageType) { if (statusText.isDisposed()) { return;//from w ww. java 2 s . com } this.messageType = messageType; Color fg; String statusIconId; switch (messageType) { case ERROR: fg = colorError; statusIconId = Dialog.DLG_IMG_MESSAGE_ERROR; break; case WARNING: fg = colorWarning; statusIconId = Dialog.DLG_IMG_MESSAGE_WARNING; break; default: fg = colorDefault; statusIconId = Dialog.DLG_IMG_MESSAGE_INFO; break; } statusText.setForeground(fg); if (message == null) { message = "???"; //$NON-NLS-1$ } statusIcon.setImage(JFaceResources.getImage(statusIconId)); statusText.setText(TextUtils.getSingleLineString(message)); if (messageType != DBPMessageType.INFORMATION) { statusText.setToolTipText(message); } else { statusText.setToolTipText(null); } }
From source file:org.kalypso.contribs.eclipse.jface.wizard.view.WizardView.java
License:Open Source License
/** * Sets the message for this dialog with an indication of what type of message it is. * <p>//from w w w . j a v a 2 s . com * The valid message types are one of <code>NONE</code>,<code>INFORMATION</code>,<code>WARNING</code>, or * <code>ERROR</code>. * </p> * <p> * Note that for backward compatibility, a message of type <code>ERROR</code> is different than an error message (set * using <code>setErrorMessage</code>). An error message overrides the current message until the error message is * cleared. This method replaces the current message and does not affect the error message. * </p> * * @param newMessage * the message, or <code>null</code> to clear the message * @param newType * the message type * @since 2.0 */ public void setMessage(final String newMessage, final int newType) { Image newImage = null; if (newMessage != null) { switch (newType) { case IMessageProvider.NONE: break; case IMessageProvider.INFORMATION: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); break; case IMessageProvider.WARNING: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); break; case IMessageProvider.ERROR: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); break; } } showMessage(newMessage, newImage); }
From source file:org.mailster.gui.prefs.widgets.DialogMessageArea.java
License:Open Source License
/** * Create the contents for the receiver. * /* w w w . j a v a 2 s . c o m*/ * @param parent the Composite that the children will be created in */ public void createContents(Composite parent) { /* Create the title label */ this.titleLabel = new CLabel(parent, SWT.LEFT); int[] alpha = new int[] { 75, 100 }; this.titleLabel.setBackground(DEFAULT_GRADIENT_BACKGROUND, alpha); this.titleLabel.setFont(JFaceResources.getBannerFont()); this.titleLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); this.titleLabel.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { e.gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY)); Rectangle bounds = titleLabel.getClientArea(); bounds.height -= 2; bounds.width -= 1; e.gc.drawRectangle(bounds); } }); /* Create the message container */ this.messageComposite = new Composite(parent, SWT.NONE); GridLayout messageLayout = new GridLayout(2, false); messageLayout.marginWidth = 0; messageLayout.marginHeight = 0; this.messageComposite.setLayout(messageLayout); /* Create the message image holder */ this.messageImageLabel = new Label(this.messageComposite, SWT.NONE); this.messageImageLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO)); this.messageImageLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER)); /* Create the message text holder */ this.messageText = new Text(this.messageComposite, SWT.NONE); this.messageText.setEditable(false); GridData textData = new GridData( GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER); this.messageText.setLayoutData(textData); }
From source file:org.mailster.gui.prefs.widgets.DialogMessageArea.java
License:Open Source License
/** * Show the new message in the message text and update the image. Base the * background color on whether or not there are errors. * /*from w w w . j a va2 s . c om*/ * @param newMessage The new value for the message * @param newType One of the IMessageProvider constants. If newType is * IMessageProvider.NONE show the title. * @see org.eclipse.jface.dialogs.IMessageProvider */ public void updateText(String newMessage, int newType) { Image newImage = null; switch (newType) { case IMessageProvider.NONE: if (newMessage == null) { this.restoreTitle(); } else { this.showTitle(newMessage, null); } return; case IMessageProvider.INFORMATION: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); break; case IMessageProvider.WARNING: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); break; case IMessageProvider.ERROR: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); break; } this.messageComposite.setVisible(true); this.titleLabel.setVisible(false); // Any more updates required? // If the message text equals the tooltip (i.e. non-shortened text is // the same) // and shortened text is the same (i.e. not a resize) // and the image is the same then nothing to do String shortText = Dialog.shortenText(newMessage, messageText); if (newMessage.equals(messageText.getToolTipText()) && newImage == messageImageLabel.getImage() && shortText.equals(messageText.getText())) { return; } this.messageImageLabel.setImage(newImage); this.messageText.setText(Dialog.shortenText(newMessage, messageText)); this.messageText.setToolTipText(newMessage); this.lastMessageText = newMessage; }
From source file:tern.eclipse.ide.ui.contentassist.TimeoutProposal.java
License:Open Source License
@Override public Image getImage() { return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); }