Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
ec9902a5
Commit
ec9902a5
authored
6 years ago
by
Vladimir Krivosheev
1
Browse files
Options
Download
Email Patches
Plain Diff
extract ConfigureIcsAction
parent
5e4eb870
Branches unavailable
Tags unavailable
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
plugins/settings-repository/src/actions/ConfigureIcsAction.kt
+48
-0
...ins/settings-repository/src/actions/ConfigureIcsAction.kt
plugins/settings-repository/src/actions/SyncAction.kt
+1
-38
plugins/settings-repository/src/actions/SyncAction.kt
with
49 additions
and
38 deletions
+49
-38
plugins/settings-repository/src/actions/ConfigureIcsAction.kt
0 → 100644
+
48
-
0
View file @
ec9902a5
// Copyright 2000-2018 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.settingsRepository.actions
import
com.intellij.configurationStore.StateStorageManagerImpl
import
com.intellij.openapi.actionSystem.AnActionEvent
import
com.intellij.openapi.application.ApplicationManager
import
com.intellij.openapi.components.stateStore
import
com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
import
com.intellij.openapi.project.DumbAwareAction
import
com.intellij.openapi.ui.TextFieldWithBrowseButton
import
com.intellij.ui.components.dialog
import
com.intellij.ui.layout.*
import
org.jetbrains.settingsRepository.createMergeActions
import
org.jetbrains.settingsRepository.icsManager
import
org.jetbrains.settingsRepository.icsMessage
import
kotlin.properties.Delegates
internal
class
ConfigureIcsAction
:
DumbAwareAction
()
{
override
fun
actionPerformed
(
e
:
AnActionEvent
)
{
var
urlTextField
:
TextFieldWithBrowseButton
by
Delegates
.
notNull
()
icsManager
.
runInAutoCommitDisabledMode
{
val
panel
=
panel
{
row
(
icsMessage
(
"settings.upstream.url"
))
{
urlTextField
=
textFieldWithBrowseButton
(
value
=
icsManager
.
repositoryManager
.
getUpstream
(),
browseDialogTitle
=
"Choose Local Git Repository"
,
fileChooserDescriptor
=
FileChooserDescriptorFactory
.
createSingleFolderDescriptor
())
}
}
dialog
(
title
=
icsMessage
(
"settings.panel.title"
),
panel
=
panel
,
focusedComponent
=
urlTextField
,
project
=
e
.
project
,
createActions
=
{
createMergeActions
(
e
.
project
,
urlTextField
,
it
)
}).
show
()
}
}
override
fun
update
(
e
:
AnActionEvent
)
{
val
application
=
ApplicationManager
.
getApplication
()
if
(
application
.
isUnitTestMode
)
{
return
}
e
.
presentation
.
isEnabledAndVisible
=
icsManager
.
isActive
||
!(
application
.
stateStore
.
storageManager
as
StateStorageManagerImpl
).
compoundStreamProvider
.
enabled
e
.
presentation
.
icon
=
null
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
plugins/settings-repository/src/actions/SyncAction.kt
+
1
-
38
View file @
ec9902a5
// Copyright 2000-2018 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.
// Copyright 2000-2018 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.settingsRepository.actions
package
org.jetbrains.settingsRepository.actions
import
com.intellij.configurationStore.StateStorageManagerImpl
import
com.intellij.notification.NotificationGroup
import
com.intellij.notification.NotificationGroup
import
com.intellij.notification.NotificationType
import
com.intellij.notification.NotificationType
import
com.intellij.openapi.actionSystem.AnActionEvent
import
com.intellij.openapi.actionSystem.AnActionEvent
import
com.intellij.openapi.application.ApplicationManager
import
com.intellij.openapi.application.ApplicationManager
import
com.intellij.openapi.components.stateStore
import
com.intellij.openapi.fileChooser.FileChooserDescriptorFactory
import
com.intellij.openapi.project.DumbAwareAction
import
com.intellij.openapi.project.DumbAwareAction
import
com.intellij.openapi.project.Project
import
com.intellij.openapi.project.Project
import
com.intellij.openapi.ui.TextFieldWithBrowseButton
import
com.intellij.ui.components.dialog
import
com.intellij.ui.layout.*
import
org.jetbrains.settingsRepository.*
import
org.jetbrains.settingsRepository.*
import
kotlin.properties.Delegates.notNull
internal
val
NOTIFICATION_GROUP
=
NotificationGroup
.
balloonGroup
(
PLUGIN_NAME
)
internal
val
NOTIFICATION_GROUP
=
NotificationGroup
.
balloonGroup
(
PLUGIN_NAME
)
...
@@ -52,34 +45,4 @@ private fun syncAndNotify(syncType: SyncType, project: Project?) {
...
@@ -52,34 +45,4 @@ private fun syncAndNotify(syncType: SyncType, project: Project?) {
internal
class
MergeAction
:
SyncAction
(
SyncType
.
MERGE
)
internal
class
MergeAction
:
SyncAction
(
SyncType
.
MERGE
)
internal
class
ResetToTheirsAction
:
SyncAction
(
SyncType
.
OVERWRITE_LOCAL
)
internal
class
ResetToTheirsAction
:
SyncAction
(
SyncType
.
OVERWRITE_LOCAL
)
internal
class
ResetToMyAction
:
SyncAction
(
SyncType
.
OVERWRITE_REMOTE
)
internal
class
ResetToMyAction
:
SyncAction
(
SyncType
.
OVERWRITE_REMOTE
)
\ No newline at end of file
internal
class
ConfigureIcsAction
:
DumbAwareAction
()
{
override
fun
actionPerformed
(
e
:
AnActionEvent
)
{
var
urlTextField
:
TextFieldWithBrowseButton
by
notNull
()
icsManager
.
runInAutoCommitDisabledMode
{
val
panel
=
panel
{
row
(
icsMessage
(
"settings.upstream.url"
))
{
urlTextField
=
textFieldWithBrowseButton
(
value
=
icsManager
.
repositoryManager
.
getUpstream
(),
browseDialogTitle
=
"Choose Local Git Repository"
,
fileChooserDescriptor
=
FileChooserDescriptorFactory
.
createSingleFolderDescriptor
())
}
}
dialog
(
title
=
icsMessage
(
"settings.panel.title"
),
panel
=
panel
,
focusedComponent
=
urlTextField
,
project
=
e
.
project
,
createActions
=
{
createMergeActions
(
e
.
project
,
urlTextField
,
it
)
}).
show
()
}
}
override
fun
update
(
e
:
AnActionEvent
)
{
val
application
=
ApplicationManager
.
getApplication
()
if
(
application
.
isUnitTestMode
)
{
return
}
e
.
presentation
.
isEnabledAndVisible
=
icsManager
.
isActive
||
!(
application
.
stateStore
.
storageManager
as
StateStorageManagerImpl
).
compoundStreamProvider
.
enabled
e
.
presentation
.
icon
=
null
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
小 白蛋
@baidan
mentioned in commit
14f728ea
·
2 years ago
mentioned in commit
14f728ea
mentioned in commit 14f728ea82faa5203c4b2df6d03d36206fd680db
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help