# HG changeset patch # Parent 9680fa925904e0af4213c8f101d4989a93b78b20 Sample usage of @NbBundle.Messages. diff --git a/hudson/src/org/netbeans/modules/hudson/ui/notification/Bundle.properties b/hudson/src/org/netbeans/modules/hudson/ui/notification/Bundle.properties deleted file mode 100644 --- a/hudson/src/org/netbeans/modules/hudson/ui/notification/Bundle.properties +++ /dev/null @@ -1,56 +0,0 @@ -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. -# -# Copyright 2010 Oracle and/or its affiliates. All rights reserved. -# -# Oracle and Java are registered trademarks of Oracle and/or its affiliates. -# Other names may be trademarks of their respective owners. -# -# The contents of this file are subject to the terms of either the GNU -# General Public License Version 2 only ("GPL") or the Common -# Development and Distribution License("CDDL") (collectively, the -# "License"). You may not use this file except in compliance with the -# License. You can obtain a copy of the License at -# http://www.netbeans.org/cddl-gplv2.html -# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the -# specific language governing permissions and limitations under the -# License. When distributing the software, include this License Header -# Notice in each file and include the License file at -# nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the GPL Version 2 section of the License file that -# accompanied this code. If applicable, add the following below the -# License Header, with the fields enclosed by brackets [] replaced by -# your own identifying information: -# "Portions Copyrighted [year] [name of copyright owner]" -# -# If you wish your version of this file to be governed by only the CDDL -# or only the GPL Version 2, indicate your decision by adding -# "[Contributor] elects to include this software in this distribution -# under the [CDDL or GPL Version 2] license." If you do not indicate a -# single choice of license, a recipient has the option to distribute -# your version of this file under either the CDDL, the GPL Version 2 or -# to extend the choice of license to its licensees as provided above. -# However, if you add GPL Version 2 code and therefore, elected the GPL -# Version 2 license, then the option applies only if the new code is -# made subject to such option by the copyright holder. -# -# Contributor(s): -# -# 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. -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.Messages; import org.openide.util.RequestProcessor; +import static org.netbeans.modules.hudson.ui.notification.Bundle.*; /** * Build failed or was unstable. @@ -76,14 +77,21 @@ this.failed = failed; } + @Messages({ + "ProblemNotification.title.failed={0} #{1,number,#} failed", + "ProblemNotification.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 ? ProblemNotification_title_failed(job.getDisplayName(), build) : ProblemNotification_title_unstable(job.getDisplayName(), build); } + @Messages({ + "ProblemNotification.description.failed=The build failed.", + "ProblemNotification.description.unstable=Some tests failed." + }) String showFailureText() { - return NbBundle.getMessage(ProblemNotification.class, failed ? "ProblemNotification.description.failed" : "ProblemNotification.description.unstable"); + return failed ? ProblemNotification_description_failed() : ProblemNotification_description_unstable(); } void showFailure() { @@ -113,10 +121,14 @@ }); } + @Messages({ + "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.", + "ProblemNotification.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()), + ProblemNotification_ignore_question(job.getDisplayName(), job.getInstance().getName()), + ProblemNotification_ignore_title(job.getDisplayName()), NotifyDescriptor.OK_CANCEL_OPTION)) == NotifyDescriptor.OK_OPTION) { job.setSalient(false); } diff --git a/hudson/src/org/netbeans/modules/hudson/ui/notification/ProblemPanel.form b/hudson/src/org/netbeans/modules/hudson/ui/notification/ProblemPanel.form --- a/hudson/src/org/netbeans/modules/hudson/ui/notification/ProblemPanel.form +++ b/hudson/src/org/netbeans/modules/hudson/ui/notification/ProblemPanel.form @@ -1,4 +1,4 @@ - +
@@ -50,7 +50,6 @@ - @@ -61,8 +60,8 @@ - - + + @@ -74,7 +73,6 @@ - diff --git a/hudson/src/org/netbeans/modules/hudson/ui/notification/ProblemPanel.java b/hudson/src/org/netbeans/modules/hudson/ui/notification/ProblemPanel.java --- a/hudson/src/org/netbeans/modules/hudson/ui/notification/ProblemPanel.java +++ b/hudson/src/org/netbeans/modules/hudson/ui/notification/ProblemPanel.java @@ -44,6 +44,8 @@ import java.awt.Cursor; import javax.swing.JPanel; +import org.openide.util.NbBundle.Messages; +import static org.netbeans.modules.hudson.ui.notification.Bundle.*; class ProblemPanel extends JPanel { @@ -60,6 +62,10 @@ ignore.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); } + @Messages( + // XXX not yet really supported by form editor + {"ProblemPanel.ignore.text=Ignore"} + ) // //GEN-BEGIN:initComponents private void initComponents() { @@ -76,7 +82,6 @@ showFailure.setFocusPainted(false); showFailure.setFocusable(false); showFailure.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); - showFailure.setOpaque(false); showFailure.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { showFailureActionPerformed(evt); @@ -84,14 +89,13 @@ }); ignore.setForeground(java.awt.Color.blue); - ignore.setText(org.openide.util.NbBundle.getMessage(ProblemPanel.class, "ProblemPanel.ignore.text")); // NOI18N + ignore.setText(ProblemPanel_ignore_text()); ignore.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); ignore.setBorderPainted(false); ignore.setContentAreaFilled(false); ignore.setFocusPainted(false); ignore.setFocusable(false); ignore.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); - ignore.setOpaque(false); ignore.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ignoreActionPerformed(evt); @@ -103,14 +107,14 @@ layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(showFailure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(ignore, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ignore) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(showFailure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(ignore, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(ignore)) ); }// //GEN-END:initComponents