author | psadhukhan |
Fri, 09 Nov 2018 09:29:43 +0530 | |
changeset 52543 | 3853631e6a07 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
41884
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
1 |
/* |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
4 |
* |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
10 |
* |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
15 |
* accompanied this code). |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
16 |
* |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
20 |
* |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
23 |
* questions. |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
24 |
*/ |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
25 |
|
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
26 |
package jdk.editpad; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
27 |
|
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
28 |
import java.awt.BorderLayout; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
29 |
import java.awt.FlowLayout; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
30 |
import java.awt.Font; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
31 |
import java.awt.event.ActionListener; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
32 |
import java.awt.event.KeyEvent; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
33 |
import java.awt.event.WindowAdapter; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
34 |
import java.awt.event.WindowEvent; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
35 |
import java.util.MissingResourceException; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
36 |
import java.util.ResourceBundle; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
37 |
import java.util.function.Consumer; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
38 |
import javax.swing.JButton; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
39 |
import javax.swing.JFrame; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
40 |
import javax.swing.JPanel; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
41 |
import javax.swing.JScrollPane; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
42 |
import javax.swing.JTextArea; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
43 |
|
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
44 |
/** |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
45 |
* A minimal Swing editor as a fallback when the user does not specify an |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
46 |
* external editor. |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
47 |
*/ |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
48 |
class EditPad implements Runnable { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
49 |
|
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
50 |
private static final String L10N_RB_NAME = "jdk.editpad.resources.l10n"; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
51 |
private ResourceBundle rb = null; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
52 |
private final String windowLabel; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
53 |
private final Consumer<String> errorHandler; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
54 |
private final String initialText; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
55 |
private final Runnable closeMark; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
56 |
private final Consumer<String> saveHandler; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
57 |
|
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
58 |
/** |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
59 |
* Create an Edit Pad minimal editor. |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
60 |
* |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
61 |
* @param windowLabel the label string for the Edit Pad window |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
62 |
* @param errorHandler a handler for unexpected errors |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
63 |
* @param initialText the source to load in the Edit Pad |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
64 |
* @param closeMark a Runnable that is run when Edit Pad closes |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
65 |
* @param saveHandler a handler for changed source (sent the full source) |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
66 |
*/ |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
67 |
EditPad(String windowLabel, Consumer<String> errorHandler, String initialText, |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
68 |
Runnable closeMark, Consumer<String> saveHandler) { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
69 |
this.windowLabel = windowLabel; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
70 |
this.errorHandler = errorHandler; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
71 |
this.initialText = initialText; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
72 |
this.closeMark = closeMark; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
73 |
this.saveHandler = saveHandler; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
74 |
} |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
75 |
|
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
76 |
@Override |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
77 |
public void run() { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
78 |
JFrame jframe = new JFrame(windowLabel == null |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
79 |
? getResourceString("editpad.name") |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
80 |
: windowLabel); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
81 |
Runnable closer = () -> { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
82 |
jframe.setVisible(false); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
83 |
jframe.dispose(); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
84 |
closeMark.run(); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
85 |
}; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
86 |
jframe.addWindowListener(new WindowAdapter() { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
87 |
@Override |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
88 |
public void windowClosing(WindowEvent e) { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
89 |
closer.run(); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
90 |
} |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
91 |
}); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
92 |
jframe.setLocationRelativeTo(null); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
93 |
jframe.setLayout(new BorderLayout()); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
94 |
JTextArea textArea = new JTextArea(initialText); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
95 |
textArea.setFont(new Font("monospaced", Font.PLAIN, 13)); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
96 |
jframe.add(new JScrollPane(textArea), BorderLayout.CENTER); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
97 |
jframe.add(buttons(closer, textArea), BorderLayout.SOUTH); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
98 |
|
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
99 |
jframe.setSize(800, 600); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
100 |
jframe.setVisible(true); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
101 |
} |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
102 |
|
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
103 |
private JPanel buttons(Runnable closer, JTextArea textArea) { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
104 |
FlowLayout flow = new FlowLayout(); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
105 |
flow.setHgap(35); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
106 |
JPanel buttons = new JPanel(flow); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
107 |
addButton(buttons, "editpad.cancel", KeyEvent.VK_C, e -> { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
108 |
closer.run(); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
109 |
}); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
110 |
addButton(buttons, "editpad.accept", KeyEvent.VK_A, e -> { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
111 |
saveHandler.accept(textArea.getText()); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
112 |
}); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
113 |
addButton(buttons, "editpad.exit", KeyEvent.VK_X, e -> { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
114 |
saveHandler.accept(textArea.getText()); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
115 |
closer.run(); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
116 |
}); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
117 |
return buttons; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
118 |
} |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
119 |
|
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
120 |
private void addButton(JPanel buttons, String rkey, int mnemonic, ActionListener action) { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
121 |
JButton but = new JButton(getResourceString(rkey)); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
122 |
but.setMnemonic(mnemonic); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
123 |
buttons.add(but); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
124 |
but.addActionListener(action); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
125 |
} |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
126 |
|
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
127 |
private String getResourceString(String key) { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
128 |
if (rb == null) { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
129 |
try { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
130 |
rb = ResourceBundle.getBundle(L10N_RB_NAME); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
131 |
} catch (MissingResourceException mre) { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
132 |
error("Cannot find ResourceBundle: %s", L10N_RB_NAME); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
133 |
return ""; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
134 |
} |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
135 |
} |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
136 |
String s; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
137 |
try { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
138 |
s = rb.getString(key); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
139 |
} catch (MissingResourceException mre) { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
140 |
error("Missing resource: %s in %s", key, L10N_RB_NAME); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
141 |
return ""; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
142 |
} |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
143 |
return s; |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
144 |
} |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
145 |
|
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
146 |
private void error(String fmt, Object... args) { |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
147 |
errorHandler.accept(String.format(fmt, args)); |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
148 |
} |
b7c2cc7a10fa
8168972: Editor support: move built-in and external editor support to the jdk repo
rfield
parents:
diff
changeset
|
149 |
} |