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

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

Introduction

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

Prototype

int ERROR

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

Click Source Link

Document

Constant for an error message (value 3).

Usage

From source file:org.eclipse.jubula.client.ui.rcp.dialogs.AUTPropertiesDialog.java

License:Open Source License

/** 
 * The action of the AUT toolkit combo box.
 * @return false, if the AUT toolkit combo box contains an error:
 *                the selection is empty
 *//*from  w  ww . j a  va 2  s . c o m*/
private boolean modifyAUTToolkitComboAction() {
    String selection = m_autToolKitComboBox.getSelectedObject();
    if (selection == null || selection.trim().length() == 0) {
        setMessage(Messages.AUTPropertiesDialogNoToolkitSelected, IMessageProvider.ERROR);
        return true;
    }
    return false;
}

From source file:org.eclipse.jubula.client.ui.rcp.dialogs.AUTPropertiesDialog.java

License:Open Source License

/**
 * @return false if there is no mistake else true
 *///from   w w w.java  2s .com
private boolean modifyAUTPropertiesAction() {
    Iterator<AutProperty> props = m_viewModel.iterator();

    while (props.hasNext()) {
        AutProperty prop = props.next();
        if (StringUtils.isEmpty(prop.getName())) {
            setMessage(Messages.AUTPropertyNameIsEmpty, IMessageProvider.ERROR);
            return true;
        }
        if (StringUtils.isEmpty(prop.getValue())) {
            setMessage(Messages.AUTPropertyValueIsEmpty, IMessageProvider.ERROR);
            return true;
        }
        if (isAUTContainsDuplicatePropertyName(prop)) {
            setMessage(Messages.AUTPropertyDuplicated, IMessageProvider.ERROR);
            return true;
        }
    }
    return false;
}

From source file:org.eclipse.jubula.client.ui.rcp.widgets.autconfig.AutConfigComponent.java

License:Open Source License

/**
 * Notifies the DialogStatusListenerManager about the text input state
 * @param message The message for the new status.
 * @return the new status parameter.// ww  w.ja  va2s.  c  om
 */
protected DialogStatusParameter createErrorStatus(String message) {
    DialogStatusParameter param = new DialogStatusParameter();
    param.setButtonState(false);
    param.setStatusType(IMessageProvider.ERROR);
    param.setMessage(message);
    return param;
}

From source file:org.eclipse.jubula.client.ui.rcp.widgets.autconfig.AutConfigComponent.java

License:Open Source License

/**
 * Checks validity of all fields./*  www.j a v a  2s  .  c  o m*/
 */
public final void checkAll() {
    checkAll(m_paramList);
    if (m_paramList.isEmpty()) {
        setIsValid(true);
    } else {
        boolean isValid = true;
        for (DialogStatusParameter entry : m_paramList) {
            if (entry.getStatusType() == IMessageProvider.ERROR) {
                isValid = false;
                break;
            }
        }
        if (isValid) {
            setIsValid(false);
        } else {
            fireError();
        }
    }
    m_paramList.clear();
}

From source file:org.eclipse.jubula.client.ui.rcp.wizards.pages.AUTSettingWizardPage.java

License:Open Source License

/**
 * The action for the toolkit combo box.
 * @return <code>true</code> if the input for the toolkit combo box is
 *         valid. Otherwise, <code>false</code>.
 *//*from w  ww  .ja  v  a2  s.c om*/
private boolean modifyAutToolkitComboAction() {
    boolean isToolkitSelected = m_autToolKitComboBox.getSelectedObject() != null;

    if (isToolkitSelected) {
        String oldToolkit = m_autMain.getToolkit();
        m_autMain.setToolkit(m_autToolKitComboBox.getSelectedObject());
        checkToolkit(getShell(), m_autMain, oldToolkit);
    } else {
        setMessage(Messages.ProjectWizardNoToolkitSelected, IMessageProvider.ERROR);

    }

    return isToolkitSelected;
}

From source file:org.eclipse.jubula.client.ui.rcp.wizards.pages.AUTSettingWizardPage.java

License:Open Source License

/** 
 * The action of the AUT name field.//from w ww . j ava2  s .c  o  m
 * @return false, if the AUT name field contents an error:
 * the AUT name starts or end with a blank, or the field is empty
 */
private boolean modifyAUTNameFieldAction() {
    boolean isError = false;
    int autNameLength = m_autNameText.getText().length();
    if ((autNameLength == 0) || (m_autNameText.getText().startsWith(" ")) //$NON-NLS-1$
            || (m_autNameText.getText().charAt(autNameLength - 1) == ' ')) {

        isError = true;
    }
    if (isError) {
        if (autNameLength == 0) {
            setMessage(Messages.AUTSettingWizardPageEmptyAUTName, IMessageProvider.ERROR);
            setPageComplete(false);
        } else {
            setMessage(Messages.ProjectWizardNotValidAUT, IMessageProvider.ERROR);
            setPageComplete(false);
        }
    }
    return !isError;
}

From source file:org.eclipse.jubula.client.ui.rcp.wizards.pages.ProjectSettingWizardPage.java

License:Open Source License

/**
 * @param errorMessage the error message
 *//*from   www.  ja  v  a 2  s . c o m*/
private void errorMessage(String errorMessage) {
    if (errorMessage == null || errorMessage.isEmpty()) {
        return;
    }
    setMessage(errorMessage, IMessageProvider.ERROR);
}

From source file:org.eclipse.libra.framework.editor.ui.internal.AbstractBundleEditorPage.java

License:Open Source License

/**
 * Converts an IStatus message type to Form message type. 
 *//*from   www . j a v  a2  s.c o m*/
private int getMessageType(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:org.eclipse.linuxtools.internal.docker.ui.wizards.ImageRunSelectionPage.java

License:Open Source License

private void setStatusMessage(final Object containerstatus) {
    if (containerstatus instanceof ValidationStatus) {
        final ValidationStatus validationStatus = (ValidationStatus) containerstatus;
        if (validationStatus.getSeverity() == IStatus.ERROR) {
            setMessage(validationStatus.getMessage(), IMessageProvider.ERROR);
        } else if (validationStatus.getSeverity() == IStatus.WARNING) {
            setMessage(validationStatus.getMessage(), IMessageProvider.WARNING);
        }/*from  w  w w . j  ava  2 s .  c  o m*/
    } else if (containerstatus instanceof IStatus) {
        final IStatus status = (IStatus) containerstatus;
        if (status.getSeverity() == IStatus.ERROR) {
            setMessage(status.getMessage(), IMessageProvider.ERROR);
        } else if (status != null && status.getSeverity() == IStatus.WARNING) {
            setMessage(status.getMessage(), IMessageProvider.WARNING);
        }

    }
}

From source file:org.eclipse.linuxtools.internal.gprof.launch.GprofNoGmonDialog.java

License:Open Source License

/**
 * <h1>Construct a new dialogue for missing gprof file. </h1>
 * <p>/*from  ww w . java2 s.com*/
 * Prompt the user to browse workspace or file system if gprof file is not found. <br>
 * Note, this should be instantiated inside a UI thread.
 * </p>
 *
 * @param project The IProject that the user will browse if file is missing.
 * @param shell   the shell on top of which this dialogue will show.
 */
public GprofNoGmonDialog(IProject project, Shell shell) {

    // Missing gmon.out logic:
    //      This point is reached if pg flags were not set. (e.g in an unmanaged makefile project.)
    //      or PG flag was set but gmon.out could not be found.

    // Construct Dialog for user.
    // Declare a list for the buttons.
    List<Entry<String, String>> buttonList = new ArrayList<>();

    // Add buttons:
    buttonList.add(new SimpleEntry<>("browseWorkSpace", GprofLaunchMessages.GprofNoGmonOut_BrowseWorkSpace)); //$NON-NLS-1$
    buttonList.add(new SimpleEntry<>("browseFileSystem", GprofLaunchMessages.GprofNoGmonOut_BrowseFileSystem)); //$NON-NLS-1$
    buttonList.add(new SimpleEntry<>("cancleLaunch", GprofLaunchMessages.GprofNoGmonOut_CancleLaunch)); //$NON-NLS-1$

    // Set Dialogue options.
    String title = GprofLaunchMessages.GprofNoGmonOut_title;
    String body = GprofLaunchMessages.GprofNoGmonOut_body;
    int msgType = IMessageProvider.ERROR;

    // Instantiate & open the dialogue.
    TitleAreaDialogWithRadioButtons gmonMissingDialog = new TitleAreaDialogWithRadioButtons(shell, title, body,
            buttonList, msgType);
    int retVal = gmonMissingDialog.open();

    // Handle user's selection. (OK/ Cancle)
    switch (retVal) {
    case Window.OK:
        // Handle which button the user selected.
        switch (gmonMissingDialog.getSelectedButton()) {
        case "browseWorkSpace": //$NON-NLS-1$
            gmonExpected = browseWorkspaceHandler(shell, project);
            break;
        case "browseFileSystem": //$NON-NLS-1$
            gmonExpected = browseFileSystemHandler(shell, project);
            //gmonExpected = browseFileSystemHandler(parent);
            break;
        default: // this can happen if the user pressed escape.
            gmonExpected = null;
            return;
        }

    case Window.CANCEL:
        return; // Launch cancled if user clicked Cancle.
    default:
        return; // if somethign broke with the dialogue (manual kill, cancle launch).
    }
}