|
61 | 61 | import org.netbeans.modules.refactoring.spi.Transaction; |
62 | 62 | import org.openide.filesystems.FileObject; |
63 | 63 | import org.openide.util.Exceptions; |
| 64 | +import org.openide.util.NbBundle; |
64 | 65 |
|
65 | 66 | /** |
66 | 67 | * |
@@ -141,27 +142,32 @@ private static Problem prepare(AbstractRefactoring refactoring, RefactoringSessi |
141 | 142 | return p; |
142 | 143 | } |
143 | 144 |
|
| 145 | + @NbBundle.Messages({ |
| 146 | + "# {0} - problems message", |
| 147 | + "PROMPT_AskProceedWithRefactoringProblems=Refactoring may lead to following problems: {0}.\nDo you still want to proceed with the refactoring?", |
| 148 | + "PROMPT_AskProceedWithRefactoringProblems_Yes=Yes", |
| 149 | + "PROMPT_AskProceedWithRefactoringProblems_No=No", |
| 150 | + }) |
144 | 151 | private static ShowMessageRequestParams warningsMessageParams( |
145 | 152 | Problem p) { |
146 | | - final MessageActionItem yes = new MessageActionItem("Yes"); |
147 | | - final MessageActionItem no = new MessageActionItem("No"); |
| 153 | + final MessageActionItem yes = new MessageActionItem(Bundle.PROMPT_AskProceedWithRefactoringProblems_Yes()); |
| 154 | + final MessageActionItem no = new MessageActionItem(Bundle.PROMPT_AskProceedWithRefactoringProblems_No()); |
148 | 155 | ShowMessageRequestParams smrp = new ShowMessageRequestParams(Arrays.asList(yes, no)); |
149 | 156 | StringBuilder msgs = new StringBuilder(); |
150 | 157 | while (p != null) { |
151 | 158 | msgs.append(p.getMessage()); |
152 | 159 | msgs.append('\n'); |
153 | 160 | p = p.getNext(); |
154 | 161 | } |
155 | | - smrp.setMessage(String.format("Refactoring will lead to following problems \n %s ," |
156 | | - + "Do you want to proceed with the problems ?", msgs.toString())); |
| 162 | + smrp.setMessage(Bundle.PROMPT_AskProceedWithRefactoringProblems(msgs.toString())); |
157 | 163 | smrp.setType(MessageType.Warning); |
158 | 164 | return smrp; |
159 | 165 | } |
160 | 166 |
|
161 | 167 | private static void showRefactoringWarnings(NbCodeLanguageClient client,AbstractRefactoring refactoring,RefactoringSession session,Problem p) { |
162 | 168 | ShowMessageRequestParams smrp = warningsMessageParams(p); |
163 | 169 | client.showMessageRequest(smrp).thenAccept(ai -> { |
164 | | - if (ai.getTitle().equalsIgnoreCase("Yes")) { |
| 170 | + if (ai.getTitle().equalsIgnoreCase(Bundle.PROMPT_AskProceedWithRefactoringProblems_Yes())) { |
165 | 171 | try { |
166 | 172 | client.applyEdit(new ApplyWorkspaceEditParams(perform(refactoring, session))); |
167 | 173 | } catch (Exception ex) { |
|
0 commit comments