From 9400f7509c97db2706f8d36f816b7719c11fcb4d Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 10 Apr 2013 19:29:00 +0000 Subject: Allow to set title in dialog, use it for overwrite git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@344 174cde9d-5d70-4d2a-aa98-46368bc2aaf7 --- .../at/asit/pdfover/gui/composites/OutputComposite.java | 2 +- .../src/main/java/at/asit/pdfover/gui/controls/Dialog.java | 13 ++++++------- .../main/java/at/asit/pdfover/gui/controls/ErrorDialog.java | 5 ++++- .../main/resources/at/asit/pdfover/gui/messages.properties | 1 + .../resources/at/asit/pdfover/gui/messages_de.properties | 1 + 5 files changed, 13 insertions(+), 9 deletions(-) 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 492e9f9f..8c9e21c1 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 @@ -265,7 +265,7 @@ public class OutputComposite extends StateComposite { targetFile = new File(inputFolder, target); if (targetFile.exists()) { - Dialog dialog = new Dialog(this.getShell(), + Dialog dialog = new Dialog(this.getShell(), Messages.getString("common.warning"), //$NON-NLS-1$ String.format(Messages.getString("output.file_ask_overwrite"), targetFile.getName()), //$NON-NLS-1$ BUTTONS.OK_CANCEL, ICON.QUESTION); if (dialog.open() == SWT.CANCEL) diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/Dialog.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/Dialog.java index e6f62637..c86b0e31 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/Dialog.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/Dialog.java @@ -20,8 +20,6 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; -import at.asit.pdfover.gui.utils.Messages; - /** * A Message dialog */ @@ -61,15 +59,16 @@ public class Dialog { /** * @param parent The parent shell - * @param message The error message + * @param title The dialog title + * @param message The dialog message * @param button The BUTTONS to be shown * @param icon The ICON to be displayed */ - public Dialog(Shell parent, String message, BUTTONS button, ICON icon) { - this.initialize(parent, message, button, icon); + public Dialog(Shell parent, String title, String message, BUTTONS button, ICON icon) { + this.initialize(parent, title, message, button, icon); } - private void initialize(Shell parent, String message, BUTTONS button, ICON icon) { + private void initialize(Shell parent, String title, String message, BUTTONS button, ICON icon) { int boxstyle = 0; switch (icon) { case ERROR: @@ -106,7 +105,7 @@ public class Dialog { this.box = new MessageBox(parent, boxstyle); this.box.setMessage(message); - this.box.setText(Messages.getString("error.Title")); //$NON-NLS-1$ + this.box.setText(title); } /** diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java index 6ae8af0e..91100355 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/ErrorDialog.java @@ -18,6 +18,8 @@ package at.asit.pdfover.gui.controls; // Imports import org.eclipse.swt.widgets.Shell; +import at.asit.pdfover.gui.utils.Messages; + /** * An error dialog */ @@ -28,6 +30,7 @@ public class ErrorDialog extends Dialog { * @param button The buttons to be shown */ public ErrorDialog(Shell parent, String message, BUTTONS button) { - super(parent, message, button, ICON.ERROR); + super(parent, Messages.getString("error.Title"), //$NON-NLS-1$ + message, button, ICON.ERROR); } } diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties index f9b9ef5e..5b945769 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages.properties @@ -55,6 +55,7 @@ common.PNGExtension_Description=PNG files common.Save=&Save common.browse=&Browse common.open=Open +common.warning=Warning config.Advanced=Ad&vanced config.Simple=Basi&c dataSourceSelection.DropLabel=Drag document here diff --git a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties index 00f37fbd..a4f0dd8f 100644 --- a/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties +++ b/pdf-over-gui/src/main/resources/at/asit/pdfover/gui/messages_de.properties @@ -55,6 +55,7 @@ common.PNGExtension_Description=PNG-Bilder common.Save=&Speichern common.browse=&Durchsuchen common.open=Öffnen +common.warning=Warnung config.Advanced=Er&weitert config.Simple=&Einfach dataSourceSelection.DropLabel=Dokument hierher ziehen -- cgit v1.2.3