01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM - Initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.build.tasks;
11:
12: import java.io.PrintStream;
13: import org.apache.tools.ant.*;
14: import org.eclipse.core.runtime.IStatus;
15: import org.eclipse.core.runtime.Status;
16: import org.eclipse.osgi.util.NLS;
17: import org.eclipse.pde.internal.build.BundleHelper;
18: import org.eclipse.pde.internal.build.IPDEBuildConstants;
19:
20: /**
21: * A simple logger for an AntRunner that logs an exception (if
22: * one occurs) during a build. No messages are logged otherwise.
23: *
24: */
25: public class SimpleBuildLogger implements BuildLogger,
26: IPDEBuildConstants {
27:
28: /**
29: * Overwrite the DefaultLogger implementation to log
30: * an exception only if one occured.
31: */
32: public void buildFinished(BuildEvent event) {
33: Throwable exception = event.getException();
34:
35: if (exception != null) {
36: String message = NLS.bind(
37: TaskMessages.error_runningRetrieve, exception
38: .getMessage());
39: BundleHelper.getDefault().getLog().log(
40: new Status(IStatus.ERROR, PI_PDEBUILD, message));
41: }
42: }
43:
44: public void setEmacsMode(boolean emacsMode) {
45: // Do nothing
46: }
47:
48: public void setErrorPrintStream(PrintStream err) {
49: // Do nothing
50: }
51:
52: public void setMessageOutputLevel(int level) {
53: // Do nothing
54: }
55:
56: public void setOutputPrintStream(PrintStream output) {
57: // Do nothing
58: }
59:
60: public void buildStarted(BuildEvent event) {
61: // Do nothing
62: }
63:
64: public void messageLogged(BuildEvent event) {
65: // Do nothing
66: }
67:
68: public void targetFinished(BuildEvent event) {
69: // Do nothing
70: }
71:
72: public void targetStarted(BuildEvent event) {
73: // Do nothing
74: }
75:
76: public void taskFinished(BuildEvent event) {
77: // Do nothing
78: }
79:
80: public void taskStarted(BuildEvent event) {
81: // Do nothing
82: }
83: }
|