mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
Resolved comparability issue because of deletion ErrorNotificationPanel#getContent
GitOrigin-RevId: 6924342fc5d08109a17dff9a2b3daa7bb2399809
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c4a1d26e78
commit
2115dfafc6
@@ -29,6 +29,15 @@ private const val VERTICAL_MARGINS = 10
|
||||
private const val HEIGHT_BETWEEN_TEXT_AND_BUTTONS = 6
|
||||
private const val HORIZONTAL_MARGINS = 16
|
||||
|
||||
/**
|
||||
* Notification panel displayed at the bottom of the editor when execution fails.
|
||||
*
|
||||
* To provide custom fixes, implement the
|
||||
* [com.intellij.database.connection.throwable.info.RuntimeErrorActionProvider]
|
||||
* extension point and register it in your `plugin.xml` under the
|
||||
* `database.runtimeErrorFixProvider` key.
|
||||
*/
|
||||
|
||||
class ErrorNotificationPanel private constructor(
|
||||
htmlErrorMessage: String?,
|
||||
items: List<PanelItem>,
|
||||
@@ -37,19 +46,23 @@ class ErrorNotificationPanel private constructor(
|
||||
) : JPanel(BorderLayout()), UiDataProvider {
|
||||
private var copyProvider: CopyProvider? = null
|
||||
private val textPane: JTextArea?
|
||||
private val content: JPanel
|
||||
|
||||
init {
|
||||
background = messageType.popupBackground
|
||||
isFocusable = true
|
||||
isFocusCycleRoot = true
|
||||
border = JBUI.Borders.empty(VERTICAL_MARGINS, 0)
|
||||
isRequestFocusEnabled = true
|
||||
|
||||
val horizontalLayout = items.size <= HORIZONTAL_LAYOUT_THRESHOLD
|
||||
content = JPanel(BorderLayout())
|
||||
textPane = htmlErrorMessage?.let { createTextPanel(htmlErrorMessage, horizontalLayout) }
|
||||
initComponent(items, horizontalLayout)
|
||||
}
|
||||
|
||||
@Deprecated("This method is deprecated and will be deleted soon." +
|
||||
" To provide custom fixes to notification panel, implement the" +
|
||||
" [com.intellij.database.connection.throwable.info.RuntimeErrorActionProvider]" +
|
||||
" extension point and declare it in your plugin.xml using the" +
|
||||
" 'database.runtimeErrorFixProvider' key")
|
||||
fun getContent(): JComponent? = content
|
||||
|
||||
private fun initComponent(items: List<PanelItem>, horizontalLayout: Boolean) {
|
||||
val buttonsGravity = if (horizontalLayout) { BorderLayout.EAST } else { BorderLayout.NORTH }
|
||||
val buttonPanel = JPanel(FlowLayout(FlowLayout.RIGHT, HORIZONTAL_MARGINS, 0)).apply {
|
||||
@@ -58,11 +71,19 @@ class ErrorNotificationPanel private constructor(
|
||||
border = JBUI.Borders.empty()
|
||||
}
|
||||
|
||||
add(buttonPanel, buttonsGravity)
|
||||
textPane?.let { add(it, BorderLayout.CENTER) }
|
||||
content.add(buttonPanel, buttonsGravity)
|
||||
textPane?.let { content.add(it, BorderLayout.CENTER) }
|
||||
addSubscribers(textPane)
|
||||
|
||||
addMouseListener(RequestFocusMouseListener(this))
|
||||
content.isFocusable = true
|
||||
content.isFocusCycleRoot = true
|
||||
content.isOpaque = false
|
||||
content.isRequestFocusEnabled = true
|
||||
content.border = JBUI.Borders.empty(VERTICAL_MARGINS, 0)
|
||||
|
||||
content.addMouseListener(RequestFocusMouseListener(this))
|
||||
add(content, BorderLayout.CENTER)
|
||||
|
||||
textPane?.addMouseListener(RequestFocusMouseListener(this))
|
||||
}
|
||||
|
||||
@@ -86,7 +107,7 @@ class ErrorNotificationPanel private constructor(
|
||||
}
|
||||
|
||||
override fun addMouseListener(listener: MouseListener) {
|
||||
super.addMouseListener(listener)
|
||||
content.addMouseListener(listener)
|
||||
textPane?.addMouseListener(listener)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user