mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 18:05:27 +07:00
RIDER-102481 ProductChooserPage tab navigation
GitOrigin-RevId: 9da775f9db3dd3144935daf9ecbcd9eef65ef2aa
This commit is contained in:
committed by
intellij-monorepo-bot
parent
eac3cd59b8
commit
d78636fb89
@@ -27,7 +27,6 @@ class ConfigAction(val controller: ImportSettingsController) : DumbAwareAction()
|
||||
}
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
//TODO implement
|
||||
//callback(JBrActionsDataProvider.getInstance(), config)
|
||||
controller.configChosen()
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,12 @@ import com.intellij.ide.ui.laf.darcula.ui.OnboardingDialogButtons
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.Separator
|
||||
import com.intellij.ui.components.ActionLink
|
||||
import com.intellij.util.ui.JBUI
|
||||
import org.jetbrains.annotations.Nls
|
||||
import javax.swing.JButton
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.SwingConstants
|
||||
|
||||
class OtherOptions(private val controller: ImportSettingsController) : ProductChooserAction() {
|
||||
|
||||
@@ -43,7 +46,7 @@ class OtherOptions(private val controller: ImportSettingsController) : ProductCh
|
||||
sync = addActionList(syncProducts, syncDataProvider, ImportSettingsBundle.message("other.options.sub.title.setting.sync"))
|
||||
}
|
||||
|
||||
sync?.let {
|
||||
/* sync?.let {
|
||||
if (it.isNotEmpty()) {
|
||||
arr.addAll(it)
|
||||
}
|
||||
@@ -53,7 +56,7 @@ class OtherOptions(private val controller: ImportSettingsController) : ProductCh
|
||||
if (it.isNotEmpty()) {
|
||||
arr.addAll(it)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if (arr.isNotEmpty()) {
|
||||
arr.add(Separator())
|
||||
@@ -87,8 +90,10 @@ class OtherOptions(private val controller: ImportSettingsController) : ProductCh
|
||||
}
|
||||
|
||||
override fun createButton(): JButton {
|
||||
return OnboardingDialogButtons.createLinkButton().apply {
|
||||
icon = AllIcons.General.LinkDropTriangle
|
||||
return ActionLink().apply {
|
||||
setHorizontalTextPosition(SwingConstants.LEFT)
|
||||
setForeground(JBUI.CurrentTheme.Link.Foreground.ENABLED)
|
||||
iconTextGap = 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ import com.intellij.openapi.ui.popup.ListPopup
|
||||
import com.intellij.openapi.ui.popup.ListPopupStep
|
||||
import com.intellij.ui.awt.RelativePoint
|
||||
import com.intellij.ui.popup.list.ListPopupImpl
|
||||
import com.intellij.ui.util.preferredWidth
|
||||
import com.intellij.util.ui.JBUI
|
||||
import java.awt.Dimension
|
||||
import java.awt.Point
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.ListCellRenderer
|
||||
@@ -67,7 +67,6 @@ abstract class ProductChooserAction : ChooseProductActionButton(null) {
|
||||
|
||||
/* JBPopupFactory.getInstance().createListPopup(step)*/
|
||||
|
||||
|
||||
val result = object : ListPopupImpl(null, step) {
|
||||
override fun getListElementRenderer(): ListCellRenderer<*> {
|
||||
return renderer
|
||||
@@ -75,13 +74,12 @@ abstract class ProductChooserAction : ChooseProductActionButton(null) {
|
||||
|
||||
override fun createPopupComponent(content: JComponent?): JComponent {
|
||||
val popupComponent = super.createPopupComponent(content)
|
||||
popupComponent.preferredWidth = JBUI.scale(UiUtils.DEFAULT_BUTTON_WIDTH)
|
||||
popupComponent.preferredSize = Dimension(JBUI.scale (UiUtils.DEFAULT_BUTTON_WIDTH), popupComponent.preferredSize.height)
|
||||
|
||||
return popupComponent
|
||||
}
|
||||
|
||||
}
|
||||
result.setRequestFocus(false)
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.intellij.ide.startup.importSettings.chooser.ui.UiUtils
|
||||
import com.intellij.ide.startup.importSettings.data.SettingsService
|
||||
import com.intellij.openapi.actionSystem.ActionManager
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces
|
||||
import com.intellij.openapi.actionSystem.ActionToolbar
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl
|
||||
import com.intellij.openapi.rd.createLifetime
|
||||
@@ -69,6 +70,7 @@ class ProductChooserPage(val controller: ImportSettingsController) : OnboardingP
|
||||
JBUI.size(UiUtils.DEFAULT_BUTTON_WIDTH, UiUtils.DEFAULT_BUTTON_HEIGHT)
|
||||
}
|
||||
setMiniMode(false)
|
||||
layoutPolicy = ActionToolbar.NOWRAP_LAYOUT_POLICY
|
||||
}
|
||||
}
|
||||
act.targetComponent = pane
|
||||
@@ -91,7 +93,7 @@ class ProductChooserPage(val controller: ImportSettingsController) : OnboardingP
|
||||
add(accountLabel, BorderLayout.WEST)
|
||||
add(at.component, BorderLayout.EAST)
|
||||
|
||||
border = JBUI.Borders.empty(0, 20, 10, 0)
|
||||
border = JBUI.Borders.empty(0, 20, 10, 7)
|
||||
preferredSize = Dimension(preferredSize.width, JBUI.scale(47))
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.intellij.ide.startup.importSettings.chooser.productChooser
|
||||
|
||||
import com.intellij.ide.plugins.newui.ListPluginComponent
|
||||
import com.intellij.ide.startup.importSettings.chooser.settingChooser.SettingChooserItemAction
|
||||
import com.intellij.ide.startup.importSettings.chooser.ui.UiUtils
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.ui.popup.ListSeparator
|
||||
import com.intellij.openapi.ui.popup.util.PopupUtil
|
||||
@@ -21,6 +22,7 @@ import com.intellij.util.ui.UIUtil
|
||||
import org.jetbrains.annotations.Nls
|
||||
import java.awt.BorderLayout
|
||||
import java.awt.Component
|
||||
import java.awt.Dimension
|
||||
import javax.swing.*
|
||||
|
||||
class ProductChooserRenderer : ListCellRenderer<PopupFactoryImpl.ActionItem> {
|
||||
|
||||
@@ -24,6 +24,8 @@ interface ImportSettingsController : BaseController {
|
||||
|
||||
fun skipImport()
|
||||
|
||||
fun configChosen()
|
||||
|
||||
}
|
||||
|
||||
private class ImportSettingsControllerImpl(dialog: OnboardingDialog, override val skipImportAction: () -> Unit) : ImportSettingsController, BaseControllerImpl(dialog) {
|
||||
@@ -57,9 +59,11 @@ private class ImportSettingsControllerImpl(dialog: OnboardingDialog, override va
|
||||
dialog.changePage(page)
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun skipImport() {
|
||||
dialog.dialogClose()
|
||||
}
|
||||
|
||||
override fun configChosen() {
|
||||
SettingsService.getInstance().configChosen()
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import javax.swing.JPanel
|
||||
import javax.swing.border.Border
|
||||
import kotlin.math.max
|
||||
|
||||
class RoundedPanel private constructor(val unscaledRadius: Int = RADIUS) : JPanel(BorderLayout()) {
|
||||
class RoundedPanel private constructor(unscaledRadius: Int = RADIUS) : JPanel(BorderLayout()) {
|
||||
companion object {
|
||||
const val RADIUS = 20
|
||||
const val THICKNESS = 1
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
package com.intellij.ide.startup.importSettings.data
|
||||
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.ide.startup.importSettings.chooser.ui.OnboardingController
|
||||
import com.intellij.ide.startup.importSettings.chooser.ui.OnboardingDialog
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.jetbrains.rd.util.lifetime.Lifetime
|
||||
import com.jetbrains.rd.util.reactive.IProperty
|
||||
@@ -18,8 +20,11 @@ import kotlin.random.Random
|
||||
|
||||
internal const val IMPORT_SERVICE = "ImportService"
|
||||
|
||||
class TestJbService : JbService {
|
||||
class TestJbService private constructor(): JbService {
|
||||
companion object {
|
||||
private val service = TestJbService()
|
||||
|
||||
fun getInstance() = service
|
||||
|
||||
private val LOG = logger<TestJbService>()
|
||||
|
||||
@@ -197,6 +202,9 @@ class TestJbService : JbService {
|
||||
}
|
||||
}
|
||||
}
|
||||
fun configChosen() {
|
||||
OnboardingController.getInstance().startWizard(isModal = false)
|
||||
}
|
||||
|
||||
override fun hasDataToImport() = true
|
||||
|
||||
@@ -213,6 +221,7 @@ class TestJbService : JbService {
|
||||
return old
|
||||
}
|
||||
|
||||
|
||||
override fun getSettings(itemId: String): List<BaseSetting> {
|
||||
return if (itemId == main.id) settings1 else settings
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ interface SettingsService {
|
||||
|
||||
val doClose: ISignal<Unit>
|
||||
|
||||
fun configChosen()
|
||||
|
||||
fun isLoggedIn(): Boolean = jbAccount.value != null
|
||||
}
|
||||
|
||||
@@ -57,7 +59,7 @@ class SettingsServiceImpl : SettingsService, Disposable.Default {
|
||||
else SyncServiceImpl.getInstance()
|
||||
|
||||
override fun getJbService() =
|
||||
if (shouldUseMockData) TestJbService()
|
||||
if (shouldUseMockData) TestJbService.getInstance()
|
||||
else JbImportServiceImpl.getInstance()
|
||||
|
||||
override fun getExternalService(): ExternalService =
|
||||
@@ -80,6 +82,11 @@ class SettingsServiceImpl : SettingsService, Disposable.Default {
|
||||
override val jbAccount = Property<JBAccountInfoService.JBAData?>(null)
|
||||
|
||||
override val doClose = Signal<Unit>()
|
||||
override fun configChosen() {
|
||||
if (shouldUseMockData) {
|
||||
TestJbService.getInstance().configChosen()
|
||||
}
|
||||
}
|
||||
|
||||
private fun unloggedSyncHide(): IPropertyView<Boolean> {
|
||||
fun getValue(): Boolean = Registry.`is`("import.setting.unlogged.sync.hide")
|
||||
@@ -95,7 +102,8 @@ class SettingsServiceImpl : SettingsService, Disposable.Default {
|
||||
}
|
||||
}
|
||||
|
||||
override val isSyncEnabled = Property(shouldUseMockData) //jbAccount.compose(unloggedSyncHide()) { account, reg -> !reg || account != null }
|
||||
override val isSyncEnabled = Property(
|
||||
shouldUseMockData) //jbAccount.compose(unloggedSyncHide()) { account, reg -> !reg || account != null }
|
||||
|
||||
init {
|
||||
if (shouldUseMockData) {
|
||||
|
||||
@@ -64,6 +64,7 @@ class ThemeChooserPage(val controller: WizardController) : OnboardingPage {
|
||||
val centralPane = JPanel(BorderLayout(0, 0)).apply {
|
||||
val pane = panel {
|
||||
row {
|
||||
@Suppress("DialogTitleCapitalization")
|
||||
label(ImportSettingsBundle.message("theme.page.title")).applyToComponent {
|
||||
font = UiUtils.HEADER_FONT
|
||||
border = UiUtils.HEADER_BORDER
|
||||
|
||||
Reference in New Issue
Block a user