Skip to content

Commit

Permalink
tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
dkandalov committed Oct 2, 2024
1 parent 6ec9398 commit 52871f3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<postStartupActivity implementation="limitedwip.autorevert.components.AutoRevertComponentStartup"/>
<postStartupActivity implementation="limitedwip.tcr.components.TcrComponentStartup"/>

<projectConfigurable instance="limitedwip.common.settings.LimitedWipConfigurable"/>
<projectConfigurable instance="limitedwip.common.settings.LimitedWipConfigurable" displayName="Limited WIP"/>
<projectService serviceImplementation="limitedwip.common.settings.LimitedWipSettings"/>
<checkinHandlerFactory implementation="limitedwip.common.vcs.SuccessfulCheckin"/>
<checkinHandlerFactory implementation="limitedwip.common.vcs.AllowCommit"/>
Expand Down
6 changes: 2 additions & 4 deletions src/limitedwip/common/settings/LimitedWipConfigurable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ class LimitedWipConfigurable(val project: Project): SearchableConfigurable {
settingsForm.applyChanges()
}

override fun reset() {
settingsForm.resetChanges()
}
override fun reset() = settingsForm.resetChanges()

override fun isModified() = settingsForm.isModified()

override fun getDisplayName() = pluginDisplayName

override fun getId(): String = pluginId
override fun getId() = pluginId
}
7 changes: 3 additions & 4 deletions src/limitedwip/common/vcs/SuccessfulCheckin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ import com.intellij.openapi.vcs.checkin.CheckinHandler
import com.intellij.openapi.vcs.checkin.CheckinHandlerFactory
import limitedwip.common.pluginId

class SuccessfulCheckin: CheckinHandlerFactory() {
class SuccessfulCheckin : CheckinHandlerFactory() {

override fun createHandler(panel: CheckinProjectPanel, commitContext: CommitContext): CheckinHandler {
return object: CheckinHandler() {
override fun createHandler(panel: CheckinProjectPanel, commitContext: CommitContext) =
object : CheckinHandler() {
override fun checkinSuccessful() {
val changeList = panel.project.defaultChangeList() ?: return
val uncommittedFileCount = changeList.changes.size - panel.selectedChanges.size
notifySettingsListeners(allChangesAreCommitted = uncommittedFileCount == 0)
}
}
}

private fun notifySettingsListeners(allChangesAreCommitted: Boolean) {
Extensions.getRootArea().getExtensionPoint<Listener>(extensionPointName).extensions.forEach { listener ->
Expand Down

0 comments on commit 52871f3

Please sign in to comment.