Search in sources :

Example 1 with ShellSql

use of com.jsql.view.swing.shell.ShellSql in project jsql-injection by ron190.

the class CreateSQLShellTab method execute.

@Override
public void execute() {
    if (MediatorGui.frame() == null) {
        LOGGER.error("Unexpected unregistered MediatorGui.frame() in " + this.getClass());
    }
    try {
        UUID terminalID = UUID.randomUUID();
        ShellSql terminal = new ShellSql(terminalID, this.url, this.user, this.pass);
        MediatorGui.frame().getConsoles().put(terminalID, terminal);
        LightScrollPane scroller = new LightScrollPaneShell(terminal);
        MediatorGui.tabResults().addTab("SQL shell ", scroller);
        // Focus on the new tab
        MediatorGui.tabResults().setSelectedComponent(scroller);
        // Create a custom tab header with close button
        TabHeader header = new TabHeader("SQL shell", HelperUi.ICON_SHELL_SERVER);
        MediatorGui.tabResults().setToolTipTextAt(MediatorGui.tabResults().indexOfComponent(scroller), "<html><b>URL</b><br>" + this.url + RessourceAccess.FILENAME_SQLSHELL + "<br><b>Path</b><br>" + this.path + RessourceAccess.FILENAME_SQLSHELL + "</html>");
        // Apply the custom header to the tab
        MediatorGui.tabResults().setTabComponentAt(MediatorGui.tabResults().indexOfComponent(scroller), header);
        terminal.requestFocusInWindow();
    } catch (MalformedURLException e) {
        LOGGER.warn("Incorrect shell Url", e);
    }
}
Also used : TabHeader(com.jsql.view.swing.tab.TabHeader) LightScrollPaneShell(com.jsql.view.swing.scrollpane.LightScrollPaneShell) MalformedURLException(java.net.MalformedURLException) ShellSql(com.jsql.view.swing.shell.ShellSql) LightScrollPane(com.jsql.view.swing.scrollpane.LightScrollPane) UUID(java.util.UUID)

Aggregations

LightScrollPane (com.jsql.view.swing.scrollpane.LightScrollPane)1 LightScrollPaneShell (com.jsql.view.swing.scrollpane.LightScrollPaneShell)1 ShellSql (com.jsql.view.swing.shell.ShellSql)1 TabHeader (com.jsql.view.swing.tab.TabHeader)1 MalformedURLException (java.net.MalformedURLException)1 UUID (java.util.UUID)1