Skip to content

Commit 042b860

Browse files
authored
Merge branch 'main' into manodnyb/changeqBgcolor
2 parents 329f766 + 781f173 commit 042b860

File tree

12 files changed

+119
-28
lines changed

12 files changed

+119
-28
lines changed

.changes/3.87.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"date" : "2025-07-30",
3+
"version" : "3.87",
4+
"entries" : [ {
5+
"type" : "bugfix",
6+
"description" : "change to use promptStickyCard to for image verification notification"
7+
}, {
8+
"type" : "bugfix",
9+
"description" : "Suppress IDE error when current editor context is not valid for Amazon Q"
10+
} ]
11+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Fix unsupported files being shown in file picker when selecting images for adding image context in Windows"
4+
}

.changes/next-release/bugfix-7ceafecb-844d-46ce-a68d-b28360840ab6.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

.changes/next-release/bugfix-846e7004-5426-4f6b-970f-2b9437314b98.json

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Fix the issue that sometime images added via drag & drop are incorrectly routed to pinned context"
4+
}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# _3.87_ (2025-07-30)
2+
- **(Bug Fix)** change to use promptStickyCard to for image verification notification
3+
- **(Bug Fix)** Suppress IDE error when current editor context is not valid for Amazon Q
4+
15
# _3.86_ (2025-07-16)
26
- **(Bug Fix)** - Fixed "Insert to Cursor" button to correctly insert code blocks at the current cursor position in the active file
37

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# Toolkit Version
5-
toolkitVersion=3.87-SNAPSHOT
5+
toolkitVersion=3.88-SNAPSHOT
66

77
# Publish Settings
88
publishToken=

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/toolwindow/AmazonQPanel.kt

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ import software.aws.toolkits.jetbrains.services.codemodernizer.utils.isCodeTrans
4949
import software.aws.toolkits.resources.message
5050
import java.awt.datatransfer.DataFlavor
5151
import java.awt.dnd.DropTarget
52+
import java.awt.dnd.DropTargetDragEvent
5253
import java.awt.dnd.DropTargetDropEvent
54+
import java.awt.dnd.DropTargetEvent
5355
import java.io.File
5456
import java.util.concurrent.CompletableFuture
5557
import javax.imageio.ImageIO.read
@@ -138,6 +140,15 @@ class AmazonQPanel(val project: Project, private val scope: CoroutineScope) : Di
138140
// As an alternative, enabling the native drag in JCEF,
139141
// and let the native handling the drop event, and update the UI through JS bridge.
140142
val dropTarget = object : DropTarget() {
143+
override fun dragEnter(dtde: DropTargetDragEvent) {
144+
setDragAndDropOverlayVisible(browserInstance, true)
145+
}
146+
override fun dragOver(dtde: DropTargetDragEvent) {
147+
setDragAndDropOverlayVisible(browserInstance, true)
148+
}
149+
override fun dragExit(dte: DropTargetEvent) {
150+
setDragAndDropOverlayVisible(browserInstance, false)
151+
}
141152
override fun drop(dtde: DropTargetDropEvent) {
142153
try {
143154
dtde.acceptDrop(dtde.dropAction)
@@ -166,20 +177,16 @@ class AmazonQPanel(val project: Project, private val scope: CoroutineScope) : Di
166177
validImages.subList(20, validImages.size).clear()
167178
}
168179

180+
executeJavaScript(browserInstance, "window.resetTopBarClicked()")
181+
182+
setDragAndDropOverlayVisible(browserInstance, false)
183+
169184
val json = OBJECT_MAPPER.writeValueAsString(validImages)
170-
browserInstance.jcefBrowser.cefBrowser.executeJavaScript(
171-
"window.handleNativeDrop('$json')",
172-
browserInstance.jcefBrowser.cefBrowser.url,
173-
0
174-
)
185+
executeJavaScript(browserInstance, "window.handleNativeDrop('$json')")
175186

176187
if (errorMessages.isNotEmpty()) {
177188
val errorJson = OBJECT_MAPPER.writeValueAsString(errorMessages)
178-
browserInstance.jcefBrowser.cefBrowser.executeJavaScript(
179-
"window.handleNativeNotify('$errorJson')",
180-
browserInstance.jcefBrowser.cefBrowser.url,
181-
0
182-
)
189+
executeJavaScript(browserInstance, "window.handleNativeNotify('$errorJson')")
183190
}
184191

185192
dtde.dropComplete(true)
@@ -286,6 +293,22 @@ class AmazonQPanel(val project: Project, private val scope: CoroutineScope) : Di
286293
}
287294
}
288295

296+
private fun executeJavaScript(browserInstance: Browser, jsCommand: String) {
297+
try {
298+
browserInstance.jcefBrowser.cefBrowser.executeJavaScript(
299+
jsCommand,
300+
browserInstance.jcefBrowser.cefBrowser.url,
301+
0
302+
)
303+
} catch (e: Exception) {
304+
LOG.error { "Failed to execute JavaScript: $jsCommand - ${e.message}" }
305+
}
306+
}
307+
308+
private fun setDragAndDropOverlayVisible(browserInstance: Browser, visible: Boolean) {
309+
executeJavaScript(browserInstance, "window.setDragAndDropVisible('$visible')")
310+
}
311+
289312
private fun validateImageFile(file: File, allowedTypes: Set<String>, maxFileSize: Double, maxDimension: Int): String? {
290313
val fileName = file.name
291314
val ext = fileName.substringAfterLast('.', "").lowercase()

plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/webview/Browser.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ class Browser(parent: Disposable, private val webUri: URI, val project: Project)
189189
},
190190
})
191191
};
192+
193+
window.setDragAndDropVisible = function(visibility) {
194+
const parsedVisibility = JSON.parse(visibility);
195+
qChat.setDragOverlayVisible(qChat.getSelectedTabId(), parsedVisibility)
196+
};
197+
198+
window.resetTopBarClicked = function() {
199+
qChat.resetTopBarClicked(qChat.getSelectedTabId())
200+
};
192201
}
193202
</script>
194203
""".trimIndent()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package software.aws.toolkits.jetbrains.services.amazonq.lsp.util
5+
6+
import com.intellij.openapi.fileChooser.FileChooserDescriptor
7+
8+
/**
9+
* Applies file extension filtering to the given FileChooserDescriptor for IntelliJ Platform versions before 2024.3 (baseline < 243).
10+
* Uses withFileFilter method which provides filtering functionality but doesn't visually filter
11+
* files in the chooser dialog.
12+
*
13+
* @param descriptor The FileChooserDescriptor to apply filtering to
14+
* @param filterName The display name for the filter (e.g., "Images") - unused in this version
15+
* @param allowedExtensions Set of allowed file extensions (e.g., "jpg", "png")
16+
* @return The modified FileChooserDescriptor
17+
*/
18+
fun applyExtensionFilter(
19+
descriptor: FileChooserDescriptor,
20+
@Suppress("UNUSED_PARAMETER") filterName: String,
21+
allowedExtensions: Set<String>,
22+
): FileChooserDescriptor = descriptor.withFileFilter { virtualFile ->
23+
if (virtualFile.isDirectory) {
24+
true // Always allow directories for navigation
25+
} else {
26+
val extension = virtualFile.extension?.lowercase()
27+
extension != null && allowedExtensions.contains(extension)
28+
}
29+
}

0 commit comments

Comments
 (0)