if (layout == null) { coolBar.setRedraw(false); CoolItem[] coolItems = coolBar.getItems(); int[] newItemOrder = new int[coolItems.length]; // Reset the coolitem order to their original order. This order is // based on the order of the ContributionItems. Note that the only // way to reset item order is to setItemLayout (no setItemOrder API). IContributionItem[] items = getItems(); int j = 0; int[] oldItemOrder = coolBar.getItemOrder(); for (int i = 0; i < items.length; i++) { CoolBarContributionItem item = (CoolBarContributionItem)items[i]; CoolItem coolItem = findCoolItem(item); if (coolItem != null) { int visualIndex = coolBar.indexOf(coolItem); int creationIndex = oldItemOrder[visualIndex]; newItemOrder[j] = creationIndex; j++; } } coolBar.setItemLayout(newItemOrder, coolBar.getWrapIndices(), coolBar.getItemSizes()); redoLayout(); coolBar.setRedraw(true); return; }