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:com.sonatype.buildserver.eclipse.ui.job.view.SummaryPage.java

License:Open Source License

public void setJob(HudsonJob job) {
    this.job = job;
    if (!initialized) {
        return;/*  www  .j a v a2  s  .co m*/
    }
    form.setText(job.getJobName());
    form.getForm().setMessage(null, IMessageProvider.NONE);
    form.setImage(HudsonImages.getHealthImage(job));

    if (tableViewer.getInput() == null) {
        tableViewer.setInput(job);
    }

    lnkJobName.setText(NLS.bind(Messages.SummaryPage_job_link, job.getJobName()));

    lnkServerLocation.setText(NLS.bind(Messages.SummaryPage_build_on, job.getServerName()));
    lnkServerLocation.setToolTipText(NLS.bind(Messages.SummaryPage_build_on_tooltip, job.getServerName()));
    ProjectDTO details = job.getJobDetails();
    if (details != null && !(details instanceof ErrorJob)) {
        if (details.isQueued()) {
            form.setText(job.getJobName() + " [New build queued]");
        }

        markAsVisible(lblEnable, true);
        lblEnable.setText(details.isEnabled() ? Messages.SummaryPage_enabled : Messages.SummaryPage_disabled);
        if (details.isBlocked()) {
            lblBlocked.setText(Messages.SummaryPage_blocked + details.getBlockedReason() + "\" "); //$NON-NLS-2$
            markAsVisible(lblBlocked, true);
        } else {
            markAsVisible(lblBlocked, false);
        }
        markAsVisible(lblType, true);
        lblType.setText(getTypeStrings(details));
        form.setToolTipText(details.getHealth().getDescription());
        lnkJobName.setToolTipText(NLS.bind(Messages.SummaryPage_job_tooltip, details.getUrl()));
        String desc = details.getDescription();
        if (desc == null || desc.trim().length() == 0) {
            desc = Messages.SummaryPage_no_description;
        }
        markAsVisible(txtDescription, true);
        txtDescription.setText(HudsonUtils.stripHtml(desc));
        // only force last build if no build is selected in table,
        // useful on refreshes/updates when user has some context selected
        if (tableViewer.getSelection().isEmpty()) {
            setBuild(details.getLastBuild());
        }
        if (HudsonUtils.isMatrixType(details)) {
            markAsVisible(sctnConfigurations, true);
            loadConfigurations();
            composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
            txtDescription.setLayoutData(createTxtDescriptionData(2));
        } else {
            markAsVisible(sctnConfigurations, false);
            composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1));
            txtDescription.setLayoutData(createTxtDescriptionData(3));
        }
        if (HudsonUtils.isMatrixConfig(details)) {
            markAsVisible(mghprlnkParent, true);
        } else {
            markAsVisible(mghprlnkParent, false);
        }

        // System.out.println("type=" + details.getType());
        // System.out.println("job name=" + details.getLastBuild().getJobName());
        // System.out.println("id=" + details.getLastBuild().getId());
        // System.out.println("url=" + details.getLastBuild().getUrl());
        //
        //
    } else {
        if (details instanceof ErrorJob) {
            ErrorJob ej = (ErrorJob) details;
            form.getForm().setMessage(ej.getErrorMessage(), IMessageProvider.ERROR);
        }
        markAsVisible(lblType, false);
        markAsVisible(lblBlocked, false);
        markAsVisible(lblEnable, false);
        markAsVisible(txtDescription, false);
        markAsVisible(sctnConfigurations, false);
        markAsVisible(mghprlnkParent, false);
        setBuild(null);
    }
    compJob.layout();
}

From source file:com.temenos.interaction.rimdsl.visualisation.views.TransitionForm.java

License:Open Source License

/**
 * Creates the header region of the form, with the search dialog, background
 * and title.  It also sets up the error reporting
 * @param form/* w  w  w . j a  v a 2 s .  c  o m*/
 */

String createFormTextContent(IMessage[] messages) {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    pw.println("<form>");
    for (int i = 0; i < messages.length; i++) {
        IMessage message = messages[i];
        pw.print("<li vspace=\"false\" style=\"image\" indent=\"16\" value=\"");
        switch (message.getMessageType()) {
        case IMessageProvider.ERROR:
            pw.print("error");
            break;
        case IMessageProvider.WARNING:
            pw.print("warning");
            break;
        case IMessageProvider.INFORMATION:
            pw.print("info");
            break;
        }
        pw.print("\"> <a href=\"");
        pw.print(i + "");
        pw.print("\">");
        if (message.getPrefix() != null) {
            pw.print(message.getPrefix());
        }
        pw.print(message.getMessage());
        pw.println("</a></li>");
    }
    pw.println("</form>");
    pw.flush();
    return sw.toString();
}

From source file:com.versant.core.jdo.tools.eclipse.VOAConfigComposite.java

License:Open Source License

private void validateProject() {
    String projectPath = pc.getProjectFilePath();
    if (projectPath == null || projectPath.length() == 0) {
        setMessage("Please select a VOA Project file.", IMessageProvider.ERROR);
        return;//from  w w w . ja  va 2  s.  com
    }
    File file = new File(projectPath);
    String cPath = projectPath;
    try {
        cPath = file.getCanonicalPath();
    } catch (IOException e1) {
        cPath = file.getAbsolutePath();
    }
    if (!file.getAbsolutePath().equals(projectPath)) {
        file = new java.io.File(project.getLocation().toFile(), projectPath);
    }
    try {
        cPath = file.getCanonicalPath();
    } catch (IOException e1) {
        cPath = file.getAbsolutePath();
    }
    projectPath = cPath;
    pc.setProjectFilePath(projectPath);
    if (file != null && file.isDirectory()) {
        setMessage(projectPath + " is not a valid file.", IMessageProvider.ERROR);
        return;
    }
    if (file != null && file.exists() && !file.canWrite()) {
        setMessage("Project must be writable", IMessageProvider.ERROR);
        return;
    }
    boolean createFile = file == null || !file.exists();
    if (createFile) {
        File source = null;
        try {
            source = Utils.getSrcFile(project);
        } catch (JavaModelException e) {
            source = project.getLocation().toFile();
        }
        String jdoPathStr = source.getName() + "/" + project.getName() + ".jdo";
        setMessage("Create Project file: " + file + "\nand .jdo file: " + jdoPathStr, IMessageProvider.WARNING);
    } else {
        setMessage("Project file found", IMessageProvider.INFORMATION);
        Properties props = new Properties();
        InputStream in = null;
        try {
            in = new FileInputStream(file);
            props.load(in);
        } catch (Exception e) {
            e.printStackTrace();
            try {
                in.close();
            } catch (Exception x) {
            }
        }
        if (!props.containsKey("javax.jdo.option.ConnectionURL")) {
            setMessage("Project file(" + file.getName()
                    + ") is not valid.\nIt does not contain the property:javax.jdo.option.ConnectionURL",
                    IMessageProvider.ERROR);
            return;
        }
    }
}

From source file:com.versant.core.jdo.tools.eclipse.VOAConfigComposite.java

License:Open Source License

private void setMessage(String string, int type) {
    valid = type != IMessageProvider.ERROR;
    dialogPage.setMessage(string, type);
}

From source file:com.vmware.vfabric.ide.eclipse.tcserver.internal.ui.TcServer20WizardFragment.java

License:Open Source License

protected void validate() {
    if (wc == null) {
        wizard.setMessage("", IMessageProvider.ERROR);
        return;/*w  w  w  .j a v a2 s  .  com*/
    }

    IStatus status = doValidate();
    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:com.vmware.vfabric.ide.eclipse.tcserver.internal.ui.TcServer21InstanceCreationFragment.java

License:Open Source License

protected void validate() {
    if (nameText.getText().trim().length() == 0) {
        wizardHandle.setMessage(TcServerInstanceConfiguratorPage.ENTER_NAME, IMessageProvider.NONE);
    } else if (!isDefaultLocationSelected() && !isValidLocation(locationPathField.getText())) {
        wizardHandle.setMessage(LOCATION_DOES_NOT_EXIST_MESSAGE, IMessageProvider.ERROR);
    } else if (instanceExists()) {
        wizardHandle.setMessage(TcServerInstanceConfiguratorPage.INSTANCE_EXISTS, IMessageProvider.ERROR);
    } else if (hasInvalidCharacters(nameText.getText())) {
        wizardHandle.setMessage(TcServerInstanceConfiguratorPage.ILLEGAL_SERVER_NAME, IMessageProvider.ERROR);
    } else if (templateViewer.getCheckedElements().length == 0) {
        wizardHandle.setMessage(SELECT_TEMPLATE_MESSAGE, IMessageProvider.NONE);
    } else {/*from   w w  w.  ja va 2  s. c  o m*/
        wizardHandle.setMessage(null, IMessageProvider.NONE);
    }
    setComplete(wizardHandle.getMessage() == null);
    wizardHandle.update();
}

From source file:com.vmware.vfabric.ide.eclipse.tcserver.internal.ui.TcServer21WizardFragment.java

License:Open Source License

protected void validate() {
    if (!newInstanceButton.getSelection() && serverNameCombo.getText().length() == 0) {
        wizard.setMessage(SPECIFY_TC_SERVER_INSTANCE_MESSAGE, IMessageProvider.NONE);
        setComplete(false);/*from w  ww .j  ava 2 s. c o m*/
        return;
    }

    if (wc == null) {
        wizard.setMessage("", IMessageProvider.ERROR);
        setComplete(false);
        return;
    }

    IStatus status = doValidate();
    if (status == null || status.isOK()) {
        wizard.setMessage(null, IMessageProvider.NONE);
        setComplete(true);
    } else if (status.getSeverity() == IStatus.INFO) {
        wizard.setMessage(status.getMessage(), IMessageProvider.NONE);
        setComplete(false);
    } else if (status.getSeverity() == IStatus.WARNING) {
        wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
        setComplete(true);
    } else {
        wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
        setComplete(false);
    }
    updateDescription(status);
    wizard.update();
}

From source file:com.vmware.vfabric.ide.eclipse.tcserver.internal.ui.TcServerInstanceConfiguratorPage.java

License:Open Source License

protected void validate() {
    if (nameText.getText().trim().length() == 0) {
        setMessage(ENTER_NAME);// w  ww.  ja  v  a2s  .c o m
    } else if (instanceExists()) {
        setMessage(INSTANCE_EXISTS, IMessageProvider.ERROR);
    } else if (templateViewer.getCheckedElements().length == 0) {
        setMessage(SELECT_TEMPLATES);
    } else {
        setMessage(null);
    }
    setPageComplete(getMessage() == null);
}

From source file:de.defmacro.dandelion.internal.ui.dialogs.EvalFailureDialog.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    Control content = super.createContents(parent);

    setTitle(TITLE);/*  w  ww. j a v a 2 s .  c  om*/
    setMessage(fErrorDescription, IMessageProvider.ERROR);

    return content;
}

From source file:de.lmu.ifi.dbs.medmon.base.ui.validation.FormValidationAdapter.java

License:Open Source License

/**
 * Configures the <code>FormText</code> to display the errors.
 * /*from   w w w. j  a va2  s  .c o  m*/
 * @param form
 *            The parent <code>Form</code>
 * @param formText
 *            The <code>FormText</code> to be configured
 */
private void configureFormText(final Form form, FormText formText) {
    formText.addHyperlinkListener(new HyperlinkAdapter() {
        public void linkActivated(HyperlinkEvent e) {
            String is = (String) e.getHref();
            try {
                int index = Integer.parseInt(is);
                IMessage[] messages = form.getChildrenMessages();
                IMessage message = messages[index];
                Control c = message.getControl();
                ((FormText) e.widget).getShell().dispose();
                if (c != null && !c.isDisposed())
                    c.setFocus();
            } catch (NumberFormatException ex) {
            }
        }
    });
    formText.setImage("error", getImage(IMessageProvider.ERROR)); //$NON-NLS-1$
    formText.setImage("warning", getImage(IMessageProvider.WARNING)); //$NON-NLS-1$
    formText.setImage("info", getImage(IMessageProvider.INFORMATION)); //$NON-NLS-1$
}