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

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

Introduction

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

Prototype

int NONE

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

Click Source Link

Document

Constant for a regular message (value 0).

Usage

From source file:org.eclipse.pde.internal.ui.editor.validation.ControlValidationUtility.java

License:Open Source License

public static boolean validateTranslatableField(String value, IValidatorMessageHandler validator,
        IPluginModelBase model, IProject project) {

    // Check the compiler flag and translate it into a message type
    int messageType = AbstractControlValidator.getMessageType(project, CompilerFlags.P_NOT_EXTERNALIZED);
    // If the message type is none, no validation is required
    // Same as IGNORE
    if (messageType == IMessageProvider.NONE) {
        return true;
    }/*from w ww . j  a  v a2s .  com*/

    // Check to see if the name has been externalized
    if (value.startsWith("%") == false) { //$NON-NLS-1$
        validator.addMessage(PDEUIMessages.ControlValidationUtility_errorMsgValueNotExternalized, messageType);
        return false;
    }

    // Check to see if the key is in the plugin's property file
    if (model instanceof AbstractNLModel) {
        NLResourceHelper helper = ((AbstractNLModel) model).getNLResourceHelper();
        if ((helper == null) || (helper.resourceExists(value) == false)) {
            validator.addMessage(PDEUIMessages.ControlValidationUtility_errorMsgKeyNotFound, messageType);
            return false;
        }
    }
    return true;
}

From source file:org.eclipse.pde.internal.ui.editor.validation.ControlValidationUtility.java

License:Open Source License

public static boolean validateActivatorField(String value, IValidatorMessageHandler validator,
        IProject project) {/*from   w  ww  .j  a v  a 2 s.  c  om*/

    // Check the compiler flag and translate it into a message type
    int messageType = AbstractControlValidator.getMessageType(project, CompilerFlags.P_UNKNOWN_CLASS);
    // If the message type is none, no validation is required
    // Same as IGNORE
    if (messageType == IMessageProvider.NONE) {
        return true;
    }

    // Check to see if the class is on the plug-in classpath
    try {
        if (project.hasNature(JavaCore.NATURE_ID)) {
            IJavaProject javaProject = JavaCore.create(project);
            // Look for this activator in the project's classpath
            if (!PDEJavaHelper.isOnClasspath(value, javaProject)) {
                validator.addMessage(PDEUIMessages.ControlValidationUtility_errorMsgNotOnClasspath,
                        messageType);
                return false;
            }
        }
    } catch (CoreException ce) {
        // Ignore
    }

    return true;
}

From source file:org.eclipse.pde.internal.ui.editor.validation.ControlValidationUtility.java

License:Open Source License

public static boolean validateFragmentHostPluginField(String value, IValidatorMessageHandler validator,
        IProject project) {/*from w  w  w.  j  a v a  2 s  .  com*/

    // Check the compiler flag and translate it into a message type
    // If the message type is none, it is the same as IGNORE
    int reqAttMessageType = AbstractControlValidator.getMessageType(project, CompilerFlags.P_NO_REQUIRED_ATT);
    // Check to see if the host plug-in was defined
    if ((reqAttMessageType != IMessageProvider.NONE)
            && validateRequiredField(value, validator, reqAttMessageType) == false) {
        return false;
    }
    // Check the compiler flag and translate it into a message type
    int unresImpMessageType = AbstractControlValidator.getMessageType(project,
            CompilerFlags.P_UNRESOLVED_IMPORTS);
    // If the message type is none, no validation is required
    // Same as IGNORE      
    if (unresImpMessageType == IMessageProvider.NONE) {
        return true;
    }
    // Check to see if the host plugin is defined, enabled and not a 
    // fragment itself
    IPluginModelBase hostModel = PluginRegistry.findModel(value);
    if ((hostModel == null) || (hostModel instanceof IFragmentModel) || (hostModel.isEnabled() == false)) {
        validator.addMessage(PDEUIMessages.ControlValidationUtility_errorMsgPluginUnresolved,
                unresImpMessageType);
        return false;
    }

    return true;
}

From source file:org.eclipse.php.internal.debug.ui.launching.AbstractDebugExeLaunchSettingsSection.java

License:Open Source License

@Override
public StatusMessage isValid(ILaunchConfiguration configuration) {
    // Nothing to validate here
    return new StatusMessage(IMessageProvider.NONE, ""); //$NON-NLS-1$
}

From source file:org.eclipse.php.internal.debug.ui.launching.AbstractDebugWebLaunchSettingsSection.java

License:Open Source License

@Override
public StatusMessage isValid(ILaunchConfiguration configuration) {
    if (debugThroughTunnel.getSelection()) {
        boolean valid = userName.getText().trim().length() > 0;
        testButton.setEnabled(valid);/*from  www  .ja  v  a2 s.com*/
        if (!valid) {
            return new StatusMessage(IMessageProvider.ERROR,
                    Messages.AbstractDebugWebLaunchSettingsSection_Missing_SSH_user_name);
        }
    }
    return new StatusMessage(IMessageProvider.NONE, ""); //$NON-NLS-1$
}

From source file:org.eclipse.php.internal.debug.ui.launching.DebuggerLaunchSettingsSectionAdapter.java

License:Open Source License

@Override
public StatusMessage isValid(ILaunchConfiguration configuration) {
    return new StatusMessage(IMessageProvider.NONE, ""); //$NON-NLS-1$
}

From source file:org.eclipse.php.internal.debug.ui.wizards.DebuggerUnsupportedSettingsSection.java

License:Open Source License

@Override
public void validate() {
    // Reset state
    compositeFragment.setMessage(compositeFragment.getDescription(), IMessageProvider.NONE);
}

From source file:org.eclipse.php.internal.debug.ui.wizards.PathMapperCompositeFragment.java

License:Open Source License

protected void validate() {
    setMessage(getDescription(), IMessageProvider.NONE);
    setComplete(true);
    controlHandler.update();
}

From source file:org.eclipse.php.internal.debug.ui.wizards.XDebugDebuggerExeSettingsSection.java

License:Open Source License

public void validate() {
    // Reset state
    compositeFragment.setMessage(compositeFragment.getDescription(), IMessageProvider.NONE);
    if (debuggerStatus == null) {
        debuggerStatus = Status.OK_STATUS;
        PHPexeItem phpExe = (PHPexeItem) compositeFragment.getData();
        AbstractDebuggerConfiguration[] debuggers = PHPDebuggersRegistry.getDebuggersConfigurations();
        for (AbstractDebuggerConfiguration debugger : debuggers) {
            if (phpExe.getDebuggerID().equals(debugger.getDebuggerId())) {
                debuggerStatus = debugger.validate(phpExe);
            }/*from   ww  w  . j a v a2 s . c  o  m*/
        }
    }
    // Check errors
    String clientPort = (String) settingsWorkingCopy.getAttribute(PROP_CLIENT_PORT);
    if (clientPort == null || clientPort.isEmpty()) {
        compositeFragment.setMessage(Messages.XDebugDebuggerSettingsSection_Client_port_is_missing,
                IMessageProvider.ERROR);
        return;
    }
    if (debuggerStatus.getSeverity() == IStatus.ERROR) {
        compositeFragment.setMessage(debuggerStatus.getMessage(), IMessageProvider.ERROR);
        return;
    }
    // Check warnings
    if (debuggerStatus.getSeverity() == IStatus.WARNING) {
        compositeFragment.setMessage(debuggerStatus.getMessage(), IMessageProvider.WARNING);
        return;
    }
    int port = Integer.valueOf(clientPort);
    if (!PHPLaunchUtilities.isPortAvailable(port)
            && !PHPLaunchUtilities.isDebugDaemonActive(port, XDebugCommunicationDaemon.XDEBUG_DEBUGGER_ID)) {
        compositeFragment.setMessage(
                MessageFormat.format(Messages.DebuggerCommonSettingsSection_Port_is_already_in_use, clientPort),
                IMessageProvider.WARNING);
        return;
    }
    boolean isProxyEnabled = Boolean.valueOf(settingsWorkingCopy.getAttribute(PROP_PROXY_ENABLE));
    if (isProxyEnabled) {
        String proxyIdeKey = settingsWorkingCopy.getAttribute(PROP_PROXY_IDE_KEY);
        if (proxyIdeKey == null || proxyIdeKey.isEmpty()) {
            compositeFragment.setMessage(Messages.XDebugDebuggerServerSettingsSection_IDE_key_is_missing,
                    IMessageProvider.ERROR);
            return;
        }
        String proxyAddress = settingsWorkingCopy.getAttribute(PROP_PROXY_ADDRESS);
        if (proxyAddress == null || proxyAddress.isEmpty()) {
            compositeFragment.setMessage(Messages.XDebugDebuggerServerSettingsSection_Proxy_address_is_missing,
                    IMessageProvider.ERROR);
            return;
        }
    }
}

From source file:org.eclipse.php.internal.debug.ui.wizards.XDebugDebuggerServerSettingsSection.java

License:Open Source License

public void validate() {
    // Reset state
    compositeFragment.setMessage(compositeFragment.getDescription(), IMessageProvider.NONE);
    // Check errors
    String clientPort = (String) settingsWorkingCopy.getAttribute(PROP_CLIENT_PORT);
    if (clientPort == null || clientPort.isEmpty()) {
        compositeFragment.setMessage(Messages.XDebugDebuggerSettingsSection_Client_port_is_missing,
                IMessageProvider.ERROR);
        return;// ww w . j  av a2s. c  om
    }
    int port = Integer.valueOf(clientPort);
    if (!PHPLaunchUtilities.isPortAvailable(port)
            && !PHPLaunchUtilities.isDebugDaemonActive(port, XDebugCommunicationDaemon.XDEBUG_DEBUGGER_ID)) {
        compositeFragment.setMessage(
                MessageFormat.format(Messages.DebuggerCommonSettingsSection_Port_is_already_in_use, clientPort),
                IMessageProvider.WARNING);
        return;
    }
    boolean isProxyEnabled = Boolean.valueOf(settingsWorkingCopy.getAttribute(PROP_PROXY_ENABLE));
    if (isProxyEnabled) {
        String proxyIdeKey = settingsWorkingCopy.getAttribute(PROP_PROXY_IDE_KEY);
        if (proxyIdeKey == null || proxyIdeKey.isEmpty()) {
            compositeFragment.setMessage(Messages.XDebugDebuggerServerSettingsSection_IDE_key_is_missing,
                    IMessageProvider.ERROR);
            return;
        }
        String proxyAddress = settingsWorkingCopy.getAttribute(PROP_PROXY_ADDRESS);
        if (proxyAddress == null || proxyAddress.isEmpty()) {
            compositeFragment.setMessage(Messages.XDebugDebuggerServerSettingsSection_Proxy_address_is_missing,
                    IMessageProvider.ERROR);
            return;
        }
    }
}