KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > build > tasks > SimpleBuildLogger


1 /*******************************************************************************
2  * Copyright (c) 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM - Initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.build.tasks;
12
13 import java.io.PrintStream JavaDoc;
14 import org.apache.tools.ant.*;
15 import org.eclipse.core.runtime.IStatus;
16 import org.eclipse.core.runtime.Status;
17 import org.eclipse.osgi.util.NLS;
18 import org.eclipse.pde.internal.build.BundleHelper;
19 import org.eclipse.pde.internal.build.IPDEBuildConstants;
20
21 /**
22  * A simple logger for an AntRunner that logs an exception (if
23  * one occurs) during a build. No messages are logged otherwise.
24  *
25  */

26 public class SimpleBuildLogger implements BuildLogger, 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 JavaDoc exception = event.getException();
34         
35         if(exception != null) {
36             String JavaDoc message = NLS.bind(TaskMessages.error_runningRetrieve, exception.getMessage());
37             BundleHelper.getDefault().getLog().log(new Status(IStatus.ERROR, PI_PDEBUILD, message));
38         }
39     }
40
41     public void setEmacsMode(boolean emacsMode) {
42         // Do nothing
43
}
44
45     public void setErrorPrintStream(PrintStream JavaDoc err) {
46         // Do nothing
47
}
48
49     public void setMessageOutputLevel(int level) {
50         // Do nothing
51
}
52
53     public void setOutputPrintStream(PrintStream JavaDoc output) {
54         // Do nothing
55
}
56
57     public void buildStarted(BuildEvent event) {
58         // Do nothing
59
}
60
61     public void messageLogged(BuildEvent event) {
62         // Do nothing
63
}
64
65     public void targetFinished(BuildEvent event) {
66         // Do nothing
67
}
68
69     public void targetStarted(BuildEvent event) {
70         // Do nothing
71
}
72
73     public void taskFinished(BuildEvent event) {
74         // Do nothing
75
}
76
77     public void taskStarted(BuildEvent event) {
78         // Do nothing
79
}
80 }
81
Popular Tags