From e618fa12b58384db2d6f1bde7165056bfc6053c0 Mon Sep 17 00:00:00 2001 From: j-dimension Date: Sun, 29 Sep 2024 17:18:56 +0200 Subject: [PATCH] moved ingo document context menu initializiation from constructor to when the popup is opened. close #2589 --- .../editors/files/ArchiveFilePanel.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchiveFilePanel.java b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchiveFilePanel.java index 8126cfff9..05c9f5289 100755 --- a/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchiveFilePanel.java +++ b/j-lawyer-client/src/com/jdimension/jlawyer/client/editors/files/ArchiveFilePanel.java @@ -1052,17 +1052,6 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole htrs.setComparator(0, dtComparator); this.tblAccountEntries.setRowSorter(htrs); - AssistantAccess ingo = AssistantAccess.getInstance(); - try { - Map> capabilities2 = ingo.filterCapabilities(AiCapability.REQUESTTYPE_SUMMARIZE, AiCapability.INPUTTYPE_STRING); - ingo.populateMenu(this.mnuAssistant, capabilities2, (AssistantInputAdapter)this, this.dto); - this.mnuAssistant.add(new JSeparator()); - Map> capabilities3 = ingo.filterCapabilities(AiCapability.REQUESTTYPE_CHAT, AiCapability.INPUTTYPE_NONE); - ingo.populateMenu(this.mnuAssistant, capabilities3, (AssistantInputAdapter)this, this.dto); - } catch (Exception ex) { - log.error(ex); - } - EventBroker b = EventBroker.getInstance(); b.subscribeConsumer(this, Event.TYPE_DOCUMENTADDED); b.subscribeConsumer(this, Event.TYPE_REVIEWADDED); @@ -4199,6 +4188,19 @@ public void showDocumentsPopup(MouseEvent evt) { this.mnuOpenDocumentMicrosoftOffice.setEnabled(false); this.mnuUseDocumentAsTemplate.setEnabled(true); } + + AssistantAccess ingo = AssistantAccess.getInstance(); + try { + this.mnuAssistant.removeAll(); + Map> capabilities2 = ingo.filterCapabilities(AiCapability.REQUESTTYPE_SUMMARIZE, AiCapability.INPUTTYPE_STRING); + ingo.populateMenu(this.mnuAssistant, capabilities2, (AssistantInputAdapter)this, this.dto); + this.mnuAssistant.add(new JSeparator()); + Map> capabilities3 = ingo.filterCapabilities(AiCapability.REQUESTTYPE_CHAT, AiCapability.INPUTTYPE_NONE); + ingo.populateMenu(this.mnuAssistant, capabilities3, (AssistantInputAdapter)this, this.dto); + } catch (Exception ex) { + log.error(ex); + } + this.documentsPopup.show(evt.getComponent(), evt.getX(), evt.getY()); }