diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eab0cc..258ca24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # KdbInsideBrains Changelog +## [5.8.0] + +### Added + +- Execute Q File action added (mapped to Ctrl + Alt + F10 by default) that sends and executes content of whole file + till 'exit the script' command (\). + +### Changed + +- Execute action doesn't block reading thread now and runs in the background instead. + +### Removed + +- Execute On TP action removed. See no real use-case. Never used. + +### Fixed + +- Docking deprecation API resolved +- IDEA 2024 @ApiStatus.OverrideOnly issues resolved + ## [5.7.1] ### Added diff --git a/gradle.properties b/gradle.properties index 3841cde..d0aee34 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,9 +10,9 @@ pluginJavaVersion=17 # Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html for available build versions # or https://jb.gg/intellij-platform-builds-list -pluginVerifierVersions=2022.3, 2022.3.3, 2023.1.1, 2023.2.5, 2023.3.6, 2024.1.2 +pluginVerifierVersions=2022.3, 2022.3.3, 2023.1.1, 2023.2.5, 2023.3.6, 2024.1.4 platformType=IC -platformVersion=2024.1.2 +platformVersion=2024.1.4 platformPlugins=java, PsiViewer:241-SNAPSHOT #platformVersion=2023.3.6 #platformPlugins=java, PsiViewer:233.2 diff --git a/src/main/java/icons/KdbIcons.java b/src/main/java/icons/KdbIcons.java index 9a9872f..06a1b07 100644 --- a/src/main/java/icons/KdbIcons.java +++ b/src/main/java/icons/KdbIcons.java @@ -152,7 +152,8 @@ public static final class Instance { public static final @NotNull Icon Execute = AllIcons.Actions.Execute; public static final @NotNull Icon ExecuteOn = AllIcons.Actions.Expandall; public static final @NotNull Icon ExecuteContext = load("/org/kdb/inside/brains/icons/executeContext.svg"); - public static final @NotNull Icon QuickExecute = AllIcons.Debugger.EvaluateExpression; + public static final @NotNull Icon ExecuteQuick = AllIcons.Debugger.EvaluateExpression; + public static final @NotNull Icon ExecuteFile = load("/org/kdb/inside/brains/icons/executeFile.svg"); public static final @NotNull Icon Connected = load("/org/kdb/inside/brains/icons/connected.svg"); public static final @NotNull Icon Disconnected = load("/org/kdb/inside/brains/icons/disconnected.svg"); diff --git a/src/main/java/org/kdb/inside/brains/action/execute/ExecuteAction.java b/src/main/java/org/kdb/inside/brains/action/execute/ExecuteAction.java index 21a6813..ec76ddd 100644 --- a/src/main/java/org/kdb/inside/brains/action/execute/ExecuteAction.java +++ b/src/main/java/org/kdb/inside/brains/action/execute/ExecuteAction.java @@ -1,9 +1,11 @@ package org.kdb.inside.brains.action.execute; -import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.CommonDataKeys; +import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.editor.*; -import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.vfs.VirtualFile; @@ -11,11 +13,12 @@ import org.jetbrains.annotations.Nullable; import org.kdb.inside.brains.QFileType; import org.kdb.inside.brains.action.ActionPlaces; +import org.kdb.inside.brains.action.BgtAction; import org.kdb.inside.brains.core.InstanceConnection; import org.kdb.inside.brains.core.KdbConnectionManager; import org.kdb.inside.brains.view.console.KdbConsoleToolWindow; -public class ExecuteAction extends DumbAwareAction { +public class ExecuteAction extends BgtAction { private final InstanceConnection myConnection; public ExecuteAction() { @@ -40,11 +43,14 @@ public static boolean isExecutedAllowed(AnActionEvent e) { @Override public void update(@NotNull AnActionEvent e) { final Presentation presentation = e.getPresentation(); - if (org.kdb.inside.brains.action.ActionPlaces.KEYBOARD_SHORTCUT.equals(e.getPlace())) { + final Editor editor = CommonDataKeys.EDITOR.getData(e.getDataContext()); + if (editor == null) { + presentation.setEnabled(false); + presentation.setVisible(false); + } else if (org.kdb.inside.brains.action.ActionPlaces.KEYBOARD_SHORTCUT.equals(e.getPlace())) { presentation.setEnabled(true); presentation.setVisible(false); } else { - final boolean allowed = isExecutedAllowed(e); if (ActionPlaces.MAIN_TOOLBAR.equals(e.getPlace()) || "popup".equals(e.getPlace())) { presentation.setVisible(true); @@ -63,32 +69,41 @@ public void update(@NotNull AnActionEvent e) { @Override public void actionPerformed(@NotNull AnActionEvent e) { - final DataContext dataContext = e.getDataContext(); - final Editor editor = CommonDataKeys.EDITOR.getData(dataContext); - final Project project = CommonDataKeys.PROJECT.getData(dataContext); - if (editor == null || project == null) { + final DataContext context = e.getDataContext(); + final Project project = CommonDataKeys.PROJECT.getData(context); + if (project == null) { return; } - ReadAction.run(() -> { - final InstanceConnection connection = getConnection(project); - if (connection == null) { - return; - } + final String text = ReadAction.compute(() -> getExecutionContent(context)); + if (text == null || text.isEmpty()) { + return; + } - final TextRange range = getExecutionRange(editor, dataContext); - if (range != null && !range.isEmpty()) { - execute(project, editor, connection, range); - } - }); + final InstanceConnection connection = getConnection(project); + if (connection != null && connection.isConnected()) { + execute(project, connection, text, context); + } } - @Override - public @NotNull ActionUpdateThread getActionUpdateThread() { - return ActionUpdateThread.BGT; + protected String getExecutionContent(DataContext context) { + final Editor editor = CommonDataKeys.EDITOR.getData(context); + if (editor == null) { + return null; + } + + final TextRange range = getExecutionRange(editor, context); + if (range != null && !range.isEmpty()) { + return editor.getDocument().getText(range); + } + return null; } protected TextRange getExecutionRange(Editor editor, DataContext context) { + if (editor == null) { + return null; + } + final CaretModel caretModel = editor.getCaretModel(); final SelectionModel selectionModel = editor.getSelectionModel(); @@ -108,7 +123,7 @@ protected TextRange getExecutionRange(Editor editor, DataContext context) { return KdbConnectionManager.getManager(project).getActiveConnection(); } - protected void execute(Project project, Editor editor, InstanceConnection connection, TextRange range) { - KdbConsoleToolWindow.getInstance(project).execute(connection, editor.getDocument().getText(range)); + protected void execute(Project project, InstanceConnection connection, String text, DataContext context) { + KdbConsoleToolWindow.getInstance(project).execute(connection, text); } } diff --git a/src/main/java/org/kdb/inside/brains/action/execute/ExecuteFileAction.java b/src/main/java/org/kdb/inside/brains/action/execute/ExecuteFileAction.java new file mode 100644 index 0000000..dcc27fd --- /dev/null +++ b/src/main/java/org/kdb/inside/brains/action/execute/ExecuteFileAction.java @@ -0,0 +1,51 @@ +package org.kdb.inside.brains.action.execute; + +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.CommonDataKeys; +import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.openapi.actionSystem.Presentation; +import com.intellij.psi.PsiFile; +import org.jetbrains.annotations.NotNull; +import org.kdb.inside.brains.QFileType; +import org.kdb.inside.brains.core.InstanceConnection; + +public class ExecuteFileAction extends ExecuteAction { + public void update(@NotNull AnActionEvent e) { + final PsiFile file = CommonDataKeys.PSI_FILE.getData(e.getDataContext()); + + final Presentation presentation = e.getPresentation(); + presentation.setVisible(QFileType.is(file)); + + final InstanceConnection c = getConnection(e.getProject()); + presentation.setEnabled(c != null && c.isConnected()); + + if (file != null) { + presentation.setText("Execute '" + file.getName() + "'"); + } + } + + @Override + protected String getExecutionContent(DataContext context) { + final PsiFile data = CommonDataKeys.PSI_FILE.getData(context); + if (!QFileType.is(data)) { + return null; + } + try { + + final String text = data.getText(); + // end of the file comment that we should exclude as it's parsed by KDB + final int i = getEndOfFileIndex(text); + return i < 0 ? text : text.substring(0, i); + } catch (Exception ex) { + return null; + } + } + + private int getEndOfFileIndex(String text) { + final int i = text.indexOf("\\\r"); + if (i < 0) { + return text.indexOf("\\\n"); + } + return i; + } +} diff --git a/src/main/java/org/kdb/inside/brains/action/execute/ExecuteInlineAction.java b/src/main/java/org/kdb/inside/brains/action/execute/ExecuteInlineAction.java index 63ae627..8adbcf0 100644 --- a/src/main/java/org/kdb/inside/brains/action/execute/ExecuteInlineAction.java +++ b/src/main/java/org/kdb/inside/brains/action/execute/ExecuteInlineAction.java @@ -3,11 +3,11 @@ import com.intellij.codeInsight.hint.HintManager; import com.intellij.codeInsight.hint.HintManagerImpl; import com.intellij.ide.TooltipEvent; +import com.intellij.openapi.actionSystem.CommonDataKeys; +import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.LogicalPosition; -import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.TextRange; import com.intellij.ui.HintHint; import com.intellij.ui.JBColor; import com.intellij.ui.LightweightHint; @@ -25,7 +25,7 @@ import javax.swing.text.StyledDocument; import java.awt.*; -public class ExecuteInlineAction extends ExecuteAction implements DumbAware { +public class ExecuteInlineAction extends ExecuteAction { public static final Dimension MAX_SIZE = new Dimension(800, 500); private TableResultView createTableHint(Project project, TableResult result) { @@ -90,9 +90,10 @@ private void showTypedHint(JComponent c, Editor editor) { } @Override - protected void execute(Project project, Editor editor, InstanceConnection connection, TextRange range) { + protected void execute(Project project, InstanceConnection connection, String text, DataContext context) { + final Editor editor = CommonDataKeys.EDITOR.getData(context); try { - final KdbQuery query = new KdbQuery(editor.getDocument().getText(range)); + final KdbQuery query = new KdbQuery(text); connection.query(query, res -> { if (res.isError()) { showTypedHint(createTextHint(((Exception) res.getObject()).getMessage(), true), editor); diff --git a/src/main/java/org/kdb/inside/brains/action/toolbar/InstancesComboAction.java b/src/main/java/org/kdb/inside/brains/action/toolbar/InstancesComboAction.java index c88a194..d25b3be 100644 --- a/src/main/java/org/kdb/inside/brains/action/toolbar/InstancesComboAction.java +++ b/src/main/java/org/kdb/inside/brains/action/toolbar/InstancesComboAction.java @@ -425,16 +425,16 @@ public InstancesList(JBTextField editor, Consumer selectionCallback setEmptyText("Type an instance URI or search mask"); } - void setActionGroup(ActionGroup group) { + void setActionGroup(DefaultActionGroup group) { captionItems.clear(); myLastSelectedIndex = -2; myLastMouseLocation = null; setSelectionModel(new SingleSelectionModel()); // clear selection model here final List items = new ArrayList<>(); - for (AnAction action : group.getChildren(null)) { - if (action instanceof ActionGroup actionGroup) { - final AnAction[] children = actionGroup.getChildren(null); + for (AnAction action : group.getChildActionsOrStubs()) { + if (action instanceof DefaultActionGroup actionGroup) { + final AnAction[] children = actionGroup.getChildActionsOrStubs(); if (children.length != 0) { captionItems.put(children[0], actionGroup.getTemplatePresentation().getText()); for (int i = 0; i < children.length; i++) { diff --git a/src/main/java/org/kdb/inside/brains/view/chart/BaseChartPanel.java b/src/main/java/org/kdb/inside/brains/view/chart/BaseChartPanel.java index d38dda0..b25accc 100644 --- a/src/main/java/org/kdb/inside/brains/view/chart/BaseChartPanel.java +++ b/src/main/java/org/kdb/inside/brains/view/chart/BaseChartPanel.java @@ -1,7 +1,7 @@ package org.kdb.inside.brains.view.chart; import com.intellij.ide.DataManager; -import com.intellij.openapi.actionSystem.ActionGroup; +import com.intellij.openapi.actionSystem.DefaultActionGroup; import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.ui.popup.ListPopup; import com.intellij.ui.JBColor; @@ -23,17 +23,18 @@ import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.lang.reflect.Field; +import java.util.List; import java.util.function.Supplier; public class BaseChartPanel extends ChartPanel { private final ChartOptions myOptions; private boolean defaultCursor = false; - private final Supplier popupActionsProvider; + private final Supplier> popupActionsProvider; private static final JBColor COLOR_GRID = new JBColor(new Color(0xd3d3d4), new Color(0xd3d3d4)); - public BaseChartPanel(ChartOptions options, Supplier popupActionsProvider) { + public BaseChartPanel(ChartOptions options, Supplier> popupActionsProvider) { super(null, false, false, false, false, false); this.popupActionsProvider = popupActionsProvider; myOptions = options; @@ -143,11 +144,19 @@ private void initializeChart(JFreeChart chart) { @Override protected void displayPopupMenu(int x, int y) { - final ActionGroup group = popupActionsProvider.get(); - if (group == null || group.getChildren(null).length == 0) { + final List actions = popupActionsProvider.get(); + if (actions.isEmpty()) { return; } + final DefaultActionGroup group = new DefaultActionGroup(); + for (ToolActions action : actions) { + if (action.name() != null) { + group.addSeparator(action.name()); + } + group.addAll(action.actions()); + } + final ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, group, DataManager.getInstance().getDataContext(this), JBPopupFactory.ActionSelectionAid.MNEMONICS, true); final Point p = new Point(x, y); SwingUtilities.convertPointToScreen(p, this); diff --git a/src/main/java/org/kdb/inside/brains/view/chart/ChartTool.java b/src/main/java/org/kdb/inside/brains/view/chart/ChartTool.java index 2c0f1b0..f1f3e15 100644 --- a/src/main/java/org/kdb/inside/brains/view/chart/ChartTool.java +++ b/src/main/java/org/kdb/inside/brains/view/chart/ChartTool.java @@ -1,6 +1,5 @@ package org.kdb.inside.brains.view.chart; -import com.intellij.openapi.actionSystem.ActionGroup; import org.jfree.chart.JFreeChart; import org.kdb.inside.brains.KdbType; @@ -13,7 +12,7 @@ public interface ChartTool { void initialize(JFreeChart chart, KdbType domainType); - default ActionGroup getPopupActions() { - return ActionGroup.EMPTY_GROUP; + default ToolActions getToolActions() { + return ToolActions.NO_ACTIONS; } } diff --git a/src/main/java/org/kdb/inside/brains/view/chart/ChartingDialog.java b/src/main/java/org/kdb/inside/brains/view/chart/ChartingDialog.java index 4c55b05..1d7c44a 100644 --- a/src/main/java/org/kdb/inside/brains/view/chart/ChartingDialog.java +++ b/src/main/java/org/kdb/inside/brains/view/chart/ChartingDialog.java @@ -60,6 +60,7 @@ import java.io.OutputStream; import java.util.List; import java.util.stream.Collectors; +import java.util.stream.Stream; import static com.intellij.util.ui.JBUI.Borders; @@ -233,24 +234,8 @@ public void actionPerformed(@NotNull AnActionEvent e) { return p; } - private ActionGroup createPopupMenu() { - final DefaultActionGroup g = new DefaultActionGroup(); - final List crosshairTool = List.of(this.crosshairTool, measureTool, valuesTool); - for (ChartTool tool : crosshairTool) { - if (!tool.isEnabled()) { - continue; - } - - final ActionGroup popupActions = tool.getPopupActions(); - if (popupActions.getChildren(null).length != 0) { - final String templateText = popupActions.getTemplateText(); - if (templateText != null) { - g.addSeparator(templateText); - } - g.addAll(popupActions); - } - } - return g; + private List createPopupMenu() { + return Stream.of(crosshairTool, measureTool, valuesTool).filter(ChartTool::isEnabled).map(ChartTool::getToolActions).filter(ToolActions::hasActions).toList(); } private JBTabs createTabs(Project project, ChartDataProvider dataProvider) { diff --git a/src/main/java/org/kdb/inside/brains/view/chart/ToolActions.java b/src/main/java/org/kdb/inside/brains/view/chart/ToolActions.java new file mode 100644 index 0000000..ef9cb05 --- /dev/null +++ b/src/main/java/org/kdb/inside/brains/view/chart/ToolActions.java @@ -0,0 +1,11 @@ +package org.kdb.inside.brains.view.chart; + +import com.intellij.openapi.actionSystem.AnAction; + +public record ToolActions(String name, AnAction... actions) { + public static final ToolActions NO_ACTIONS = new ToolActions(null); + + public boolean hasActions() { + return actions.length != 0; + } +} diff --git a/src/main/java/org/kdb/inside/brains/view/chart/tools/MeasureTool.java b/src/main/java/org/kdb/inside/brains/view/chart/tools/MeasureTool.java index 6122832..315fcd4 100644 --- a/src/main/java/org/kdb/inside/brains/view/chart/tools/MeasureTool.java +++ b/src/main/java/org/kdb/inside/brains/view/chart/tools/MeasureTool.java @@ -1,8 +1,6 @@ package org.kdb.inside.brains.view.chart.tools; -import com.intellij.openapi.actionSystem.ActionGroup; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.DefaultActionGroup; import com.intellij.ui.JBColor; import org.jetbrains.annotations.NotNull; import org.jfree.chart.ChartMouseEvent; @@ -20,10 +18,7 @@ import org.jfree.data.xy.XYDataset; import org.kdb.inside.brains.KdbType; import org.kdb.inside.brains.action.EdtAction; -import org.kdb.inside.brains.view.chart.BaseChartPanel; -import org.kdb.inside.brains.view.chart.ChartColors; -import org.kdb.inside.brains.view.chart.ChartOptions; -import org.kdb.inside.brains.view.chart.ChartTool; +import org.kdb.inside.brains.view.chart.*; import javax.swing.*; import java.awt.*; @@ -295,37 +290,35 @@ public void initialize(JFreeChart chart, KdbType domainType) { } @Override - public ActionGroup getPopupActions() { + public ToolActions getToolActions() { if (!isEnabled()) { - return ActionGroup.EMPTY_GROUP; - } - - return new DefaultActionGroup("Measure", - List.of( - new EdtAction("Remove Measure") { - @Override - public void update(@NotNull AnActionEvent e) { - e.getPresentation().setEnabled(highlighted != null); - } - - @Override - public void actionPerformed(@NotNull AnActionEvent e) { - remove(); - } - }, - - new EdtAction("Clear Measures") { - @Override - public void update(@NotNull AnActionEvent e) { - e.getPresentation().setEnabled(!pinnedAreas.isEmpty()); - } - - @Override - public void actionPerformed(@NotNull AnActionEvent e) { - clear(); - } - } - ) + return ToolActions.NO_ACTIONS; + } + + return new ToolActions("Measure", + new EdtAction("Remove Measure") { + @Override + public void update(@NotNull AnActionEvent e) { + e.getPresentation().setEnabled(highlighted != null); + } + + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + remove(); + } + }, + + new EdtAction("Clear Measures") { + @Override + public void update(@NotNull AnActionEvent e) { + e.getPresentation().setEnabled(!pinnedAreas.isEmpty()); + } + + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + clear(); + } + } ); } diff --git a/src/main/java/org/kdb/inside/brains/view/console/table/TabsDockingManager.java b/src/main/java/org/kdb/inside/brains/view/console/table/TabsDockingManager.java index e2c6e47..79d79cb 100644 --- a/src/main/java/org/kdb/inside/brains/view/console/table/TabsDockingManager.java +++ b/src/main/java/org/kdb/inside/brains/view/console/table/TabsDockingManager.java @@ -12,6 +12,7 @@ import com.intellij.openapi.wm.StatusBar; import com.intellij.openapi.wm.ex.WindowManagerEx; import com.intellij.ui.ScreenUtil; +import com.intellij.ui.awt.DevicePoint; import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.awt.RelativeRectangle; import com.intellij.ui.components.panels.NonOpaquePanel; @@ -175,16 +176,17 @@ private List getContainers() { containers.remove(myCurrentDragSession.myStartDragContainer); containers.add(0, myCurrentDragSession.myStartDragContainer); + final DevicePoint dp = new DevicePoint(point); for (DockContainer each : containers) { RelativeRectangle rec = each.getAcceptArea(); - if (rec.contains(point) && each.getContentResponse(content, point).canAccept()) { + if (rec.contains(dp) && each.getContentResponse(content, point).canAccept()) { return each; } } for (DockContainer each : containers) { RelativeRectangle rec = each.getAcceptAreaFallback(); - if (rec.contains(point) && each.getContentResponse(content, point).canAccept()) { + if (rec.contains(dp) && each.getContentResponse(content, point).canAccept()) { return each; } } @@ -263,11 +265,12 @@ private void setLocationFrom(MouseEvent me) { @Override public @NotNull DockContainer.ContentResponse getResponse(MouseEvent e) { - RelativePoint point = new RelativePoint(e); + final DevicePoint dp = new DevicePoint(e); + final RelativePoint rp = new RelativePoint(e); for (DockContainer each : getContainers()) { - RelativeRectangle rec = each.getAcceptArea(); - if (rec.contains(point)) { - DockContainer.ContentResponse response = each.getContentResponse(myContent, point); + final RelativeRectangle rec = each.getAcceptArea(); + if (rec.contains(dp)) { + DockContainer.ContentResponse response = each.getContentResponse(myContent, rp); if (response.canAccept()) { return response; } @@ -278,7 +281,7 @@ private void setLocationFrom(MouseEvent me) { @Override public void process(MouseEvent e) { - RelativePoint point = new RelativePoint(e); + final RelativePoint point = new RelativePoint(e); Image img = null; if (e.getID() == MouseEvent.MOUSE_DRAGGED) { diff --git a/src/main/java/org/kdb/inside/brains/view/console/table/TabsTableResult.java b/src/main/java/org/kdb/inside/brains/view/console/table/TabsTableResult.java index 54be1b7..e288b85 100644 --- a/src/main/java/org/kdb/inside/brains/view/console/table/TabsTableResult.java +++ b/src/main/java/org/kdb/inside/brains/view/console/table/TabsTableResult.java @@ -59,12 +59,7 @@ public TabsTableResult(Project project, Disposable parent) { tabs = (JBTabsEx) JBTabsFactory.createTabs(project, this); // We can't use Supplier here as it's been Getter before and some versions are not compatiable anymore. - tabs.setPopupGroup(new ActionGroup() { - @Override - public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) { - return buildTabsPopupGroup().getChildren(e); - } - }, "KdbConsoleTabsMenu", true); + tabs.setPopupGroup(createTabsPopup(), "KdbConsoleTabsMenu", true); renameAction = new RenameTabAction(); @@ -128,15 +123,6 @@ public void addListener(@NotNull Listener listener, Disposable parent) { Disposer.register(parent, () -> listeners.remove(listener)); } - private @NotNull ActionGroup buildTabsPopupGroup() { - final TabInfo info = tabs.getTargetInfo(); - if (info == null || info == consoleTab) { - return ActionGroup.EMPTY_GROUP; - } - - return new DefaultActionGroup(renameAction); - } - public int getTabCount() { return tabs.getTabCount(); } @@ -251,20 +237,6 @@ public void resetDropOver(@NotNull DockableContent content) { return this; } - private @Nullable JBTabs getTabsAt(DockableContent content, RelativePoint point) { - if (content instanceof TableResultContent) { - final Point p = point.getPoint(tabs.getComponent()); - Component c = SwingUtilities.getDeepestComponentAt(tabs.getComponent(), p.x, p.y); - while (c != null) { - if (c instanceof JBTabs) { - return (JBTabs) c; - } - c = c.getParent(); - } - } - return null; - } - public void showTab(String name, TableResult tableResult) { showTab(name, tableResult, -1); } @@ -290,6 +262,28 @@ public void showTabAfter(String name, TableResult result, TableMode mode) { showTab(name, result, mode, index); } + private @NotNull ActionGroup createTabsPopup() { + final TabInfo info = tabs.getTargetInfo(); + if (info == null || info == consoleTab) { + return ActionGroup.EMPTY_GROUP; + } + return new DefaultActionGroup(renameAction); + } + + private @Nullable JBTabs getTabsAt(DockableContent content, RelativePoint point) { + if (content instanceof TableResultContent) { + final Point p = point.getPoint(tabs.getComponent()); + Component c = SwingUtilities.getDeepestComponentAt(tabs.getComponent(), p.x, p.y); + while (c != null) { + if (c instanceof JBTabs) { + return (JBTabs) c; + } + c = c.getParent(); + } + } + return null; + } + private void insertNewTab(TabInfo info, int index) { tabs.addTab(info, index); fireContentOpen(info); diff --git a/src/main/java/org/kdb/inside/brains/view/export/ClipboardExportAction.java b/src/main/java/org/kdb/inside/brains/view/export/ClipboardExportAction.java index 6c7ace3..aa5a3ab 100644 --- a/src/main/java/org/kdb/inside/brains/view/export/ClipboardExportAction.java +++ b/src/main/java/org/kdb/inside/brains/view/export/ClipboardExportAction.java @@ -103,7 +103,7 @@ protected void exportResultView(Project project, ExportingType type, CopyPasteMa plainStr.append(val).append('\t'); htmlStr.append(" "); - htmlStr.append(StringEscapeUtils.escapeXml(val)); + htmlStr.append(StringEscapeUtils.escapeHtml3(val)); htmlStr.append("\n"); indicator.setFraction(count++ / totalCount); } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index e2aaed7..45e5dfc 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -64,17 +64,17 @@ - - + + + + @@ -106,13 +114,15 @@ text="Cancel Active Queries" description="Cancels all active queries, if possible" icon="AllIcons.Actions.Suspend"/> + + + + - + diff --git a/src/main/resources/org/kdb/inside/brains/icons/executeFile.svg b/src/main/resources/org/kdb/inside/brains/icons/executeFile.svg new file mode 100644 index 0000000..9344a30 --- /dev/null +++ b/src/main/resources/org/kdb/inside/brains/icons/executeFile.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/org/kdb/inside/brains/icons/executeFile_dark.svg b/src/main/resources/org/kdb/inside/brains/icons/executeFile_dark.svg new file mode 100644 index 0000000..3340ba4 --- /dev/null +++ b/src/main/resources/org/kdb/inside/brains/icons/executeFile_dark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/version.properties b/version.properties index a6d65fc..7a5c00c 100644 --- a/version.properties +++ b/version.properties @@ -1 +1 @@ -pluginVersion=5.7.1 \ No newline at end of file +pluginVersion=5.8.0 \ No newline at end of file