Example usage for org.eclipse.jface.dialogs IMessageProvider INFORMATION

List of usage examples for org.eclipse.jface.dialogs IMessageProvider INFORMATION

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IMessageProvider INFORMATION.

Prototype

int INFORMATION

To view the source code for org.eclipse.jface.dialogs IMessageProvider INFORMATION.

Click Source Link

Document

Constant for an info message (value 1).

Usage

From source file:com.google.cloud.tools.eclipse.preferences.areas.AreaPreferencePageTest.java

License:Apache License

@Test
public void testStatusSeverityInfo() {
    // add three areas, status = OK, OK, INFO; verify showing INFO
    setupAreas();//from w  ww  .  ja va 2  s.  c om

    area3.status = new Status(IStatus.INFO, "foo", "info3");
    area3.fireValueChanged(TestPrefArea.IS_VALID, true, false);

    assertTrue("should still be valid", page.isValid());
    assertEquals(IMessageProvider.INFORMATION, page.getMessageType());
    assertEquals("info3", page.getMessage());
}

From source file:com.google.cloud.tools.eclipse.preferences.areas.AreaPreferencePageTest.java

License:Apache License

@Test
public void testStatusSeverityWarn() {
    // add three areas, status = OK, WARN, INFO; verify showing WARN
    setupAreas();//from  w ww .  j  a  va2s .  co  m

    area3.status = new Status(IStatus.INFO, "foo", "info3");
    area3.fireValueChanged(TestPrefArea.IS_VALID, true, false);

    assertTrue("should still be valid", page.isValid());
    assertEquals(IMessageProvider.INFORMATION, page.getMessageType());
    assertEquals("info3", page.getMessage());

    area2.status = new Status(IStatus.WARNING, "foo", "warn2");
    area2.fireValueChanged(TestPrefArea.IS_VALID, true, false);

    assertTrue("should still be valid", page.isValid());
    assertEquals(IMessageProvider.WARNING, page.getMessageType());
    assertEquals("warn2", page.getMessage());
}

From source file:com.google.cloud.tools.eclipse.preferences.areas.AreaPreferencePageTest.java

License:Apache License

@Test
public void testStatusSeverityError() {
    // add three areas, status = WARN, ERROR, INFO; verify showing ERROR

    setupAreas();//from  w  w w.  j  ava  2 s  .c  om

    area3.status = new Status(IStatus.INFO, "foo", "info3");
    area3.fireValueChanged(TestPrefArea.IS_VALID, true, false);

    assertTrue("should still be valid", page.isValid());
    assertEquals(IMessageProvider.INFORMATION, page.getMessageType());
    assertEquals("info3", page.getMessage());

    area1.status = new Status(IStatus.WARNING, "foo", "warn1");
    area1.fireValueChanged(TestPrefArea.IS_VALID, true, false);

    assertTrue("should still be valid", page.isValid());
    assertEquals(IMessageProvider.WARNING, page.getMessageType());
    assertEquals("warn1", page.getMessage());

    area2.status = new Status(IStatus.ERROR, "foo", "error2");
    area2.fireValueChanged(TestPrefArea.IS_VALID, true, false);

    assertFalse("should now be invalid", page.isValid());
    assertEquals(IMessageProvider.ERROR, page.getMessageType());
    assertEquals("error2", page.getMessage());
}

From source file:com.google.cloud.tools.eclipse.preferences.areas.FieldEditorWrapper.java

License:Apache License

@Override
public IStatus getStatus() {
    // DialogPage has an unfortunately complex set of message possibilities
    String message = messages.getErrorMessage();
    if (message != null) {
        return new Status(IStatus.ERROR, PLUGIN_ID, message);
    }/*w ww . j a  v  a2 s. co m*/
    int messageType = messages.getMessageType();
    switch (messageType) {
    case IMessageProvider.INFORMATION:
        return new Status(IStatus.INFO, PLUGIN_ID, messages.getMessage());
    case IMessageProvider.WARNING:
        return new Status(IStatus.WARNING, PLUGIN_ID, messages.getMessage());
    case IMessageProvider.ERROR:
        return new Status(IStatus.ERROR, PLUGIN_ID, messages.getMessage());
    default:
        return Status.OK_STATUS;
    }
}

From source file:com.google.gdt.eclipse.core.ui.AbstractProjectPropertyPage.java

License:Open Source License

/**
 * Converts a standard IStatus's severity into the severity flags used by
 * dialogs and property pages./*from   w  ww.j a  v a2s  . c  om*/
 */
protected static int convertSeverity(IStatus status) {
    switch (status.getSeverity()) {
    case IStatus.ERROR:
        return IMessageProvider.ERROR;
    case IStatus.WARNING:
        return IMessageProvider.WARNING;
    case IStatus.INFO:
        return IMessageProvider.INFORMATION;
    default:
        return IMessageProvider.NONE;
    }
}

From source file:com.gorillalogic.monkeyconsole.editors.utils.TitleAreaDialogStyledTextMessage.java

License:Open Source License

/**
 * Sets the message for this dialog with an indication of what type of
 * message it is.//  ww  w.  j a  v  a  2  s  .c o m
 * <p>
 * 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(String newMessage, int newType) {
    Image newImage = null;
    if (newMessage != null) {
        switch (newType) {
        case IMessageProvider.NONE:
            break;
        case IMessageProvider.INFORMATION:
            newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_INFO);
            break;
        case IMessageProvider.WARNING:
            newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_WARNING);
            break;
        case IMessageProvider.ERROR:
            newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_ERROR);
            break;
        }
    }
    showMessage(newMessage, newImage);
}

From source file:com.hangum.tadpole.rdb.core.dialog.msg.TDBClipboardDialog.java

License:Open Source License

/**
 * Create contents of the dialog.//  ww w.  j a va 2  s. c o  m
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    setMessage(title, IMessageProvider.INFORMATION);

    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    container.setLayout(new GridLayout(2, false));
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    lblMessage = new Label(container, SWT.NONE);
    lblMessage.setText(Messages.get().TDBInfoDialog_0);
    new Label(container, SWT.NONE);

    textMessage = new Text(container, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
    textMessage.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (e.stateMask == SWT.CTRL && e.keyCode == 'c') {
                closeWindow();
            } else if (e.stateMask == SWT.COMMAND && e.keyCode == 'c') {
                closeWindow();
            }
        }
    });
    textMessage.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));

    compositeExtension = new Composite(container, SWT.NONE);
    compositeExtension.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    compositeExtension.setLayout(new GridLayout(2, false));

    label = new Label(compositeExtension, SWT.NONE);
    label.setText(Messages.get().Separator);

    txtSeperate = new Text(compositeExtension, SWT.BORDER);
    txtSeperate.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (e.keyCode == SWT.Selection) {
                initData();
            }
        }
    });
    txtSeperate.addTraverseListener(new TraverseListener() {
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
                e.doit = false;
            }
        }
    });
    txtSeperate.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    txtSeperate.setText("\\t");

    initData();

    // google analytic
    AnalyticCaller.track(this.getClass().getName());

    return area;
}

From source file:com.hangum.tadpole.rdb.core.dialog.msg.TDBInfoDialog.java

License:Open Source License

/**
 * Create contents of the dialog.//from   w  w w .  j  a v  a 2  s. c o  m
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    setMessage(title, IMessageProvider.INFORMATION);

    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    container.setLayout(new GridLayout(2, false));
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    lblMessage = new Label(container, SWT.NONE);
    lblMessage.setText(Messages.get().TDBInfoDialog_0);
    new Label(container, SWT.NONE);

    textMessage = new Text(container,
            SWT.BORDER | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
    textMessage.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    textMessage.setText(message);

    // google analytic
    AnalyticCaller.track(this.getClass().getName());

    return area;
}

From source file:com.htmlhifive.tools.jslint.dialog.CreateEngineDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    initialDataBinding();/*  w w w. j  ava2  s . c om*/
    setMessage(Messages.DL0027.getText(), IMessageProvider.INFORMATION);
}

From source file:com.htmlhifive.tools.jslint.dialog.CreateOptionFileDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    setTitle(Messages.DL0018.getText());
    Composite area = (Composite) super.createDialogArea(parent);
    area.setLayout(new GridLayout(1, false));

    Composite composite = new Composite(area, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    composite.setLayout(new GridLayout(2, false));

    Label labelOutputDir = new Label(composite, SWT.NONE);
    labelOutputDir.setText(Messages.DL0020.getText());

    Composite outputDircomp = new Composite(composite, SWT.NONE);
    outputDircomp.setLayout(new GridLayout(2, false));
    outputDircomp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));

    textOutputDir = new Text(outputDircomp, SWT.BORDER);
    textOutputDir.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Button btnOutPut = new Button(outputDircomp, SWT.NONE);
    GridData gdBtnOutPut = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gdBtnOutPut.widthHint = 60;//w w w . j  a  v  a2  s .c om
    btnOutPut.setLayoutData(gdBtnOutPut);
    btnOutPut.setText(Messages.B0001.getText());
    btnOutPut.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FolderSelectionDialog dialog = new FolderSelectionDialog(getShell(), Messages.DT0008.getText(),
                    Messages.DL0022.getText());
            if (dialog.open() != Window.OK) {
                return;
            }
            IContainer outputDir = (IContainer) dialog.getFirstResult();
            textOutputDir.setText(outputDir.getFullPath().toString());
        }
    });

    Label labelOptionFileName = new Label(composite, SWT.NONE);
    labelOptionFileName.setText(Messages.DL0021.getText());

    Composite inputComp = new Composite(composite, SWT.NONE);
    inputComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
    inputComp.setLayout(new GridLayout(1, false));

    textOptionFileName = new Text(inputComp, SWT.BORDER);
    textOptionFileName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    initializeDataBindings();
    setMessage(Messages.DL0019.getText(), IMessageProvider.INFORMATION);
    return area;
}