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

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

Introduction

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

Prototype

int WARNING

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

Click Source Link

Document

Constant for a warning message (value 2).

Usage

From source file:com.siteview.mde.internal.ui.wizards.extension.PointSelectionPage.java

License:Open Source License

private void handlePointSelection(IMonitorExtensionPoint element) {
    fCurrentPoint = element;/*from   w  ww.  j a v  a 2 s  .  c o  m*/
    fTemplateViewer.setInput(fCurrentPoint);
    fTemplateViewer.setSelection(StructuredSelection.EMPTY);
    String fullPointID = IdUtil.getFullId(fCurrentPoint, fModel);

    String description = XMLComponentRegistry.Instance().getDescription(fullPointID,
            XMLComponentRegistry.F_SCHEMA_COMPONENT);
    String name = XMLComponentRegistry.Instance().getName(fullPointID, XMLComponentRegistry.F_SCHEMA_COMPONENT);
    URL url = null;
    if ((description == null) || (name == null)) {
        url = SchemaRegistry.getSchemaURL(fCurrentPoint, fModel);
    }
    if (url != null) {
        SchemaAnnotationHandler handler = new SchemaAnnotationHandler();
        SchemaUtil.parseURL(url, handler);
        description = handler.getDescription();
        name = handler.getName();
    }
    if (description == null) {
        setPointDescriptionText(MDEUIMessages.PointSelectionPage_noDescAvailable);
    } else {
        setPointDescriptionText(description);
    }
    if (name == null) {
        name = fullPointID;
    }
    // Check if the extension point is deprecated and display a warning
    SchemaRegistry reg = MDECore.getDefault().getSchemaRegistry();
    ISchema schema = reg.getSchema(fCurrentPoint.getFullId());
    if (schema != null && schema.isDeperecated()) {
        setMessage(NLS.bind(MDEUIMessages.NewExtensionWizard_PointSelectionPage_pluginDescription_deprecated,
                name), IMessageProvider.WARNING);
    } else {
        setMessage(null);
        setDescription(NLS.bind(MDEUIMessages.NewExtensionWizard_PointSelectionPage_pluginDescription, name));
    }
    setDescriptionText(""); //$NON-NLS-1$
    fTemplateLabel
            .setText(NLS.bind(MDEUIMessages.NewExtensionWizard_PointSelectionPage_contributedTemplates_label,
                    name.toLowerCase(Locale.ENGLISH)));
    fDescLink.setText(NLS.bind(MDEUIMessages.PointSelectionPage_extPointDesc, name));
    setSelectedNode(null);
    setPageComplete(true);

    XMLComponentRegistry.Instance().putDescription(fullPointID, description,
            XMLComponentRegistry.F_SCHEMA_COMPONENT);
    XMLComponentRegistry.Instance().putName(fullPointID, name, XMLComponentRegistry.F_SCHEMA_COMPONENT);
}

From source file:com.siteview.mde.internal.ui.wizards.feature.PatchSpecPage.java

License:Open Source License

protected String validateContent() {
    fFeatureToPatch = MDECore.getDefault().getFeatureModelManager().findFeatureModel(fFeatureIdText.getText(),
            fFeatureVersionText.getText());
    if (fFeatureToPatch != null) {
        setMessage(null);//from w  w  w.j  a  v  a  2 s  .  com
        return null;
    }

    setMessage(NLS.bind(MDEUIMessages.NewFeaturePatch_SpecPage_notFound, fFeatureIdText.getText(),
            fFeatureVersionText.getText()), IMessageProvider.WARNING);
    getContainer().updateButtons();
    return null;
}

From source file:com.siteview.mde.internal.ui.wizards.plugin.PluginContentPage.java

License:Open Source License

protected void validatePage() {
    String errorMessage = validateProperties();
    if (errorMessage == null && fGenerateActivator.getSelection()) {
        IStatus status = JavaConventions.validateJavaTypeName(fClassText.getText().trim(),
                PDEJavaHelper.getJavaSourceLevel(null), PDEJavaHelper.getJavaComplianceLevel(null));
        if (status.getSeverity() == IStatus.ERROR) {
            errorMessage = status.getMessage();
        } else if (status.getSeverity() == IStatus.WARNING) {
            setMessage(status.getMessage(), IMessageProvider.WARNING);
        }/*from w w  w  .j  a va  2 s.c  o m*/
    }
    if (errorMessage == null) {
        String eeid = fEEChoice.getText();
        if (fEEChoice.isEnabled()) {
            IExecutionEnvironment ee = VMUtil.getExecutionEnvironment(eeid);
            if (ee != null && ee.getCompatibleVMs().length == 0) {
                errorMessage = MDEUIMessages.NewProjectCreationPage_invalidEE;
            }
        }
    }
    setErrorMessage(errorMessage);
    setPageComplete(errorMessage == null);
}

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/*from w  w w .  j a  v  a2s. com*/
 */

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.vectrace.MercurialEclipse.dialogs.AutoresolveRecapDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    super.createDialogArea(parent);
    Composite container = SWTWidgetHelper.createComposite(parent, 1);
    GridData gd = SWTWidgetHelper.getFillGD(400);
    gd.minimumWidth = 500;// w ww. j  a v  a 2  s. c o m
    container.setLayoutData(gd);

    CommitFilesChooser fileList = new CommitFilesChooser(container, false, resources, true, true, true);
    fileList.setLayoutData(new GridData(GridData.FILL_BOTH));

    if (!allConflictsResolved) {
        SWTWidgetHelper.createLabel(container, Messages.getString("AutoresolveSummaryDialog.conflictsExist")); //$NON-NLS-1$
    }

    getShell().setText(Messages.getString("AutoresolveSummaryDialog.windowTitle")); //$NON-NLS-1$
    setTitle(Messages.getString("AutoresolveSummaryDialog.title")); //$NON-NLS-1$

    if (resources.size() == 0) {
        setMessage(Messages.getString("AutoresolveSummaryDialog.noResourcesResolved"), //$NON-NLS-1$
                IMessageProvider.WARNING);
    } else {
        setMessage(Messages.getString("AutoresolveSummaryDialog.message"), //$NON-NLS-1$
                IMessageProvider.INFORMATION);
    }

    return container;
}

From source file:com.vectrace.MercurialEclipse.dialogs.CommitDialog.java

License:Open Source License

@Override
protected void validateControls() {
    if (isDefaultCommitMessage()) {
        setErrorMessage(Messages.getString("CommitDialog.commitMessageRequired")); // ";
        getButton(IDialogConstants.OK_ID).setEnabled(false);
    } else if (commitFilesList.getCheckedResources().size() == 0 && !options.allowEmptyCommit
            && commitFilesList.isSelectable() && (amendCheckbox == null || !amendCheckbox.getSelection())
            && !isCloseBranchSelected()) {
        setErrorMessage(Messages.getString("CommitDialog.noResourcesSelected")); // ";
        getButton(IDialogConstants.OK_ID).setEnabled(false);
    } else {/*from  www  .j  a v  a2 s  .  co m*/
        setErrorMessage(null);
        getButton(IDialogConstants.OK_ID).setEnabled(true);

        if (isAmend() && HgFeatures.PHASES.isEnabled() && currentChangeset.getPhase() == Phase.PUBLIC) {
            setMessage(Messages.getString("CommitDialog.amendPublicWarning"), IMessageProvider.WARNING);
        } else {
            setMessage(Messages.getString(options.readyMessageSelector == null ? "CommitDialog.readyToCommit"
                    : options.readyMessageSelector));
        }
    }
}

From source file:com.vectrace.MercurialEclipse.wizards.AddBranchPage.java

License:Open Source License

/**
 * @return true if branch does not exists yet
 *///  w  ww.  j  av  a2 s .c om
public boolean validateIfBranchExists() {
    String text = branchNameTextField.getText();
    if (branchNames.contains(text)) {
        if (!forceCheckBox.getSelection()) {
            setMessage(null, IMessageProvider.WARNING);
            setErrorMessage("'" + text + "' branch already exists!");
        } else {
            setErrorMessage(null);
            setMessage("'" + text + "' branch shadows existing branch.", IMessageProvider.WARNING);
        }
        return false;
    }
    setMessage(null, IMessageProvider.WARNING);
    setErrorMessage(null);
    return true;
}

From source file:com.vectrace.MercurialEclipse.wizards.PushRepoWizard.java

License:Open Source License

@Override
public void addPages() {
    super.addPages();
    PushPullPage myPage = new PushRepoPage(Messages.getString("PushRepoWizard.pushRepoPage.name"), //$NON-NLS-1$
            Messages.getString("PushRepoWizard.pushRepoPage.title"), null, hgRoot); //$NON-NLS-1$
    initPage(Messages.getString("PushRepoWizard.pushRepoPage.description"), //$NON-NLS-1$
            myPage);//from w w  w  .  j  a va 2  s .c  om
    myPage.setShowCredentials(true);
    page = myPage;
    addPage(page);
    outgoingPage = new OutgoingPage("OutgoingPage"); //$NON-NLS-1$
    initPage(outgoingPage.getDescription(), outgoingPage);
    outgoingPage.setHgRoot(hgRoot);
    addPage(outgoingPage);

    if (message != null) {
        page.setMessage(message, IMessageProvider.WARNING);
    }
}

From source file:com.vectrace.MercurialEclipse.wizards.PushRepoWizard.java

License:Open Source License

public void setInitialMessage(String message) {
    this.message = message;

    if (page != null) {
        page.setMessage(message, IMessageProvider.WARNING);
    }/*from www .j ava  2  s.c  o  m*/
}

From source file:com.vectrace.MercurialEclipse.wizards.TransplantPage.java

License:Open Source License

private void validatePage() {
    boolean valid = true;
    setMessage(null, IMessageProvider.WARNING);
    try {//  www  .ja  v  a2 s  .  c o m
        if (branch) {
            valid &= !StringUtils.isEmpty(branchName);
            if (!valid) {
                setErrorMessage("Please select local branch!");
                return;
            }
            //            if (!all) {
            //               valid &= selectedChangesets.size() == 1
            //                     && Branch.same(branchName, selectedChangesets.first().getBranch());
            //               if(!valid){
            //                  setErrorMessage("Please select exact one changeset if transplanting "
            //                        + "not all changesets from the local branch!");
            //                  return;
            //               }
            //            }
            if (valid && !all && selectedChangesets.size() == 0) {
                setMessage("No changeset selected.", IMessageProvider.WARNING);
                return;
            }
        } else {
            valid &= !StringUtils.isEmpty(getUrlText());
            if (!valid) {
                setErrorMessage("Please provide valid repository location!");
                return;
            }
            valid &= selectedChangesets.size() > 0;
            if (!valid) {
                setErrorMessage("Please select at least one changeset!");
                return;
            }
        }
    } finally {
        if (valid) {
            setErrorMessage(null);
        }
        if (isPageComplete() ^ valid) {
            setPageComplete(valid);
        }
    }
}