Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2019-08-24 13:15:34 +0000
committerEd Merks2019-08-24 13:15:34 +0000
commit8a3d58071a0cd5ce0fd5c765f4563620f14cbe50 (patch)
tree654ac9dbc019fb5f0437436b0572807a90125b65
parentc3e3ac224c99512e0d976010b60154889053c931 (diff)
downloadorg.eclipse.emf-8a3d58071a0cd5ce0fd5c765f4563620f14cbe50.tar.gz
org.eclipse.emf-8a3d58071a0cd5ce0fd5c765f4563620f14cbe50.tar.xz
org.eclipse.emf-8a3d58071a0cd5ce0fd5c765f4563620f14cbe50.zip
[550304] Provide better support for editing and compiling JET templatesR2_19_0
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.java14
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();

Back to the top