1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Disable formatter problem logging for code templates and preview

This commit is contained in:
Anton Leherbauer 2007-03-20 15:59:30 +00:00
parent 777bb96452
commit ada2801b8f
2 changed files with 12 additions and 3 deletions

View file

@ -32,6 +32,7 @@ import org.eclipse.cdt.core.parser.ScannerInfo;
import org.eclipse.cdt.internal.core.dom.SavedCodeReaderFactory;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.text.edits.TextEdit;
public class CCodeFormatter extends CodeFormatter {
@ -147,6 +148,10 @@ public class CCodeFormatter extends CodeFormatter {
}
CodeFormatterVisitor codeFormatter = new CodeFormatterVisitor(this.preferences, this.options, offset, length);
edit= codeFormatter.format(source, ast);
IStatus status= codeFormatter.getStatus();
if (!status.isOK()) {
CCorePlugin.log(status);
}
} finally {
index.releaseReadLock();
}

View file

@ -237,12 +237,16 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
if (DEBUG){
System.out.println("Formatting time: " + (System.currentTimeMillis() - startTime)); //$NON-NLS-1$
}
if (!fStatus.isOK()) {
CCorePlugin.log(fStatus);
}
return scribe.getRootEdit();
}
/**
* @return the status collected during formatting
*/
IStatus getStatus() {
return fStatus;
}
private final TextEdit failedToFormat(RuntimeException e) {
if (DEBUG) {
System.out.println("COULD NOT FORMAT: " + e.getMessage()); //$NON-NLS-1$