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 HEIGHT_BETWEEN_TEXT_AND_BUTTONS = 6
|
||||||
private const val HORIZONTAL_MARGINS = 16
|
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(
|
class ErrorNotificationPanel private constructor(
|
||||||
htmlErrorMessage: String?,
|
htmlErrorMessage: String?,
|
||||||
items: List<PanelItem>,
|
items: List<PanelItem>,
|
||||||
@@ -37,19 +46,23 @@ class ErrorNotificationPanel private constructor(
|
|||||||
) : JPanel(BorderLayout()), UiDataProvider {
|
) : JPanel(BorderLayout()), UiDataProvider {
|
||||||
private var copyProvider: CopyProvider? = null
|
private var copyProvider: CopyProvider? = null
|
||||||
private val textPane: JTextArea?
|
private val textPane: JTextArea?
|
||||||
|
private val content: JPanel
|
||||||
|
|
||||||
init {
|
init {
|
||||||
background = messageType.popupBackground
|
background = messageType.popupBackground
|
||||||
isFocusable = true
|
|
||||||
isFocusCycleRoot = true
|
|
||||||
border = JBUI.Borders.empty(VERTICAL_MARGINS, 0)
|
|
||||||
isRequestFocusEnabled = true
|
|
||||||
|
|
||||||
val horizontalLayout = items.size <= HORIZONTAL_LAYOUT_THRESHOLD
|
val horizontalLayout = items.size <= HORIZONTAL_LAYOUT_THRESHOLD
|
||||||
|
content = JPanel(BorderLayout())
|
||||||
textPane = htmlErrorMessage?.let { createTextPanel(htmlErrorMessage, horizontalLayout) }
|
textPane = htmlErrorMessage?.let { createTextPanel(htmlErrorMessage, horizontalLayout) }
|
||||||
initComponent(items, 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) {
|
private fun initComponent(items: List<PanelItem>, horizontalLayout: Boolean) {
|
||||||
val buttonsGravity = if (horizontalLayout) { BorderLayout.EAST } else { BorderLayout.NORTH }
|
val buttonsGravity = if (horizontalLayout) { BorderLayout.EAST } else { BorderLayout.NORTH }
|
||||||
val buttonPanel = JPanel(FlowLayout(FlowLayout.RIGHT, HORIZONTAL_MARGINS, 0)).apply {
|
val buttonPanel = JPanel(FlowLayout(FlowLayout.RIGHT, HORIZONTAL_MARGINS, 0)).apply {
|
||||||
@@ -58,11 +71,19 @@ class ErrorNotificationPanel private constructor(
|
|||||||
border = JBUI.Borders.empty()
|
border = JBUI.Borders.empty()
|
||||||
}
|
}
|
||||||
|
|
||||||
add(buttonPanel, buttonsGravity)
|
content.add(buttonPanel, buttonsGravity)
|
||||||
textPane?.let { add(it, BorderLayout.CENTER) }
|
textPane?.let { content.add(it, BorderLayout.CENTER) }
|
||||||
addSubscribers(textPane)
|
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))
|
textPane?.addMouseListener(RequestFocusMouseListener(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +107,7 @@ class ErrorNotificationPanel private constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun addMouseListener(listener: MouseListener) {
|
override fun addMouseListener(listener: MouseListener) {
|
||||||
super.addMouseListener(listener)
|
content.addMouseListener(listener)
|
||||||
textPane?.addMouseListener(listener)
|
textPane?.addMouseListener(listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,4 +323,4 @@ class ErrorNotificationPanel private constructor(
|
|||||||
return Builder(message, error)
|
return Builder(message, error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user