/** * @see org.eclipse.wst.validation.internal.operations.internal.attribute.ValidationConfiguration#serialize() */ public String serialize() throws InvocationTargetException { StringBuffer buffer = new StringBuffer(); buffer.append(ConfigurationConstants.SAVE_AUTOMATICALLY_SETTING); buffer.append(String.valueOf(getSaveAutomatically())); buffer.append(ConfigurationConstants.PREF_PROJECTS_CAN_OVERRIDE); buffer.append(String.valueOf(canProjectsOverride())); buffer.append(super.serialize()); return buffer.toString(); }
protected void copyTo(GlobalConfiguration gp) throws InvocationTargetException { super.copyTo(gp); // Need to have a distinct method for this child class (i.e., the parameter // is not a ValidationConfiguration) because if this initialization is // called as part of ValidationConfiguration's constructor, then the value of // this field is overwritten. Fields of this class are initialized to the // default after the ValidationConfiguration parent is created. gp.setCanProjectsOverride(canProjectsOverride()); gp.setSaveAutomatically(getSaveAutomatically()); }
/** * Return the ValidationConfiguration to use, whether global or project. */ public boolean useGlobalPreference() { try { GlobalConfiguration gp = ConfigurationManager.getManager().getGlobalConfiguration(); if (gp == null) { return false; } if (!gp.canProjectsOverride()) { // If project's can't override the global, use the global return true; } // If the project overrides, then don't use the global. // If the project does not override, use the global. return !_doesProjectOverride; } catch (InvocationTargetException exc) { Logger logger = ValidationPlugin.getPlugin().getMsgLogger(); if (logger.isLoggingLevel(Level.SEVERE)) { LogEntry entry = ValidationPlugin.getLogEntry(); entry.setSourceIdentifier("ProjectConfiguration.userGlobalPreference"); //$NON-NLS-1$ entry.setTargetException(exc); logger.write(Level.SEVERE, entry); } return false; } }