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.pdtextensions.server.ui.internal.lhttpd.LHttpdRuntimeComposite.java

License:Open Source License

protected void validate() {
    if (runtime == null) {
        wizard.setMessage("", IMessageProvider.ERROR); //$NON-NLS-1$
        return;/*from   w  w  w  .  j  av  a 2s .  c o  m*/
    }

    IStatus status = runtimeWC.validate(null);
    if (status == null || status.isOK())
        wizard.setMessage(null, IMessageProvider.NONE);
    else if (status.getSeverity() == IStatus.WARNING)
        wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
    else
        wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
    wizard.update();
}

From source file:org.raspinloop.fmi.plugin.preferences.extension.AbstractHWConfigPage.java

License:Open Source License

/**
 * Updates the status message on the page, based on the status of the RIL Hardware and other
 * status provided by the page.//  ww w  .  j  a  va2s .c o m
 */
protected void updatePageStatus() {
    IStatus max = Status.OK_STATUS;
    IStatus[] hwStatus = getHWStatus();
    for (int i = 0; i < hwStatus.length; i++) {
        IStatus status = hwStatus[i];
        if (status.getSeverity() > max.getSeverity()) {
            max = status;
        }
    }
    if (fNameStatus.getSeverity() > max.getSeverity()) {
        max = fNameStatus;
    }
    if (max.isOK()) {
        setMessage(null, IMessageProvider.NONE);
    } else {
        setStatusMessage(max);
    }
    setPageComplete(max.isOK() || max.getSeverity() == IStatus.INFO);
}

From source file:org.sonar.ide.eclipse.ui.internal.wizards.associate.ConfigureProjectsPage.java

License:Open Source License

private void scheduleAutomaticAssociation() {
    getShell().addShellListener(new ShellAdapter() {
        @Override/* ww w  . j a  v a 2  s . c  o  m*/
        public void shellActivated(ShellEvent shellevent) {
            if (!alreadyRun) {
                alreadyRun = true;
                try {
                    if (sonarServers.isEmpty()) {
                        setMessage("Please configure a SonarQube server first", IMessageProvider.ERROR);
                    } else {
                        setMessage("", IMessageProvider.NONE);
                        getWizard().getContainer().run(true, false,
                                new AssociateProjects(sonarServers, getProjects()));
                    }
                } catch (InvocationTargetException ex) {
                    LOG.error(ex.getMessage(), ex);
                    if (ex.getTargetException() instanceof ConnectionException) {
                        setMessage(
                                "One of your SonarQube server cannot be reached. Please check your connection settings.",
                                IMessageProvider.ERROR);
                    } else {
                        setMessage("Error: " + ex.getMessage(), IMessageProvider.ERROR);
                    }
                } catch (Exception ex) {
                    LOG.error(ex.getMessage(), ex);
                    setMessage("Error: " + ex.getMessage(), IMessageProvider.ERROR);
                }
            }
        }
    });
}

From source file:org.sonar.ide.eclipse.ui.internal.wizards.associate.SonarSearchEngineProvider.java

License:Open Source License

public IContentProposal[] getProposals(String contents, int position) {
    List<IContentProposal> list = new ArrayList<IContentProposal>();
    for (ISonarServer sonarServer : sonarServers) {
        List<ISonarRemoteModule> remoteModules = WSClientFactory.getSonarClient(sonarServer)
                .searchRemoteModules(contents);
        for (ISonarRemoteModule resource : remoteModules) {
            RemoteSonarProject prj = new RemoteSonarProject(sonarServer.getUrl(), resource.getKey(),
                    resource.getName());
            list.add(new ContentProposal(prj.asString(), resource.getName(), prj.getDescription()));
        }//from w  w w . j  a va2s  .  c o  m
    }
    if (!list.isEmpty()) {
        parentPage.setMessage("", IMessageProvider.NONE);
        return list.toArray(new IContentProposal[list.size()]);
    } else {
        parentPage.setMessage("No result", IMessageProvider.INFORMATION);
        return new IContentProposal[0];
    }
}

From source file:org.sonarlint.eclipse.ui.internal.bind.SearchEngineProvider.java

License:Open Source License

@Override
public IContentProposal[] getProposals(String contents, int position) {
    if (!server.isUpdated()) {
        parentPage.setMessage("Please update server first", IMessageProvider.INFORMATION);
        return new IContentProposal[0];
    }/*from w  w  w .  j a  v a  2  s .c om*/
    List<IContentProposal> list = new ArrayList<>();
    try {
        List<RemoteModule> modules = getModuleIndex().search(contents);
        for (RemoteModule m : modules) {
            RemoteSonarProject prj = new RemoteSonarProject(server.getId(), m.getKey(), m.getName());
            list.add(new ContentProposal(prj.asString(), m.getName(), prj.getDescription()));
        }
    } catch (Exception e) {
        SonarLintCorePlugin.getDefault().debug("Unable to search modules from server " + server.getId(), e);
    }
    if (!list.isEmpty()) {
        parentPage.setMessage("", IMessageProvider.NONE);
        return list.toArray(new IContentProposal[list.size()]);
    } else {
        parentPage.setMessage("No results", IMessageProvider.INFORMATION);
        return new IContentProposal[0];
    }
}

From source file:org.sonarlint.eclipse.ui.internal.server.wizard.OrganizationProvider.java

License:Open Source License

@Override
public IContentProposal[] getProposals(String contents, int position) {
    List<IContentProposal> list = new ArrayList<>();
    TextSearchIndex<RemoteOrganization> organizationsIndex = model.getOrganizationsIndex();
    Map<RemoteOrganization, Double> filtered = organizationsIndex != null ? organizationsIndex.search(contents)
            : Collections.emptyMap();
    if (filtered.isEmpty()) {
        parentPage.setMessage("No results", IMessageProvider.INFORMATION);
    } else {/*w  ww .j av a2  s  .c  om*/
        parentPage.setMessage("", IMessageProvider.NONE);
    }
    List<Map.Entry<RemoteOrganization, Double>> entries = new ArrayList<>(filtered.entrySet());
    entries.sort(Comparator.comparing(Map.Entry<RemoteOrganization, Double>::getValue).reversed()
            .thenComparing(Comparator.comparing(e -> e.getKey().getName(), String.CASE_INSENSITIVE_ORDER)));
    for (Map.Entry<RemoteOrganization, Double> e : entries) {
        list.add(new ContentProposal(e.getKey().getKey(), e.getKey().getName(), toDescription(e.getKey())));
    }
    return list.toArray(new IContentProposal[list.size()]);
}

From source file:org.springframework.ide.eclipse.config.ui.editors.SpringConfigGraphPage.java

License:Open Source License

protected void updateHeader() {
    if (sform != null && !sform.isDisposed() && editor != null) {
        mform.reflow(true);/*from   ww  w  . j av a 2s.c  o  m*/
        if (editor.isDirty()) {
            sform.setMessage(Messages.getString("SpringConfigGraphPage.DIRTY_INFO"), //$NON-NLS-1$
                    IMessageProvider.INFORMATION);
        } else {
            sform.setMessage(null, IMessageProvider.NONE);
        }
    }
}

From source file:org.springframework.ide.eclipse.config.ui.editors.SpringConfigHeaderMessage.java

License:Open Source License

public void updateMessage() {
    if (cEditor != null && cEditor.getResourceFile() != null && cEditor.getResourceFile().exists()) {
        try {// w w w .  j ava 2s. c  o  m
            IResource resource = cEditor.getResourceFile();
            IMarker[] markers = resource.findMarkers(SpringCore.MARKER_ID, true, IResource.DEPTH_ONE);
            message = null;
            messageType = IMessageProvider.NONE;

            if (markers.length > 0) {
                int errorCount = 0;
                int warningCount = 0;
                int infoCount = 0;
                for (IMarker marker : markers) {
                    Object attr = marker.getAttribute(IMarker.SEVERITY);
                    if (attr instanceof Integer) {
                        Integer severity = (Integer) attr;
                        if (severity == IMarker.SEVERITY_ERROR) {
                            errorCount++;
                        } else if (severity == IMarker.SEVERITY_WARNING) {
                            warningCount++;
                        } else if (severity == IMarker.SEVERITY_INFO) {
                            infoCount++;
                        }
                    }
                }

                String errorMessage = ""; //$NON-NLS-1$
                String warnMessage = ""; //$NON-NLS-1$
                String infoMessage = ""; //$NON-NLS-1$
                String errorSingular = Messages.getString("AbstractConfigFormPage.ERROR_SINGULAR"); //$NON-NLS-1$
                String errorPlural = Messages.getString("AbstractConfigFormPage.ERROR_PLURAL"); //$NON-NLS-1$
                String warningSingular = Messages.getString("AbstractConfigFormPage.WARNING_SINGULAR"); //$NON-NLS-1$
                String warningPlural = Messages.getString("AbstractConfigFormPage.WARNING_PLURAL"); //$NON-NLS-1$
                String infoSingular = Messages.getString("AbstractConfigFormPage.INFO_SINGULAR"); //$NON-NLS-1$
                String infoPlural = Messages.getString("AbstractConfigFormPage.INFO_PLURAL"); //$NON-NLS-1$

                if (infoCount > 0) {
                    messageType = IMessageProvider.INFORMATION;
                    if (infoCount > 1) {
                        infoMessage = infoCount + " " + infoPlural; //$NON-NLS-1$
                    } else {
                        infoMessage = infoCount + " " + infoSingular; //$NON-NLS-1$
                    }
                }
                if (warningCount > 0) {
                    messageType = IMessageProvider.WARNING;
                    if (warningCount > 1) {
                        warnMessage = warningCount + " " + warningPlural; //$NON-NLS-1$
                    } else {
                        warnMessage = warningCount + " " + warningSingular; //$NON-NLS-1$
                    }
                    if (infoCount > 0) {
                        warnMessage += ", "; //$NON-NLS-1$
                    }
                }
                if (errorCount > 0) {
                    messageType = IMessageProvider.ERROR;
                    if (errorCount > 1) {
                        errorMessage = errorCount + " " + errorPlural; //$NON-NLS-1$
                    } else {
                        errorMessage = errorCount + " " + errorSingular; //$NON-NLS-1$
                    }
                    if (warningCount > 0 || infoCount > 0) {
                        errorMessage += ", "; //$NON-NLS-1$
                    }
                }
                message = errorMessage + warnMessage + infoMessage;
            }
        } catch (CoreException e) {
            StatusHandler.log(new Status(IStatus.ERROR, ConfigUiPlugin.PLUGIN_ID,
                    Messages.getString("AbstractConfigFormPage.ERROR_UPDATING_PAGE_HEADER"), e)); //$NON-NLS-1$
        }
    }
}

From source file:org.springsource.ide.eclipse.commons.livexp.core.ValidationResult.java

License:Open Source License

/**
 * Convert the status code of this validation results into an IMessageProvider status code.
 *//*from  w  ww. j  a  v  a2 s  . c  o m*/
public int getMessageProviderStatus() {
    switch (status) {
    case IStatus.OK:
        return IMessageProvider.NONE;
    case IStatus.CANCEL:
        //There's no corresponding statis in IMessageProvider. Treat cancelation like an error.
        return IMessageProvider.ERROR;
    case IStatus.ERROR:
        return IMessageProvider.ERROR;
    case IStatus.INFO:
        return IMessageProvider.INFORMATION;
    case IStatus.WARNING:
        return IMessageProvider.WARNING;
    default:
        //Shouldn't happen since all cases should be covered above... byt anyhow
        return IMessageProvider.ERROR;
    }
}

From source file:org.springsource.ide.eclipse.commons.livexp.ui.DialogWithSections.java

License:Open Source License

private void updateStatus(ValidationResult status) {
    boolean enableOk = true;
    if (status == null || status.isOk()) {
        setMessage("", IMessageProvider.NONE);
    } else {//from   w w w.jav  a  2  s .com
        setMessage(status.msg, status.getMessageProviderStatus());
        enableOk = status.status < disableOkButtonLevel;
    }
    Button okButton = getButton(IDialogConstants.OK_ID);
    if (okButton != null) {
        okButton.setEnabled(enableOk);
    }
}