[#2456] Save warning priority in .ork
This commit is contained in:
		
							parent
							
								
									7d23bb58ee
								
							
						
					
					
						commit
						90599bce02
					
				@ -216,23 +216,8 @@ public class OpenRocketSaver extends RocketSaver {
 | 
			
		||||
	private int calculateNecessaryFileVersion(OpenRocketDocument document, StorageOptions opts) {
 | 
			
		||||
		/*
 | 
			
		||||
		 * NOTE:  Remember to update the supported versions in DocumentConfig as well!
 | 
			
		||||
		 * 
 | 
			
		||||
		 * File version 1.9 is required for:
 | 
			
		||||
		 *  - new-style positioning
 | 
			
		||||
		 *  - external/parallel booster stages
 | 
			
		||||
		 *  - external pods
 | 
			
		||||
		 *  - Rail Buttons
 | 
			
		||||
		 *  - Flight event source saving
 | 
			
		||||
		 *  
 | 
			
		||||
		 * Otherwise use version 1.9.
 | 
			
		||||
		 */
 | 
			
		||||
		
 | 
			
		||||
		/////////////////
 | 
			
		||||
		// Version 1.9 //
 | 
			
		||||
		/////////////////
 | 
			
		||||
		// for any new-style positioning:  'axialoffset', 'angleoffset', 'radiusoffset' tags
 | 
			
		||||
		// these tags are used for any RocketComponent child classes positioning... so... ALL the classes.
 | 
			
		||||
		return FILE_VERSION_DIVISOR + 9;
 | 
			
		||||
		return FILE_VERSION_DIVISOR + 10;
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
@ -409,7 +394,7 @@ public class OpenRocketSaver extends RocketSaver {
 | 
			
		||||
			indent++;
 | 
			
		||||
			
 | 
			
		||||
			for (Warning w : data.getWarningSet()) {
 | 
			
		||||
				writeElement("warning", TextUtil.escapeXML(w.toString()));
 | 
			
		||||
				writeElementWithAttribute("warning", "priority", w.getPriority().getExportLabel(), TextUtil.escapeXML(w.toString()));
 | 
			
		||||
			}
 | 
			
		||||
			
 | 
			
		||||
			// Check whether to store data
 | 
			
		||||
@ -606,6 +591,12 @@ public class OpenRocketSaver extends RocketSaver {
 | 
			
		||||
			content = "";
 | 
			
		||||
		writeln("<" + element + ">" + TextUtil.escapeXML(content) + "</" + element + ">");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private void writeElementWithAttribute(String element, String attributeName, String attribute, Object content) throws IOException {
 | 
			
		||||
		content = content == null ? "" : content;
 | 
			
		||||
 | 
			
		||||
		writeln("<" + element + " " + attributeName + " = \"" + attribute + "\">" + TextUtil.escapeXML(content) + "</" + element + ">");
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
@ -52,7 +52,7 @@ import net.sf.openrocket.util.Reflection;
 | 
			
		||||
class DocumentConfig {
 | 
			
		||||
	
 | 
			
		||||
	/* Remember to update OpenRocketSaver as well! */
 | 
			
		||||
	public static final String[] SUPPORTED_VERSIONS = { "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9" };
 | 
			
		||||
	public static final String[] SUPPORTED_VERSIONS = { "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "1.10" };
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * Divisor used in converting an integer version to the point-represented version.
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,7 @@ import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import net.sf.openrocket.logging.MessagePriority;
 | 
			
		||||
import net.sf.openrocket.logging.Warning;
 | 
			
		||||
import net.sf.openrocket.logging.WarningSet;
 | 
			
		||||
import net.sf.openrocket.file.DocumentLoadingContext;
 | 
			
		||||
@ -83,7 +84,9 @@ class FlightDataHandler extends AbstractElementHandler {
 | 
			
		||||
				branches.add(branch);
 | 
			
		||||
			}
 | 
			
		||||
		} else if (element.equals("warning")) {
 | 
			
		||||
			warningSet.add(Warning.fromString(content));
 | 
			
		||||
			String priorityStr = attributes.get("priority");
 | 
			
		||||
			MessagePriority priority = MessagePriority.fromExportLabel(priorityStr);
 | 
			
		||||
			warningSet.add(Warning.fromString(content, priority));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
@ -64,5 +64,8 @@ The following file format versions exist:
 | 
			
		||||
      Rename <position> to <axialoffset> (<position> remains for backward compatibility)
 | 
			
		||||
      Rename <rotation> to <angleoffset> (<rotation> remains for backward compatibility)
 | 
			
		||||
 | 
			
		||||
1.9:  Introduced with OpenRocket 23.xx.
 | 
			
		||||
      Added ID for each rocket component, to in turn add this ID as a source for flight events.
 | 
			
		||||
1.9:  Introduced with OpenRocket 23.09.
 | 
			
		||||
      Added ID for each rocket component, to in turn add this ID as a source for flight events.
 | 
			
		||||
 | 
			
		||||
1.10: Introduced with OpenRocket 24.XX.
 | 
			
		||||
      Added a priority attribute to simulation warnings.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user