-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getTMPresentationReconciler textViewer usage causes errors logged for other ITextViewer implementations #281
Comments
Please submit a PR for that. |
GeraldMit
added a commit
to GeraldMit/tm4e
that referenced
this issue
Sep 26, 2021
Remove error for textViewer not an instance of SourceViewer Change-Id: I6c5dbacd489b5094f0ae958f0bb40e27bb79c8b6 Signed-off-by: GeraldMit <Gerald.Mitchell@ibm.com>
GeraldMit
added a commit
to GeraldMit/tm4e
that referenced
this issue
Sep 26, 2021
Remove error for textViewer not an instance of SourceViewer; Update TM4E to 4.3 Change-Id: I6c5dbacd489b5094f0ae958f0bb40e27bb79c8b6 Signed-off-by: GeraldMit <Gerald.Mitchell@ibm.com>
GeraldMit
added a commit
to GeraldMit/tm4e
that referenced
this issue
Sep 27, 2021
Remove error for textViewer not an instance of SourceViewer Change-Id: I6c5dbacd489b5094f0ae958f0bb40e27bb79c8b6 Signed-off-by: GeraldMit <Gerald.Mitchell@ibm.com>
GeraldMit
added a commit
to GeraldMit/tm4e
that referenced
this issue
Sep 27, 2021
Remove error for textViewer not an instance of SourceViewer; Update TM4E UI to 4.3 and feature to 4.4 Change-Id: I6c5dbacd489b5094f0ae958f0bb40e27bb79c8b6 Signed-off-by: GeraldMit <Gerald.Mitchell@ibm.com>
mickaelistria
pushed a commit
that referenced
this issue
Sep 27, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tm4e/org.eclipse.tm4e.ui/src/main/java/org/eclipse/tm4e/ui/text/TMPresentationReconciler.java
Line 758 in 2625f15
After file opens in a custom Editor, attempting to open a context menu results in
For any use of TM4E after 0.3.3, this exception is no longer absorbed and floods the logs after
TMUIPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, TMUIPlugin.PLUGIN_ID, e.getMessage(), e));
was added.
The code has an assumption that the textViewer implementation is from SourceViewer from an ITextViewer parameter
org.eclipse.jface.text.source.ISourceViewer extends org.eclipse.jface.text.source.ITextViewer
Implementing Classes:org.eclipse.jface.text.source.SourceViewer
Field field = SourceViewer.class.getDeclaredField("fPresentationReconciler");
This doesn't check that that field actually exists on textViewer before trying to get textViewer's field value, nor that textViewer is an instance of SourceViewer ( ISourceViewer can be implemented elsewhere)
I think there should be a check that textViewer is an instance of SourceViewer but also that field isn't null.
instead I think that the code should have
IPresentationReconciler presentationReconciler = field == null ? null : (IPresentationReconciler) field.get(textViewer);
The text was updated successfully, but these errors were encountered: