diff options
author | Ed Merks | 2019-08-24 13:15:34 +0000 |
---|---|---|
committer | Ed Merks | 2019-08-24 13:15:34 +0000 |
commit | 8a3d58071a0cd5ce0fd5c765f4563620f14cbe50 (patch) | |
tree | 654ac9dbc019fb5f0437436b0572807a90125b65 | |
parent | c3e3ac224c99512e0d976010b60154889053c931 (diff) | |
download | org.eclipse.emf-8a3d58071a0cd5ce0fd5c765f4563620f14cbe50.tar.gz org.eclipse.emf-8a3d58071a0cd5ce0fd5c765f4563620f14cbe50.tar.xz org.eclipse.emf-8a3d58071a0cd5ce0fd5c765f4563620f14cbe50.zip |
Fix NPEs from marker.
Fix annotations to not use the visual model.
Fix formatting to put more things on the same line.
-rw-r--r-- | plugins/org.eclipse.emf.codegen.ui/src/org/eclipse/emf/codegen/presentation/JETEditor.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.codegen.ui/src/org/eclipse/emf/codegen/presentation/JETEditor.java b/plugins/org.eclipse.emf.codegen.ui/src/org/eclipse/emf/codegen/presentation/JETEditor.java index a2905579e..ef8a7c55f 100644 --- a/plugins/org.eclipse.emf.codegen.ui/src/org/eclipse/emf/codegen/presentation/JETEditor.java +++ b/plugins/org.eclipse.emf.codegen.ui/src/org/eclipse/emf/codegen/presentation/JETEditor.java @@ -702,7 +702,7 @@ public final class JETEditor extends AbstractDecoratedTextEditor void applyProblemAnnotations(List<JETProblemAnnotation> jetProblemAnnotations) { SourceViewer sourceViewer = getJETSourceViewer(); - IAnnotationModel annotationModel = sourceViewer.getVisualAnnotationModel(); + IAnnotationModel annotationModel = sourceViewer.getAnnotationModel(); List<Annotation> annotationsToRemove = new ArrayList<Annotation>(); for (Iterator<Annotation> i = annotationModel.getAnnotationIterator(); i.hasNext();) { @@ -5720,12 +5720,17 @@ public final class JETEditor extends AbstractDecoratedTextEditor { try { - return (Integer)markerAnnotation.getMarker().getAttribute(IMarker.SEVERITY); + IMarker marker = markerAnnotation.getMarker(); + if (marker != null) + { + Object severity = marker.getAttribute(IMarker.SEVERITY); + return severity instanceof Integer ? (Integer)severity : IMarker.SEVERITY_INFO; + } } catch (CoreException exception) { - return IMarker.SEVERITY_ERROR; } + return IMarker.SEVERITY_ERROR; } } @@ -8613,6 +8618,9 @@ public final class JETEditor extends AbstractDecoratedTextEditor options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE); options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "2"); options.put(DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE, "2"); + options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, DefaultCodeFormatterConstants.FALSE); + options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE, DefaultCodeFormatterConstants.TRUE); + options.put(DefaultCodeFormatterConstants.FORMATTER_COMPACT_ELSE_IF, DefaultCodeFormatterConstants.TRUE); CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(options); JavaEditor javaEditor = jetEditor.getJavaEditor(); |