/** * Validates if the redirect file is valid * @return true if the filename is not zero, false otherwise */ private boolean validateRedirectFile() { if(fFileOutput.getSelection()) { int len = fFileText.getText().trim().length(); if (len == 0) { setErrorMessage(LaunchConfigurationsMessages.CommonTab_8); return false; } } return true; }
/** * validates the stdin file location * * @return true if the stdin file exists, false otherwise */ private boolean validateStdinFile() { if (isInputFile()) { int len = fInputFileLocationText.getText().trim().length(); if (len == 0) { setErrorMessage(LaunchConfigurationsMessages.CommonTab_Invalid_stdin_file_location_15); return false; } } return true; }
/** * validates the encoding selection * @return true if the validate encoding is allowable, false otherwise */ private boolean validateEncoding() { if (fAltEncodingButton.getSelection()) { if (fEncodingCombo.getSelectionIndex() == -1) { if (!isValidEncoding(fEncodingCombo.getText().trim())) { setErrorMessage(LaunchConfigurationsMessages.CommonTab_15); return false; } } } return true; }
/** * validates the local shared config file location * @return true if the local shared file exists, false otherwise */ private boolean validateLocalShared() { if (isShared()) { String path = fSharedLocationText.getText().trim(); IContainer container = getContainer(path); if (container == null || container.equals(ResourcesPlugin.getWorkspace().getRoot())) { setErrorMessage(LaunchConfigurationsMessages.CommonTab_Invalid_shared_configuration_location_14); return false; } else if (!container.getProject().isOpen()) { setErrorMessage(LaunchConfigurationsMessages.CommonTab_Cannot_save_launch_configuration_in_a_closed_project__1); return false; } } return true; }
@Override public boolean isValid(ILaunchConfiguration config) { setMessage(null); setErrorMessage(null); return validateLocalShared() && validateRedirectFile() && validateEncoding() && validateStdinFile(); }