EditorTextFiled Display exception
Answered
hi
When I place EditorTextField in toolwindows, the border display of EditorTextField will be abnormal when I switch themes. You need to close and then open the woodwindow to display normally. How can I solve this problem?
thanks
Please sign in to leave a comment.
Hi,
Please try implementing
com.intellij.openapi.editor.colors.EditorColorsListener.globalSchemeChange()
that willrevalidate()
andrepaint()
yourEditorTextField
.I tried implementing this interface, but it doesn't seem to work.It is normal to open the interface for the first time as shown in the figure below. Both the EditorTextField on the left and the JTextField on the right display normally, but after switching the theme, the display is very weird, and there is no blue border after getting the focus.
This is after switching the theme, the blue border does not appear after getting the focus and the background color is also abnormal, but when I close the toolwindow and open it again, everything is normal again.This is so weird, I don't know what's going on in the middle
Please share the minimal working example and steps to reproduce the problem.
It can be shared via https://uploads.jetbrains.com/.
ID: 2023_03_01_u3cxrX9Yc7Sw9D1gyZwstF (file: tool_window.zip)
This is the id of the file I uploaded, and there are some instructions in note.txt
Please show me the implementation of the interface I mentioned. The attached project doesn't include it.
Also, please delete the build and VCS directories before uploading ZIP.
I customized an EditorTextField named MyEditorTextField, which inherits EditorTextField and implements EditorColorsListener, and then re-globalSchemaChange(). Sorry, can you see it ? Is my internship method wrong?
Upload id: 2023_03_05_oe85qCidw2B7zDP5sK29PJ (file: tool_window.zip)
Hi,
Please get familiar with registering listeners: https://plugins.jetbrains.com/docs/intellij/messaging-infrastructure.html#putting-altogether
You probably will need to register it in tool window's constructor. I suggest checking the platform code for example implementations, e.g.:
https://github.com/JetBrains/intellij-community/blob/master/platform/platform-impl/src/com/intellij/ide/lightEdit/LightEditTabs.java#L77:L82