Skip to content

Commit

Permalink
Merge pull request #7451 from matthiasblaesing/cleanup_context_action2
Browse files Browse the repository at this point in the history
Cleanup ContextAction and fix TerminalAction behavior
  • Loading branch information
matthiasblaesing authored Jul 18, 2024
2 parents 3add6af + c4f10c8 commit 9b1b308
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,18 @@ private class PopupListener extends MouseUtils.PopupMouseAdapter {

@Override
protected void showPopup(MouseEvent e) {
Terminal selected = (Terminal) getSelected();

Terminal selected = null;
if (e.getSource() == tabbedPane) {
int tabIndex = tabbedPane.indexAtLocation(e.getX(), e.getY());
if(tabIndex >= 0) {
selected = (Terminal) tabbedPane.getComponentAt(tabIndex);
}
}

if (selected == null) {
selected = (Terminal) getSelected();
}

Action close = ActionFactory.forID(ActionFactory.CLOSE_ACTION_ID);
Action setTitle = ActionFactory.forID(ActionFactory.SET_TITLE_ACTION_ID);
Action pin = ActionFactory.forID(ActionFactory.PIN_TAB_ACTION_ID);
Expand All @@ -285,7 +295,7 @@ protected void showPopup(MouseEvent e) {
null,
setTitle,
pin
}, Lookups.fixed(getSelected())
}, Lookups.fixed(selected)
);
menu.show(TerminalContainerTabbed.this, e.getX(), e.getY());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,12 @@ public void setTitleAt(int idx, String title) {
}

super.setTitleAt(idx, title);
// Force update of the special "CloseButton" UI. It was observed, that
// after a change to an empty title changing to a title with content
// only works when the surrounding component is resized, forcing a
// revalidation of the terminal
getTabComponentAt(idx).revalidate();
getTabComponentAt(idx).repaint();
}

private Component findTabAt(int index) {
Expand Down
Loading

0 comments on commit 9b1b308

Please sign in to comment.