Lines 41-47
Link Here
|
41 |
|
41 |
|
42 |
package org.apache.tools.ant.module.run; |
42 |
package org.apache.tools.ant.module.run; |
43 |
|
43 |
|
|
|
44 |
import java.awt.Color; |
44 |
import java.io.File; |
45 |
import java.io.File; |
|
|
46 |
import java.io.IOException; |
45 |
import java.io.PrintWriter; |
47 |
import java.io.PrintWriter; |
46 |
import java.io.StringWriter; |
48 |
import java.io.StringWriter; |
47 |
import java.net.MalformedURLException; |
49 |
import java.net.MalformedURLException; |
Lines 61-66
Link Here
|
61 |
import org.openide.filesystems.FileUtil; |
63 |
import org.openide.filesystems.FileUtil; |
62 |
import org.openide.util.NbBundle; |
64 |
import org.openide.util.NbBundle; |
63 |
import org.openide.util.lookup.ServiceProvider; |
65 |
import org.openide.util.lookup.ServiceProvider; |
|
|
66 |
import org.openide.windows.IOColorLines; |
67 |
import org.openide.windows.InputOutput; |
64 |
import org.openide.windows.OutputListener; |
68 |
import org.openide.windows.OutputListener; |
65 |
|
69 |
|
66 |
/** |
70 |
/** |
Lines 233-239
Link Here
|
233 |
time = mockTotalTime; |
237 |
time = mockTotalTime; |
234 |
} |
238 |
} |
235 |
if (t == null) { |
239 |
if (t == null) { |
236 |
session.println(formatMessageWithTime("FMT_finished_target_printed", time), false, null); |
240 |
formatColoredMessageWithTime(session, "FMT_finished_target_printed", false, time); |
237 |
StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(StandardLogger.class, "FMT_finished_target_status", session.getDisplayName())); |
241 |
StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(StandardLogger.class, "FMT_finished_target_status", session.getDisplayName())); |
238 |
} else { |
242 |
} else { |
239 |
if (isStopException(t.getCause())) { |
243 |
if (isStopException(t.getCause())) { |
Lines 263-272
Link Here
|
263 |
} |
267 |
} |
264 |
} |
268 |
} |
265 |
if (isStopException(t)) { |
269 |
if (isStopException(t)) { |
266 |
event.getSession().println(formatMessageWithTime("FMT_target_stopped_printed", time), true, null); |
270 |
formatColoredMessageWithTime(session, "FMT_target_stopped_printed", true, time); |
267 |
StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(StandardLogger.class, "FMT_target_stopped_status", event.getSession().getDisplayName())); |
271 |
StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(StandardLogger.class, "FMT_target_stopped_status", event.getSession().getDisplayName())); |
268 |
} else { |
272 |
} else { |
269 |
event.getSession().println(formatMessageWithTime("FMT_target_failed_printed", time), true, null); // #10305 |
273 |
formatColoredMessageWithTime(session, "FMT_target_failed_printed", true, time); |
270 |
StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(StandardLogger.class, "FMT_target_failed_status", event.getSession().getDisplayName())); |
274 |
StatusDisplayer.getDefault().setStatusText(NbBundle.getMessage(StandardLogger.class, "FMT_target_failed_status", event.getSession().getDisplayName())); |
271 |
} |
275 |
} |
272 |
} |
276 |
} |
Lines 290-300
Link Here
|
290 |
* Total time: {0} minutes |
294 |
* Total time: {0} minutes |
291 |
* {1} seconds |
295 |
* {1} seconds |
292 |
*/ |
296 |
*/ |
293 |
private static String formatMessageWithTime(String key, long millis) { |
297 |
private static void formatColoredMessageWithTime(AntSession session, String key, boolean error, long millis) { |
294 |
int secs = (int) (millis / 1000); |
298 |
int secs = (int) (millis / 1000); |
295 |
int minutes = secs / 60; |
299 |
int minutes = secs / 60; |
296 |
int seconds = secs % 60; |
300 |
int seconds = secs % 60; |
297 |
return NbBundle.getMessage(StandardLogger.class, key, minutes, seconds); |
301 |
String msg = NbBundle.getMessage(StandardLogger.class, key, minutes, seconds); |
|
|
302 |
InputOutput io = session.getIO(); |
303 |
if (IOColorLines.isSupported(io)) { |
304 |
try { |
305 |
IOColorLines.println(io, msg, error ? Color.RED : Color.GREEN); |
306 |
return; |
307 |
} catch (IOException x) { |
308 |
ERR.log(Level.INFO, null, x); |
309 |
} |
310 |
} |
311 |
session.println(msg, error, null); |
298 |
} |
312 |
} |
299 |
|
313 |
|
300 |
@Override |
314 |
@Override |