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:org.eclipse.libra.framework.editor.ui.internal.AbstractBundleEditorPage.java

License:Open Source License

/**
 * Converts an IStatus message type to Form message type. 
 *//* ww w . j  a va  2s.co  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.ImageBuildPage.java

License:Open Source License

private void validate() {
    boolean complete = true;
    boolean error = false;

    String name = nameText.getText();

    if (name.length() > 0 && name.charAt(name.length() - 1) == ':') { //$NON-NLS-1$
        //            && (tag.length() > 0) || tag.contains(":")) { //$NON-NLS-1$
        setErrorMessage(WizardMessages.getString(INVALID_ID));
        error = true;//from  ww w . j av a2s  .c om
    } else {
        if (name.contains(":")) { //$NON-NLS-$
            if (name.substring(name.indexOf(':') + 1).contains(":")) { //$NON-NLS-1$
                setErrorMessage(WizardMessages.getString(INVALID_ID));
                error = true;
            }
        }
    }

    if (!error) {
        String dir = directoryText.getText();
        if (dir.length() == 0) {
            editButton.setEnabled(false);
            complete = false;
        } else {
            IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(dir));
            IFileInfo info = fileStore.fetchInfo();
            if (!info.exists()) {
                error = true;
                setErrorMessage(WizardMessages.getString(NONEXISTENT_DIRECTORY));
            } else if (!info.isDirectory()) {
                error = true;
                setErrorMessage(WizardMessages.getString(INVALID_DIRECTORY));
            } else if (!Files.isReadable(Paths.get(dir))) {
                error = true;
                setErrorMessage(WizardMessages.getString(UNREADABLE_DIRECTORY));
            } else {
                editButton.setEnabled(true);
                IFileStore dockerStore = fileStore.getChild("Dockerfile"); //$NON-NLS-1$
                if (!dockerStore.fetchInfo().exists()) {
                    complete = false;
                    setMessage(WizardMessages.getString(NO_DOCKER_FILE), IMessageProvider.INFORMATION);
                } else {
                    setMessage(null, IMessageProvider.INFORMATION);
                    lastDirectoryPath = dir;
                }

            }
        }
    }

    if (!error) {
        setErrorMessage(null);
    } else {
        editButton.setEnabled(false);
    }

    setPageComplete(complete && !error);
}

From source file:org.eclipse.m2e.editor.pom.MavenPomEditorPage.java

License:Open Source License

private void doLoadData(boolean active) {
    try {// w w w.  j a  v  a 2 s . com
        if (active && !dataLoaded) {
            dataLoaded = true;
            if (getPartControl() != null) {
                getPartControl().getDisplay().asyncExec(new Runnable() {
                    public void run() {
                        try {
                            loadData();
                            updateParentAction();
                        } catch (Throwable e) {
                            LOG.error("Error loading data", e); //$NON-NLS-1$
                        }
                    }
                });
            }

        }

        //error markers have to be always updated..
        IFile pomFile = pomEditor.getPomFile();
        if (pomFile != null) {
            String text = ""; //$NON-NLS-1$
            IMarker[] markers = pomFile.findMarkers(IMavenConstants.MARKER_ID, true, IResource.DEPTH_ZERO);
            IMarker max = null;
            int maxSev = -1;
            if (markers != null) {
                for (IMarker mark : markers) {
                    IMarker toAdd = max;
                    int sev = mark.getAttribute(IMarker.SEVERITY, -1);
                    if (sev > maxSev) {
                        max = mark;
                        maxSev = sev;
                    } else {
                        toAdd = mark;
                    }
                    if (toAdd != null) {
                        //errors get prepended while warnings get appended.
                        if (toAdd.getAttribute(IMarker.SEVERITY, -1) == IMarker.SEVERITY_ERROR) {
                            text = NLS.bind(Messages.MavenPomEditorPage_error_add,
                                    toAdd.getAttribute(IMarker.MESSAGE, "")) + text; //$NON-NLS-2$
                        } else {
                            text = text + NLS.bind(Messages.MavenPomEditorPage_warning_add,
                                    toAdd.getAttribute(IMarker.MESSAGE, "")); //$NON-NLS-2$
                        }
                    }
                }
            }
            if (max != null) {
                String head;
                String maxText = max.getAttribute(IMarker.MESSAGE, Messages.MavenPomEditorPage_error_unknown);
                if (text.length() > 0) {
                    //if we have multiple errors
                    text = NLS.bind(Messages.MavenPomEditorPage_add_desc, maxText, text);
                    if (markers != null) {
                        String number = new Integer(markers.length - 1).toString();
                        head = NLS.bind(Messages.FormUtils_click_for_details2,
                                maxText.length() > FormUtils.MAX_MSG_LENGTH
                                        ? maxText.substring(0, FormUtils.MAX_MSG_LENGTH)
                                        : maxText,
                                number);
                    } else {
                        head = maxText;
                        if (head.length() > FormUtils.MAX_MSG_LENGTH) {
                            head = NLS.bind(Messages.FormUtils_click_for_details,
                                    head.substring(0, FormUtils.MAX_MSG_LENGTH));
                        }
                    }
                } else {
                    //only this one
                    text = maxText;
                    head = maxText;
                    if (head.length() > FormUtils.MAX_MSG_LENGTH) {
                        head = NLS.bind(Messages.FormUtils_click_for_details,
                                head.substring(0, FormUtils.MAX_MSG_LENGTH));
                    }
                }
                int severity;
                switch (max.getAttribute(IMarker.SEVERITY, -1)) {
                case IMarker.SEVERITY_ERROR: {
                    severity = IMessageProvider.ERROR;
                    break;
                }
                case IMarker.SEVERITY_WARNING: {
                    severity = IMessageProvider.WARNING;
                    break;
                }
                case IMarker.SEVERITY_INFO: {
                    severity = IMessageProvider.INFORMATION;
                    break;
                }
                default: {
                    severity = IMessageProvider.NONE;
                }
                }
                setErrorMessageForMarkers(head, text, severity, markers);
            } else {
                setErrorMessageForMarkers(null, null, IMessageProvider.NONE, new IMarker[0]);
            }
        }
    } catch (final CoreException ex) {
        LOG.error(ex.getMessage(), ex);
        final String msg = ex.getMessage();
        setErrorMessageForMarkers(msg, msg, IMessageProvider.ERROR, new IMarker[0]);
    }

}

From source file:org.eclipse.m2e.internal.discovery.wizards.MavenCatalogViewer.java

License:Open Source License

private void handleStatus(final IStatus status) {
    if (status.isOK()) {
        return;//from w ww .  j a v a2  s .  com
    }

    if (shellProvider instanceof WizardPage) {
        shellProvider.getShell().getDisplay().asyncExec(new Runnable() {
            public void run() {
                // Display the error in the wizard header
                int messageType = IMessageProvider.INFORMATION;
                if (status.matches(IStatus.ERROR)) {
                    messageType = IMessageProvider.ERROR;
                } else if (status.matches(IStatus.WARNING)) {
                    messageType = IMessageProvider.WARNING;
                }
                ((WizardPage) shellProvider).setMessage(status.getMessage(), messageType);
                StatusManager.getManager().handle(status);
            }
        });
    } else {
        StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.BLOCK | StatusManager.LOG);
    }
}

From source file:org.eclipse.m2m.atl.adt.ui.wizard.atlplugin.AtlPluginScreen.java

License:Open Source License

private void checkValid() {
    String errorMessage = null;/* w w  w  . j av a  2s .c o  m*/
    String message = null;

    // Check for unset values
    if (initFromFile.getSelection() && (fileText.getText() == null || "".equals(fileText.getText().trim()))) { //$NON-NLS-1$
        message = Messages.getString("AtlPluginScreen.UNSET_FILE"); //$NON-NLS-1$
    } else if (initFromConfig.getSelection()
            && (configChoice.getText() == null || "".equals(configChoice.getText().trim()))) { //$NON-NLS-1$
        message = Messages.getString("AtlPluginScreen.UNSET_CONFIG"); //$NON-NLS-1$

    } else if (runnableData.getTransformationFiles() == null
            || runnableData.getTransformationFiles().length == 0) {
        if (!initFromConfig.getSelection()) {
            errorMessage = Messages.getString("AtlPluginScreen.INVALID_FILE") + fileText.getText(); //$NON-NLS-1$
        } else {
            errorMessage = Messages.getString("AtlPluginScreen.INVALID_CONFIGURATION"); //$NON-NLS-1$
        }
    } else {
        // Check for transformations files validity
        for (IFile file : runnableData.getTransformationFiles()) {
            if (!file.isAccessible()) {
                errorMessage = Messages.getString("AtlPluginScreen.INVALID_FILE") + file.getFullPath(); //$NON-NLS-1$
            }
        }
        if (errorMessage == null) {
            // Check for main transformation validity
            if (!("Module".equals(runnableData.getFileType()) || "Query".equals(runnableData.getFileType()))) { //$NON-NLS-1$ //$NON-NLS-2$
                errorMessage = Messages.getString("AtlPluginScreen.CANNOT_LAUNCH"); //$NON-NLS-1$
            } else {
                List<String> missingLocations = new ArrayList<String>();
                for (Iterator<String> iterator = runnableData.getAllMetamodelsNames().iterator(); iterator
                        .hasNext();) {
                    String name = iterator.next();
                    String location = runnableData.getMetamodelLocations().get(name);
                    if (location == null || "".equals(location.trim())) { //$NON-NLS-1$
                        missingLocations.add(name);
                    }
                }
                for (Iterator<String> iterator = runnableData.getAllLibrariesNames().iterator(); iterator
                        .hasNext();) {
                    String name = iterator.next();
                    String location = runnableData.getLibraryLocations().get(name);
                    if (location == null || "".equals(location.trim())) { //$NON-NLS-1$
                        missingLocations.add(name);
                    } else {
                        IResource resource = ResourcesPlugin.getWorkspace().getRoot()
                                .findMember(new Path(location));
                        if (resource == null || !resource.isAccessible()) {
                            errorMessage = Messages.getString("AtlPluginScreen.UNABLE_TO_ACCESS_LIB") //$NON-NLS-1$
                                    + location;
                        }
                    }
                }
                if (errorMessage == null && !missingLocations.isEmpty()) {
                    message = Messages.getString("AtlPluginScreen.INVALID_LOCATION"); //$NON-NLS-1$
                    for (Iterator<String> iterator = missingLocations.iterator(); iterator.hasNext();) {
                        String string = iterator.next();
                        message += string;
                        if (iterator.hasNext()) {
                            message += ", "; //$NON-NLS-1$
                        }
                    }
                }
            }
        }
    }

    setErrorMessage(errorMessage);
    setMessage(message, IMessageProvider.INFORMATION);
    setPageComplete(message == null && errorMessage == null);
}

From source file:org.eclipse.m2m.internal.qvt.oml.ui.wizards.NewQvtModuleCreationPage.java

License:Open Source License

final protected void updateStatus(IStatus[] result) {
    // select most sever status
    fStatus = Status.OK_STATUS;// w  w w.j  av  a  2s. com
    for (IStatus status : result) {
        if (status.getSeverity() > fStatus.getSeverity()) {
            fStatus = status;
        }
    }

    if (!fStatus.isOK()) {
        int type = IMessageProvider.NONE;
        switch (fStatus.getSeverity()) {
        case IStatus.ERROR:
            type = IMessageProvider.ERROR;
            break;
        case IStatus.WARNING:
            type = IMessageProvider.WARNING;
            break;
        case IStatus.INFO:
            type = IMessageProvider.INFORMATION;
            break;
        }

        setMessage(fStatus.getMessage(), type);
        setPageComplete(isValid());
        setPageComplete(true);

    } else {
        setErrorMessage(null);
        setMessage(null);

        setPageComplete(true);
    }
}

From source file:org.eclipse.m2m.internal.qvt.oml.ui.wizards.project.NewQVTProjectCreationPage.java

License:Open Source License

protected boolean validateQvtSourceContainer() {
    IStatus status = SourceContainerUpdater.validate(getQVTSourceContainerValue());

    if (!status.isOK()) {
        int type = IMessageProvider.NONE;
        switch (status.getSeverity()) {
        case IStatus.INFO:
            type = IMessageProvider.INFORMATION;
            break;
        case IStatus.WARNING:
            type = IMessageProvider.WARNING;
            break;
        case IStatus.ERROR:
            type = IMessageProvider.ERROR;
            break;
        }// w  w  w  . j a  v  a 2  s.  c  o  m

        setMessage(status.getMessage(), type);
        return status.getSeverity() <= IStatus.INFO;
    }

    return true;
}

From source file:org.eclipse.m2m.internal.qvt.oml.ui.wizards.project.Util.java

License:Open Source License

public static int getIMessageProviderSeverity(IStatus status) {
    int type = IMessageProvider.NONE;
    switch (status.getSeverity()) {
    case IStatus.INFO:
        type = IMessageProvider.INFORMATION;
        break;//from w ww .  j a v  a 2s  .c o m
    case IStatus.WARNING:
        type = IMessageProvider.WARNING;
        break;
    case IStatus.ERROR:
        type = IMessageProvider.ERROR;
        break;
    }

    return type;
}

From source file:org.eclipse.mat.ui.internal.acquire.ProviderArgumentsWizardPage.java

License:Open Source License

public void onFocus(String message) {
    if (getErrorMessage() != null)
        setMessage(getErrorMessage(), IMessageProvider.ERROR);
    else if (message != null)
        setMessage(message, IMessageProvider.INFORMATION);
    else/*w w  w.j  a v  a 2s .  co  m*/
        setMessage(table.getProviderDescriptor().getName());
    getContainer().updateButtons();
}

From source file:org.eclipse.mat.ui.internal.acquire.ProviderConfigurationWizardPage.java

License:Open Source License

public void onFocus(String message) {
    if (getErrorMessage() != null)
        setMessage(getErrorMessage(), IMessageProvider.ERROR);
    else if (message != null)
        setMessage(message, IMessageProvider.INFORMATION);
    else/* w ww .java2  s .  c  om*/
        setMessage(table.getProviderDescriptor().getName());
    // Causes recursion from getNextPage();
    //getContainer().updateButtons();
}