Skip to content

Commit

Permalink
Merge branch 'private-release/v1.2.3-223' into zowe-release/v1.2.3-223
Browse files Browse the repository at this point in the history
  • Loading branch information
KUGDev committed Sep 23, 2024
2 parents 55303b4 + 37fff22 commit 8edcb0d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ class SyncAction : DumbAwareAction() {
}
val editor = getEditor(e) ?: return

val isDumbMode = ActionUtil.isDumbMode(e.project)
if (!isDumbMode && file.isWritable) {
editor.document.setReadOnly(false)
editor.isViewer = false
} else {
e.presentation.isEnabledAndVisible = false
return
}

val contentSynchronizer = service<DataOpsManager>().getContentSynchronizer(file)
val syncProvider = DocumentedSyncProvider(file)
val currentContent = runReadAction { syncProvider.retrieveCurrentContent() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,19 @@ class ChangeContentServiceImpl : ChangeContentService {
override fun afterActionPerformed(action: AnAction, event: AnActionEvent, result: AnActionResult) {
if (action is EditorPasteAction || (action is PasteAction && event.place == "EditorPopup")) {
val editor = event.getData(CommonDataKeys.EDITOR) ?: return

processMfContent(editor)
val isFileWritable = requestDocumentWriting(editor)
if (isFileWritable) {
processMfContent(editor)
}
}
}

override fun afterEditorTyping(c: Char, dataContext: DataContext) {
val editor = dataContext.getData(CommonDataKeys.EDITOR) ?: return

processMfContent(editor)
val isFileWritable = requestDocumentWriting(editor)
if (isFileWritable) {
processMfContent(editor)
}
}
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@ class FileEditorEventsListener : FileEditorManagerListener {
override fun fileOpened(source: FileEditorManager, file: VirtualFile) {
if (file is MFVirtualFile) {
val editor = source.selectedTextEditor as? EditorEx
editor?.addFocusListener(focusListener)
if (editor != null) {
editor.addFocusListener(focusListener)
val isDumbMode = ActionUtil.isDumbMode(editor.project)
if (isDumbMode) {
editor.document.setReadOnly(true)
editor.isViewer = true
}
super.fileOpened(source, file)
}
}
super.fileOpened(source, file)
}
}

Expand Down

0 comments on commit 8edcb0d

Please sign in to comment.