Skip to content

Commit b5f7503

Browse files
Fix CR problems
1 parent 5f523cc commit b5f7503

File tree

8 files changed

+46
-47
lines changed

8 files changed

+46
-47
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The following options can be set for DITA topics or maps (or both):
2121

2222
- **Author**: Specifies the name of the author. By default, it is the system user name.
2323
- **Enable automatic prolog update on save**: When this option is selected, the prolog is updated anytime the document is saved.
24-
- **Set the creator name**: When this option is selected, the author is set as the document's *creator* in the prolog when the document is saved. This option is only applicable for new documents.
25-
- **Set the created date**: When this option is selected, a *created date* is added to the prolog when the document is saved. This option is only applicable for new documents.
26-
- **Update the contributor names**: When this option is selected, the author is set as a *contributor* in the prolog when the document is saved. This option is only applicable for already existing documents.
27-
- **Update the revised dates**: When this option is selected, a *revised date* is added to the prolog when the document is saved. This option is only applicable for already existing documents.
24+
- **Set creator name**: When this option is selected, the author is set as the document's *creator* in the prolog when the document is saved. This option is only applicable for new documents.
25+
- **Set created date**: When this option is selected, a *created date* is added to the prolog when the document is saved. This option is only applicable for new documents.
26+
- **Update contributor names**: When this option is selected, the author is set as a *contributor* in the prolog when the document is saved. This option is only applicable for already existing documents.
27+
- **Update revised dates**: When this option is selected, a *revised date* is added to the prolog when the document is saved. This option is only applicable for already existing documents.

i18n/translation.xml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,35 +44,35 @@
4444
</key>
4545
<key value="prolog.updater.set.creator">
4646
<comment>The text from the check box which set the creator</comment>
47-
<val lang="en_US">Set the creator name</val>
48-
<val lang="de_DE">Set the creator name</val>
49-
<val lang="fr_FR">Set the creator name</val>
50-
<val lang="ja_JP">Set the creator name</val>
51-
<val lang="nl_NL">Set the creator name</val>
47+
<val lang="en_US">Set creator name</val>
48+
<val lang="de_DE">Set creator name</val>
49+
<val lang="fr_FR">Set creator name</val>
50+
<val lang="ja_JP">Set creator name</val>
51+
<val lang="nl_NL">Set creator name</val>
5252
</key>
5353
<key value="prolog.updater.set.created.date">
5454
<comment>The text from the check box which set the created date</comment>
55-
<val lang="en_US">Set the created date</val>
56-
<val lang="de_DE">Set the created date</val>
57-
<val lang="fr_FR">Set the created date</val>
58-
<val lang="ja_JP">Set the created date</val>
59-
<val lang="nl_NL">Set the created date</val>
55+
<val lang="en_US">Set created date</val>
56+
<val lang="de_DE">Set created date</val>
57+
<val lang="fr_FR">Set created date</val>
58+
<val lang="ja_JP">Set created date</val>
59+
<val lang="nl_NL">Set created date</val>
6060
</key>
6161
<key value="prolog.updater.update.contributor">
6262
<comment>The text from the check box which set the contributor</comment>
63-
<val lang="en_US">Update the contributor names</val>
64-
<val lang="de_DE">Update the contributor names</val>
65-
<val lang="fr_FR">Update the contributor names</val>
66-
<val lang="ja_JP">Update the contributor names</val>
67-
<val lang="nl_NL">Update the contributor names</val>
63+
<val lang="en_US">Update contributor names</val>
64+
<val lang="de_DE">Update contributor names</val>
65+
<val lang="fr_FR">Update contributor names</val>
66+
<val lang="ja_JP">Update contributor names</val>
67+
<val lang="nl_NL">Update contributor names</val>
6868
</key>
6969
<key value="prolog.updater.update.revised.dates">
7070
<comment>The text from the check box which set the revised date</comment>
71-
<val lang="en_US">Update the revised dates</val>
72-
<val lang="de_DE">Update the revised dates</val>
73-
<val lang="fr_FR">Update the revised dates</val>
74-
<val lang="ja_JP">Update the revised dates</val>
75-
<val lang="nl_NL">Update the revised dates</val>
71+
<val lang="en_US">Update revised dates</val>
72+
<val lang="de_DE">Update revised dates</val>
73+
<val lang="fr_FR">Update revised dates</val>
74+
<val lang="ja_JP">Update revised dates</val>
75+
<val lang="nl_NL">Update revised dates</val>
7676
</key>
7777

7878
<key value="prolog.updater.error.message">

src/main/java/com/oxygenxml/prolog/updater/dita/editor/DitaTopicTextEditor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class DitaTopicTextEditor implements DitaEditor {
3535
/**
3636
* Text document controller
3737
*/
38-
TextDocumentController documentController;
38+
private TextDocumentController documentController;
3939

4040
/**
4141
* The page from Workspace text editor.

src/main/java/com/oxygenxml/prolog/updater/prolog/content/PrologContentCreator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
*/
2222
public class PrologContentCreator {
2323

24+
/**
25+
* Date pattern.
26+
*/
27+
public static final String DATE_PATTERN = "yyyy/MM/dd";
28+
2429
/**
2530
* XML fragment for author that has type creator.
2631
*/
@@ -45,6 +50,7 @@ public class PrologContentCreator {
4550
* The local date in format "yyyy/MM/dd".
4651
*/
4752
private String localDate;
53+
4854
/**
4955
* The name of the author
5056
*/
@@ -304,7 +310,7 @@ public String getDateFragment(boolean isNewDocument, DocumentType documentType)
304310
* @return The local date in String format.
305311
*/
306312
protected String createLocalDate() {
307-
return new SimpleDateFormat(XMLFragmentUtils.DATE_PATTERN).format(new Date());
313+
return new SimpleDateFormat(DATE_PATTERN).format(new Date());
308314
}
309315

310316
/**

src/main/java/com/oxygenxml/prolog/updater/tags/Tags.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,22 @@ private Tags() {
3636
public static final String ENABLE_UPDATE_ON_SAVE = "prolog.updater.enable.on.save";
3737

3838
/**
39-
* en: Set the creator name
39+
* en: Set creator name
4040
*/
4141
public static final String SET_CREATOR = "prolog.updater.set.creator";
4242

4343
/**
44-
* en: Set the created date
44+
* en: Set created date
4545
*/
4646
public static final String SET_CREATED_DATE = "prolog.updater.set.created.date";
4747

4848
/**
49-
* en: Update the contributor names
49+
* en: Update contributor names
5050
*/
5151
public static final String UPDATE_CONTRIBUTOR = "prolog.updater.update.contributor";
5252

5353
/**
54-
* en: Update the revised dates
54+
* en: Update revised dates
5555
*/
5656
public static final String UPDATE_REVISED_DATES = "prolog.updater.update.revised.dates";
5757

src/main/java/com/oxygenxml/prolog/updater/utils/AuthorPageDocumentUtil.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,7 @@ public static void insertFragmentSchemaAware(final WSEditorPage page, final Auth
170170
}
171171

172172
try {
173-
if (caretOffset != -1) {
174-
position = controller.createPositionInContent(caretOffset);
175-
}
173+
position = controller.createPositionInContent(caretOffset);
176174
} catch (BadLocationException e) {
177175
logger.debug(e.getMessage(), e);
178176
}
@@ -220,16 +218,16 @@ public static void insertFragmentSchemaAware(final WSEditorPage page,
220218
if (page instanceof WSAuthorEditorPage) {
221219
caretOffset = ((WSAuthorEditorPage) page).getCaretOffset();
222220
}
223-
if (caretOffset != -1) {
224-
try {
225-
pos = documentController.createPositionInContent(caretOffset);
226-
} catch (BadLocationException e) {
227-
logger.debug(e.getMessage(), e);
228-
}
221+
try {
222+
pos = documentController.createPositionInContent(caretOffset);
223+
} catch (BadLocationException e) {
224+
logger.debug(e.getMessage(), e);
229225
}
230226

227+
// Insert the fragment.
231228
documentController.insertXMLFragmentSchemaAware(xmlFragment, xPath, position);
232229

230+
// Restore the caret position.
233231
if (pos != null) {
234232
((WSAuthorEditorPage) page).setCaretPosition(pos.getOffset());
235233
}

src/main/java/com/oxygenxml/prolog/updater/utils/TextPageDocumentUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private static String prettyPrintFragment(WSXMLTextEditorPage wsTextEditorPage,
112112
// Pretty print moves to next line. We don't want that.
113113
if (fragment.endsWith("\r\n")) {
114114
fragment = fragment.substring(0, fragment.length() - 2);
115-
} else if (fragment.endsWith("\n") || fragment.endsWith("\r\n") || fragment.endsWith("\r")) {
115+
} else if (fragment.endsWith("\n") || fragment.endsWith("\r")) {
116116
fragment = fragment.substring(0, fragment.length() - 1);
117117
}
118118
} catch (PrettyPrintException e) {

src/main/java/com/oxygenxml/prolog/updater/utils/XMLFragmentUtils.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
* @author adrian_sorop
77
*/
88
public class XMLFragmentUtils {
9-
/**
10-
* Date pattern.
11-
*/
12-
public static final String DATE_PATTERN = "yyyy/MM/dd";
139

1410
/**
1511
* Private constructor. Avoid instantiation.
@@ -25,15 +21,14 @@ private XMLFragmentUtils() {
2521
* @return The critdates element with the date.
2622
*/
2723
public static String createCritdateTag(String date) {
28-
if (date == null) {
29-
return null;
30-
} else {
24+
if (date != null) {
3125
StringBuilder sb = new StringBuilder();
3226
sb.append("<critdates>");
3327
sb.append(date);
3428
sb.append("</critdates>");
3529
return sb.toString();
3630
}
31+
return null;
3732
}
3833

3934
/**

0 commit comments

Comments
 (0)