View | Details | Raw Unified | Return to bug 107535 | Differences between
and this patch

Collapse All | Expand All

(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-30 / +34 lines)
Lines 718-723 Link Here
718
		}
718
		}
719
719
720
		/**
720
		/**
721
		 * Print the usage of the compiler
721
		 * @param usage
722
		 * @param usage
722
		 */
723
		 */
723
		public void logUsage(String usage) {
724
		public void logUsage(String usage) {
Lines 725-744 Link Here
725
		}
726
		}
726
727
727
		/**
728
		/**
728
		 * 
729
		 * Print the version of the compiler in the log and/or the out field
729
		 */
730
		 */
730
		public void logVersion() {
731
		public void logVersion(final boolean printToOut) {
731
			this.printlnOut(Main.bind("misc.version", //$NON-NLS-1$
732
			if (this.log != null && !this.isXml) {
732
				new String[] {
733
				final String version = Main.bind("misc.version", //$NON-NLS-1$
733
					Main.bind("compiler.name"), //$NON-NLS-1$
734
					new String[] {
734
					Main.bind("compiler.version"), //$NON-NLS-1$
735
						Main.bind("compiler.name"), //$NON-NLS-1$
735
					Main.bind("compiler.copyright") //$NON-NLS-1$
736
						Main.bind("compiler.version"), //$NON-NLS-1$
736
				}
737
						Main.bind("compiler.copyright") //$NON-NLS-1$
737
			));
738
					}
739
				);
740
				this.log.println(version);
741
				if (printToOut) {
742
					this.out.println(version);
743
				}
744
			} else if (printToOut) {
745
				final String version = Main.bind("misc.version", //$NON-NLS-1$
746
					new String[] {
747
						Main.bind("compiler.name"), //$NON-NLS-1$
748
						Main.bind("compiler.version"), //$NON-NLS-1$
749
						Main.bind("compiler.copyright") //$NON-NLS-1$
750
					}
751
				);
752
				this.out.println(version);
753
			}
738
		}
754
		}
739
755
740
		/**
756
		/**
741
		 * 
757
		 * Print the usage of wrong JDK
742
		 */
758
		 */
743
		public void logWrongJDK() {
759
		public void logWrongJDK() {
744
			if (isXml) {
760
			if (isXml) {
Lines 806-833 Link Here
806
		}
822
		}
807
		private void printErr(String s) {
823
		private void printErr(String s) {
808
			this.err.print(s);
824
			this.err.print(s);
809
			if (!this.isXml) {
825
			if (!this.isXml && this.log != null) {
810
				if (this.log != null) {
826
				this.log.print(s);
811
					this.log.print(s);
812
				}
813
			}
827
			}
814
		}
828
		}
815
829
816
		private void printlnErr(String s) {
830
		private void printlnErr(String s) {
817
			this.err.println(s);
831
			this.err.println(s);
818
			if (!this.isXml) {
832
			if (!this.isXml && this.log != null) {
819
				if (this.log != null) {
833
				this.log.println(s);
820
					this.log.println(s);
821
				}
822
			}
834
			}
823
		}
835
		}
824
836
825
		private void printlnOut(String s) {
837
		private void printlnOut(String s) {
826
			this.out.println(s);
838
			this.out.println(s);
827
			if (!this.isXml) {
839
			if (!this.isXml && this.log != null) {
828
				if (this.log != null) {
840
				this.log.println(s);
829
					this.log.println(s);
830
				}
831
			}
841
			}
832
		}
842
		}
833
843
Lines 1446-1452 Link Here
1446
			}
1456
			}
1447
			if (currentArg.equals("-version") //$NON-NLS-1$
1457
			if (currentArg.equals("-version") //$NON-NLS-1$
1448
					|| currentArg.equals("-v")) { //$NON-NLS-1$
1458
					|| currentArg.equals("-v")) { //$NON-NLS-1$
1449
				printVersion();
1459
				this.logger.logVersion(true);
1450
				this.proceed = false;
1460
				this.proceed = false;
1451
				return;
1461
				return;
1452
			}
1462
			}
Lines 2180-2194 Link Here
2180
		} else {
2190
		} else {
2181
			this.showProgress = false;
2191
			this.showProgress = false;
2182
		}
2192
		}
2193
		this.logger.logVersion(printVersionRequired);
2183
		
2194
		
2184
		if (printUsageRequired || filesCount == 0) {
2195
		if (printUsageRequired || filesCount == 0) {
2185
			printUsage();
2196
			printUsage();
2186
			this.proceed = false;
2197
			this.proceed = false;
2187
			return;
2198
			return;
2188
		}
2199
		}
2189
		if (printVersionRequired) {
2190
			printVersion();
2191
		}
2192
2200
2193
		if (filesCount != 0)
2201
		if (filesCount != 0)
2194
			System.arraycopy(
2202
			System.arraycopy(
Lines 2716-2723 Link Here
2716
		));
2724
		));
2717
		this.logger.flush();
2725
		this.logger.flush();
2718
	}
2726
	}
2719
	public void printVersion() {
2720
		this.logger.logVersion();
2721
		this.logger.flush();
2722
	}
2723
}
2727
}

Return to bug 107535