@Nullable @Override public JComponent createComponent() { FormBuilder builder = FormBuilder.createFormBuilder(); myCbShowImportPopup = new JCheckBox(ApplicationBundle.message("checkbox.show.import.popup")); myCbAddUnambiguousImports = new JCheckBox(ApplicationBundle.message("checkbox.add.unambiguous.imports.on.the.fly")); builder.addComponent(myCbShowImportPopup); builder.addComponent(myCbAddUnambiguousImports); myExcludePackagesList = new JBList(); JComponent excludedPanel = new JPanel(new BorderLayout()); excludedPanel.add(ToolbarDecorator.createDecorator(myExcludePackagesList) .setAddAction(new AddImportExclusionAction()).disableUpDownActions().createPanel(), BorderLayout.CENTER); excludedPanel.setBorder(IdeBorderFactory.createTitledBorder(ApplicationBundle.message("exclude.from.completion.group"), true)); if (!myIsDefaultProject) { builder.addComponent(excludedPanel); } JPanel result = new JPanel(new BorderLayout()); result.add(builder.getPanel(), BorderLayout.NORTH); if (myIsDialog) result.setPreferredSize(new Dimension(300, -1)); return result; }
private JPanel buildClassPathPanel() { final ToolbarDecorator pathListDecorator = ToolbarDecorator.createDecorator(pathList); pathListDecorator.setAddAction(new AddPathAction()); pathListDecorator.setEditAction(new EditPathAction()); pathListDecorator.setRemoveAction(new RemovePathAction()); pathListDecorator.setMoveUpAction(new MoveUpPathAction()); pathListDecorator.setMoveDownAction(new MoveDownPathAction()); pathListDecorator.setPreferredSize(DECORATOR_DIMENSIONS); final JPanel container = new JPanel(new BorderLayout()); container.add(new TitledSeparator(CheckStyleBundle.message("config.path.tab")), BorderLayout.NORTH); container.add(pathListDecorator.createPanel(), BorderLayout.CENTER); return container; }
@Nullable @Override public JComponent createComponent() { ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<MethodParameterSetting>() { @Override public MethodParameterSetting createElement() { //IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true); return null; } @Override public boolean canCreateElement() { return true; } }); tablePanel.setEditAction(anActionButton -> MethodParameterReferenceSettingsForm.this.openTwigPathDialog(MethodParameterReferenceSettingsForm.this.tableView.getSelectedObject()) ); tablePanel.setAddAction(anActionButton -> MethodParameterReferenceSettingsForm.this.openTwigPathDialog(null) ); tablePanel.disableUpAction(); tablePanel.disableDownAction(); this.panelConfigTableView.add(tablePanel.createPanel()); return this.panel1; }
private JPanel buildRuleFilePanel() { setColumnWith(locationTable, 0, ACTIVE_COL_MIN_WIDTH, ACTIVE_COL_MAX_WIDTH, ACTIVE_COL_MAX_WIDTH); setColumnWith(locationTable, 1, DESC_COL_MIN_WIDTH, DESC_COL_MAX_WIDTH, DESC_COL_MAX_WIDTH); locationTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); locationTable.setStriped(true); locationTable.getTableHeader().setReorderingAllowed(false); final ToolbarDecorator tableDecorator = ToolbarDecorator.createDecorator(locationTable); tableDecorator.setAddAction(new AddLocationAction()); tableDecorator.setEditAction(new EditPropertiesAction()); tableDecorator.setRemoveAction(new RemoveLocationAction()); tableDecorator.setEditActionUpdater(new DisableForDefaultUpdater()); tableDecorator.setRemoveActionUpdater(new DisableForDefaultUpdater()); tableDecorator.setPreferredSize(DECORATOR_DIMENSIONS); final JPanel container = new JPanel(new BorderLayout()); container.add(new TitledSeparator(CheckStyleBundle.message("config.file.tab")), BorderLayout.NORTH); container.add(tableDecorator.createPanel(), BorderLayout.CENTER); final JLabel infoLabel = new JLabel(CheckStyleBundle.message("config.file.description"), Icons.icon("/general/information.png"), SwingConstants.LEFT); infoLabel.setBorder(JBUI.Borders.empty(8, 0, 4, 0)); container.add(infoLabel, BorderLayout.SOUTH); return container; }
@Nullable @Override public JComponent createComponent() { ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<ContainerFile>() { @Override public ContainerFile createElement() { tablePanel.setEditAction(anActionButton -> { ContainerFile containerFile = ContainerSettingsForm.this.tableView.getSelectedObject(); if(containerFile != null) { tablePanel.setAddAction(anActionButton -> { String uri = UiSettingsUtil.getPathDialog(project, StdFileTypes.XML); if(uri != null) { this.panel1.add(tablePanel.createPanel()); return this.panel1;
private void createUIComponents() { mainPanel = new JPanel(); mainPanel.setLayout(new GridLayout(0, 1)); this.modelList = new ListTableModel<>( new IconColumn(), new NamespaceColumn(), new ServiceColumn() ); for (Map.Entry<String, Set<String>> entry : this.arguments.entrySet()) { this.modelList.addRow(new ServiceParameter(entry.getKey(), entry.getValue())); } this.tableView = new TableView<>(); this.tableView.setModelAndUpdateColumns(this.modelList); mainPanel.add(ToolbarDecorator.createDecorator(this.tableView) .disableAddAction() .disableDownAction() .disableRemoveAction() .disableUpDownActions() .createPanel() ); }
ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<TwigPath>() { @Override public TwigPath createElement() { tablePanel.setEditAction(anActionButton -> TwigSettingsForm.this.openTwigPathDialog(TwigSettingsForm.this.tableView.getSelectedObject())); tablePanel.setAddAction(anActionButton -> TwigSettingsForm.this.openTwigPathDialog(null)); tablePanel.setEditActionUpdater(e -> { TwigPath twigPath = TwigSettingsForm.this.tableView.getSelectedObject(); return twigPath != null && twigPath.isCustomPath(); }); tablePanel.setRemoveActionUpdater(e -> { TwigPath twigPath = TwigSettingsForm.this.tableView.getSelectedObject(); return twigPath != null && twigPath.isCustomPath(); }); tablePanel.disableUpAction(); tablePanel.disableDownAction(); this.panelTableView.add(tablePanel.createPanel());
protected void createAutobaseNamesComponent(FormBuilder builder) { autobaseModel = new CollectionListModel<>(); autobaseList = new JBList<>(autobaseModel); builder.addLabeledComponent( new JLabel("Autobase names (autobase_names option. Order is important, later components may be inherited from early):"), ToolbarDecorator .createDecorator(autobaseList) .setAddAction(anActionButton -> { String fileName = Messages.showInputDialog( myProject, "Type new Autobase filename:", "New Autobase Filename", Messages.getQuestionIcon(), "", null); if (StringUtil.isNotEmpty(fileName) && !autobaseModel.getItems().contains(fileName)) { autobaseModel.add(fileName); } }) .setPreferredSize(JBUI.size(0, PerlConfigurationUtil.WIDGET_HEIGHT)) .createPanel()); } }
private JComponent createCheckboxTreeView(ConfigCheckboxTree tree, List<MethodConfig> configs) { ToolbarDecorator decorator = ToolbarDecorator.createDecorator(tree); decorator.setToolbarPosition(ActionToolbarPosition.RIGHT); decorator.setAddAction(new AddNodeActionButton(tree, tempConfiguration, project)); decorator.setRemoveAction(new RemoveNodeActionButton(tree)); decorator.addExtraAction(AnActionButton.fromAction(new CopyAction(tree))); JPanel panel = decorator.createPanel(); tree.initTree(configs); initValidation(); return panel; }
.setText("There are no custom watches for this snapshot location."); final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(treePanel.getTree()).disableUpDownActions(); decorator.setToolbarPosition(ActionToolbarPosition.RIGHT); decorator.setAddAction( new AnActionButtonRunnable() { @Override decorator.setRemoveAction( new AnActionButtonRunnable() { @Override SystemInfo.isMac ? 0 : 1, 0); decorator.setToolbarBorder(border); watchPanel.add(decorator.createPanel(), BorderLayout.CENTER);
/** Sets up the the toolbar that appears in the cloud debugger snapshots panel. */ private void configureToolbar() { final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(table) .disableUpDownActions() .disableAddAction() .setToolbarPosition(ActionToolbarPosition.TOP); decorator.setRemoveAction(new RemoveSelectedBreakpointsAction()); decorator.addExtraAction(new RemoveAllBreakpointsAction()); decorator.addExtraAction(new ReactivateBreakpointAction()); this.add(decorator.createPanel()); }
builder.addLabeledComponent( PerlBundle.message("perl.settings.external.libs"), ToolbarDecorator.createDecorator(myLibsList) .setAddAction(this::doAddExternalLibrary) .createPanel() ); selfNamesList.setVisibleRowCount(ourRowsCount); builder.addLabeledComponent(new JLabel(PerlBundle.message("perl.config.self.names.label")), ToolbarDecorator .createDecorator(selfNamesList) .setAddAction( anActionButton -> { String variableName = Messages.showInputDialog( }).createPanel());
private void createUIComponents() { tableModel = new Model(); analyzerTable = new JBTable(tableModel); analyzerTable.setShowGrid(false); analyzerTable.setIntercellSpacing(JBUI.emptySize()); analyzerTable.getEmptyText().setText("No information"); analyzerTable.setDragEnabled(false); analyzerTable.setShowVerticalLines(false); analyzerTable.getTableHeader().setReorderingAllowed(false); analyzerTable.enableInputMethods(false); analyzerTable.setDefaultRenderer(String.class, new NoFocusCellRenderer(new DefaultTableCellRenderer())); final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(analyzerTable); tablePanel = decorator.createPanel(); }
public void initToolWindow(Project project, ToolWindow toolWindow) { if (!initialized) { ContentFactory contentFactory = ContentFactory.SERVICE.getInstance(); Content content = contentFactory.createContent(toolWindowContent, "", false); toolWindow.getContentManager().addContent(content); component = project.getComponent(DataSourcesComponent.class); componentMetadata = project.getComponent(DataSourcesComponentMetadata.class); cypherMetadataProviderService = ServiceManager.getService(project, CypherMetadataProviderService.class); dataSourceMetadataUi = new DataSourceMetadataUi(componentMetadata); treeRoot = new PatchedDefaultMutableTreeNode(new RootTreeNodeModel()); treeModel = new DefaultTreeModel(treeRoot, false); decorator = ToolbarDecorator.createDecorator(dataSourceTree); decorator.addExtraAction(new RefreshDataSourcesAction(this)); configureDataSourceTree(); decorateDataSourceTree(); interactions = new DataSourceInteractions(project, this); replaceTreeWithDecorated(); showDataSources(); refreshDataSourcesMetadata(); initialized = true; } }
private void replaceTreeWithDecorated() { JPanel panel = decorator.createPanel(); treePanel.add(panel); }
private void initRemoveAction() { decorator.setRemoveAction(anActionButton -> { DefaultMutableTreeNode[] selectedNodes = dataSourceTree.getSelectedNodes(DefaultMutableTreeNode.class, this::isDataSource); List<DataSourceApi> dataSourcesForRemoval = Arrays.stream(selectedNodes) .map(this::getDataSourceApi) .collect(Collectors.toList()); if (dataSourcesForRemoval.size() > 0) { dataSourcesView.removeDataSources(project, dataSourcesForRemoval); } }); decorator.setRemoveActionUpdater(e -> { DefaultMutableTreeNode[] selectedNodes = dataSourceTree.getSelectedNodes(DefaultMutableTreeNode.class, this::isDataSource); return selectedNodes.length > 0; }); }
private void initAddAction() { decorator.setAddAction(anActionButton -> { ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup( "New Data Source", new NewDataSourceActionGroup(project, dataSourcesView), anActionButton.getDataContext(), JBPopupFactory.ActionSelectionAid.NUMBERING, true ); popup.show(anActionButton.getPreferredPopupPoint()); }); }
private void initEditAction() { decorator.setEditActionUpdater(e -> { DefaultMutableTreeNode[] selectedNodes = dataSourceTree.getSelectedNodes(DefaultMutableTreeNode.class, this::isDataSource); return selectedNodes.length == 1; }); decorator.setEditAction(anActionButton -> { PatchedDefaultMutableTreeNode[] selectedNodes = dataSourceTree.getSelectedNodes(PatchedDefaultMutableTreeNode.class, (node) -> node.getUserObject() instanceof TreeNodeModelApi); if (selectedNodes.length == 1) { PatchedDefaultMutableTreeNode treeNode = selectedNodes[0]; DataSourceApi dataSourceToEdit = getDataSourceApi(treeNode); DataSourceDialog dialog = null; if (dataSourceToEdit.getDataSourceType().equals(DataSourceType.NEO4J_BOLT)) { dialog = new Neo4jBoltDataSourceDialog(project, dataSourcesView, dataSourceToEdit); } if (dialog != null) { if (dialog.go()) { dataSourcesView.updateDataSource(treeNode, dataSourceToEdit, dialog.constructDataSource()); } } } }); }
@Nullable @Override public JComponent createComponent() { ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<RoutingFile>() { @Override public RoutingFile createElement() { tablePanel.setEditAction(anActionButton -> { RoutingFile containerFile = RoutingSettingsForm.this.tableView.getSelectedObject(); if(containerFile == null) { }); tablePanel.setAddAction(anActionButton -> { String uri = UiSettingsUtil.getPathDialog(project, PhpFileType.INSTANCE); if(uri == null) { this.panel1.add(tablePanel.createPanel());
tableView.setModelAndUpdateColumns(listTableModel); panelTableView.add(ToolbarDecorator.createDecorator(tableView) .disableAddAction() .disableDownAction() .disableRemoveAction() .disableUpDownActions() .createPanel() );