Skip to content

Commit

Permalink
Merge pull request #537 from sanao1006/feature/display_explanation_of…
Browse files Browse the repository at this point in the history
…_roborazzi_task

Add settings panel for configuring Roborazzi tasks explanation
  • Loading branch information
takahirom authored Nov 5, 2024
2 parents 7d4e64f + dea35c0 commit d1c65c0
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 10 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1594,6 +1594,11 @@ android {
It is discussed in [this issue](https://github.com/takahirom/roborazzi/issues/272).
Additionally, it might be worth trying to run your tests with VisualVM to monitor memory usage and identify potential leaks.
### Q: [IDEA Plugin] Roborazzi Gradle task is not displayed in Tool Window.
**A:** It is discussed in [this issue](https://github.com/takahirom/roborazzi/issues/493).
To enable the display of Roborazzi tasks, please enable ***Configure all Gradle tasks during Gradle Sync (this can make Gradle Sync slower)*** in the Settings | Experimental | Gradle.
<img src="https://github.com/user-attachments/assets/67fbb2a8-6b2a-458c-bb31-99025f1c1cab" width="800" />
</div>
### LICENSE
Expand Down
6 changes: 6 additions & 0 deletions docs/topics/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,9 @@ android {
```
It is discussed in [this issue](https://github.com/takahirom/roborazzi/issues/272).
Additionally, it might be worth trying to run your tests with VisualVM to monitor memory usage and identify potential leaks.

### Q: [IDEA Plugin] Roborazzi Gradle task is not displayed in Tool Window.

**A:** It is discussed in [this issue](https://github.com/takahirom/roborazzi/issues/493).
To enable the display of Roborazzi tasks, please enable ***Configure all Gradle tasks during Gradle Sync (this can make Gradle Sync slower)*** in the Settings | Experimental | Gradle.
<img src="https://github.com/user-attachments/assets/67fbb2a8-6b2a-458c-bb31-99025f1c1cab" width="800" />
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,46 @@ package com.github.takahirom.roborazzi.idea.settings
import com.intellij.ui.components.JBLabel
import com.intellij.ui.components.JBTextField
import com.intellij.util.ui.FormBuilder
import java.awt.Dimension
import javax.swing.Box
import javax.swing.BoxLayout
import javax.swing.JComponent
import javax.swing.JLabel
import javax.swing.JPanel
import javax.swing.JSeparator

/**
* Supports creating and managing a [JPanel] for the Settings Dialog.
*/
class AppSettingsComponent {
private val myMainPanel: JPanel
private val imagesPathFromModuleText: JBTextField = JBTextField()

init {
myMainPanel = FormBuilder.createFormBuilder()
.addLabeledComponent(JBLabel("Enter images directory path from module: "), imagesPathFromModuleText, 1, false)
.addComponentFillVertically(JPanel(), 0)
.getPanel()
}
private val myMainPanel: JPanel
private val imagesPathFromModuleText: JBTextField = JBTextField()

private val descriptionText = """
<html>To enable the display of Roborazzi tasks, please enable<br>
<b>Configure all Gradle tasks during Gradle Sync (this can make Gradle Sync slower)</b> in the Settings | Experimental | Gradle.</html>
""".trimIndent()

init {
myMainPanel = FormBuilder.createFormBuilder()
.addLabeledComponent(
JBLabel("Enter images directory path from module: "),
imagesPathFromModuleText,
1,
false
)
// adjust margin between components
.addVerticalGap(8)
.addComponent(createNoteSection())
.addComponent(JBLabel(descriptionText).apply {
verticalAlignment = JBLabel.TOP
preferredSize = Dimension(400, 200)
})
.addComponentFillVertically(JPanel(), 0)
.panel
}
val panel: JPanel
get() = myMainPanel

val preferredFocusedComponent: JComponent
get() = imagesPathFromModuleText

Expand All @@ -31,4 +51,20 @@ class AppSettingsComponent {
set(newText) {
imagesPathFromModuleText.setText(newText)
}

private fun createNoteSection(): JPanel {
val panel = JPanel()
panel.layout = BoxLayout(panel, BoxLayout.X_AXIS)

val label = JLabel("Note")
val separator = JSeparator().apply {
alignmentY = 0f
}

panel.add(label)
panel.add(Box.createHorizontalStrut(8))
panel.add(separator)

return panel
}
}

0 comments on commit d1c65c0

Please sign in to comment.