Menu

#528 Change Title of tab session

SQuirreL
open
nobody
None
1
2018-05-31
2015-11-27
No

Is it possible change title of tab session when you change catalog combobox?

from: 1 - Test Connection (DB1) as test
to: 1 - Test Connection (DB2) as test

Reguards.

1 Attachments

Discussion

  • sfst

    sfst - 2015-12-08

    Right-click the name in the tab and use "Rename Session/Tab"

    It probably would be a nice enhancement to put the old name into the textbox for editing (though I never use that feature anyway).

     

    Last edit: sfst 2015-12-11
  • Chris B

    Chris B - 2018-05-26

    This code enhancement in class net.sourceforge.squirrel_sql.client.session.action.RenameSessionAction should do the job as suggested by sfst:

        public void actionPerformed(ActionEvent evt)
        {
            setSession(_app.getSessionManager().getActiveSession());
    
    
            String oldTitle;
    
            if(!_session.getActiveSessionWindow().equals(_app.getWindowManager().getAllFramesOfSession(_session.getIdentifier())[0])) 
            {
                oldTitle = _session.getActiveSessionWindow().getTitle();
            }
            else
            {
                oldTitle = _session.getTitle();
            }
    
    
            String newTitle = (String) JOptionPane.showInputDialog(_app.getMainFrame(),
                    s_stringMgr.getString("RenameSessionAction.label"),
                    s_stringMgr.getString("RenameSessionAction.title"),
                    JOptionPane.QUESTION_MESSAGE,
                    null,
                    null,
                    oldTitle);
    
    
            if(null == newTitle)
            {
                // Dialog was canceled.
                return;
            }
    
    
            if(!_session.getActiveSessionWindow().equals(_app.getWindowManager().getAllFramesOfSession(_session.getIdentifier())[0])) 
            {
                _session.getActiveSessionWindow().setTitle(newTitle);
            }
            else
            {
                _session.setTitle(newTitle);
                updateGui();
            }
        }
    

    Hope this is of any help.

     
  • Gerd Wagner

    Gerd Wagner - 2018-05-31

    Chris, I just committed your code to our GIT repository. It will be available in future snapshots and versions.
    Thanks
    Gerd

     

Log in to post a comment.