Skip to content

Commit

Permalink
feat(globs): Refresh icons after updating globs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Blarc committed Apr 17, 2023
1 parent 79652c6 commit 10c69d6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
### Added
- Exclusion globs for excluding files from linting.
- Gitlab yaml file type and icon.
- Update file icons after updating file globs.

## [1.6.0] - 2023-03-31

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import com.github.blarc.gitlab.template.lint.plugin.GitlabLintBundle
import com.github.blarc.gitlab.template.lint.plugin.extensions.createColumn
import com.github.blarc.gitlab.template.lint.plugin.extensions.reportBugLink
import com.github.blarc.gitlab.template.lint.plugin.settings.AppSettings
import com.intellij.ide.DataManager
import com.intellij.ide.projectView.ProjectView
import com.intellij.openapi.actionSystem.PlatformDataKeys
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
import com.intellij.openapi.options.BoundConfigurable
import com.intellij.openapi.ui.DialogWrapper
import com.intellij.ui.ToolbarDecorator
Expand Down Expand Up @@ -128,6 +132,24 @@ class GlobsConfigurable : BoundConfigurable(GitlabLintBundle.message("settings.g
super.apply()
AppSettings.instance.gitlabLintGlobStrings = inclusionGlobs
AppSettings.instance.exclusionGlobs = exclusionGlobs

DataManager.getInstance().dataContextFromFocusAsync.onSuccess { context ->
context.getData(PlatformDataKeys.PROJECT)?.let { project ->

if (project.isDisposed) {
return@onSuccess
}

val projectView = ProjectView.getInstance(project)
projectView ?: return@onSuccess

projectView.refresh()
projectView.currentProjectViewPane?.updateFromRoot(true)
FileEditorManagerEx.getInstanceEx(project).windows.forEach {
it.manager.refreshIcons()
}
}
}
}

private class GlobDialog(var glob: String = "") : DialogWrapper(false) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/messages/MyBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ settings.run-lint-on-file-change.comment=Run linting when you switch tab.
settings.gitlabUrlToken.dialog=New Gitlab Url and Token
settings.verify=Verify
settings.report-bug=Report bug
settings.globs.comment=Editors need to be reopened to see changes.
settings.globs.comment=Editors need to be reopened to see changes. File icons might not get updated correctly.
settings.globs.inclusions.title=Inclusions
settings.globs.exclusions.title=Exclusions

0 comments on commit 10c69d6

Please sign in to comment.