Skip to content

Commit 8567a08

Browse files
authored
Merge pull request #2720 from ControlSystemStudio/CSSTUDIO-1964
CSSTUDIO-1964 Add the option "org.csstudio.display.builder.model/enable_saved_on_comments"
2 parents ddefe76 + 8568dce commit 8567a08

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

app/display/model/src/main/java/org/csstudio/display/builder/model/Preferences.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public class Preferences
3535
@Preference public static boolean skip_defaults;
3636
/** Preference setting */
3737
@Preference(name="macros") private static String macro_spec;
38+
/** Preference setting */
39+
@Preference public static boolean enable_saved_on_comments;
3840
private static Macros macros;
3941

4042
static

app/display/model/src/main/java/org/csstudio/display/builder/model/persist/ModelWriter.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class ModelWriter implements Closeable
4343
{
4444
/** Add comments to the XML output? */
4545
public static boolean with_comments = Preferences.with_comments;
46+
public static boolean enable_saved_on_comment = Preferences.enable_saved_on_comments;
4647

4748
/** Default values are usually not written,
4849
* but for tests they can be included in the XML output.
@@ -83,7 +84,9 @@ public ModelWriter(final OutputStream stream) throws Exception
8384
writer = new IndentingXMLStreamWriter(base);
8485

8586
writer.writeStartDocument(XMLUtil.ENCODING, "1.0");
86-
writer.writeComment("Saved on " + TimestampFormats.SECONDS_FORMAT.format(Instant.now()) + " by " + System.getProperty("user.name"));
87+
if (enable_saved_on_comment) {
88+
writer.writeComment("Saved on " + TimestampFormats.SECONDS_FORMAT.format(Instant.now()) + " by " + System.getProperty("user.name"));
89+
}
8790
writer.writeStartElement(XMLTags.DISPLAY);
8891
writer.writeAttribute(XMLTags.VERSION, DisplayModel.VERSION.toString());
8992
}

app/display/model/src/main/resources/display_model_preferences.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,6 @@ with_comments=false
8585

8686
# When writing a display file, skip properties that are still at default values?
8787
skip_defaults=true
88+
89+
# Add a comment containing the date, time, and username when saving an OPI in the Display Editor.
90+
enable_saved_on_comments=true

app/display/model/src/test/java/org/csstudio/display/builder/model/AllWidgetsAllProperties.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public static void main(String[] args) throws Exception
5656
}
5757
ModelWriter.with_comments = true;
5858
ModelWriter.skip_defaults = false;
59+
ModelWriter.enable_saved_on_comment = true;
5960
try
6061
{
6162
final ModelWriter writer = new ModelWriter(new FileOutputStream(filename));

docs/source/preference_properties.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,9 @@ File ../../app/display/model/src/main/resources/display_model_preferences.proper
623623
# When writing a display file, skip properties that are still at default values?
624624
skip_defaults=true
625625

626+
# Add a comment containing the date, time, and username when saving an OPI in the Display Editor.
627+
enable_saved_on_comments=true
628+
626629

627630
display.builder.representation
628631
------------------------------

0 commit comments

Comments
 (0)