# HG changeset patch # Parent dda6687cfa179c04cecbbdb152a67fc36c794fbb Sample usage of @NbBundle.Keys. diff --git a/hudson/src/org/netbeans/modules/hudson/ui/notification/Bundle.properties b/hudson/src/org/netbeans/modules/hudson/ui/notification/Bundle.properties --- a/hudson/src/org/netbeans/modules/hudson/ui/notification/Bundle.properties +++ b/hudson/src/org/netbeans/modules/hudson/ui/notification/Bundle.properties @@ -38,19 +38,5 @@ # # Portions Copyrighted 2009 Sun Microsystems, Inc. -# {0} - job name -# {1} - build number -ProblemNotification.title.failed={0} #{1,number,#} failed -# {0} - job name -# {1} - build number -ProblemNotification.title.unstable={0} #{1,number,#} is unstable -ProblemNotification.description.failed=The build failed. -ProblemNotification.description.unstable=Some tests failed. +# XXX convert to @NbBundle.Keys when Matisse supports it ProblemPanel.ignore.text=Ignore -# {0} - job name -ProblemNotification.ignore.title=Ignore Failures in {0} -# {0} - job name -# {1} - server name -ProblemNotification.ignore.question=\ - Do you wish to cease to receive notifications of failures in {0}? \ - If you change your mind, use Services > Hudson Builders > {1} > {0} > Properties > Watched. diff --git a/hudson/src/org/netbeans/modules/hudson/ui/notification/ProblemNotification.java b/hudson/src/org/netbeans/modules/hudson/ui/notification/ProblemNotification.java --- a/hudson/src/org/netbeans/modules/hudson/ui/notification/ProblemNotification.java +++ b/hudson/src/org/netbeans/modules/hudson/ui/notification/ProblemNotification.java @@ -55,8 +55,9 @@ import org.openide.awt.NotificationDisplayer; import org.openide.awt.NotificationDisplayer.Priority; import org.openide.util.ImageUtilities; -import org.openide.util.NbBundle; +import org.openide.util.NbBundle.Keys; import org.openide.util.RequestProcessor; +import static org.netbeans.modules.hudson.ui.notification.ProblemNotificationBundle.*; /** * Build failed or was unstable. @@ -76,14 +77,21 @@ this.failed = failed; } + @Keys({ + "title_failed={0} #{1,number,#} failed", + "title_unstable={0} #{1,number,#} is unstable" + }) private String getTitle() { // XXX use HudsonJobBuild.getDisplayName - return NbBundle.getMessage(ProblemNotification.class, failed ? "ProblemNotification.title.failed" : "ProblemNotification.title.unstable", - job.getDisplayName(), build); + return failed ? title_failed(job.getDisplayName(), build) : title_unstable(job.getDisplayName(), build); } + @Keys({ + "description_failed=The build failed.", + "description_unstable=Some tests failed." + }) String showFailureText() { - return NbBundle.getMessage(ProblemNotification.class, failed ? "ProblemNotification.description.failed" : "ProblemNotification.description.unstable"); + return failed ? description_failed() : description_unstable(); } void showFailure() { @@ -113,10 +121,14 @@ }); } + @Keys({ + "ignore_question=Do you wish to cease to receive notifications of failures in {0}? If you change your mind, use Services > Hudson Builders > {1} > {0} > Properties > Watched.", + "ignore_title=Ignore Failures in {0}" + }) void ignore() { // #161601 if (DialogDisplayer.getDefault().notify(new NotifyDescriptor.Confirmation( - NbBundle.getMessage(ProblemNotification.class, "ProblemNotification.ignore.question", job.getDisplayName(), job.getInstance().getName()), - NbBundle.getMessage(ProblemNotification.class, "ProblemNotification.ignore.title", job.getDisplayName()), + ignore_question(job.getDisplayName(), job.getInstance().getName()), + ignore_title(job.getDisplayName()), NotifyDescriptor.OK_CANCEL_OPTION)) == NotifyDescriptor.OK_OPTION) { job.setSalient(false); }