public void toggleActiveTabPinned() {
        CTabItem activeTab = getActiveResultsTab();
        QueryResultsContainer container = (QueryResultsContainer) activeTab.getData();
        
        if (!container.hasData()) {
            return;
        }

        boolean isPinned = container.isPinned();

        container.setPinned(!isPinned);

        CTabItem currTabItem = activeTab;
        CTabItem nextTabItem;

        if (isPinned) {
            for (int i = resultTabs.indexOf(activeTab) + 1; i < resultTabs.getItemCount(); i++) {
                nextTabItem = resultTabs.getItem(i);
                if (nextTabItem.getShowClose()) {
                    break;
                }
                resultTabsReorder.swapTabs(currTabItem, nextTabItem);
                currTabItem = nextTabItem;
            }
        } else {
            for (int i = resultTabs.indexOf(activeTab) - 1; i >= 0; i--) {
                nextTabItem = resultTabs.getItem(i);
                if (!nextTabItem.getShowClose()) {
                    break;
                }
                resultTabsReorder.swapTabs(currTabItem, nextTabItem);
                currTabItem = nextTabItem;
            }
        }

    }
Toggle isPinned value of active tab container,
then move tab to left of all unpinned tabs if pinning,
or move tab to right of all pinned tabs if unpinning
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java