public JComponent createActionsToolbar(ConsoleView console) { DefaultActionGroup group = new DefaultActionGroup(console.createConsoleActions()); ActionManager manager = ActionManager.getInstance(); ActionToolbar toolbar = manager.createActionToolbar(ActionPlaces.UNKNOWN, group, false); toolbar.setLayoutPolicy(ActionToolbar.WRAP_LAYOUT_POLICY); return toolbar.getComponent(); }
@Override public void updateTabs() { if (isDisposed()) { return; } if (getEditedNode() != null && getEditedNode().resolve(getProject().getRepository()) == null) { editNode(myBaseNode); } myRealTabs.clear(); final NodeChangeCallback callback = new NodeChangeCallback() { @Override public void changeNode(SNodeReference newNode) { editNode(newNode); } }; TabEditorLayout newContent = updateDocumentsAndNodes(); for (RelationDescriptor tabDescriptor : myPossibleTabs) { if (newContent.covers(tabDescriptor)) { final ButtonEditorTab tab = new ButtonEditorTab( this, myRealTabs.size(), tabDescriptor, newContent.get(tabDescriptor)); final SelectTabAction action = new SelectTabAction(getProject(), tab, callback); tab.setSelectTabAction(action); action.registerShortcut(myEditor); myRealTabs.add(tab); } } updateTabColors(); DefaultActionGroup group = new DefaultActionGroup(); for (ButtonEditorTab tab : myRealTabs) { group.add(tab.getSelectTabAction()); } if (myToolbar != null) { removeContent(myToolbar.getComponent()); } ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true); actionToolbar.setLayoutPolicy(ActionToolbar.WRAP_LAYOUT_POLICY); myToolbar = actionToolbar; setContent(myToolbar.getComponent()); if (getEditedNode() != null) { // MPS-22337: getEditedNode() exists even if node was deleted. // So we need to check if tab created for such node as tabs was created only for non deleted // aspects. boolean isTabExists = false; for (ButtonEditorTab tab : myRealTabs) { if (tab.isEditingTabFor(getEditedNode())) { isTabExists = true; break; } } editNode(isTabExists ? getEditedNode() : myBaseNode); } }
private JComponent createToolbar() { ActionGroup group = (ActionGroup) CustomActionsSchema.getInstance().getCorrectedAction(IdeActions.GROUP_MAIN_TOOLBAR); final ActionToolbar toolBar = myActionManager.createActionToolbar(ActionPlaces.MAIN_TOOLBAR, group, true); toolBar.setLayoutPolicy(ActionToolbar.WRAP_LAYOUT_POLICY); DefaultActionGroup menuGroup = new DefaultActionGroup(); menuGroup.add(new ViewToolbarAction()); menuGroup.add(new CustomizeUIAction()); PopupHandler.installUnknownPopupHandler(toolBar.getComponent(), menuGroup, myActionManager); return toolBar.getComponent(); }