<commit_before>package org.jetbrains.settingsRepository.actions

import com.intellij.notification.NotificationGroup
import com.intellij.notification.NotificationType
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.DumbAwareAction
import org.jetbrains.settingsRepository.IcsSettingsPanel
import org.jetbrains.settingsRepository.PLUGIN_NAME
import org.jetbrains.settingsRepository.SyncType
import org.jetbrains.settingsRepository.IcsManager
import org.jetbrains.settingsRepository.IcsBundle

val NOTIFICATION_GROUP = NotificationGroup.balloonGroup(PLUGIN_NAME)

abstract class SyncAction(private val syncType: SyncType) : DumbAwareAction() {
  override fun update(e: AnActionEvent) {
    e.getPresentation().setEnabledAndVisible(IcsManager.getInstance().repositoryManager.hasUpstream())
  }

  override fun actionPerformed(event: AnActionEvent) {
    val project = event.getProject()!!
    try {
      IcsManager.getInstance().sync(syncType, project)
    }
    catch (e: Exception) {
      NOTIFICATION_GROUP.createNotification(IcsBundle.message("sync.rejected.title"), e.getMessage() ?: "Internal error", NotificationType.ERROR, null).notify(project)
      return
    }

    NOTIFICATION_GROUP.createNotification(IcsBundle.message("sync.done.message"), NotificationType.INFORMATION).notify(project)
  }
}

// we don't
class MergeAction : SyncAction(SyncType.MERGE)
class ResetToTheirsAction : SyncAction(SyncType.RESET_TO_THEIRS)
class ResetToMyAction : SyncAction(SyncType.RESET_TO_MY)

class ConfigureIcsAction : DumbAwareAction() {
  override fun actionPerformed(e: AnActionEvent) {
    IcsManager.getInstance().runInAutoCommitDisabledMode {
      IcsSettingsPanel(e.getProject()).show()
    }
  }
}<commit_msg>we don't have icon for action yet, but by default welcome scree stub icon used for any other places also — looks ugly (due to big size 32x32).<commit_after>package org.jetbrains.settingsRepository.actions

import com.intellij.notification.NotificationGroup
import com.intellij.notification.NotificationType
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.DumbAwareAction
import org.jetbrains.settingsRepository.IcsSettingsPanel
import org.jetbrains.settingsRepository.PLUGIN_NAME
import org.jetbrains.settingsRepository.SyncType
import org.jetbrains.settingsRepository.IcsManager
import org.jetbrains.settingsRepository.IcsBundle

val NOTIFICATION_GROUP = NotificationGroup.balloonGroup(PLUGIN_NAME)

abstract class SyncAction(private val syncType: SyncType) : DumbAwareAction() {
  override fun update(e: AnActionEvent) {
    e.getPresentation().setEnabledAndVisible(IcsManager.getInstance().repositoryManager.hasUpstream())
  }

  override fun actionPerformed(event: AnActionEvent) {
    val project = event.getProject()!!
    try {
      IcsManager.getInstance().sync(syncType, project)
    }
    catch (e: Exception) {
      NOTIFICATION_GROUP.createNotification(IcsBundle.message("sync.rejected.title"), e.getMessage() ?: "Internal error", NotificationType.ERROR, null).notify(project)
      return
    }

    NOTIFICATION_GROUP.createNotification(IcsBundle.message("sync.done.message"), NotificationType.INFORMATION).notify(project)
  }
}

// we don't
class MergeAction : SyncAction(SyncType.MERGE)
class ResetToTheirsAction : SyncAction(SyncType.RESET_TO_THEIRS)
class ResetToMyAction : SyncAction(SyncType.RESET_TO_MY)

class ConfigureIcsAction : DumbAwareAction() {
  override fun actionPerformed(e: AnActionEvent) {
    IcsManager.getInstance().runInAutoCommitDisabledMode {
      IcsSettingsPanel(e.getProject()).show()
    }
  }

  override fun update(e: AnActionEvent) {
    e.getPresentation().setIcon(null)
  }
}
{'fraction_non_alphanumeric': 0.09473966720343532, 'fraction_numerical': 0.0010735373054213634, 'mean_word_length': 5.99249530956848, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1082104', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1089, 'n_words': 186}