Example usage for org.eclipse.jface.wizard WizardPage setMessage

List of usage examples for org.eclipse.jface.wizard WizardPage setMessage

Introduction

In this page you can find the example usage for org.eclipse.jface.wizard WizardPage setMessage.

Prototype

@Override
public void setMessage(String newMessage, int newType) 

Source Link

Document

The WizardPage implementation of this method declared on DialogPage updates the container if this is the current page.

Usage

From source file:com.iw.plugins.spindle.ui.wizards.TapestryWizardPage.java

License:Mozilla Public License

public void applyToStatusLine(WizardPage page, IStatus status) {
    if (status == null) {
        return;/*from   www  .j a v a2s  .c o m*/
    }
    String message = status.getMessage();
    switch (status.getSeverity()) {
    case IStatus.OK:
        page.setErrorMessage(null);
        page.setMessage(message, NONE);
        break;
    case IStatus.WARNING:
        page.setErrorMessage(null);
        page.setMessage(message, WARNING);
        break;
    case IStatus.INFO:
        page.setErrorMessage(null);
        page.setMessage(message, INFORMATION);
        break;
    default:
        if (message.length() == 0) {
            message = null;
        }
        page.setErrorMessage(message);
        page.setMessage(null);
        break;
    }
}

From source file:net.refractions.udig.catalog.internal.wfs.ui.WFSRegistryWizardPage.java

License:Open Source License

@Override
public void setMessage(String newMessage, int messageType) {
    WizardPage page = (WizardPage) getContainer().getCurrentPage();
    page.setMessage(newMessage, messageType);
}

From source file:net.rim.ejde.internal.ui.wizards.templates.AbstractBBTemplateSection.java

License:Open Source License

/**
 * Update the wizard page error message.
 *
 * @param page//from   w  w  w.  ja  v  a  2  s. co  m
 *            The wizard page
 * @param names
 *            The component name with error
 * @param status
 *            The error status
 */
protected void updateStatus(WizardPage page, List<String> names, IStatus status) {
    if (status.getSeverity() == IStatus.ERROR) {
        page.setPageComplete(false);
        IStatus[] children = status.getChildren();
        for (int i = 0; i < children.length; i++) {
            if (children[i].getSeverity() == IStatus.ERROR) {
                if (names.get(i).length() > 0) {
                    page.setMessage(names.get(i) + ": " + children[i].getMessage(), IMessageProvider.ERROR);
                } else {
                    page.setMessage(children[i].getMessage(), IMessageProvider.ERROR);
                }
                break;
            }
        }
    } else if (status.getSeverity() == IStatus.WARNING) {
        page.setPageComplete(true);
        IStatus[] children = status.getChildren();
        for (int i = 0; i < children.length; i++) {
            if (children[i].getSeverity() == IStatus.WARNING) {
                if (names.get(i).length() > 0) {
                    page.setMessage(names.get(i) + ": " + children[i].getMessage(), IMessageProvider.WARNING);
                } else {
                    page.setMessage(children[i].getMessage(), IMessageProvider.ERROR);
                }
                break;
            }
        }
    } else {
        page.setPageComplete(true);
        page.setMessage(null);
    }
}

From source file:org.apache.sling.ide.eclipse.ui.wizards.AbstractNewSlingApplicationWizard.java

License:Apache License

public void reportError(CoreException e) {
    WizardPage currentPage = getCurrentWizardPage();
    if (currentPage != null) {
        currentPage.setMessage(e.getMessage(), IMessageProvider.ERROR);
    } else {// w w  w.ja  va2s .c o m
        MessageDialog.openError(getShell(), "Unexpected error", e.getMessage());
    }

    Activator.getDefault().getLog().log(e.getStatus());
}

From source file:org.apache.sling.ide.eclipse.ui.wizards.np.AbstractNewSlingApplicationWizard.java

License:Apache License

protected void reportError(CoreException e) {
    WizardPage currentPage = getCurrentWizardPage();
    if (currentPage != null) {
        currentPage.setMessage(e.getMessage(), IMessageProvider.ERROR);
    } else {/* w  w w.j  ava2s  .  c  om*/
        MessageDialog.openError(getShell(), "Unexpected error", e.getMessage());
    }

    Activator.getDefault().getLog().log(e.getStatus());
}

From source file:org.eclipse.scada.configuration.ui.project.template.BaseTemplate.java

License:Open Source License

/**
 * Locates the page that this option is presented in and flags that the
 * option// ww w. ja  va2  s  .c  o m
 * is required and is currently not set. The flagging is done by setting the
 * page incomplete and setting the error message that uses option's message
 * label.
 *
 * @param option
 *            the option that is required and currently not set
 */
protected void flagErrorMessage(final TemplateOption option, final String newMessage, final int newType) {
    for (int i = 0; i < getPageCount(); i++) {
        final WizardPage page = getPage(i);
        for (final TemplateOption pageOption : getOptions(i)) {
            if (pageOption.equals(option)) {
                page.setPageComplete(false);
                page.setMessage(newMessage, newType);
            }
        }
    }
}

From source file:org.jkiss.dbeaver.tools.project.ProjectImportData.java

License:Open Source License

boolean isFileSpecified(WizardPage page) {
    if (importFile == null) {
        page.setMessage("Import file not specified", IMessageProvider.ERROR);
        return false;
    }//from  w w  w. j  a  v a  2 s  .com
    if (!importFile.exists()) {
        page.setMessage("File '" + importFile.getAbsolutePath() + "' doesn't exist", IMessageProvider.ERROR);
        return false;
    }
    if (!importFile.isFile()) {
        page.setMessage("File '" + importFile.getAbsolutePath() + "' is a directory", IMessageProvider.ERROR);
        return false;
    }
    page.setMessage("Configure project import settings", IMessageProvider.NONE);
    return true;
}

From source file:org.jkiss.dbeaver.tools.project.ProjectImportData.java

License:Open Source License

boolean loadArchiveMeta(WizardPage page) {
    try {//from   ww  w . j ava2 s  .  co m
        try (ZipFile zipFile = new ZipFile(importFile, ZipFile.OPEN_READ)) {
            ZipEntry metaEntry = zipFile.getEntry(ExportConstants.META_FILENAME);
            if (metaEntry == null) {
                page.setMessage("Cannot find meta file", IMessageProvider.ERROR);
                return false;
            }
            try (InputStream metaStream = zipFile.getInputStream(metaEntry)) {
                metaTree = XMLUtils.parseDocument(metaStream);
            } catch (XMLException e) {
                page.setMessage("Cannot parse meta file: " + e.getMessage(), IMessageProvider.ERROR);
                return false;
            }
            return true;
        }
    } catch (IOException e) {
        page.setMessage("Cannot open archive '" + importFile.getAbsolutePath() + "': " + e.getMessage(),
                IMessageProvider.ERROR);
        return false;
    }
}

From source file:org.teiid.designer.tools.textimport.ui.wizards.ImportTextWizard.java

License:Open Source License

/**
 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
 * @since 4.0//from  w  w  w.  ja va 2s. com
 */
@Override
public void init(final IWorkbench workbench, final IStructuredSelection selection) {

    IStructuredSelection finalSelection = selection;
    if (!ModelerUiViewUtils.workspaceHasOpenModelProjects()) {
        IProject newProject = ModelerUiViewUtils.queryUserToCreateModelProject();

        if (newProject != null) {
            finalSelection = new StructuredSelection(newProject);
        }
    }

    if (importLicensed) {
        importTextMainPage = new ImportTextMainPage(finalSelection);
        addPage(importTextMainPage);
        //
        for (int i = 0; i < importers.length; i++) {
            addPage((IWizardPage) importers[i]);
        }
    } else {
        // Create empty page
        WizardPage page = new WizardPage(ImportTextWizard.class.getSimpleName(), TITLE, null) {

            @Override
            public void createControl(final Composite parent) {
                setControl(createEmptyPageControl(parent));
            }
        };
        page.setMessage(NOT_LICENSED_MSG, IMessageProvider.ERROR);
        page.setPageComplete(false);
        addPage(page);
    }
}

From source file:org.teiid.designer.vdb.ui.wizards.ImportVdbWizard.java

License:Open Source License

/**
 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
 * @since 4.0//  ww  w .j ava 2  s  . com
 */
@Override
public void init(final IWorkbench workbench, final IStructuredSelection selection) {
    if (importLicensed) {
        zipPage = createMainPage(selection);
        addPage(zipPage);
    } else {
        // Create empty page
        final WizardPage page = new WizardPage(ImportVdbWizard.class.getSimpleName(), TITLE, null) {
            @Override
            public void createControl(final Composite parent) {
                setControl(createEmptyPageControl(parent));
            }
        };
        page.setMessage(NOT_LICENSED_MSG, IMessageProvider.ERROR);
        page.setPageComplete(false);
        addPage(page);
    }
}