summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-11-16 12:12:11 +0100
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-11-16 12:12:11 +0100
commit41a1bc68b5b24f323aa89e39ec586b3c02935bee (patch)
treed1fdec6c0b8b2c3f59015246c72cbb2957f7cfaa
parent9a705e911485af200937ed4fbbd216f1ecefdea2 (diff)
downloadpdf-over-41a1bc68b5b24f323aa89e39ec586b3c02935bee.tar.gz
pdf-over-41a1bc68b5b24f323aa89e39ec586b3c02935bee.tar.bz2
pdf-over-41a1bc68b5b24f323aa89e39ec586b3c02935bee.zip
replace String.format(Messages.getString with Messages.formatString(
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreAliasDoesntExistException.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreAliasNoKeyException.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreDoesntExistException.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/OutputfolderDoesntExistException.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/OutputfolderNotADirectoryException.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/osx/CocoaUIEnhancer.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/UpdateCheckManager.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java4
16 files changed, 26 insertions, 26 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
index 9620cd0b..a382bf4d 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/MainWindow.java
@@ -354,7 +354,7 @@ public class MainWindow {
/* aboutListener */
(Event arg0) -> {
Dialog dialog = new Dialog(getShell(),
- String.format(Messages.getString("main.about"), Constants.APP_NAME),
+ Messages.formatString("main.about", Constants.APP_NAME),
Constants.APP_NAME_VERSION, BUTTONS.OK, ICON.INFORMATION);
dialog.open();
},
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java
index 0bcbdf17..852afecc 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java
@@ -205,7 +205,7 @@ public class DataSourceSelectComposite extends StateComposite {
// Only taking first file ...
File file = new File(files[0]);
if (!file.exists()) {
- log.error(String.format(Messages.getString("error.FileNotExist"), files[0]));
+ log.error(Messages.formatString("error.FileNotExist", files[0]));
return;
}
DataSourceSelectComposite.this.setSelected(file);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java
index bb21d4b6..96dc3982 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java
@@ -295,7 +295,7 @@ public class OutputComposite extends StateComposite {
if (targetFile.exists()) {
Dialog dialog = new Dialog(getShell(), Messages.getString("common.warning"),
- String.format(Messages.getString("output.file_ask_overwrite"), targetFile.getName()),
+ Messages.formatString("output.file_ask_overwrite", targetFile.getName()),
BUTTONS.OK_CANCEL, ICON.QUESTION);
if (dialog.open() == SWT.CANCEL)
{
@@ -316,7 +316,7 @@ public class OutputComposite extends StateComposite {
} catch (FileNotFoundException e) {
log.warn("Failed to open output file", e);
ErrorDialog dialog = new ErrorDialog(getShell(),
- String.format(Messages.getString("output.save_failed"),
+ Messages.formatString("output.save_failed",
targetFile.getName(), e.getLocalizedMessage()),
BUTTONS.RETRY_CANCEL);
if (dialog.open() == SWT.CANCEL)
@@ -325,7 +325,7 @@ public class OutputComposite extends StateComposite {
} catch (IOException e) {
log.error("I/O Error", e);
ErrorDialog dialog = new ErrorDialog(getShell(),
- String.format(Messages.getString("output.save_failed"),
+ Messages.formatString("output.save_failed",
targetFile.getName(), e.getLocalizedMessage()),
BUTTONS.RETRY_CANCEL);
if (dialog.open() == SWT.CANCEL)
@@ -412,7 +412,7 @@ public class OutputComposite extends StateComposite {
} catch (IOException ex) {
log.error("OpenSelectionListener: ", ex);
ErrorDialog error = new ErrorDialog(getShell(),
- String.format(Messages.getString("error.FailedToOpenDocument"),
+ Messages.formatString("error.FailedToOpenDocument",
ex.getLocalizedMessage()), BUTTONS.RETRY_CANCEL);
if (error.open() == SWT.RETRY)
widgetSelected(e);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
index 61e87b56..a477422e 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/KeystoreConfigurationComposite.java
@@ -238,8 +238,8 @@ public class KeystoreConfigurationComposite extends ConfigurationCompositeBase {
showErrorDialog(Messages.getString("error.KeyStore"));
} catch (FileNotFoundException ex) {
log.error("Error loading keystore", ex);
- showErrorDialog(String.format(Messages.getString(
- "error.KeyStoreFileNotExist"), f.getName()));
+ showErrorDialog(Messages.formatString(
+ "error.KeyStoreFileNotExist", f.getName()));
} catch (NoSuchAlgorithmException ex) {
log.error("Error loading keystore", ex);
showErrorDialog(Messages.getString("error.KeyStore"));
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java
index e4e3223e..27295b1d 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidEmblemFile.java
@@ -34,7 +34,7 @@ public class InvalidEmblemFile extends PDFOverGUIException {
* @param file
*/
public InvalidEmblemFile(final File file) {
- super(String.format(Messages.getString("exception.InvalidEmblemFile"), file.getAbsolutePath()));
+ super(Messages.formatString("exception.InvalidEmblemFile", file.getAbsolutePath()));
}
/**
@@ -43,6 +43,6 @@ public class InvalidEmblemFile extends PDFOverGUIException {
* @param reason
*/
public InvalidEmblemFile(final File file, Throwable reason) {
- super(String.format(Messages.getString("exception.InvalidEmblemFile"), file.getAbsolutePath()), reason);
+ super(Messages.formatString("exception.InvalidEmblemFile", file.getAbsolutePath()), reason);
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java
index 253f935d..96c09663 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/InvalidPortException.java
@@ -32,7 +32,7 @@ public class InvalidPortException extends PDFOverGUIException {
* @param port invalid port number
*/
public InvalidPortException(int port) {
- super(String.format(Messages.getString("exception.InvalidPort"), Integer.toString(port), 1, 0xffff));
+ super(Messages.formatString("exception.InvalidPort", Integer.toString(port), 1, 0xffff));
}
/**
@@ -41,6 +41,6 @@ public class InvalidPortException extends PDFOverGUIException {
* @param portString invalid port string
*/
public InvalidPortException(String portString, Throwable source) {
- super(String.format(Messages.getString("exception.InvalidPort"), portString, 1, 0xffff), source);
+ super(Messages.formatString("exception.InvalidPort", portString, 1, 0xffff), source);
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreAliasDoesntExistException.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreAliasDoesntExistException.java
index 8f817a8b..da1a2fe9 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreAliasDoesntExistException.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreAliasDoesntExistException.java
@@ -31,6 +31,6 @@ public class KeystoreAliasDoesntExistException extends ResumableException {
* @param resumeIndex The resume Index
*/
public KeystoreAliasDoesntExistException(final String alias, int resumeIndex) {
- super(String.format(Messages.getString("error.KeyStoreAliasExist"), alias), resumeIndex);
+ super(Messages.formatString("error.KeyStoreAliasExist", alias), resumeIndex);
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreAliasNoKeyException.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreAliasNoKeyException.java
index f4416e42..3b1d28cf 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreAliasNoKeyException.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreAliasNoKeyException.java
@@ -31,6 +31,6 @@ public class KeystoreAliasNoKeyException extends ResumableException {
* @param resumeIndex The resume Index
*/
public KeystoreAliasNoKeyException(final String alias, int resumeIndex) {
- super(String.format(Messages.getString("error.KeyStoreAliasNoKey"), alias), resumeIndex);
+ super(Messages.formatString("error.KeyStoreAliasNoKey", alias), resumeIndex);
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreDoesntExistException.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreDoesntExistException.java
index e1f19b72..9cd205d4 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreDoesntExistException.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/KeystoreDoesntExistException.java
@@ -33,6 +33,6 @@ public class KeystoreDoesntExistException extends ResumableException {
* @param resumeIndex The resume Index
*/
public KeystoreDoesntExistException(final File keystore, int resumeIndex) {
- super(String.format(Messages.getString("error.KeyStoreFileNotExist"), keystore.getPath()), resumeIndex);
+ super(Messages.formatString("error.KeyStoreFileNotExist", keystore.getPath()), resumeIndex);
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/OutputfolderDoesntExistException.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/OutputfolderDoesntExistException.java
index 607f27bf..cddaec98 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/OutputfolderDoesntExistException.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/OutputfolderDoesntExistException.java
@@ -33,7 +33,7 @@ public class OutputfolderDoesntExistException extends ResumableException {
* @param resumeIndex The resume Index
*/
public OutputfolderDoesntExistException(final File folder, int resumeIndex) {
- super(String.format(Messages.getString("exception.PathNotExist"), folder.getAbsolutePath()), resumeIndex);
+ super(Messages.formatString("exception.PathNotExist", folder.getAbsolutePath()), resumeIndex);
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/OutputfolderNotADirectoryException.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/OutputfolderNotADirectoryException.java
index 30ad642c..9355ff87 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/OutputfolderNotADirectoryException.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/exceptions/OutputfolderNotADirectoryException.java
@@ -34,6 +34,6 @@ public class OutputfolderNotADirectoryException extends PDFOverGUIException {
* @param folder The file
*/
public OutputfolderNotADirectoryException(File folder) {
- super(String.format(Messages.getString("exception.PathNotDirectory"), folder.getAbsolutePath()));
+ super(Messages.formatString("exception.PathNotDirectory", folder.getAbsolutePath()));
}
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/osx/CocoaUIEnhancer.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/osx/CocoaUIEnhancer.java
index ed3e0057..60e39aac 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/osx/CocoaUIEnhancer.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/osx/CocoaUIEnhancer.java
@@ -234,14 +234,14 @@ public class CocoaUIEnhancer {
final Object aboutMenuItem = invoke(nsmenuCls, appMenu, "itemAtIndex",
new Object[] { wrapPointer(kAboutMenuItem) });
final Object nsStrAbout = invoke(nsstringCls, "stringWith",
- new Object[] { String.format(Messages.getString("main.about"), Constants.APP_NAME) });
+ new Object[] { Messages.formatString("main.about", Constants.APP_NAME) });
invoke(nsmenuitemCls, aboutMenuItem, "setTitle",
new Object[] { nsStrAbout });
// Rename the quit action.
final Object quitMenuItem = invoke(nsmenuCls, appMenu,
"itemAtIndex", new Object[] { wrapPointer(kQuitMenuItem) });
final Object nsStrQuit = invoke(nsstringCls, "stringWith",
- new Object[] { String.format(Messages.getString("main.quit"), Constants.APP_NAME) });
+ new Object[] { Messages.formatString("main.quit", Constants.APP_NAME) });
invoke(nsmenuitemCls, quitMenuItem, "setTitle",
new Object[] { nsStrQuit });
@@ -250,7 +250,7 @@ public class CocoaUIEnhancer {
"itemAtIndex",
new Object[] { wrapPointer(kHideApplicationMenuItem) });
final Object nsStrHide = invoke(nsstringCls, "stringWith",
- new Object[] { String.format(Messages.getString("main.hide"), Constants.APP_NAME) });
+ new Object[] { Messages.formatString("main.hide", Constants.APP_NAME) });
invoke(nsmenuitemCls, hideMenuItem, "setTitle",
new Object[] { nsStrHide });
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java
index 792b2414..22e52467 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SWTUtils.java
@@ -57,7 +57,7 @@ public final class SWTUtils {
}
}
public static void setLocalizedText(Object o, String messageKey) { genericSetText(o, Messages.getString(messageKey)); }
- public static void setLocalizedText(Object o, String formatMessageKey, Object... formatArgs) { genericSetText(o, String.format(Messages.getString(formatMessageKey), formatArgs)); }
+ public static void setLocalizedText(Object o, String formatMessageKey, Object... formatArgs) { genericSetText(o, Messages.formatString(formatMessageKey, formatArgs)); }
private static void genericSetToolTipText(Object swtObj, String text) {
try {
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/UpdateCheckManager.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/UpdateCheckManager.java
index 095704b7..168f5b18 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/UpdateCheckManager.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/UpdateCheckManager.java
@@ -63,7 +63,7 @@ public final class UpdateCheckManager {
shell.getDisplay().asyncExec(() -> {
Dialog info = new Dialog(shell,
Messages.getString("version_check.UpdateTitle"),
- String.format(Messages.getString("version_check.UpdateText"), version),
+ Messages.formatString("version_check.UpdateText", version),
BUTTONS.OK_CANCEL, ICON.INFORMATION);
if (info.open() == SWT.OK)
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java
index 54730b10..42a2f605 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/KSState.java
@@ -59,12 +59,12 @@ public class KSState extends State {
private void showError(String messageKey, Object... args)
{
- new ErrorDialog(getStateMachine().getMainShell(), String.format(Messages.getString(messageKey), args), BUTTONS.OK).open();
+ new ErrorDialog(getStateMachine().getMainShell(), Messages.formatString(messageKey, args), BUTTONS.OK).open();
}
private boolean askShouldRetry(String messageKey, Object... args)
{
- return SWT.RETRY == (new ErrorDialog(getStateMachine().getMainShell(), String.format(Messages.getString(messageKey), args), BUTTONS.RETRY_CANCEL).open());
+ return SWT.RETRY == (new ErrorDialog(getStateMachine().getMainShell(), Messages.formatString(messageKey, args), BUTTONS.RETRY_CANCEL).open());
}
/*
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
index cec7acd5..d858c067 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
@@ -162,10 +162,10 @@ public class MobileBKUState extends State {
if (e instanceof UnknownHostException)
{
log.error("Failed to resolve hostname", e);
- message = String.format(Messages.getString("error.CouldNotResolveHostname"), e.getMessage());
+ message = Messages.formatString("error.CouldNotResolveHostname", e.getMessage());
} else if (e instanceof ConnectException) {
log.error("Failed to connect", e);
- message = String.format(Messages.getString("error.FailedToConnect"), e.getMessage());
+ message = Messages.formatString("error.FailedToConnect", e.getMessage());
} else {
message = Messages.getString("error.Unexpected");
log.error(message, e);