Skip to content

Commit

Permalink
fix:remove unneeded CopyProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
cunla committed Apr 21, 2024
1 parent 4da6b36 commit 16c0403
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import com.dsoftware.ghmanager.api.model.Job
import com.dsoftware.ghmanager.api.model.Status
import com.dsoftware.ghmanager.i18n.MessagesBundle
import com.dsoftware.ghmanager.ui.ToolbarUtil
import com.intellij.ide.CopyProvider
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.DataProvider
import com.intellij.openapi.actionSystem.PlatformDataKeys
import com.intellij.ui.AnimatedIcon
Expand Down Expand Up @@ -36,7 +33,7 @@ import javax.swing.ListSelectionModel

class JobListComponent(
model: ListModel<Job>, private val infoInNewLine: Boolean,
) : JBList<Job>(model), DataProvider, CopyProvider {
) : JBList<Job>(model), DataProvider {

init {
isEnabled = true
Expand All @@ -56,7 +53,6 @@ class JobListComponent(
}

override fun getData(dataId: String): Any? = when {
PlatformDataKeys.COPY_PROVIDER.`is`(dataId) -> this
ActionKeys.SELECTED_JOB.`is`(dataId) -> selectedValue
else -> null
}
Expand Down Expand Up @@ -129,13 +125,4 @@ class JobListComponent(
return this
}
}

override fun performCopy(dataContext: DataContext) = TODO("Not yet implemented")

override fun isCopyEnabled(dataContext: DataContext): Boolean = false

override fun isCopyVisible(dataContext: DataContext): Boolean = false
override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import javax.swing.ListSelectionModel

class WorkflowRunsListComponent(
model: ListModel<WorkflowRun>
) : JBList<WorkflowRun>(model), DataProvider, CopyProvider {
) : JBList<WorkflowRun>(model), DataProvider {

init {
selectionModel.selectionMode = ListSelectionModel.SINGLE_SELECTION
Expand All @@ -50,18 +50,13 @@ class WorkflowRunsListComponent(
ClientProperty.put(this, AnimatedIcon.ANIMATION_IN_RENDERER_ALLOWED, true)
}

override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}

override fun getToolTipText(event: MouseEvent): String? {
val childComponent = ListUtil.getDeepestRendererChildComponentAt(this, event.point)
if (childComponent !is JComponent) return null
return childComponent.toolTipText
}

override fun getData(dataId: String): Any? = when {
PlatformDataKeys.COPY_PROVIDER.`is`(dataId) -> this
ActionKeys.SELECTED_WORKFLOW_RUN.`is`(dataId) -> selectedValue
ActionKeys.SELECTED_WORKFLOW_RUN_FILEPATH.`is`(dataId) -> selectedValue?.path
else -> null
Expand Down Expand Up @@ -123,7 +118,4 @@ class WorkflowRunsListComponent(
}
}

override fun performCopy(dataContext: DataContext) = TODO("Not yet implemented")
override fun isCopyEnabled(dataContext: DataContext): Boolean = false
override fun isCopyVisible(dataContext: DataContext): Boolean = false
}

0 comments on commit 16c0403

Please sign in to comment.