[github] Rename files to new naming convention

GitOrigin-RevId: d81f944fd9884d8b0ae28350ee059cd66f69049b
This commit is contained in:
Ivan Semenov
2019-12-26 16:49:00 +03:00
committed by intellij-monorepo-bot
parent 72345b7f02
commit 5cb51fa189
43 changed files with 221 additions and 234 deletions

View File

@@ -38,7 +38,7 @@
<projectService serviceImplementation="org.jetbrains.plugins.github.util.GithubSharedProjectSettings"/>
<projectService serviceImplementation="org.jetbrains.plugins.github.authentication.accounts.GithubProjectDefaultAccountHolder"/>
<vcsAnnotationGutterActionProvider implementation="org.jetbrains.plugins.github.extensions.GithubAnnotationGutterActionProvider"/>
<vcsAnnotationGutterActionProvider implementation="org.jetbrains.plugins.github.extensions.GHAnnotationGutterActionProvider"/>
<projectConfigurable parentId="project.propVCSSupport.Mappings" groupWeight="-500"
instance="org.jetbrains.plugins.github.ui.GithubSettingsConfigurable"/>
<statistics.applicationUsagesCollector
@@ -90,7 +90,7 @@
<action id="Github.View.Pull.Request" class="org.jetbrains.plugins.github.GithubViewPullRequestsAction">
<add-to-group group-id="Git.Menu"/>
</action>
<action id="Github.Open.In.Browser" class="org.jetbrains.plugins.github.GithubOpenInBrowserActionGroup">
<action id="Github.Open.In.Browser" class="org.jetbrains.plugins.github.GHOpenInBrowserActionGroup">
<add-to-group group-id="EditorPopupMenu"/>
<add-to-group group-id="ProjectViewPopupMenu"/>
<add-to-group group-id="EditorTabPopupMenu"/>
@@ -108,7 +108,7 @@
<action id="Github.PullRequest.Timeline.Show"
class="org.jetbrains.plugins.github.pullrequest.action.GHPRShowTimelineAction"/>
<action id="Github.PullRequest.Branch.Create"
class="org.jetbrains.plugins.github.pullrequest.action.GithubPullRequestCreateBranchAction"/>
class="org.jetbrains.plugins.github.pullrequest.action.GHPRCreateBranchAction"/>
<reference id="Github.Open.In.Browser"/>
<action id="Github.PullRequest.List.Reload"
class="org.jetbrains.plugins.github.pullrequest.action.GHPRReloadListAction" use-shortcut-of="Refresh"/>

View File

@@ -26,12 +26,12 @@ import git4idea.GitRevisionNumber
import git4idea.GitUtil
import git4idea.history.GitHistoryUtils
import org.jetbrains.plugins.github.api.GHRepositoryCoordinates
import org.jetbrains.plugins.github.pullrequest.action.GithubPullRequestKeys
import org.jetbrains.plugins.github.pullrequest.action.GHPRActionKeys
import org.jetbrains.plugins.github.util.GithubGitHelper
import org.jetbrains.plugins.github.util.GithubNotifications
import org.jetbrains.plugins.github.util.GithubUtil
open class GithubOpenInBrowserActionGroup
open class GHOpenInBrowserActionGroup
: ActionGroup("Open on GitHub", "Open corresponding link in browser", AllIcons.Vcs.Vendors.Github), DumbAware {
override fun update(e: AnActionEvent) {
@@ -69,8 +69,8 @@ open class GithubOpenInBrowserActionGroup
}
private fun getDataFromPullRequest(project: Project, dataContext: DataContext): Pair<Set<GHRepositoryCoordinates>, Data>? {
val pullRequest = dataContext.getData(GithubPullRequestKeys.SELECTED_PULL_REQUEST) ?: return null
val context = dataContext.getData(GithubPullRequestKeys.ACTION_DATA_CONTEXT) ?: return null
val pullRequest = dataContext.getData(GHPRActionKeys.SELECTED_PULL_REQUEST) ?: return null
val context = dataContext.getData(GHPRActionKeys.ACTION_DATA_CONTEXT) ?: return null
return setOf(context.repositoryCoordinates) to Data.URL(project, pullRequest.url)
}

View File

@@ -12,8 +12,8 @@ import org.jetbrains.plugins.github.api.GHRepositoryCoordinates
import org.jetbrains.plugins.github.util.GithubGitHelper
class GithubOpenInBrowserFromAnnotationActionGroup(val annotation: FileAnnotation)
: GithubOpenInBrowserActionGroup(), UpToDateLineNumberListener {
class GHOpenInBrowserFromAnnotationActionGroup(val annotation: FileAnnotation)
: GHOpenInBrowserActionGroup(), UpToDateLineNumberListener {
private var myLineNumber = -1
override fun getData(dataContext: DataContext): Pair<Set<GHRepositoryCoordinates>, Data>? {

View File

@@ -0,0 +1,20 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.github.extensions;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.vcs.annotate.AnnotationGutterActionProvider;
import com.intellij.openapi.vcs.annotate.FileAnnotation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.github.GHOpenInBrowserFromAnnotationActionGroup;
/**
* @author Kirill Likhodedov
*/
public class GHAnnotationGutterActionProvider implements AnnotationGutterActionProvider {
@NotNull
@Override
public AnAction createAction(@NotNull FileAnnotation annotation) {
return new GHOpenInBrowserFromAnnotationActionGroup(annotation);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.github.extensions;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.vcs.annotate.AnnotationGutterActionProvider;
import com.intellij.openapi.vcs.annotate.FileAnnotation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.github.GithubOpenInBrowserFromAnnotationActionGroup;
/**
* @author Kirill Likhodedov
*/
public class GithubAnnotationGutterActionProvider implements AnnotationGutterActionProvider {
@NotNull
@Override
public AnAction createAction(@NotNull FileAnnotation annotation) {
return new GithubOpenInBrowserFromAnnotationActionGroup(annotation);
}
}

View File

@@ -30,13 +30,13 @@ import org.jetbrains.annotations.CalledInAwt
import org.jetbrains.plugins.github.api.GithubApiRequestExecutor
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequest
import org.jetbrains.plugins.github.authentication.accounts.GithubAccount
import org.jetbrains.plugins.github.pullrequest.action.GHPRActionKeys
import org.jetbrains.plugins.github.pullrequest.action.GHPRListSelectionActionDataContext
import org.jetbrains.plugins.github.pullrequest.action.GithubPullRequestKeys
import org.jetbrains.plugins.github.pullrequest.avatars.CachingGithubAvatarIconsProvider
import org.jetbrains.plugins.github.pullrequest.config.GithubPullRequestsProjectUISettings
import org.jetbrains.plugins.github.pullrequest.data.GHPullRequestsDataContext
import org.jetbrains.plugins.github.pullrequest.data.GHPullRequestsDataContextRepository
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestDataProvider
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataContext
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataContextRepository
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataProvider
import org.jetbrains.plugins.github.pullrequest.search.GithubPullRequestSearchPanel
import org.jetbrains.plugins.github.pullrequest.ui.*
import org.jetbrains.plugins.github.pullrequest.ui.changes.*
@@ -67,14 +67,14 @@ internal class GHPRComponentFactory(private val project: Project) {
private val autoPopupController = AutoPopupController.getInstance(project)
private val projectUiSettings = GithubPullRequestsProjectUISettings.getInstance(project)
private val dataContextRepository = GHPullRequestsDataContextRepository.getInstance(project)
private val dataContextRepository = GHPRDataContextRepository.getInstance(project)
@CalledInAwt
fun createComponent(remoteUrl: GitRemoteUrlCoordinates, account: GithubAccount, requestExecutor: GithubApiRequestExecutor,
parentDisposable: Disposable): JComponent {
val contextDisposable = Disposer.newDisposable()
val contextValue = object : LazyCancellableBackgroundProcessValue<GHPullRequestsDataContext>(progressManager) {
val contextValue = object : LazyCancellableBackgroundProcessValue<GHPRDataContext>(progressManager) {
override fun compute(indicator: ProgressIndicator) =
dataContextRepository.getContext(indicator, account, requestExecutor, remoteUrl).also {
Disposer.register(contextDisposable, it)
@@ -86,7 +86,7 @@ internal class GHPRComponentFactory(private val project: Project) {
val uiDisposable = Disposer.newDisposable()
Disposer.register(parentDisposable, uiDisposable)
val loadingModel = GHCompletableFutureLoadingModel<GHPullRequestsDataContext>()
val loadingModel = GHCompletableFutureLoadingModel<GHPRDataContext>()
val contentContainer = JBPanelWithEmptyText(null).apply {
background = UIUtil.getListBackground()
}
@@ -167,7 +167,7 @@ internal class GHPRComponentFactory(private val project: Project) {
editorWindow.setFilePinned(file, true)
}
private fun createContent(dataContext: GHPullRequestsDataContext, disposable: Disposable): JComponent {
private fun createContent(dataContext: GHPRDataContext, disposable: Disposable): JComponent {
val avatarIconsProviderFactory = CachingGithubAvatarIconsProvider.Factory(avatarLoader, imageResizer, dataContext.requestExecutor)
val listSelectionHolder = GithubPullRequestsListSelectionHolderImpl()
val actionDataContext = GHPRListSelectionActionDataContext(dataContext, listSelectionHolder, avatarIconsProviderFactory)
@@ -216,7 +216,7 @@ internal class GHPRComponentFactory(private val project: Project) {
DataManager.registerDataProvider(it) { dataId ->
if (Disposer.isDisposed(disposable)) null
else when {
GithubPullRequestKeys.ACTION_DATA_CONTEXT.`is`(dataId) -> actionDataContext
GHPRActionKeys.ACTION_DATA_CONTEXT.`is`(dataId) -> actionDataContext
else -> null
}
@@ -224,11 +224,11 @@ internal class GHPRComponentFactory(private val project: Project) {
}
}
private fun createListComponent(dataContext: GHPullRequestsDataContext,
private fun createListComponent(dataContext: GHPRDataContext,
listSelectionHolder: GithubPullRequestsListSelectionHolder,
avatarIconsProviderFactory: CachingGithubAvatarIconsProvider.Factory,
disposable: Disposable): JComponent {
val list = GithubPullRequestsList(copyPasteManager, avatarIconsProviderFactory, dataContext.listModel).apply {
val list = GHPRList(copyPasteManager, avatarIconsProviderFactory, dataContext.listModel).apply {
emptyText.clear()
}.also {
it.addFocusListener(object : FocusListener {
@@ -268,7 +268,7 @@ internal class GHPRComponentFactory(private val project: Project) {
return loaderPanel
}
private fun createDetailsPanel(dataContext: GHPullRequestsDataContext,
private fun createDetailsPanel(dataContext: GHPRDataContext,
detailsModel: SingleValueModel<GHPullRequest?>,
avatarIconsProviderFactory: CachingGithubAvatarIconsProvider.Factory,
parentDisposable: Disposable): JBPanelWithEmptyText {
@@ -312,7 +312,7 @@ internal class GHPRComponentFactory(private val project: Project) {
}
}
private fun installPopup(list: GithubPullRequestsList) {
private fun installPopup(list: GHPRList) {
val popupHandler = object : PopupHandler() {
override fun invokePopup(comp: java.awt.Component, x: Int, y: Int) {
if (ListUtil.isPointOnSelection(list, x, y)) {
@@ -327,7 +327,7 @@ internal class GHPRComponentFactory(private val project: Project) {
list.addMouseListener(popupHandler)
}
private fun installSelectionSaver(list: GithubPullRequestsList, listSelectionHolder: GithubPullRequestsListSelectionHolder) {
private fun installSelectionSaver(list: GHPRList, listSelectionHolder: GithubPullRequestsListSelectionHolder) {
var savedSelectionNumber: Long? = null
list.selectionModel.addListSelectionListener { e: ListSelectionEvent ->
@@ -356,13 +356,13 @@ internal class GHPRComponentFactory(private val project: Project) {
private fun createChangesLoadingModel(changesModel: GHPRChangesModel,
diffHelper: GHPRChangesDiffHelper,
dataProviderModel: SingleValueModel<GithubPullRequestDataProvider?>,
dataProviderModel: SingleValueModel<GHPRDataProvider?>,
uiSettings: GithubPullRequestsProjectUISettings,
disposable: Disposable): GHPRChangesLoadingModel {
val model = GHPRChangesLoadingModel(changesModel, diffHelper, uiSettings.zipChanges)
projectUiSettings.addChangesListener(disposable) { model.zipChanges = projectUiSettings.zipChanges }
val requestChangesListener = object : GithubPullRequestDataProvider.RequestsChangedListener {
val requestChangesListener = object : GHPRDataProvider.RequestsChangedListener {
override fun commitsRequestChanged() {
model.dataProvider = model.dataProvider
}
@@ -376,7 +376,7 @@ internal class GHPRComponentFactory(private val project: Project) {
return model
}
private fun createDetailsLoadingModel(dataProviderModel: SingleValueModel<GithubPullRequestDataProvider?>,
private fun createDetailsLoadingModel(dataProviderModel: SingleValueModel<GHPRDataProvider?>,
parentDisposable: Disposable): GHCompletableFutureLoadingModel<GHPullRequest> {
val model = GHCompletableFutureLoadingModel<GHPullRequest>()
@@ -395,7 +395,7 @@ internal class GHPRComponentFactory(private val project: Project) {
val disposable = Disposer.newDisposable().apply {
Disposer.register(parentDisposable, this)
}
provider.addRequestsChangesListener(disposable, object : GithubPullRequestDataProvider.RequestsChangedListener {
provider.addRequestsChangesListener(disposable, object : GHPRDataProvider.RequestsChangedListener {
override fun detailsRequestChanged() {
model.future = provider.detailsRequest
}
@@ -422,12 +422,12 @@ internal class GHPRComponentFactory(private val project: Project) {
return model
}
private fun createDataProviderModel(dataContext: GHPullRequestsDataContext,
private fun createDataProviderModel(dataContext: GHPRDataContext,
listSelectionHolder: GithubPullRequestsListSelectionHolder,
parentDisposable: Disposable): SingleValueModel<GithubPullRequestDataProvider?> {
val model: SingleValueModel<GithubPullRequestDataProvider?> = SingleValueModel(null)
parentDisposable: Disposable): SingleValueModel<GHPRDataProvider?> {
val model: SingleValueModel<GHPRDataProvider?> = SingleValueModel(null)
fun setNewProvider(provider: GithubPullRequestDataProvider?) {
fun setNewProvider(provider: GHPRDataProvider?) {
val oldValue = model.value
if (oldValue != null && provider != null && oldValue.number != provider.number) {
model.value = null

View File

@@ -33,12 +33,12 @@ import net.miginfocom.layout.LC
import net.miginfocom.swing.MigLayout
import org.jetbrains.plugins.github.api.data.GHUser
import org.jetbrains.plugins.github.pullrequest.action.GHPRActionDataContext
import org.jetbrains.plugins.github.pullrequest.action.GHPRActionKeys
import org.jetbrains.plugins.github.pullrequest.action.GHPRFixedActionDataContext
import org.jetbrains.plugins.github.pullrequest.action.GithubPullRequestKeys
import org.jetbrains.plugins.github.pullrequest.avatars.GHAvatarIconsProvider
import org.jetbrains.plugins.github.pullrequest.comment.ui.GHPRCommentsUIUtil
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataProvider
import org.jetbrains.plugins.github.pullrequest.data.GHPRTimelineLoader
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestDataProvider
import org.jetbrains.plugins.github.pullrequest.data.service.GHPRCommentServiceAdapter
import org.jetbrains.plugins.github.pullrequest.data.service.GHPRReviewServiceAdapter
import org.jetbrains.plugins.github.pullrequest.ui.GHLoadingErrorHandlerImpl
@@ -83,14 +83,14 @@ internal class GHPREditorProvider : FileEditorProvider, DumbAware {
if (pr != null) detailsModel.value = pr
}
}
dataProvider.addRequestsChangesListener(disposable, object : GithubPullRequestDataProvider.RequestsChangedListener {
dataProvider.addRequestsChangesListener(disposable, object : GHPRDataProvider.RequestsChangedListener {
override fun detailsRequestChanged() = handleDetails()
})
handleDetails()
val mainPanel = Wrapper().also {
DataManager.registerDataProvider(it, DataProvider { dataId ->
if (GithubPullRequestKeys.ACTION_DATA_CONTEXT.`is`(dataId))
if (GHPRActionKeys.ACTION_DATA_CONTEXT.`is`(dataId))
GHPRFixedActionDataContext(context, dataProvider, context.pullRequestDetails)
else null
})

View File

@@ -7,21 +7,21 @@ import org.jetbrains.plugins.github.api.data.GHUser
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestShort
import org.jetbrains.plugins.github.authentication.accounts.GithubAccount
import org.jetbrains.plugins.github.pullrequest.avatars.CachingGithubAvatarIconsProvider
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestDataProvider
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestsBusyStateTracker
import org.jetbrains.plugins.github.pullrequest.data.GHPRBusyStateTracker
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataProvider
import org.jetbrains.plugins.github.pullrequest.data.service.GHPRCommentService
import org.jetbrains.plugins.github.pullrequest.data.service.GHPRReviewService
import org.jetbrains.plugins.github.pullrequest.data.service.GithubPullRequestsSecurityService
import org.jetbrains.plugins.github.pullrequest.data.service.GithubPullRequestsStateService
import org.jetbrains.plugins.github.pullrequest.data.service.GHPRSecurityService
import org.jetbrains.plugins.github.pullrequest.data.service.GHPRStateService
import org.jetbrains.plugins.github.util.GitRemoteUrlCoordinates
interface GHPRActionDataContext {
val account: GithubAccount
val securityService: GithubPullRequestsSecurityService
val busyStateTracker: GithubPullRequestsBusyStateTracker
val stateService: GithubPullRequestsStateService
val securityService: GHPRSecurityService
val busyStateTracker: GHPRBusyStateTracker
val stateService: GHPRStateService
val reviewService: GHPRReviewService
val commentService: GHPRCommentService
@@ -35,7 +35,7 @@ interface GHPRActionDataContext {
val pullRequest: Long?
val pullRequestDetails: GHPullRequestShort?
val pullRequestDataProvider: GithubPullRequestDataProvider?
val pullRequestDataProvider: GHPRDataProvider?
fun resetAllData()
}

View File

@@ -4,7 +4,7 @@ package org.jetbrains.plugins.github.pullrequest.action
import com.intellij.openapi.actionSystem.DataKey
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestShort
object GithubPullRequestKeys {
object GHPRActionKeys {
@JvmStatic
val ACTION_DATA_CONTEXT = DataKey.create<GHPRActionDataContext>("org.jetbrains.plugins.github.pullrequest.datacontext")

View File

@@ -15,18 +15,18 @@ import git4idea.branch.GitBranchWorker
import git4idea.commands.Git
import org.jetbrains.plugins.github.util.GithubAsyncUtil
class GithubPullRequestCreateBranchAction : DumbAwareAction("Create New Local Branch...",
"Checkout synthetic pull request branch",
null) {
class GHPRCreateBranchAction : DumbAwareAction("Create New Local Branch...",
"Checkout synthetic pull request branch",
null) {
override fun update(e: AnActionEvent) {
val project = e.getData(CommonDataKeys.PROJECT)
val selection = e.getData(GithubPullRequestKeys.ACTION_DATA_CONTEXT)?.pullRequestDataProvider
val selection = e.getData(GHPRActionKeys.ACTION_DATA_CONTEXT)?.pullRequestDataProvider
e.presentation.isEnabled = project != null && !project.isDefault && selection != null
}
override fun actionPerformed(e: AnActionEvent) {
val project = e.getRequiredData(CommonDataKeys.PROJECT)
val context = e.getRequiredData(GithubPullRequestKeys.ACTION_DATA_CONTEXT)
val context = e.getRequiredData(GHPRActionKeys.ACTION_DATA_CONTEXT)
val repository = context.gitRepositoryCoordinates.repository
val repositoryList = listOf(repository)
val dataProvider = context.pullRequestDataProvider ?: return

View File

@@ -2,10 +2,10 @@
package org.jetbrains.plugins.github.pullrequest.action
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestShort
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestDataProvider
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataProvider
class GHPRFixedActionDataContext internal constructor(private val delegate: GHPRActionDataContext,
dataProvider: GithubPullRequestDataProvider,
dataProvider: GHPRDataProvider,
details: GHPullRequestShort? = null)
: GHPRActionDataContext {

View File

@@ -3,11 +3,11 @@ package org.jetbrains.plugins.github.pullrequest.action
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestShort
import org.jetbrains.plugins.github.pullrequest.avatars.CachingGithubAvatarIconsProvider
import org.jetbrains.plugins.github.pullrequest.data.GHPullRequestsDataContext
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestDataProvider
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataContext
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataProvider
import org.jetbrains.plugins.github.pullrequest.ui.GithubPullRequestsListSelectionHolder
class GHPRListSelectionActionDataContext internal constructor(private val dataContext: GHPullRequestsDataContext,
class GHPRListSelectionActionDataContext internal constructor(private val dataContext: GHPRDataContext,
private val selectionHolder: GithubPullRequestsListSelectionHolder,
override val avatarIconsProviderFactory: CachingGithubAvatarIconsProvider.Factory)
: GHPRActionDataContext {
@@ -39,6 +39,6 @@ class GHPRListSelectionActionDataContext internal constructor(private val dataCo
override val pullRequestDetails: GHPullRequestShort?
get() = pullRequest?.let { dataContext.listLoader.findData(it) }
override val pullRequestDataProvider: GithubPullRequestDataProvider?
override val pullRequestDataProvider: GHPRDataProvider?
get() = pullRequest?.let { dataContext.dataLoader.getDataProvider(it) }
}

View File

@@ -8,11 +8,11 @@ import com.intellij.openapi.actionSystem.AnActionEvent
class GHPRReloadCommentsAction : RefreshAction("Refresh Pull Request Comments", null, AllIcons.Actions.Refresh) {
override fun update(e: AnActionEvent) {
val selection = e.getData(GithubPullRequestKeys.ACTION_DATA_CONTEXT)?.pullRequestDataProvider
val selection = e.getData(GHPRActionKeys.ACTION_DATA_CONTEXT)?.pullRequestDataProvider
e.presentation.isEnabled = selection != null
}
override fun actionPerformed(e: AnActionEvent) {
e.getRequiredData(GithubPullRequestKeys.ACTION_DATA_CONTEXT).pullRequestDataProvider?.reloadReviewThreads()
e.getRequiredData(GHPRActionKeys.ACTION_DATA_CONTEXT).pullRequestDataProvider?.reloadReviewThreads()
}
}

View File

@@ -8,11 +8,11 @@ import com.intellij.openapi.actionSystem.AnActionEvent
class GHPRReloadDetailsAction : RefreshAction("Refresh Pull Request Details", null, AllIcons.Actions.Refresh) {
override fun update(e: AnActionEvent) {
val selection = e.getData(GithubPullRequestKeys.ACTION_DATA_CONTEXT)?.pullRequestDataProvider
val selection = e.getData(GHPRActionKeys.ACTION_DATA_CONTEXT)?.pullRequestDataProvider
e.presentation.isEnabled = selection != null
}
override fun actionPerformed(e: AnActionEvent) {
e.getRequiredData(GithubPullRequestKeys.ACTION_DATA_CONTEXT).pullRequestDataProvider?.reloadDetails()
e.getRequiredData(GHPRActionKeys.ACTION_DATA_CONTEXT).pullRequestDataProvider?.reloadDetails()
}
}

View File

@@ -8,11 +8,11 @@ import com.intellij.openapi.actionSystem.AnActionEvent
class GHPRReloadListAction : RefreshAction("Refresh List", null, AllIcons.Actions.Refresh) {
override fun update(e: AnActionEvent) {
val context = e.getData(GithubPullRequestKeys.ACTION_DATA_CONTEXT)
val context = e.getData(GHPRActionKeys.ACTION_DATA_CONTEXT)
e.presentation.isEnabled = context != null
}
override fun actionPerformed(e: AnActionEvent) {
e.getRequiredData(GithubPullRequestKeys.ACTION_DATA_CONTEXT).resetAllData()
e.getRequiredData(GHPRActionKeys.ACTION_DATA_CONTEXT).resetAllData()
}
}

View File

@@ -9,15 +9,15 @@ import org.jetbrains.plugins.github.pullrequest.GHPRVirtualFile
class GHPRShowTimelineAction : DumbAwareAction("View Timeline", "Open pull request timeline in editor tab", null) {
override fun update(e: AnActionEvent) {
val selection = e.getData(GithubPullRequestKeys.SELECTED_PULL_REQUEST)
val context = e.getData(GithubPullRequestKeys.ACTION_DATA_CONTEXT)
val selection = e.getData(GHPRActionKeys.SELECTED_PULL_REQUEST)
val context = e.getData(GHPRActionKeys.ACTION_DATA_CONTEXT)
e.presentation.isEnabled = e.project != null && selection != null && context != null
}
override fun actionPerformed(e: AnActionEvent) {
val project = e.getRequiredData(PlatformDataKeys.PROJECT)
val selection = e.getRequiredData(GithubPullRequestKeys.SELECTED_PULL_REQUEST)
val context = e.getRequiredData(GithubPullRequestKeys.ACTION_DATA_CONTEXT)
val selection = e.getRequiredData(GHPRActionKeys.SELECTED_PULL_REQUEST)
val context = e.getRequiredData(GHPRActionKeys.ACTION_DATA_CONTEXT)
val file = GHPRVirtualFile(context, selection)
FileEditorManager.getInstance(project).openFile(file, true)

View File

@@ -8,12 +8,12 @@ import com.intellij.openapi.actionSystem.AnActionEvent
class GHPRUpdateTimelineAction : RefreshAction("Refresh Timeline", "Check for new timeline events", AllIcons.Actions.Refresh) {
override fun update(e: AnActionEvent) {
val context = e.getData(GithubPullRequestKeys.ACTION_DATA_CONTEXT)
val context = e.getData(GHPRActionKeys.ACTION_DATA_CONTEXT)
e.presentation.isEnabled = context?.pullRequestDataProvider?.timelineLoader != null
}
override fun actionPerformed(e: AnActionEvent) {
val dataProvider = e.getRequiredData(GithubPullRequestKeys.ACTION_DATA_CONTEXT).pullRequestDataProvider
val dataProvider = e.getRequiredData(GHPRActionKeys.ACTION_DATA_CONTEXT).pullRequestDataProvider
if (dataProvider?.timelineLoader?.loadMore(true) != null)
dataProvider.reloadReviewThreads()
}

View File

@@ -9,7 +9,7 @@ import org.jetbrains.annotations.CalledInAwt
/**
* Provides means to prevent concurrent pull request modifications which can result in undefined/broken state
*/
interface GithubPullRequestsBusyStateTracker {
interface GHPRBusyStateTracker {
@CalledInAwt
fun acquire(pullRequest: Long): Boolean

View File

@@ -8,7 +8,7 @@ import org.jetbrains.annotations.CalledInAny
import org.jetbrains.annotations.CalledInAwt
import java.util.*
class GithubPullRequestsBusyStateTrackerImpl : GithubPullRequestsBusyStateTracker {
class GHPRBusyStateTrackerImpl : GHPRBusyStateTracker {
private val busySet = ContainerUtil.newConcurrentSet<Long>()
private val busyChangeEventDispatcher = EventDispatcher.create(GithubPullRequestBusyStateListener::class.java)

View File

@@ -14,21 +14,21 @@ import org.jetbrains.plugins.github.pullrequest.search.GithubPullRequestSearchQu
import org.jetbrains.plugins.github.util.GitRemoteUrlCoordinates
import javax.swing.ListModel
internal class GHPullRequestsDataContext(val gitRepositoryCoordinates: GitRemoteUrlCoordinates,
val repositoryCoordinates: GHRepositoryCoordinates,
val account: GithubAccount,
val requestExecutor: GithubApiRequestExecutor,
val messageBus: MessageBus,
val listModel: ListModel<GHPullRequestShort>,
val searchHolder: GithubPullRequestSearchQueryHolder,
val listLoader: GHPRListLoader,
val dataLoader: GithubPullRequestsDataLoader,
val securityService: GithubPullRequestsSecurityService,
val busyStateTracker: GithubPullRequestsBusyStateTracker, //TODO: move to ui
val metadataService: GithubPullRequestsMetadataService,
val stateService: GithubPullRequestsStateService,
val reviewService: GHPRReviewService,
val commentService: GHPRCommentService) : Disposable {
internal class GHPRDataContext(val gitRepositoryCoordinates: GitRemoteUrlCoordinates,
val repositoryCoordinates: GHRepositoryCoordinates,
val account: GithubAccount,
val requestExecutor: GithubApiRequestExecutor,
val messageBus: MessageBus,
val listModel: ListModel<GHPullRequestShort>,
val searchHolder: GithubPullRequestSearchQueryHolder,
val listLoader: GHPRListLoader,
val dataLoader: GHPRDataLoader,
val securityService: GHPRSecurityService,
val busyStateTracker: GHPRBusyStateTracker, //TODO: move to ui
val metadataService: GHPRMetadataService,
val stateService: GHPRStateService,
val reviewService: GHPRReviewService,
val commentService: GHPRCommentService) : Disposable {
override fun dispose() {
Disposer.dispose(messageBus)

View File

@@ -20,8 +20,8 @@ import org.jetbrains.plugins.github.api.data.GHUser
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestShort
import org.jetbrains.plugins.github.authentication.accounts.GithubAccount
import org.jetbrains.plugins.github.authentication.accounts.GithubAccountInformationProvider
import org.jetbrains.plugins.github.pullrequest.data.GHPullRequestsDataContext.Companion.PULL_REQUEST_EDITED_TOPIC
import org.jetbrains.plugins.github.pullrequest.data.GHPullRequestsDataContext.Companion.PullRequestEditedListener
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataContext.Companion.PULL_REQUEST_EDITED_TOPIC
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataContext.Companion.PullRequestEditedListener
import org.jetbrains.plugins.github.pullrequest.data.service.*
import org.jetbrains.plugins.github.pullrequest.search.GithubPullRequestSearchQueryHolderImpl
import org.jetbrains.plugins.github.util.GitRemoteUrlCoordinates
@@ -30,12 +30,12 @@ import org.jetbrains.plugins.github.util.GithubUrlUtil
import java.io.IOException
@Service
internal class GHPullRequestsDataContextRepository(private val project: Project) {
internal class GHPRDataContextRepository(private val project: Project) {
@CalledInBackground
@Throws(IOException::class)
fun getContext(indicator: ProgressIndicator,
account: GithubAccount, requestExecutor: GithubApiRequestExecutor,
gitRemoteCoordinates: GitRemoteUrlCoordinates): GHPullRequestsDataContext {
gitRemoteCoordinates: GitRemoteUrlCoordinates): GHPRDataContext {
val fullPath = GithubUrlUtil.getUserAndRepositoryFromRemoteUrl(gitRemoteCoordinates.url)
?: throw IllegalArgumentException(
"Invalid GitHub Repository URL - ${gitRemoteCoordinates.url} is not a GitHub repository")
@@ -59,8 +59,9 @@ internal class GHPullRequestsDataContextRepository(private val project: Project)
override fun createListener(descriptor: ListenerDescriptor) = throw UnsupportedOperationException()
})
val securityService = GithubPullRequestsSecurityServiceImpl(GithubSharedProjectSettings.getInstance(project), currentUser, repoWithPermissions)
val reviewService = GHPRReviewServiceImpl(ProgressManager.getInstance(), messageBus, securityService, requestExecutor, repositoryCoordinates)
val securityService = GHPRSecurityServiceImpl(GithubSharedProjectSettings.getInstance(project), currentUser, repoWithPermissions)
val reviewService = GHPRReviewServiceImpl(ProgressManager.getInstance(), messageBus, securityService, requestExecutor,
repositoryCoordinates)
val commentService = GHPRCommentServiceImpl(ProgressManager.getInstance(), messageBus, securityService, requestExecutor,
repositoryCoordinates)
@@ -69,9 +70,9 @@ internal class GHPullRequestsDataContextRepository(private val project: Project)
val listLoader = GHPRListLoaderImpl(ProgressManager.getInstance(), requestExecutor, account.server, repoWithPermissions.path, listModel,
searchHolder)
val dataLoader = GithubPullRequestsDataLoaderImpl {
GithubPullRequestDataProviderImpl(project, ProgressManager.getInstance(), Git.getInstance(), requestExecutor, gitRemoteCoordinates,
repositoryCoordinates, it)
val dataLoader = GHPRDataLoaderImpl {
GHPRDataProviderImpl(project, ProgressManager.getInstance(), Git.getInstance(), requestExecutor, gitRemoteCoordinates,
repositoryCoordinates, it)
}
requestExecutor.addListener(dataLoader) {
dataLoader.invalidateAllData()
@@ -101,18 +102,18 @@ internal class GHPullRequestsDataContextRepository(private val project: Project)
}
}
})
val busyStateTracker = GithubPullRequestsBusyStateTrackerImpl()
val metadataService = GithubPullRequestsMetadataServiceImpl(ProgressManager.getInstance(), messageBus, requestExecutor, account.server,
repoWithPermissions.path, repoWithPermissions.owner)
val stateService = GithubPullRequestsStateServiceImpl(ProgressManager.getInstance(), messageBus,
requestExecutor, account.server, repoWithPermissions.path)
val busyStateTracker = GHPRBusyStateTrackerImpl()
val metadataService = GHPRMetadataServiceImpl(ProgressManager.getInstance(), messageBus, requestExecutor, account.server,
repoWithPermissions.path, repoWithPermissions.owner)
val stateService = GHPRStateServiceImpl(ProgressManager.getInstance(), messageBus,
requestExecutor, account.server, repoWithPermissions.path)
return GHPullRequestsDataContext(gitRemoteCoordinates, repositoryCoordinates, account,
requestExecutor, messageBus, listModel, searchHolder, listLoader, dataLoader, securityService,
busyStateTracker, metadataService, stateService, reviewService, commentService)
return GHPRDataContext(gitRemoteCoordinates, repositoryCoordinates, account,
requestExecutor, messageBus, listModel, searchHolder, listLoader, dataLoader, securityService,
busyStateTracker, metadataService, stateService, reviewService, commentService)
}
companion object {
fun getInstance(project: Project) = project.service<GHPullRequestsDataContextRepository>()
fun getInstance(project: Project) = project.service<GHPRDataContextRepository>()
}
}

View File

@@ -4,12 +4,12 @@ package org.jetbrains.plugins.github.pullrequest.data
import com.intellij.openapi.Disposable
import org.jetbrains.annotations.CalledInAwt
internal interface GithubPullRequestsDataLoader : Disposable {
internal interface GHPRDataLoader : Disposable {
@CalledInAwt
fun getDataProvider(number: Long): GithubPullRequestDataProvider
fun getDataProvider(number: Long): GHPRDataProvider
@CalledInAwt
fun findDataProvider(number: Long): GithubPullRequestDataProvider?
fun findDataProvider(number: Long): GHPRDataProvider?
@CalledInAwt
fun invalidateAllData()

View File

@@ -8,16 +8,16 @@ import com.intellij.util.EventDispatcher
import org.jetbrains.annotations.CalledInAwt
import java.util.*
internal class GithubPullRequestsDataLoaderImpl(private val dataProviderFactory: (Long) -> GithubPullRequestDataProvider)
: GithubPullRequestsDataLoader {
internal class GHPRDataLoaderImpl(private val dataProviderFactory: (Long) -> GHPRDataProvider)
: GHPRDataLoader {
private var isDisposed = false
private val cache = CacheBuilder.newBuilder()
.removalListener<Long, GithubPullRequestDataProvider> {
.removalListener<Long, GHPRDataProvider> {
runInEdt { invalidationEventDispatcher.multicaster.providerChanged(it.key) }
}
.maximumSize(5)
.build<Long, GithubPullRequestDataProvider>()
.build<Long, GHPRDataProvider>()
private val invalidationEventDispatcher = EventDispatcher.create(DataInvalidatedListener::class.java)
@@ -27,7 +27,7 @@ internal class GithubPullRequestsDataLoaderImpl(private val dataProviderFactory:
}
@CalledInAwt
override fun getDataProvider(number: Long): GithubPullRequestDataProvider {
override fun getDataProvider(number: Long): GHPRDataProvider {
if (isDisposed) throw IllegalStateException("Already disposed")
return cache.get(number) {
@@ -36,7 +36,7 @@ internal class GithubPullRequestsDataLoaderImpl(private val dataProviderFactory:
}
@CalledInAwt
override fun findDataProvider(number: Long): GithubPullRequestDataProvider? = cache.getIfPresent(number)
override fun findDataProvider(number: Long): GHPRDataProvider? = cache.getIfPresent(number)
override fun addInvalidationListener(disposable: Disposable, listener: (Long) -> Unit) =
invalidationEventDispatcher.addListener(object : DataInvalidatedListener {

View File

@@ -10,7 +10,7 @@ import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestReviewThre
import java.util.*
import java.util.concurrent.CompletableFuture
interface GithubPullRequestDataProvider : GHPRTimelineLoaderHolder {
interface GHPRDataProvider : GHPRTimelineLoaderHolder {
val number: Long
val detailsRequest: CompletableFuture<GHPullRequest>

View File

@@ -32,16 +32,16 @@ import java.util.concurrent.CompletionException
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
internal class GithubPullRequestDataProviderImpl(private val project: Project,
private val progressManager: ProgressManager,
private val git: Git,
private val requestExecutor: GithubApiRequestExecutor,
private val gitRemote: GitRemoteUrlCoordinates,
private val repository: GHRepositoryCoordinates,
override val number: Long)
: GithubPullRequestDataProvider {
internal class GHPRDataProviderImpl(private val project: Project,
private val progressManager: ProgressManager,
private val git: Git,
private val requestExecutor: GithubApiRequestExecutor,
private val gitRemote: GitRemoteUrlCoordinates,
private val repository: GHRepositoryCoordinates,
override val number: Long)
: GHPRDataProvider {
private val requestsChangesEventDispatcher = EventDispatcher.create(GithubPullRequestDataProvider.RequestsChangedListener::class.java)
private val requestsChangesEventDispatcher = EventDispatcher.create(GHPRDataProvider.RequestsChangedListener::class.java)
private var lastKnownBaseSha: String? = null
private var lastKnownHeadSha: String? = null
@@ -182,12 +182,12 @@ internal class GithubPullRequestDataProviderImpl(private val project: Project,
GithubAsyncUtil.futureOfMutable { invokeAndWaitIfNeeded { backingValue.value } }
}
override fun addRequestsChangesListener(listener: GithubPullRequestDataProvider.RequestsChangedListener) =
override fun addRequestsChangesListener(listener: GHPRDataProvider.RequestsChangedListener) =
requestsChangesEventDispatcher.addListener(listener)
override fun addRequestsChangesListener(disposable: Disposable, listener: GithubPullRequestDataProvider.RequestsChangedListener) =
override fun addRequestsChangesListener(disposable: Disposable, listener: GHPRDataProvider.RequestsChangedListener) =
requestsChangesEventDispatcher.addListener(listener, disposable)
override fun removeRequestsChangesListener(listener: GithubPullRequestDataProvider.RequestsChangedListener) =
override fun removeRequestsChangesListener(listener: GHPRDataProvider.RequestsChangedListener) =
requestsChangesEventDispatcher.removeListener(listener)
}

View File

@@ -4,7 +4,7 @@ package org.jetbrains.plugins.github.pullrequest.data.service
import com.intellij.openapi.progress.ProgressIndicator
import org.jetbrains.annotations.CalledInAny
import org.jetbrains.plugins.github.api.data.GithubIssueCommentWithHtml
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestDataProvider
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataProvider
import java.util.concurrent.CompletableFuture
interface GHPRCommentServiceAdapter {
@@ -18,7 +18,7 @@ interface GHPRCommentServiceAdapter {
companion object {
@CalledInAny
fun create(commentService: GHPRCommentService, dataProvider: GithubPullRequestDataProvider): GHPRCommentServiceAdapter {
fun create(commentService: GHPRCommentService, dataProvider: GHPRDataProvider): GHPRCommentServiceAdapter {
return object : GHPRCommentServiceAdapter {
override fun canComment() = commentService.canComment()

View File

@@ -9,13 +9,13 @@ import org.jetbrains.plugins.github.api.GithubApiRequestExecutor
import org.jetbrains.plugins.github.api.GithubApiRequests
import org.jetbrains.plugins.github.api.data.GHRepositoryPermissionLevel
import org.jetbrains.plugins.github.api.data.GithubIssueCommentWithHtml
import org.jetbrains.plugins.github.pullrequest.data.GHPullRequestsDataContext
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataContext
import org.jetbrains.plugins.github.util.submitIOTask
import java.util.concurrent.CompletableFuture
class GHPRCommentServiceImpl(private val progressManager: ProgressManager,
private val messageBus: MessageBus,
private val securityService: GithubPullRequestsSecurityService,
private val securityService: GHPRSecurityService,
private val requestExecutor: GithubApiRequestExecutor,
private val repository: GHRepositoryCoordinates) : GHPRCommentService {
override fun canComment() = securityService.currentUserHasPermissionLevel(GHRepositoryPermissionLevel.TRIAGE)
@@ -26,7 +26,7 @@ class GHPRCommentServiceImpl(private val progressManager: ProgressManager,
return progressManager.submitIOTask(progressIndicator) {
val comment = requestExecutor.execute(
GithubApiRequests.Repos.Issues.Comments.create(repository, pullRequest, body))
messageBus.syncPublisher(GHPullRequestsDataContext.PULL_REQUEST_EDITED_TOPIC).onPullRequestCommentsEdited(pullRequest)
messageBus.syncPublisher(GHPRDataContext.PULL_REQUEST_EDITED_TOPIC).onPullRequestCommentsEdited(pullRequest)
comment
}
}

View File

@@ -12,7 +12,7 @@ import org.jetbrains.plugins.github.api.data.pullrequest.GHTeam
import org.jetbrains.plugins.github.util.CollectionDelta
import java.util.concurrent.CompletableFuture
interface GithubPullRequestsMetadataService : Disposable {
interface GHPRMetadataService : Disposable {
val collaboratorsWithPushAccess: CompletableFuture<List<GHUser>>
val teams: CompletableFuture<List<GHTeam>>
val potentialReviewers: CompletableFuture<List<GHPullRequestRequestedReviewer>>

View File

@@ -14,20 +14,20 @@ import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestRequestedR
import org.jetbrains.plugins.github.api.data.pullrequest.GHTeam
import org.jetbrains.plugins.github.api.util.GithubApiPagesLoader
import org.jetbrains.plugins.github.api.util.SimpleGHGQLPagesLoader
import org.jetbrains.plugins.github.pullrequest.data.GHPullRequestsDataContext.Companion.PULL_REQUEST_EDITED_TOPIC
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataContext.Companion.PULL_REQUEST_EDITED_TOPIC
import org.jetbrains.plugins.github.util.CollectionDelta
import org.jetbrains.plugins.github.util.GithubAsyncUtil
import org.jetbrains.plugins.github.util.LazyCancellableBackgroundProcessValue
import java.util.concurrent.CompletableFuture
import java.util.function.BiFunction
class GithubPullRequestsMetadataServiceImpl internal constructor(progressManager: ProgressManager,
private val messageBus: MessageBus,
private val requestExecutor: GithubApiRequestExecutor,
private val serverPath: GithubServerPath,
private val repoPath: GHRepositoryPath,
private val repoOwner: GHRepositoryOwnerName)
: GithubPullRequestsMetadataService {
class GHPRMetadataServiceImpl internal constructor(progressManager: ProgressManager,
private val messageBus: MessageBus,
private val requestExecutor: GithubApiRequestExecutor,
private val serverPath: GithubServerPath,
private val repoPath: GHRepositoryPath,
private val repoOwner: GHRepositoryOwnerName)
: GHPRMetadataService {
init {
requestExecutor.addListener(this) {

View File

@@ -7,7 +7,7 @@ import org.jetbrains.annotations.CalledInAny
import org.jetbrains.annotations.CalledInAwt
import org.jetbrains.plugins.github.api.data.GithubPullRequestCommentWithHtml
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestReviewThread
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestDataProvider
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataProvider
import java.util.concurrent.CompletableFuture
interface GHPRReviewServiceAdapter {
@@ -34,7 +34,7 @@ interface GHPRReviewServiceAdapter {
companion object {
@CalledInAny
fun create(reviewService: GHPRReviewService, dataProvider: GithubPullRequestDataProvider): GHPRReviewServiceAdapter {
fun create(reviewService: GHPRReviewService, dataProvider: GHPRDataProvider): GHPRReviewServiceAdapter {
return object : GHPRReviewServiceAdapter {
override fun loadReviewThreads(): CompletableFuture<List<GHPullRequestReviewThread>> {
@@ -60,7 +60,7 @@ interface GHPRReviewServiceAdapter {
}
override fun addReviewThreadsListener(disposable: Disposable, listener: () -> Unit) {
dataProvider.addRequestsChangesListener(disposable, object : GithubPullRequestDataProvider.RequestsChangedListener {
dataProvider.addRequestsChangesListener(disposable, object : GHPRDataProvider.RequestsChangedListener {
override fun reviewThreadsRequestChanged() {
listener()
}

View File

@@ -9,13 +9,13 @@ import org.jetbrains.plugins.github.api.GithubApiRequestExecutor
import org.jetbrains.plugins.github.api.GithubApiRequests
import org.jetbrains.plugins.github.api.data.GHRepositoryPermissionLevel
import org.jetbrains.plugins.github.api.data.GithubPullRequestCommentWithHtml
import org.jetbrains.plugins.github.pullrequest.data.GHPullRequestsDataContext
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataContext
import org.jetbrains.plugins.github.util.submitIOTask
import java.util.concurrent.CompletableFuture
class GHPRReviewServiceImpl(private val progressManager: ProgressManager,
private val messageBus: MessageBus,
private val securityService: GithubPullRequestsSecurityService,
private val securityService: GHPRSecurityService,
private val requestExecutor: GithubApiRequestExecutor,
private val repository: GHRepositoryCoordinates) : GHPRReviewService {
override fun canComment() = securityService.currentUserHasPermissionLevel(GHRepositoryPermissionLevel.TRIAGE)
@@ -27,7 +27,7 @@ class GHPRReviewServiceImpl(private val progressManager: ProgressManager,
return progressManager.submitIOTask(progressIndicator) {
val comment = requestExecutor.execute(
GithubApiRequests.Repos.PullRequests.Comments.createReply(repository, pullRequest, replyToCommentId, body))
messageBus.syncPublisher(GHPullRequestsDataContext.PULL_REQUEST_EDITED_TOPIC).onPullRequestReviewsEdited(pullRequest)
messageBus.syncPublisher(GHPRDataContext.PULL_REQUEST_EDITED_TOPIC).onPullRequestReviewsEdited(pullRequest)
comment
}
}
@@ -41,7 +41,7 @@ class GHPRReviewServiceImpl(private val progressManager: ProgressManager,
return progressManager.submitIOTask(progressIndicator) {
val comment = requestExecutor.execute(
GithubApiRequests.Repos.PullRequests.Comments.create(repository, pullRequest, commitSha, fileName, diffLine, body))
messageBus.syncPublisher(GHPullRequestsDataContext.PULL_REQUEST_EDITED_TOPIC).onPullRequestReviewsEdited(pullRequest)
messageBus.syncPublisher(GHPRDataContext.PULL_REQUEST_EDITED_TOPIC).onPullRequestReviewsEdited(pullRequest)
comment
}
}

View File

@@ -5,7 +5,7 @@ import org.jetbrains.plugins.github.api.data.GHRepositoryPermissionLevel
import org.jetbrains.plugins.github.api.data.GHUser
import org.jetbrains.plugins.github.api.data.GithubUser
interface GithubPullRequestsSecurityService {
interface GHPRSecurityService {
val currentUser: GHUser
fun isCurrentUser(user: GithubUser): Boolean

View File

@@ -7,9 +7,9 @@ import org.jetbrains.plugins.github.api.data.GHUser
import org.jetbrains.plugins.github.api.data.GithubUser
import org.jetbrains.plugins.github.util.GithubSharedProjectSettings
class GithubPullRequestsSecurityServiceImpl(private val sharedProjectSettings: GithubSharedProjectSettings,
override val currentUser: GHUser,
private val repo: GHRepositoryPermission) : GithubPullRequestsSecurityService {
class GHPRSecurityServiceImpl(private val sharedProjectSettings: GithubSharedProjectSettings,
override val currentUser: GHUser,
private val repo: GHRepositoryPermission) : GHPRSecurityService {
override fun isCurrentUser(user: GithubUser) = user.nodeId == currentUser.id
override fun currentUserCanEditPullRequestsMetadata() = currentUserHasPermissionLevel(GHRepositoryPermissionLevel.TRIAGE)

View File

@@ -5,7 +5,7 @@ import com.intellij.openapi.progress.ProgressIndicator
import org.jetbrains.annotations.CalledInAny
import java.util.concurrent.CompletableFuture
interface GithubPullRequestsStateService {
interface GHPRStateService {
@CalledInAny
fun close(progressIndicator: ProgressIndicator, pullRequest: Long): CompletableFuture<Unit>

View File

@@ -9,15 +9,15 @@ import org.jetbrains.plugins.github.api.GithubApiRequestExecutor
import org.jetbrains.plugins.github.api.GithubApiRequests
import org.jetbrains.plugins.github.api.GithubServerPath
import org.jetbrains.plugins.github.api.data.GithubIssueState
import org.jetbrains.plugins.github.pullrequest.data.GHPullRequestsDataContext.Companion.PULL_REQUEST_EDITED_TOPIC
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataContext.Companion.PULL_REQUEST_EDITED_TOPIC
import org.jetbrains.plugins.github.util.submitIOTask
class GithubPullRequestsStateServiceImpl internal constructor(private val progressManager: ProgressManager,
private val messageBus: MessageBus,
private val requestExecutor: GithubApiRequestExecutor,
private val serverPath: GithubServerPath,
private val repoPath: GHRepositoryPath)
: GithubPullRequestsStateService {
class GHPRStateServiceImpl internal constructor(private val progressManager: ProgressManager,
private val messageBus: MessageBus,
private val requestExecutor: GithubApiRequestExecutor,
private val serverPath: GithubServerPath,
private val repoPath: GHRepositoryPath)
: GHPRStateService {
override fun close(progressIndicator: ProgressIndicator, pullRequest: Long) =
progressManager.submitIOTask(progressIndicator) {

View File

@@ -21,7 +21,7 @@ import net.miginfocom.layout.LC
import net.miginfocom.swing.MigLayout
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestShort
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestState
import org.jetbrains.plugins.github.pullrequest.action.GithubPullRequestKeys
import org.jetbrains.plugins.github.pullrequest.action.GHPRActionKeys
import org.jetbrains.plugins.github.pullrequest.avatars.CachingGithubAvatarIconsProvider
import org.jetbrains.plugins.github.util.GithubUIUtil
import java.awt.Component
@@ -30,9 +30,9 @@ import java.awt.event.MouseAdapter
import java.awt.event.MouseEvent
import javax.swing.*
internal class GithubPullRequestsList(private val copyPasteManager: CopyPasteManager,
avatarIconsProviderFactory: CachingGithubAvatarIconsProvider.Factory,
model: ListModel<GHPullRequestShort>)
internal class GHPRList(private val copyPasteManager: CopyPasteManager,
avatarIconsProviderFactory: CachingGithubAvatarIconsProvider.Factory,
model: ListModel<GHPullRequestShort>)
: JBList<GHPullRequestShort>(model), CopyProvider, DataProvider, Disposable {
private val avatarIconsProvider = avatarIconsProviderFactory.create(GithubUIUtil.avatarSize, this)
@@ -66,7 +66,7 @@ internal class GithubPullRequestsList(private val copyPasteManager: CopyPasteMan
override fun getData(dataId: String): Any? = when {
PlatformDataKeys.COPY_PROVIDER.`is`(dataId) -> this
GithubPullRequestKeys.SELECTED_PULL_REQUEST.`is`(dataId) -> selectedValue
GHPRActionKeys.SELECTED_PULL_REQUEST.`is`(dataId) -> selectedValue
else -> null
}

View File

@@ -5,10 +5,10 @@ import com.intellij.diff.util.DiffUserDataKeysEx
import com.intellij.openapi.vcs.changes.Change
import org.jetbrains.plugins.github.pullrequest.comment.GHPRDiffReviewSupport
import org.jetbrains.plugins.github.pullrequest.data.GHPRChangesProvider
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestDataProvider
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataProvider
interface GHPRChangesDiffHelper {
fun setUp(dataProvider: GithubPullRequestDataProvider, changesProvider: GHPRChangesProvider)
fun setUp(dataProvider: GHPRDataProvider, changesProvider: GHPRChangesProvider)
fun reset()
fun getReviewSupport(change: Change): GHPRDiffReviewSupport?

View File

@@ -13,7 +13,7 @@ import org.jetbrains.plugins.github.pullrequest.avatars.CachingGithubAvatarIcons
import org.jetbrains.plugins.github.pullrequest.comment.GHPRDiffReviewSupport
import org.jetbrains.plugins.github.pullrequest.comment.GHPRDiffReviewSupportImpl
import org.jetbrains.plugins.github.pullrequest.data.GHPRChangesProvider
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestDataProvider
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataProvider
import org.jetbrains.plugins.github.pullrequest.data.service.GHPRReviewService
import org.jetbrains.plugins.github.pullrequest.data.service.GHPRReviewServiceAdapter
@@ -22,10 +22,10 @@ class GHPRChangesDiffHelperImpl(private val project: Project,
private val avatarIconsProviderFactory: CachingGithubAvatarIconsProvider.Factory,
private val currentUser: GHUser)
: GHPRChangesDiffHelper {
private var dataProvider: GithubPullRequestDataProvider? = null
private var dataProvider: GHPRDataProvider? = null
private var changesProvider: GHPRChangesProvider? = null
override fun setUp(dataProvider: GithubPullRequestDataProvider, changesProvider: GHPRChangesProvider) {
override fun setUp(dataProvider: GHPRDataProvider, changesProvider: GHPRChangesProvider) {
this.dataProvider = dataProvider
this.changesProvider = changesProvider
}

View File

@@ -1,7 +1,7 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.github.pullrequest.ui.changes
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestDataProvider
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataProvider
import org.jetbrains.plugins.github.pullrequest.ui.GHEventDispatcherLoadingModel
import org.jetbrains.plugins.github.util.handleOnEdt
import org.jetbrains.plugins.github.util.successOnEdt
@@ -16,12 +16,12 @@ class GHPRChangesLoadingModel(private val changesModel: GHPRChangesModel,
var zipChanges by Delegates.observable(zipChanges) { _, _, _ ->
update()
}
private val requestChangesListener = object : GithubPullRequestDataProvider.RequestsChangedListener {
private val requestChangesListener = object : GHPRDataProvider.RequestsChangedListener {
override fun commitsRequestChanged() {
update()
}
}
var dataProvider by Delegates.observable<GithubPullRequestDataProvider?>(null) { _, oldValue, newValue ->
var dataProvider by Delegates.observable<GHPRDataProvider?>(null) { _, oldValue, newValue ->
oldValue?.removeRequestsChangesListener(requestChangesListener)
newValue?.addRequestsChangesListener(requestChangesListener)
update()

View File

@@ -19,9 +19,9 @@ import org.jetbrains.plugins.github.api.data.GHUser
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequest
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestRequestedReviewer
import org.jetbrains.plugins.github.pullrequest.avatars.CachingGithubAvatarIconsProvider
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestsBusyStateTracker
import org.jetbrains.plugins.github.pullrequest.data.service.GithubPullRequestsMetadataService
import org.jetbrains.plugins.github.pullrequest.data.service.GithubPullRequestsSecurityService
import org.jetbrains.plugins.github.pullrequest.data.GHPRBusyStateTracker
import org.jetbrains.plugins.github.pullrequest.data.service.GHPRMetadataService
import org.jetbrains.plugins.github.pullrequest.data.service.GHPRSecurityService
import org.jetbrains.plugins.github.ui.util.SingleValueModel
import org.jetbrains.plugins.github.util.*
import javax.swing.JLabel
@@ -30,9 +30,9 @@ import javax.swing.SwingConstants
internal class GHPRMetadataPanel(private val project: Project,
private val model: SingleValueModel<GHPullRequest?>,
private val securityService: GithubPullRequestsSecurityService,
private val busyStateTracker: GithubPullRequestsBusyStateTracker,
private val metadataService: GithubPullRequestsMetadataService,
private val securityService: GHPRSecurityService,
private val busyStateTracker: GHPRBusyStateTracker,
private val metadataService: GHPRMetadataService,
private val avatarIconsProviderFactory: CachingGithubAvatarIconsProvider.Factory)
: JPanel(), Disposable {

View File

@@ -20,10 +20,10 @@ import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestMergeableS
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestShort
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestState
import org.jetbrains.plugins.github.pullrequest.action.ui.GithubMergeCommitMessageDialog
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestDataProvider
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestsBusyStateTracker
import org.jetbrains.plugins.github.pullrequest.data.service.GithubPullRequestsSecurityService
import org.jetbrains.plugins.github.pullrequest.data.service.GithubPullRequestsStateService
import org.jetbrains.plugins.github.pullrequest.data.GHPRBusyStateTracker
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataProvider
import org.jetbrains.plugins.github.pullrequest.data.service.GHPRSecurityService
import org.jetbrains.plugins.github.pullrequest.data.service.GHPRStateService
import org.jetbrains.plugins.github.ui.util.HtmlEditorPane
import org.jetbrains.plugins.github.ui.util.SingleValueModel
import org.jetbrains.plugins.github.util.errorOnEdt
@@ -36,10 +36,10 @@ import javax.swing.*
object GHPRStatePanel {
fun create(project: Project,
model: SingleValueModel<out GHPullRequestShort>,
dataProvider: GithubPullRequestDataProvider,
securityService: GithubPullRequestsSecurityService,
busyStateTracker: GithubPullRequestsBusyStateTracker,
stateService: GithubPullRequestsStateService,
dataProvider: GHPRDataProvider,
securityService: GHPRSecurityService,
busyStateTracker: GHPRBusyStateTracker,
stateService: GHPRStateService,
parentDisposable: Disposable): JComponent {
val stateLabel = JLabel().apply {
@@ -65,10 +65,10 @@ object GHPRStatePanel {
private fun createButtons(project: Project,
model: SingleValueModel<out GHPullRequestShort?>,
dataProvider: GithubPullRequestDataProvider,
securityService: GithubPullRequestsSecurityService,
busyStateTracker: GithubPullRequestsBusyStateTracker,
stateService: GithubPullRequestsStateService,
dataProvider: GHPRDataProvider,
securityService: GHPRSecurityService,
busyStateTracker: GHPRBusyStateTracker,
stateService: GHPRStateService,
parentDisposable: Disposable): JComponent {
val closeButton = JButton()
val reopenButton = JButton()
@@ -91,7 +91,7 @@ object GHPRStatePanel {
}
private class Controller(private val model: SingleValueModel<out GHPullRequestShort?>,
private val securityService: GithubPullRequestsSecurityService,
private val securityService: GHPRSecurityService,
private val stateLabel: JLabel,
private val accessDeniedLabel: JLabel) {
@@ -152,10 +152,10 @@ object GHPRStatePanel {
private class ButtonsController(private val project: Project,
private val model: SingleValueModel<out GHPullRequestShort?>,
private val dataProvider: GithubPullRequestDataProvider,
private val securityService: GithubPullRequestsSecurityService,
private val busyStateTracker: GithubPullRequestsBusyStateTracker,
private val stateService: GithubPullRequestsStateService,
private val dataProvider: GHPRDataProvider,
private val securityService: GHPRSecurityService,
private val busyStateTracker: GHPRBusyStateTracker,
private val stateService: GHPRStateService,
parentDisposable: Disposable,
private val closeButton: JButton,
private val reopenButton: JButton,

View File

@@ -11,8 +11,8 @@ import com.intellij.util.ui.JBUI
import com.intellij.util.ui.JBUI.Panels.simplePanel
import com.intellij.util.ui.UIUtil
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequest
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestsBusyStateTracker
import org.jetbrains.plugins.github.pullrequest.data.service.GithubPullRequestsSecurityService
import org.jetbrains.plugins.github.pullrequest.data.GHPRBusyStateTracker
import org.jetbrains.plugins.github.pullrequest.data.service.GHPRSecurityService
import org.jetbrains.plugins.github.ui.WrapLayout
import org.jetbrains.plugins.github.ui.util.SingleValueModel
import org.jetbrains.plugins.github.util.GithubUtil.Delegates.equalVetoingObservable
@@ -26,8 +26,8 @@ import javax.swing.JComponent
import javax.swing.JLabel
internal abstract class LabeledListPanelHandle<T>(private val model: SingleValueModel<GHPullRequest?>,
private val securityService: GithubPullRequestsSecurityService,
private val busyStateTracker: GithubPullRequestsBusyStateTracker,
private val securityService: GHPRSecurityService,
private val busyStateTracker: GHPRBusyStateTracker,
emptyText: String, notEmptyText: String)
: Disposable {

View File

@@ -3,10 +3,10 @@ package org.jetbrains.plugins.github.pullrequest.ui.timeline
import com.intellij.openapi.Disposable
import org.jetbrains.plugins.github.api.data.pullrequest.GHPullRequestReviewThread
import org.jetbrains.plugins.github.pullrequest.data.GithubPullRequestDataProvider
import org.jetbrains.plugins.github.pullrequest.data.GHPRDataProvider
import org.jetbrains.plugins.github.util.handleOnEdt
class GHPRReviewsThreadsModelsProviderImpl(private val dataProvider: GithubPullRequestDataProvider,
class GHPRReviewsThreadsModelsProviderImpl(private val dataProvider: GHPRDataProvider,
private val parentDisposable: Disposable)
: GHPRReviewsThreadsModelsProvider {
@@ -16,7 +16,7 @@ class GHPRReviewsThreadsModelsProviderImpl(private val dataProvider: GithubPullR
private var threadsUpdateRequired = false
init {
dataProvider.addRequestsChangesListener(parentDisposable, object : GithubPullRequestDataProvider.RequestsChangedListener {
dataProvider.addRequestsChangesListener(parentDisposable, object : GHPRDataProvider.RequestsChangedListener {
override fun reviewThreadsRequestChanged() {
if (threadsModelsByReview.isNotEmpty()) requestUpdateReviewsThreads()
}