Skip to content

Intellij plugin GitHub notifications 56 #70

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.github.naoyukik.intellijplugingithubnotifications.application

import com.github.naoyukik.intellijplugingithubnotifications.application.dto.GitRepositoryDto
import com.github.naoyukik.intellijplugingithubnotifications.domain.GitProviderService

class GitProviderWorkflow(
private val gitProviderService: GitProviderService,
) {
fun getGitRepositories(): List<GitRepositoryDto> {
return gitProviderService.getGitRepositories().map {
GitRepositoryDto(it.name)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.github.naoyukik.intellijplugingithubnotifications.application.dto

data class GitRepositoryDto(val name: String)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.github.naoyukik.intellijplugingithubnotifications.domain

import com.github.naoyukik.intellijplugingithubnotifications.domain.model.GitRepository
import com.intellij.openapi.project.Project
import com.intellij.openapi.vcs.ProjectLevelVcsManager

class GitProviderService(
private val project: Project,
) {
fun getGitRepositories(): List<GitRepository> {
val vcsManager = ProjectLevelVcsManager.getInstance(project)
val allVcsRoots = vcsManager.allVcsRoots
val result = mutableListOf<GitRepository>()
allVcsRoots.forEach {
result.add(GitRepository(it.path.name))
}
return result
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.github.naoyukik.intellijplugingithubnotifications.domain.model

data class GitRepository(val name: String)
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.github.naoyukik.intellijplugingithubnotifications.settings

import com.github.naoyukik.intellijplugingithubnotifications.application.GitProviderWorkflow
import com.github.naoyukik.intellijplugingithubnotifications.application.dto.GitRepositoryDto
import com.github.naoyukik.intellijplugingithubnotifications.domain.GitProviderService
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.ComboBox
import com.intellij.ui.JBIntSpinner
import com.intellij.ui.components.JBLabel
import com.intellij.ui.components.JBTextField
Expand All @@ -12,7 +17,9 @@ import javax.swing.JPanel
/**
* Supports creating and managing a [JPanel] for the Settings Dialog.
*/
class AppSettingsComponent {
class AppSettingsComponent(
project: Project,
) {
companion object {
private const val PADDING = 5
private const val FETCH_INTERVAL_DEFAULT_VALUE = 15
Expand All @@ -26,8 +33,12 @@ class AppSettingsComponent {
JBIntSpinner(FETCH_INTERVAL_DEFAULT_VALUE, FETCH_INTERVAL_MIN_VALUE, FETCH_INTERVAL_MAX_VALUE, 1)
private val customizedRepositoryName = JBTextField(TEXT_AREA_COLUMNS)
private val customizedGhCliPath = JBTextField(TEXT_AREA_COLUMNS)
private val repositoryComboBox: ComboBox<GitRepositoryDto>

init {
val vcsRepositoryProvider = GitProviderWorkflow(GitProviderService(project))
val gitRepositories = vcsRepositoryProvider.getGitRepositories()
repositoryComboBox = ComboBox(gitRepositories.toTypedArray())
mainPanel = FormBuilder.createFormBuilder()
.addLabeledComponent(
JBLabel("Fetch interval:"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.intellij.openapi.options.Configurable
import com.intellij.openapi.project.Project
import com.intellij.platform.ide.progress.ModalTaskOwner.project

Check warning on line 5 in src/main/kotlin/com/github/naoyukik/intellijplugingithubnotifications/settings/AppSettingsConfigurable.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive
import org.jetbrains.annotations.Nls
import javax.swing.JComponent

Expand All @@ -13,7 +14,7 @@
private var mySettingsState: AppSettingsState? = null

init {
mySettingsComponent = AppSettingsComponent()
mySettingsComponent = AppSettingsComponent(project)
mySettingsState = AppSettingsState.getInstance(project)
}

Expand All @@ -27,7 +28,7 @@
}

override fun createComponent(): JComponent? {
mySettingsComponent = AppSettingsComponent()
// mySettingsComponent = AppSettingsComponent(project)
return mySettingsComponent?.getPanel()
}

Expand Down
Loading