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

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

Introduction

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

Prototype

int NONE

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

Click Source Link

Document

Constant for a regular message (value 0).

Usage

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

License:Apache License

@Test
public void testStatusTransition() {
    testErrorStatusResults();/* www  .  j av  a 2 s.  c  o  m*/
    // change its status to be OK, trigger its VALUE property.
    // verify no error message
    area1.status = Status.OK_STATUS;
    area1.fireValueChanged(TestPrefArea.IS_VALID, false, true);

    assertTrue(page.isValid());
    assertEquals(IMessageProvider.NONE, page.getMessageType());
}

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

License:Apache License

private void setupAreas() {
    page = new AreaBasedPreferencePage("test");
    area1 = new TestPrefArea("pref1", "value", preferences);
    area2 = new TestPrefArea("pref2", "value", preferences);
    area3 = new TestPrefArea("pref3", "value", preferences);
    page.addArea(area1);//  www  .  j  a  v a  2  s.  co  m
    page.addArea(area2);
    page.addArea(area3);

    area1.status = Status.OK_STATUS;
    area2.status = Status.OK_STATUS;
    area3.status = Status.OK_STATUS;

    show(page);
    assertTrue(page.isValid());
    assertEquals(IMessageProvider.NONE, page.getMessageType());
}

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 w  w  . j  a v a  2  s  .  c  o m*/
 */
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.google.gdt.eclipse.core.ui.SdkTable.java

License:Open Source License

public SdkTable(Composite parent, int style, SdkSet<T> startingSdks,
        SdkManagerStateChangeListener stateChangeListener, DialogPage dialogPage) {
    super(parent, style);

    this.dialogPage = dialogPage;
    this.stateChangeListener = stateChangeListener;

    this.sdks = startingSdks;

    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;/*  www  . j  ava 2  s  .  c o  m*/
    layout.marginHeight = 0;
    setLayout(layout);

    final Label headerLabel = new Label(this, SWT.WRAP);
    final GridData headerLabelGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    headerLabelGridData.widthHint = 250;
    headerLabel.setLayoutData(headerLabelGridData);
    headerLabel.setText(
            "Add, remove or download SDKs.\n\nBy default, the checked SDK is added to the build path of newly created projects.");

    Composite panel = this;
    final Label spacerLabel = new Label(panel, SWT.NONE);
    final GridData spacerLabelGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    spacerLabelGridData.heightHint = 1;
    spacerLabel.setLayoutData(spacerLabelGridData);

    final Composite versionsPanel = new Composite(panel, SWT.NONE);
    final GridData versionsPanelGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    versionsPanel.setLayoutData(versionsPanelGridData);
    final GridLayout gridLayout = new GridLayout();
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    gridLayout.numColumns = 2;
    versionsPanel.setLayout(gridLayout);

    final Label tableHeaderLabel = new Label(versionsPanel, SWT.NONE);
    tableHeaderLabel.setText("SDKs:");
    GridDataFactory.fillDefaults().span(2, 1).applyTo(tableHeaderLabel);

    sdkTableViewer = CheckboxTableViewer.newCheckList(versionsPanel, SWT.FULL_SELECTION | SWT.BORDER);
    sdkTableViewer.setContentProvider(new ArrayContentProvider());
    sdkTableViewer.setLabelProvider(new ColumnLabelProvider());
    sdkTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            updateRemoteButtonEnabled();
            SdkTable.this.dialogPage.setMessage(null, IMessageProvider.NONE);

            // NOTE: It is bad form that this control sets the dialog page's message
            // directly.
            ISelection selection = event.getSelection();
            if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
                IStructuredSelection sselection = (IStructuredSelection) selection;
                Object firstElement = sselection.getFirstElement();
                Sdk sdk = (Sdk) firstElement;
                IStatus validationStatus = sdk != null ? sdk.validate() : Status.OK_STATUS;
                if (!validationStatus.isOK()) {
                    SdkTable.this.dialogPage.setMessage(validationStatus.getMessage(),
                            IMessageProvider.WARNING);
                }
            }
        }
    });
    sdkTableViewer.addCheckStateListener(new ICheckStateListener() {
        @SuppressWarnings("unchecked")
        public void checkStateChanged(CheckStateChangedEvent event) {
            // Only one GWT runtime can be the default
            if (event.getChecked()) {
                T sdk = (T) event.getElement();
                sdks.setDefault(sdk);
            }

            updateControls();

            fireStateChangedEvent();
        }
    });

    table = sdkTableViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    GridDataFactory.fillDefaults().grab(true, true).hint(200, 200).applyTo(table);

    final TableColumn nameTableColumn = new TableColumn(table, SWT.NONE);
    nameTableColumn.setWidth(110);
    nameTableColumn.setText("Name");

    final TableColumn versionTableColumn = new TableColumn(table, SWT.NONE);
    versionTableColumn.setWidth(53);
    versionTableColumn.setText("Version");

    final TableColumn locationTableColumn = new TableColumn(table, SWT.NONE);
    locationTableColumn.setWidth(600);
    locationTableColumn.setText("Location");

    final Composite buttonsPanel = new Composite(versionsPanel, SWT.NONE);
    final GridData buttonsPanelGridData = new GridData(SWT.LEFT, SWT.TOP, false, false);
    buttonsPanel.setLayoutData(buttonsPanelGridData);
    final GridLayout buttonsPanelGridLayout = new GridLayout();
    buttonsPanelGridLayout.marginHeight = 0;
    buttonsPanelGridLayout.marginWidth = 0;
    buttonsPanel.setLayout(buttonsPanelGridLayout);

    final Button addButton = new Button(buttonsPanel, SWT.NONE);
    final GridData addButtonGridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
    addButtonGridData.widthHint = 76;
    addButton.setLayoutData(addButtonGridData);
    addButton.setText("Add...");
    addButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStatus status = doAddSdk();
            if (status.isOK()) {
                updateControls();
                fireStateChangedEvent();
            }
        }
    });

    removeButton = new Button(buttonsPanel, SWT.NONE);
    final GridData removeButtonGridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
    removeButtonGridData.widthHint = 76;
    removeButton.setLayoutData(removeButtonGridData);
    removeButton.setText("Remove");
    removeButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            removeSelectedSdk();
            updateControls();
            fireStateChangedEvent();
        }
    });

    dowloadButton = new Button(buttonsPanel, SWT.NONE);
    final GridData downloadButtonGridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
    removeButtonGridData.widthHint = 76;
    dowloadButton.setLayoutData(downloadButtonGridData);
    dowloadButton.setText("Download...");
    dowloadButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStatus status = doDownloadSdk();
            if (status.isOK()) {
                updateControls();
                fireStateChangedEvent();
            }
        }
    });

    final Label footerLabel = new Label(panel, SWT.NONE);
    final GridData footerLabelGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    footerLabel.setLayoutData(footerLabelGridData);

    sdkTableViewer.setInput(sdks);
    sdkTableViewer.setContentProvider(new IStructuredContentProvider() {
        public void dispose() {
        }

        public Object[] getElements(Object inputElement) {
            return sdks.toArray();
        }

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }
    });

    updateControls();
    updateRemoteButtonEnabled();
}

From source file:com.google.gdt.eclipse.mobile.android.wizards.NewAndroidCloudProjectWizardPage.java

License:Open Source License

/**
 * Sets the error message for the wizard with the given message icon.
 * //from www  .ja  v a 2s  .c  o m
 * @param message The wizard message type, one of MSG_ERROR or MSG_WARNING.
 * @return As a convenience, always returns messageType so that the caller can
 *         return immediately.
 */
private int setStatus(String message, int messageType) {
    if (message == null) {
        setErrorMessage(null);
        setMessage(null);
    } else if (!message.equals(getMessage())) {
        if (messageType == MSG_NONE) {
            setMessage(message, IMessageProvider.NONE);
        } else if (messageType == MSG_ERROR) {
            setMessage(message, IMessageProvider.ERROR);
        } else {
            setMessage(message, IMessageProvider.WARNING);
        }
    }
    return messageType;
}

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

License:Open Source License

/**
 * Set the message text. If the message line currently displays an error,
 * the message is saved and will be redisplayed when the error message is
 * set to <code>null</code>.
 * <p>//from   w w  w  .java 2s  . c o m
 * Shortcut for <code>setMessage(newMessage, IMessageProvider.NONE)</code>
 * </p>
 * This method should be called after the dialog has been opened as it
 * updates the message label immediately.
 * 
 * @param newMessage
 *            the message, or <code>null</code> to clear the message
 */
public void setMessage(String newMessage) {
    setMessage(newMessage, 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 av  a  2s .com
 * <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.ivenix.debug.gdbjtag.render.peripheral.PeripheralFilterDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    setTitle("Filter");
    setMessage("Hide register/fields not containing the filter string", IMessageProvider.NONE);
}

From source file:com.iw.plugins.spindle.editorjwc.beans.NewBeanDialog.java

License:Mozilla Public License

/**
 * @see AbstractDialog#createAreaContents(Composite)
 *///from   ww  w  .  j  a va2 s  .  c  o m
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);

    Composite innerContainer = new Composite(parent, SWT.NONE);
    innerContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
    FormLayout layout = new FormLayout();
    layout.marginHeight = 4;
    layout.marginWidth = 4;
    innerContainer.setLayout(layout);

    beanName = new StringField("Bean name:", FIELD_WIDTH);
    beanName.addListener(adapter);
    Control beanNameControl = beanName.getControl(innerContainer);

    beanClassname = new StringButtonField("Bean Class:", FIELD_WIDTH);
    beanClassname.addListener(adapter);
    Control beanClassnameControl = beanClassname.getControl(innerContainer);

    String[] choices = comboChoices;

    if (DTDVersion < XMLUtil.DTD_1_3) {

        choices = pre13comboChoices;

    }
    lifecycleCombo = new UneditableComboBoxDialogField("Bean Lifecycle:", FIELD_WIDTH, choices);
    lifecycleCombo.addListener(adapter);
    Control lifecycleControl = lifecycleCombo.getControl(innerContainer);

    FormData data = new FormData();
    data.top = new FormAttachment(0, 5);
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    beanNameControl.setLayoutData(data);

    data = new FormData();
    data.top = new FormAttachment(beanNameControl, 4);
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    beanClassnameControl.setLayoutData(data);

    data = new FormData();
    data.top = new FormAttachment(beanClassnameControl, 4);
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    lifecycleControl.setLayoutData(data);

    setTitle("New Bean");
    setMessage("Enter the new bean information", IMessageProvider.NONE);

    return container;
}

From source file:com.iw.plugins.spindle.ui.ChooseFromNamespaceDialog.java

License:Mozilla Public License

public void create() {
    super.create();
    setTitle(title);//from   ww  w.j  ava 2  s  .c om
    setMessage(description, IMessageProvider.NONE);
    chooserWidget.setFocus();
    chooserWidget.refresh();
    updateOkState();
}