Search in sources :

Example 1 with CheckConfigurationTester

use of net.sf.eclipsecs.core.config.CheckConfigurationTester in project eclipse-cs by checkstyle.

the class CheckConfigurationPropertiesDialog method okPressed.

/**
 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
 */
@Override
protected void okPressed() {
    try {
        // Check if the configuration is valid
        mCheckConfig = mConfigurationEditor.getEditedWorkingCopy();
        CheckConfigurationTester tester = new CheckConfigurationTester(mCheckConfig);
        List<ResolvableProperty> unresolvedProps = tester.getUnresolvedProperties();
        if (!unresolvedProps.isEmpty()) {
            MessageDialog dialog = new MessageDialog(getShell(), Messages.CheckConfigurationPropertiesDialog_titleUnresolvedProps, null, NLS.bind(Messages.CheckConfigurationPropertiesDialog_msgUnresolvedProps, // $NON-NLS-1$
            "" + unresolvedProps.size()), MessageDialog.WARNING, new String[] { Messages.CheckConfigurationPropertiesDialog_btnEditProps, Messages.CheckConfigurationPropertiesDialog_btnContinue, Messages.CheckConfigurationPropertiesDialog_btnCancel }, 0);
            int result = dialog.open();
            if (0 == result) {
                ResolvablePropertiesDialog propsDialog = new ResolvablePropertiesDialog(getShell(), mCheckConfig);
                propsDialog.open();
                return;
            } else if (1 == result) {
                super.okPressed();
            } else if (2 == result) {
                return;
            }
        } else {
            super.okPressed();
        }
    } catch (CheckstylePluginException e) {
        CheckstyleLog.log(e);
        this.setErrorMessage(e.getLocalizedMessage());
    }
}
Also used : ResolvableProperty(net.sf.eclipsecs.core.config.ResolvableProperty) CheckstylePluginException(net.sf.eclipsecs.core.util.CheckstylePluginException) CheckConfigurationTester(net.sf.eclipsecs.core.config.CheckConfigurationTester) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) Point(org.eclipse.swt.graphics.Point)

Aggregations

CheckConfigurationTester (net.sf.eclipsecs.core.config.CheckConfigurationTester)1 ResolvableProperty (net.sf.eclipsecs.core.config.ResolvableProperty)1 CheckstylePluginException (net.sf.eclipsecs.core.util.CheckstylePluginException)1 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)1 Point (org.eclipse.swt.graphics.Point)1