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.tcf.launch.ui.filetransfer.AddEditFileTransferDialog.java

License:Open Source License

protected void validate() {
    IFileTransferItem wc = new FileTransferItem();
    saveWidgetValues(wc);/*from   w  w  w. j a v a  2s .com*/
    Map<String, String> invalid = FileTransferItemValidator.validate(wc);
    boolean valid = true;

    if (invalid != null && invalid.containsKey(IFileTransferItem.PROPERTY_HOST)) {
        host.updateControlDecoration(invalid.get(IFileTransferItem.PROPERTY_HOST), IMessageProvider.ERROR);
        if (valid) {
            setErrorMessage(invalid.get(IFileTransferItem.PROPERTY_HOST));
        }
        valid = false;
    } else {
        host.updateControlDecoration(null, IMessageProvider.NONE);
    }

    if (invalid != null && invalid.containsKey(IFileTransferItem.PROPERTY_TARGET_STRING)) {
        target.updateControlDecoration(invalid.get(IFileTransferItem.PROPERTY_TARGET_STRING),
                IMessageProvider.ERROR);
        if (valid) {
            setErrorMessage(invalid.get(IFileTransferItem.PROPERTY_TARGET_STRING));
        }
        valid = false;
    } else {
        target.updateControlDecoration(null, IMessageProvider.NONE);
    }

    if (valid) {
        setErrorMessage(null);
    }

    getButton(IDialogConstants.OK_ID).setEnabled(valid);
}

From source file:org.eclipse.tcf.te.tcf.launch.ui.remote.app.LaunchConfigurationMainTabSection.java

License:Open Source License

@Override
public boolean isValid(ILaunchConfiguration configuration) {
    firstSelection = null;/* w ww .ja  v  a  2s  . c  om*/
    IModelNode[] contexts = LaunchContextsPersistenceDelegate.getLaunchContexts(configuration);
    if (contexts != null && contexts.length > 0) {
        firstSelection = contexts[0];
    }
    processImage.getButtonControl().setEnabled(firstSelection != null);

    if (processImage.getEditFieldControlText().trim().length() > 0) {
        setMessage(null, IMessageProvider.NONE);
    } else {
        setMessage(Messages.LaunchConfigurationMainTabSection_error_missingProcessImage,
                IMessageProvider.ERROR);
    }
    processImage.updateControlDecoration(getMessage(), getMessageType());

    return processImage.getEditFieldControlText().trim().length() > 0;
}

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

License:Open Source License

@Override
protected void createDialogAreaContent(Composite parent) {
    super.createDialogAreaContent(parent);

    setDialogTitle(getDialogTitle());//from ww  w  . ja va 2 s  .  c  om
    setTitle(getTitle());
    setDefaultMessage(getDefaultMessage(), IMessageProvider.NONE);

    Composite comp = new Composite(parent, SWT.NONE);
    GridLayout gl = new GridLayout(2, false);
    gl.marginWidth = 0;
    gl.marginHeight = 0;
    comp.setLayout(gl);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    comp.setLayoutData(gd);

    createTableAreaContent(comp);
    createButtonAreaContent(comp);
}

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

License:Open Source License

@Override
protected void createDialogAreaContent(Composite parent) {
    super.createDialogAreaContent(parent);

    setDialogTitle(getDialogTitle());/*from  www .j a  v  a2  s  .c o  m*/
    setTitle(getTitle());
    setDefaultMessage(getDefaultMessage(), IMessageProvider.NONE);

    Composite comp = new Composite(parent, SWT.NONE);
    GridLayout gl = new GridLayout(2, false);
    gl.marginWidth = 0;
    gl.marginHeight = 0;
    comp.setLayout(gl);
    GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
    comp.setLayoutData(layoutData);

    createTreeAreaContent(comp);
    createButtonAreaContent(comp);
}

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

License:Open Source License

/**
 * Updates the control decoration to represent the given message and message type.
 * If the message is <code>null</code> or the message type is IMessageProvider.NONE,
 * no decoration will be shown./*w  w w .  j av a  2s .c  o  m*/
 *
 * @param message The message.
 * @param messageType The message type.
 */
public void updateControlDecoration(String message, int messageType) {
    if (getControlDecoration() != null) {
        // The description is the same as the message
        getControlDecoration().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) {
            getControlDecoration().setImage(fieldDeco.getImage());
        }

        if (message == null || messageType == IMessageProvider.NONE) {
            if (!hasContentAssist()) {
                getControlDecoration().hide();
            } else {
                fieldDeco = registry.getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
                if (fieldDeco != null) {
                    getControlDecoration().setDescriptionText(
                            Messages.AbstractDecoratedDialogPageControl_contentAssist_message);
                    getControlDecoration().setImage(fieldDeco.getImage());
                    getControlDecoration().show();
                }
            }
        } else {
            getControlDecoration().show();
        }
    }
}

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

License:Open Source License

@Override
public boolean isValid() {
    setMessage(null, IMessageProvider.NONE);
    return true;
}

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

License:Open Source License

@Override
public boolean isValid() {
    if (isInitializing) {
        return true;
    }/*from   w  ww  .  j  av a2  s .  c  om*/
    boolean valid = internalIsValid();

    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.controls.net.RemoteHostAddressControl.java

License:Open Source License

@Override
protected void onButtonControlSelected() {
    onCheckAddress();/*ww  w .  j  a v  a2  s  .  co m*/
    getButtonControl().setEnabled(false);
    // Reset the validation message.
    if (getMessage() != null && getMessage().equals(getUserInformationTextCheckNameAddress())) {
        setMessage(null, IMessageProvider.NONE);
    }
    if (getControlDecoration() != null) {
        getControlDecoration().hide();
    }
}

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

License:Open Source License

@Override
protected void createDialogAreaContent(Composite parent) {
    super.createDialogAreaContent(parent);

    setDialogTitle(dialogTitle);/*from w  ww.  j av a  2s .  c om*/
    setTitle(title);
    setDefaultMessage(message, IMessageProvider.NONE);

    Composite panel = new Composite(parent, SWT.NONE);
    panel.setLayout(new GridLayout(2, false));
    panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    Label label = new Label(panel, SWT.NONE);
    label.setText(fieldLabels[0]);

    nameText = new Text(panel, SWT.BORDER | SWT.SINGLE);
    nameText.setText(initialValues[0]);
    GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    layoutData.widthHint = 300;
    nameText.setLayoutData(layoutData);
    nameText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            updateButtons();
        }
    });

    label = new Label(panel, SWT.NONE);
    label.setText(fieldLabels[1]);

    valueText = new Text(panel, SWT.BORDER | SWT.SINGLE);
    valueText.setText(initialValues[1]);
    layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.widthHint = 300;
    valueText.setLayoutData(layoutData);
    valueText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            updateButtons();
        }
    });

    applyDialogFont(panel);
}

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

License:Open Source License

/**
 * Enable the OK button if valid input//from w w w  .j  a v  a  2s . c  om
 */
protected void updateButtons() {
    String name = SWTControlUtil.getText(nameText).trim();
    String value = SWTControlUtil.getText(valueText).trim();

    if (name.trim().length() == 0) {
        setMessage(getErrorMissingName(), IMessageProvider.INFORMATION);
    } else if (usedNames.contains(name.trim())) {
        setMessage(NLS.bind(getErrorUsedOrIllegalName(), name), IMessageProvider.ERROR);
    } else if (value.trim().length() == 0) {
        setMessage(NLS.bind(getErrorMissingValue(), name), IMessageProvider.INFORMATION);
    } else {
        setMessage(message, IMessageProvider.NONE);
    }
    getButton(IDialogConstants.OK_ID).setEnabled(getMessageType() == IMessageProvider.NONE);
}