public ValidationLauncherJob(Job validationJob) { super(ResourceHandler.getExternalizedMessage("VBF_VALIDATION_JOB_MSG")); setSystem(true); setRule(ResourcesPlugin.getWorkspace().getRoot()); this.validationJob= validationJob; } protected IStatus run(IProgressMonitor monitor) {
public static String getExternalizedMessage(String key) { try { ResourceBundle bundle = getBundle(); if (bundle == null) { Logger logger = ValidationPlugin.getPlugin().getMsgLogger(); if (logger.isLoggingLevel(Level.FINE)) { LogEntry entry = ValidationPlugin.getLogEntry(); entry.setSourceID("org.eclipse.wst.validation.internal.operations.internal.ResourceHandler.getExternalizedMessage(String)"); //$NON-NLS-1$ entry.setText("Resource bundle is null"); //$NON-NLS-1$ logger.write(Level.FINE, entry); } return key; } return bundle.getString(key); } catch (NullPointerException exc) { Logger logger = ValidationPlugin.getPlugin().getMsgLogger(); if (logger.isLoggingLevel(Level.FINE)) { LogEntry entry = ValidationPlugin.getLogEntry(); entry.setSourceID("org.eclipse.wst.validation.internal.operations.ui.ResourceHandler.getExternalizedMessage(String)"); //$NON-NLS-1$ entry.setText("Cannot find message id " + key); //$NON-NLS-1$ entry.setTargetException(exc); logger.write(Level.FINE, entry); } } return key; }
protected ValidationConfiguration(IResource resource, ValidatorMetaData[] validators) throws InvocationTargetException { this(); if (resource == null) { throw new InvocationTargetException(null, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_NULLCREATE)); } setResource(resource); setValidators(validators); }
/** * Once all of the fields have been updated on this ValidationConfiguration instance, this * preference should be stored back on the IResource for later use. This method must be called * manually by the validation framework once the fields of this type have been updated. */ public final void passivate() throws InvocationTargetException { try { if (getResource() == null) { throw new InvocationTargetException(null, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_NULLSAVE)); } getResource().setSessionProperty(ConfigurationConstants.USER_PREFERENCE, this); } catch (CoreException exc) { throw new InvocationTargetException(exc, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_SAVE, new String[]{getResource().getName()})); } }
String msg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_VALIDATOR_TERMINATED); status = WTPCommonPlugin.createCancelStatus(msg);
protected final String loadVersion(IResource resource) throws InvocationTargetException { try { // This method will be called in one of two situations: // 1. This is a new workspace and no preferences exist. // 2. This is a migrated workspace and the old preferences have already been created as // persistent properties. String storedConfiguration = resource.getPersistentProperty(ConfigurationConstants.USER_PREFERENCE); String version = null; if (storedConfiguration == null) { version = getVersionDefault(); } else { int versionIndex = storedConfiguration.indexOf(ConfigurationConstants.VERSION); if (versionIndex != -1) version = storedConfiguration.substring(versionIndex + ConfigurationConstants.VERSION.length()); } if (version == null) { return getVersionDefault(); } return version; } catch (CoreException exc) { throw new InvocationTargetException(exc, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_RETRIEVE, new String[]{getResource().getName()})); } }
String msg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_VALIDATOR_TERMINATED); status = WTPCommonPlugin.createCancelStatus(msg);
/** * Load the values of these fields when the project or workspace is opened. */ protected final void load() throws InvocationTargetException { try { if (getResource() == null) { throw new InvocationTargetException(null, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_NULLRETRIEVE)); } IMarker[] marker = getMarker(); if (marker == null) { // either a new workspace or already migrated; proceed as normal loadPreference(); } else { // migrate load(marker); } } catch (InvocationTargetException exc) { throw exc; } catch (Exception exc) { String resourceName = (getResource() == null) ? "null" : getResource().getName(); //$NON-NLS-1$ throw new InvocationTargetException(exc, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_RETRIEVE, new String[]{resourceName})); } }
throw new IllegalArgumentException(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_BADVMD)); throw new IllegalArgumentException(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_OPENPRJ, new String[]{project.getName()})); throw new IllegalArgumentException(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_EXISTPRJ, new String[]{project.getName()})); IProject p = changedResources[i].getProject(); if (!p.isOpen()) { throw new IllegalArgumentException(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_OPENPRJ, new String[]{p.getName()})); throw new IllegalArgumentException(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_EXISTPRJ, new String[]{p.getName()})); throw new IllegalArgumentException(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_BADPRJ, new String[]{project.getName()})); throw new IllegalArgumentException(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_MULTIPRJ, new String[]{buffer.toString()})); ValidatorMetaData vmd = vmds[i]; if (!ValidationRegistryReader.getReader().isConfiguredOnProject(vmd, project)) { throw new IllegalArgumentException(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_BADVAL, new String[]{vmd.getValidatorDisplayName(), project.getName()}));
String msg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_VALIDATOR_TERMINATED); status = WTPCommonPlugin.createCancelStatus(msg);
String msg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_VALIDATOR_TERMINATED); status = WTPCommonPlugin.createCancelStatus(msg);
public void validateTagLibs() { if (webDD.getTagLibs().isEmpty()) return; Iterator tags = webDD.getTagLibs().iterator(); Hashtable remember = new Hashtable(); while (tags.hasNext()) { if( _reporter.isCancelled() ){ String msg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_VALIDATOR_TERMINATED); status = WTPCommonPlugin.createCancelStatus(msg); } TagLibRef taglib = (TagLibRef) tags.next(); // ClassCastException at runtime String uri = taglib.getTaglibURI(); if (uri != null) uri = uri.trim(); if (uri == null || uri.equals("")) { //$NON-NLS-1$ String[] parms = new String[1]; parms[0] = WARValidationResourceHandler.of_Type_Taglib_80; addWarning(WAR_CATEGORY, MESSAGE_WAR_VALIDATION_EMPTY_ENTRY, parms, taglib); continue; } if (remember.get(uri) != null) { // Check for dups String[] parms = new String[1]; parms[0] = WARValidationResourceHandler.of_Type_TagLib___81 + ": " + uri; addWarning(WAR_CATEGORY, MESSAGE_WAR_VALIDATION_DUPLICATE_ENTRY, parms, taglib); continue; } remember.put(uri, "Yea"); //$NON-NLS-1$ } }
/** * Validate the existance of Web Roles within the EAR Roles and duplicates in Web Roles. */ protected void validateWEBRolesWithEARRoles(EList earRoleList, EList warRoles) { int numRoles = warRoles.size(); // TFB This implementation requires a 'small' list of warRoles. // If 'warRoles' gets too big then another implementation // will be necessary. for (int roleNo = 0; roleNo < numRoles; roleNo++) { if( _reporter.isCancelled() ){ String msg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_VALIDATOR_TERMINATED); status = WTPCommonPlugin.createErrorStatus(msg); } SecurityRoleImpl nextRole = (SecurityRoleImpl) (warRoles.get(roleNo)); String[] parms = new String[1]; parms[0] = nextRole.getRoleName(); if (!(earRoleList.contains(nextRole))) addWarning(WAR_CATEGORY, ERROR_EAR_MISSING_EJB_ROLE, parms, nextRole); } } }
/** * This method returns the validator if it can be loaded; if the validator cannot be loaded, * e.g., if its plugin is disabled for some reason, then this method throws an * InstantiationException. Before the CoreException is thrown, this validator is disabled. * * @return IValidator * @throws InstantiationException */ public IValidator getValidator() throws InstantiationException { if (_validator == null) { _validator = ValidationRegistryReader.createValidator(_validatorClassElement, getValidatorUniqueName()); // Since the element won't be used any more, clear it. //_validatorClassElement = null; if (_validator == null) { setCannotLoad(); throw new InstantiationException(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_DISABLEV, new String[]{getValidatorUniqueName()})); } } return _validator; }
/** * Returns the Validator extension point */ private IExtensionPoint getValidatorExtensionPoint() { IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint extensionPoint = registry.getExtensionPoint(PLUGIN_ID, VALIDATOR_EXT_PT_ID); if (extensionPoint == null) { // If this happens it means that someone removed the "validator" extension point // declaration // from our plugin.xml file. Logger logger = ValidationPlugin.getPlugin().getMsgLogger(); if (logger.isLoggingLevel(Level.FINE)) { LogEntry entry = ValidationPlugin.getLogEntry(); entry.setSourceID("ValidationRegistryReader.getValidatorExtensionPoint()"); //$NON-NLS-1$ entry.setMessageTypeID(ResourceConstants.VBF_EXC_MISSING_VALIDATOR_EP); //entry.setTokens(new String[]{ValidationPlugin.PLUGIN_ID + "." + VALIDATOR_EXT_PT_ID}); //$NON-NLS-1$ String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_MISSING_VALIDATOR_EP), new String[]{ValidationPlugin.PLUGIN_ID + "." + VALIDATOR_EXT_PT_ID}); entry.setText(result); logger.write(Level.FINE, entry); } } return extensionPoint; }
String msg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_VALIDATOR_TERMINATED); status = WTPCommonPlugin.createCancelStatus(msg);
public ProjectConfiguration getProjectConfiguration(IProject project) throws InvocationTargetException { ProjectConfiguration prjp = null; try { prjp = (ProjectConfiguration) project.getSessionProperty(USER_PREFERENCE); if (prjp == null || !prjp.getResource().exists()) { prjp = new ProjectConfiguration(project); prjp.getVersion(); // initialize the configuration's version attribute prjp.load(); // initialize this instance from the stored values prjp.passivate(); // store this instance as a property on the IResource } return prjp; } catch (CoreException exc) { throw new InvocationTargetException(exc, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_RETRIEVE, new String[]{project.getName()})); } }
while (servletMappings.hasNext()) { if( _reporter.isCancelled() ){ String msg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_VALIDATOR_TERMINATED); status = WTPCommonPlugin.createCancelStatus(msg);
/** * Load and store the version number, but nothing else. The version isn't a preference, but it's * stored and loaded as if it is. Because the load mechanism is different between an IProject * and the IWorkspaceRoot, keep the load mechanism inside the ValidationConfiguration * implementation, but initialize only the minimum at first. After the project has been * migrated, load the other fields (loading the other fields before the migration may overwrite * the values of those fields). */ protected final void loadVersion() throws InvocationTargetException { if (getResource() == null) { throw new InvocationTargetException(null, ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_NULLRETRIEVE)); } IMarker[] marker = getMarker(); String version = null; if (marker == null) { // either a new workspace or already migrated; proceed as normal version = loadVersion(getResource()); } else { // migrate version = loadVersion(marker); } setVersion(version); }
String msg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_VALIDATOR_TERMINATED); status = WTPCommonPlugin.createCancelStatus(msg);