Bug 512335 - [formatter] UI for new feature: count comment width from starting position

Change-Id: Ia1275334167202457e45840675108394287df728
Signed-off-by: Mateusz Matela <mateusz.matela@gmail.com>
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/CommentsTabPage.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/CommentsTabPage.java
index 647b8ac..5f86bf8 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/CommentsTabPage.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/CommentsTabPage.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -173,6 +173,7 @@
 		// line width settings
 		final Group widthGroup= createGroup(numColumns, composite, FormatterMessages.CommentsTabPage_group3_title);
 		final NumberPreference lineWidth= createNumberPref(widthGroup, numColumns, FormatterMessages.CommentsTabPage_line_width, DefaultCodeFormatterConstants.FORMATTER_COMMENT_LINE_LENGTH, 0, 9999);
+		final CheckboxPreference lineWidthFromStrtingPos= createPrefFalseTrue(widthGroup, numColumns, FormatterMessages.CommentsTabPage_line_width_count_from_starting_position, DefaultCodeFormatterConstants.FORMATTER_COMMENT_COUNT_LINE_LENGTH_FROM_STARTING_POSITION, false);
 
 
 		ArrayList<CheckboxPreference> lineFirstColumnMasters= new ArrayList<>();
@@ -243,6 +244,7 @@
 		ArrayList<Object> lineWidthSlaves= new ArrayList<>();
 		lineWidthSlaves.add(widthGroup);
 		lineWidthSlaves.add(lineWidth);
+		lineWidthSlaves.add(lineWidthFromStrtingPos);
 
 		new OrController(lineWidthMasters, lineWidthSlaves);
 	}
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.java
index e782988..6b1d84b 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2017 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -388,6 +388,7 @@
 	public static String CommentsTabPage_group3_title;
 	public static String CommentsTabPage_group4_title;
 	public static String CommentsTabPage_line_width;
+	public static String CommentsTabPage_line_width_count_from_starting_position;
 	public static String CommentsTabPage_never_indent_block_comments_on_first_column;
 	public static String CommentsTabPage_never_indent_line_comments_on_first_column;
 	public static String CommentsTabPage_do_not_join_lines;
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties
index c20a2a0..3d75ad1 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties
@@ -1,5 +1,5 @@
 ###############################################################################
-# Copyright (c) 2000, 2016 IBM Corporation and others.
+# Copyright (c) 2000, 2017 IBM Corporation and others.
 # All rights reserved. This program and the accompanying materials
 # are made available under the terms of the Eclipse Public License v1.0
 # which accompanies this distribution, and is available at
@@ -427,7 +427,8 @@
 CommentsTabPage_indent_description_after_param=Indent description after @param
 CommentsTabPage_new_line_after_param_tags=New line after @param tags
 CommentsTabPage_group3_title=Line width
-CommentsTabPage_line_width=Maximum line width &for comments:
+CommentsTabPage_line_width=Maximum width &for comments:
+CommentsTabPage_line_width_count_from_starting_position=Count width from comment's starting position
 
 CommentsTabPage_group4_title=Bl&ock comment settings
 CommentsTabPage_new_lines_at_comment_boundaries=/* and */ on separate lines