} else {
newCols = new double[oldCols.length + 2];
// Move all components
for (Component component : toolWindowTitleButtonPanel.getComponents()) {
TableLayoutConstraints constraints = containerLayout.getConstraints(component);
if (constraints.col1 >= 1) {
constraints.col1 += 2;
constraints.col2 = constraints.col1;
containerLayout.setConstraints(component, constraints);
}
}
// Prepare the space at the beginning of neCols
System.arraycopy(oldCols, 1, newCols, 3, oldCols.length - 1);
// Setup the columns for the new actions
newCols[1] = -2;
newCols[2] = 1;
// setup the column destination
col = 1;
}
containerLayout.setColumn(newCols);
} else {
int colIndex = (index != 0 ? 1 : 0) + ((toolWindowTitleButtonPanel.getComponentCount() - index) * 2);
for (Component component : toolWindowTitleButtonPanel.getComponents()) {
TableLayoutConstraints constraints = containerLayout.getConstraints(component);
if (constraints.col1 >= colIndex) {
constraints.col1 += 2;
constraints.col2 = constraints.col1;
containerLayout.setConstraints(component, constraints);
}