Bug 50194 Indenting Java breaks comments
When correcting indentation (ctrl-I in my configuration), java comments are not properly preserved. My original code [1] is 'indented' to code [2], which is unexpected and syntactically incorrect. thanks PhF .. [1] try{ /* for(int i=0; i<8; i++){ System.out.println("something");} */ somethingElse(); .. [2] try{ /* */ for(int i=0; i<8; i++){ System.out.println("something");} */ somethingElse();
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/javadoc/JavaDocAutoIndentStrategy.java
jdocWrapParagraphFromLine(document, document.getLineOfOffset(c.offset), caretOffset, always);
			c.offset= caretOffset[0];
		} catch (BadLocationException e) {
			JavaPlugin.log(e);
		}
	}
	/**
	 * Returns the compilation unit of the CompilationUnitEditor invoking the AutoIndentStrategy,
	 * might return <code>null</code> on error.
	 */
	private static ICompilationUnit getCompilationUnit() {
		IWorkbenchWindow window= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
		if (window == null)
			return null;
			
		IWorkbenchPage page= window.getActivePage();
		if (page == null)	
			return null;
		IEditorPart editor= page.getActiveEditor();
		if (editor == null)
			return null;
		IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager();
		ICompilationUnit unit= manager.getWorkingCopy(editor.getEditorInput());
		if (unit == null)
			return null;
		return unit;
	}
			
}