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:org.eclipse.tcf.te.ui.jface.dialogs.CustomTitleAreaDialog.java

License:Open Source License

/**
 * Cleanup when dialog is closed.//from   w  ww  . ja va2 s .c o  m
 */
protected void dispose() {
    dialogSettings = null;
    message = null;
    messageType = IMessageProvider.NONE;
    errorMessage = null;
    title = null;
    defaultMessage = null;
    defaultMessageType = IMessageProvider.NONE;
}

From source file:org.eclipse.tcf.te.ui.views.controls.AbstractContextSelectorControl.java

License:Open Source License

@Override
public boolean isValid() {
    boolean valid = super.isValid();
    if (!valid)//from www . j a v  a 2s . c o  m
        return valid;

    // If there is a last failure cause set, show that failure cause
    valid = getLastFailureCause() == null;
    if (!valid) {
        setMessage(getLastFailureCause().getLocalizedMessage(), IMessageProvider.ERROR);
    }

    // The remote context selector control is only valid, if at least one
    // element has been checked (if operating with CHECK style set)
    if (valid && (getTreeViewerStyle() & SWT.CHECK) != 0 && requireSelection) {
        int count = getCheckedModelContexts().length;
        valid = count == 1
                || (count > 1 && getPropertiesContainer().isProperty(PROPERTY_MULTI_CONTEXT_SELECTOR, true));

        // if we are not valid here, it can only mean, that there is
        // no connectable checked.
        if (!valid) {
            String messageId = "AbstractContextSelectorControl_error_noContextSelected"; //$NON-NLS-1$
            if (getPropertiesContainer().isProperty(PROPERTY_MULTI_CONTEXT_SELECTOR, true)) {
                messageId += "_multi"; //$NON-NLS-1$
            } else {
                messageId += "_single"; //$NON-NLS-1$
            }

            setMessage(getMessageForId(messageId), getMessageTypeForId(messageId, IMessageProvider.ERROR));
        }
    }

    if (getControlDecoration() != null) {
        // Setup and show the control decoration if necessary
        if (isEnabled() && (!valid || (getMessage() != null && getMessageType() != IMessageProvider.NONE))) {
            // Update the control decorator
            updateControlDecoration(getMessage(), getMessageType());
        } else {
            updateControlDecoration(null, IMessageProvider.NONE);
        }
    }

    return valid;
}

From source file:org.eclipse.tcf.te.ui.views.editor.pages.AbstractEditorPage.java

License:Open Source License

@Override
public final void validate() {
    ValidationResult result = doValidate();
    if (result != null)
        setMessage(result.getMessage(), result.getMessageType());
    else/*from w ww  .  j  a  v a  2  s. com*/
        setMessage(null, IMessageProvider.NONE);
}

From source file:org.eclipse.tcf.te.ui.wizards.pages.AbstractValidatingWizardPage.java

License:Open Source License

@Override
public final void validate() {
    if (isValidationInProgress())
        return;//from   w w  w .  ja v a 2 s. c o  m

    ValidationResult result = doValidate();
    if (result != null) {
        setMessage(result.getMessage(), result.getMessageType());
        setPageComplete(result.isValid());
    } else {
        setMessage(null, IMessageProvider.NONE);
        setPageComplete(true);
    }

    setValidationInProgress(false);
}

From source file:org.eclipse.team.svn.ui.preferences.AbstractSVNTeamPreferencesPage.java

License:Open Source License

public void addListeners() {
    this.changeListener.addListeners();
    this.validateContent();
    this.setMessage(this.getTitle(), IMessageProvider.NONE);
}

From source file:org.eclipse.team.svn.ui.wizard.AbstractVerifiedWizardPage.java

License:Open Source License

public void addListeners() {
    this.changeListener.addListeners();
    this.validateContent();
    this.setMessage(this.getDescription(), IMessageProvider.NONE);
}

From source file:org.eclipse.team.svn.ui.wizard.AbstractVerifiedWizardPage.java

License:Open Source License

public void setMessage(String newMessage, int newType) {
    if (newType == IMessageProvider.WARNING) {
        //NOTE Eclipse workaround: all warnings are rendered as animated but old message does not cleared. So, old error still visible after warning is shown.
        AbstractVerifiedWizardPage.this.setMessage("", IMessageProvider.NONE); //$NON-NLS-1$
        //NOTE Eclipse workaround: clear error message before setting warning message
        AbstractVerifiedWizardPage.this.setErrorMessage(null);
        super.setMessage(newMessage, newType);
    } else if (newType == IMessageProvider.ERROR) {
        //NOTE Eclipse workaround: all warnings are rendered as animated but old message does not cleared. So, old error still visible after warning is shown.
        AbstractVerifiedWizardPage.this.setMessage("", IMessageProvider.NONE); //$NON-NLS-1$
        //NOTE Eclipse workaround: error will be rendered as animated only when setErrorMessage() is used.
        AbstractVerifiedWizardPage.this.setErrorMessage(newMessage);
    } else {//from  ww w. java 2  s  .co m
        //NOTE Eclipse workaround: clear error message before setting default message
        AbstractVerifiedWizardPage.this.setErrorMessage(null);
        super.setMessage(newMessage, newType);
    }
}

From source file:org.eclipse.titan.designer.editors.configeditor.pages.compgroupmc.ComponentsGroupsMCPage.java

License:Open Source License

public void setErrorMessage() {
    if (form != null) {
        Display.getDefault().asyncExec(new Runnable() {
            @Override/*from   w ww . j  ava  2 s  .  com*/
            public void run() {
                if (editor.getErrorMessage() == null) {
                    form.getForm().setMessage(null, IMessageProvider.NONE);
                } else {
                    form.getForm().setMessage(editor.getErrorMessage(), IMessageProvider.ERROR);
                }
                form.getForm().getHead().layout();
                form.getForm().getHead().redraw();
            }
        });
    }
}

From source file:org.eclipse.tm.internal.terminal.provisional.api.AbstractSettingsPage.java

License:Open Source License

/**
 * Updates the control decoration of the given control to represent the given message
 * and message type. If the message is <code>null</code> or the message type is
 * {@link IMessageProvider#NONE} no decoration will be shown.
 *
 * @param control The control. Must not be <code>null</code>.
 * @param message The message.//  w  w  w  . ja  v a 2 s.  com
 * @param messageType The message type.
 */
protected final void updateControlDecoration(Control control, String message, int messageType) {
    Assert.isNotNull(control);

    ControlDecoration controlDecoration = (ControlDecoration) control.getData("controlDecoration"); //$NON-NLS-1$
    if (controlDecoration != null) {
        // The description is the same as the message
        controlDecoration.setDescriptionText(message);

        // The icon depends on the message type
        FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();

        // Determine the id of the decoration to show
        String decorationId = FieldDecorationRegistry.DEC_INFORMATION;
        if (messageType == IMessageProvider.ERROR) {
            decorationId = FieldDecorationRegistry.DEC_ERROR;
        } else if (messageType == IMessageProvider.WARNING) {
            decorationId = FieldDecorationRegistry.DEC_WARNING;
        }

        // Get the field decoration
        FieldDecoration fieldDeco = registry.getFieldDecoration(decorationId);
        if (fieldDeco != null) {
            controlDecoration.setImage(fieldDeco.getImage());
        }

        if (message == null || messageType == IMessageProvider.NONE) {
            controlDecoration.hide();
        } else {
            controlDecoration.show();
        }
    }
}

From source file:org.eclipse.tm.te.tcf.ui.dialogs.AgentSelectionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite top = (Composite) super.createDialogArea(parent);

    setDialogTitle(getDialogTitle());// w  w  w  .j a  v  a2  s.  com
    setTitle(getTitle());
    setDefaultMessage(getDefaultMessage(), IMessageProvider.NONE);

    // Create the table viewer
    viewer = new TableViewer(top, SWT.MULTI | SWT.BORDER);

    // Configure the table
    Table table = viewer.getTable();

    @SuppressWarnings("unused")
    TableColumn column = new TableColumn(table, SWT.LEFT);

    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(new ColumnWeightData(100));
    table.setLayout(tableLayout);

    GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
    table.setLayoutData(layoutData);

    viewer.setContentProvider(new ArrayContentProvider());
    LabelProviderDelegate labelProvider = new LabelProviderDelegate() {
        /* (non-Javadoc)
         * @see org.eclipse.tm.te.tcf.ui.internal.navigator.LabelProviderDelegate#decorateImage(org.eclipse.swt.graphics.Image, java.lang.Object)
         */
        @Override
        public Image decorateImage(Image image, Object element) {
            return image;
        }
    };
    viewer.setLabelProvider(new DecoratingLabelProvider(labelProvider, labelProvider));

    // The content to show is static. Do the filtering manually so that
    // we can disable the OK Button if the dialog would not show any content.
    final ILocatorModelLookupService service = getModel().getService(ILocatorModelLookupService.class);
    final List<IPeerModel> nodes = new ArrayList<IPeerModel>();
    if (service != null) {
        Protocol.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                nodes.addAll(Arrays.asList(service.lkupPeerModelBySupportedServices(null, services)));
            }
        });
    }
    viewer.setInput(nodes.size() > 0 ? nodes.toArray(new IPeerModel[nodes.size()]) : null);

    return top;
}