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:org.eclipse.birt.data.oda.mongodb.ui.impl.MongoDBDataSourcePageHelper.java

License:Open Source License

/**
 * Validate the page properties//from  ww  w  .ja v a2  s.  co m
 * 
 * @return
 */
private boolean validatePageProperties() {
    boolean isValid = true;

    if (URIRadioBtn.getSelection() || isURITextFieldFoucs) {
        if (databaseURIText.getText().trim().length() == 0) {
            isValid = false;
        }
    } else if (serverHostText.getText().trim().length() == 0 || serverPortText.getText().trim().length() == 0
            || databaseNameText.getText().trim().length() == 0) {
        isValid = false;
    }

    if (!isValid) {
        if (isPropertyPage) {
            propertyPage.setMessage(
                    Messages.getString("MongoDBDataSourceWizardPage.error.MissingConnectionProperty"), //$NON-NLS-1$
                    IMessageProvider.ERROR);
        } else {
            wizardPage.setMessage(
                    Messages.getString("MongoDBDataSourceWizardPage.error.MissingConnectionProperty"), //$NON-NLS-1$
                    IMessageProvider.ERROR);
        }
    } else {
        if (isPropertyPage) {
            propertyPage.setMessage(DEFAULT_MESSAGE);
        } else {
            wizardPage.setMessage(DEFAULT_MESSAGE);
        }
    }

    if (wizardPage != null) {
        wizardPage.setPageComplete(isValid);
    }
    return isValid;
}

From source file:org.eclipse.birt.data.oda.pojo.ui.impl.dialogs.DataSetPropertiesWizardPage.java

License:Open Source License

@Override
protected void refresh(DataSetDesign dataSetDesign) {
    super.refresh(dataSetDesign);
    this.design = dataSetDesign;
    txtAppContextKey.setText(""); //$NON-NLS-1$
    txtPojoDataSetClass.setText(""); //$NON-NLS-1$
    String query = dataSetDesign.getQueryText();
    PojoQuery pq = null;/*from  w  w  w . j  a  v a 2  s .  c om*/
    if (query != null && query.length() > 0) {
        try {
            pq = PojoQueryParser.parse(query);
        } catch (OdaException e) {
            ExceptionHandler.showException(getControl().getShell(), Messages.getString("FailedParseQueryTitle"), //$NON-NLS-1$
                    Messages.getFormattedString("FailedParseQueryMsg", new String[] { query }), e); //$NON-NLS-1$
            setMessage(Messages.getString("FailedParseQueryTitle"), IMessageProvider.ERROR); //$NON-NLS-1$
        }
    }
    if (pq != null) {
        if (pq.getAppContextKey() != null) {
            txtAppContextKey.setText(pq.getAppContextKey().trim());
        }
        if (pq.getDataSetClass() != null) {
            txtPojoDataSetClass.setText(pq.getDataSetClass().trim());
        }
    }

    if (classLoader == null)
        initPageInfos();
}

From source file:org.eclipse.birt.report.data.oda.excel.ui.wizards.ExcelDataSourcePageHelper.java

License:Open Source License

/**
 * //  www.j  av  a 2s .  com
 * @return
 */
private int verifyFileLocation() {
    int result = CORRECT_FOLDER;
    String folderLocationValue = getFolderLocationString().trim();
    if (folderLocationValue.length() > 0) {
        URI uri = null;
        try {
            uri = ResourceLocatorUtil.resolvePath(ri, folderLocationValue);
        } catch (OdaException e) {
            setMessage(e.getMessage(), IMessageProvider.ERROR);
            setPageComplete(false);
            return ERROR_FOLDER;
        }
        if (uri == null) {
            setMessage(Messages.getString("ui.ExcelFileNotFound"), IMessageProvider.ERROR); //$NON-NLS-1$
            setPageComplete(false);
            return ERROR_FOLDER;
        }
        try {
            ResourceLocatorUtil.validateFileURI(uri);
            setMessage(DEFAULT_MESSAGE, IMessageProvider.NONE);
            setPageComplete(true);
        } catch (Exception e) {
            setMessage(Messages.getString("ui.ExcelFileNotFound"), IMessageProvider.ERROR); //$NON-NLS-1$
            setPageComplete(false);
            return ERROR_FOLDER;
        }
    } else {
        setMessage(Messages.getString("error.emptyPath"), IMessageProvider.ERROR); //$NON-NLS-1$
        setPageComplete(false);
        result = ERROR_EMPTY_PATH;
    }
    if (result == CORRECT_FOLDER)
        return result;

    if (wizardPage == null) {
        // error message is already set above when result is set to an error
        // state
        setPageComplete(true);
    }
    return result;
}

From source file:org.eclipse.birt.report.data.oda.hive.ui.profile.HiveSelectionPageHelper.java

License:Open Source License

private void updateTestButton() {
    if (isURLBlank()) {
        // Jdbc Url cannot be blank
        setMessage(EMPTY_URL, IMessageProvider.ERROR);
        testButton.setEnabled(false);//from   ww w  .j  av  a2  s. c  om
    } else {
        setMessage(DEFAULT_MESSAGE);
        if (!testButton.isEnabled())
            testButton.setEnabled(true);
    }
}

From source file:org.eclipse.birt.report.data.oda.jdbc.ui.profile.GetSyncResultRunnable.java

License:Open Source License

/**
 * This method should be called in the following occations: 1. The value of
 * selected driver is changed 2. The value of inputed URL is changed 3. When
 * the control is created 4.//from   w ww  .j a  va  2  s  . c  om
 */
private void updateTestButton() {
    // Jdbc Url cannot be blank
    if (isDriverClassBlank() || isURLBlank()) {
        if (isJNDIBlank()) {
            setMessage(EMPTY_DRIVER_CLASS_OR_URL, IMessageProvider.ERROR);
            testButton.setEnabled(false);
        } else {
            setMessage(DEFAULT_MESSAGE);
            if (!testButton.isEnabled())
                testButton.setEnabled(true);
        }
    } else {
        setMessage(DEFAULT_MESSAGE);
        if (!testButton.isEnabled())
            testButton.setEnabled(true);
    }
}

From source file:org.eclipse.birt.report.data.oda.jdbc_resultset.ui.profile.JDBCSelectionPageHelper.java

License:Open Source License

/**
 * This method should be called in the following occations: 1. The value of
 * selected driver is changed 2. The value of inputed URL is changed 3. When
 * the control is created 4.//ww w  . ja v a  2  s  .  c  o  m
 */
private void updateTestButton() {
    if (isDriverClassBlank() || (isURLBlank() && isJNDIBlank())) {
        // Jdbc Url cannot be blank
        setMessage(EMPTY_URL, IMessageProvider.ERROR);
        testButton.setEnabled(false);
    } else {
        setMessage(DEFAULT_MESSAGE);
        if (!testButton.isEnabled())
            testButton.setEnabled(true);
    }
}

From source file:org.eclipse.birt.report.data.oda.jdbc_resultset.ui.profile.JDBCSelectionPageHelper.java

License:Open Source License

/**
 * Reset the testButton and manageButton to "enabled" status
 *///from   w ww . ja v  a2s  .co m
protected void resetTestAndMngButton() {
    if (isURLBlank() && isJNDIBlank()) {
        // Jdbc Url cannot be blank
        setMessage(EMPTY_URL, IMessageProvider.ERROR);
        testButton.setEnabled(false);
    } else {
        setMessage(DEFAULT_MESSAGE);
        if (!testButton.isEnabled())
            testButton.setEnabled(true);
    }
    manageButton.setEnabled(true);
    enableParent(manageButton);
}

From source file:org.eclipse.birt.report.designer.data.ui.dataset.DataSetComputedColumnsPage.java

License:Open Source License

private boolean validateSingleColumn(ComputedColumn computedColumn) {
    if (computedColumn.getName() == null || computedColumn.getName().trim().length() == 0) {
        getContainer().setMessage(Messages.getFormattedString("dataset.editor.error.missingComputedColumnName", //$NON-NLS-1$
                new Object[] { computedColumn.getName() }), IMessageProvider.ERROR);
        return false;
    }// ww w  . j  a v a  2  s. c  o  m

    Iterator iter = ((DataSetHandle) getContainer().getModel())
            .getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP).iterator();
    while (iter.hasNext()) {
        ColumnHintHandle hint = (ColumnHintHandle) iter.next();
        if (!computedColumn.getName().equals(hint.getColumnName())
                && computedColumn.getName().equals(hint.getAlias())) {
            getContainer().setMessage(
                    Messages.getFormattedString("dataset.editor.error.computedColumnNameAlreadyUsed", //$NON-NLS-1$
                            new Object[] { computedColumn.getName() }),
                    IMessageProvider.ERROR);
            return false;
        }
    }
    return true;
}

From source file:org.eclipse.birt.report.designer.data.ui.dataset.DataSetEditor.java

License:Open Source License

protected void okPressed() {
    super.okPressed();

    try {/*from  w ww.ja va2  s .c  o  m*/
        DataSetUIUtil.updateColumnCache(this.getHandle(), false);
    } catch (Exception e) {
        DataSetExceptionHandler.handle(e);
        return;
    }

    // First call ok on all the pages
    if (super.rootNode.hasSubNodes()) {
        PropertyNode[] nodes = rootNode.getSubNodes();
        for (int n = 0; n < nodes.length; n++) {
            // Check whether the current page can be closed
            if (nodes[n].getPage() instanceof DataSetParametersPage) {
                if (viewer == null || viewer.getTree() == null)
                    return;

                DataSetParametersPage page = (DataSetParametersPage) nodes[n].getPage();
                if (!page.canFinish() && !viewer.getTree().isDisposed()) {
                    TreeItem firstNode = viewer.getTree().getItems()[n];
                    StructuredSelection select = new StructuredSelection(firstNode.getData());
                    viewer.setSelection(select);
                    String name = ((DataSetParametersPage) nodes[n].getPage()).getNoneValuedParameterName();
                    this.setMessage(
                            Messages.getFormattedString("dataset.editor.error.noInputParameterDefaultValue", //$NON-NLS-1$
                                    new Object[] { name }),
                            IMessageProvider.ERROR);
                    return;
                }
            }
        }
    }
}

From source file:org.eclipse.birt.report.designer.data.ui.dataset.DataSetParametersPage.java

License:Open Source License

protected void refreshLinkedReportParamStatus() {
    TableItem items[] = viewer.getViewer().getTable().getItems();
    for (int i = 0; i < items.length; i++) {
        if (items[i].getData() instanceof OdaDataSetParameterHandle) {
            OdaDataSetParameterHandle handle = (OdaDataSetParameterHandle) items[i].getData();
            if (handle.getParamName() == null) {
                continue;
            }/*from  w w  w .  ja  v a2s . c  o m*/

            ScalarParameterHandle reportParam = ParameterPageUtil.getScalarParameter(handle.getParamName(),
                    true);
            if (reportParam == null) {
                getContainer().setMessage(
                        Messages.getFormattedString(
                                "DataSetParametersPage.errorMessage.LinkedReportParamNotFound", //$NON-NLS-1$
                                new Object[] { handle.getParamName(), handle.getName() }),
                        IMessageProvider.ERROR);
            }
            viewer.getViewer().refresh();

        }
    }
}