com.intellij.ui.ToolbarDecorator Java Examples
The following examples show how to use
com.intellij.ui.ToolbarDecorator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TargetExpressionListUi.java From intellij with Apache License 2.0 | 7 votes |
public TargetExpressionListUi(Project project) { this.project = project; listModel = new ListTableModel<>(new TargetColumn()); tableView = new TableView<>(listModel); tableView.getEmptyText().setText("Choose some targets"); tableView.setPreferredScrollableViewportSize(new Dimension(200, tableView.getRowHeight() * 4)); setLayout(new BorderLayout()); add( ToolbarDecorator.createDecorator(tableView) .setAddAction(button -> addTarget()) .setRemoveAction(button -> removeTarget()) .disableUpDownActions() .createPanel(), BorderLayout.CENTER); }
Example #2
Source File: GenerateDialog.java From android-parcelable-intellij-plugin with Apache License 2.0 | 6 votes |
protected GenerateDialog(final PsiClass psiClass) { super(psiClass.getProject()); setTitle("Select Fields for Parcelable Generation"); fieldsCollection = new CollectionListModel<PsiField>(); final JBList fieldList = new JBList(fieldsCollection); fieldList.setCellRenderer(new DefaultPsiElementCellRenderer()); final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(fieldList).disableAddAction(); final JPanel panel = decorator.createPanel(); fieldsComponent = LabeledComponent.create(panel, "Fields to include in Parcelable"); includeSubclasses = new JBCheckBox("Include fields from base classes"); setupCheckboxClickAction(psiClass); showCheckbox = psiClass.getFields().length != psiClass.getAllFields().length; updateFieldsDisplay(psiClass); init(); }
Example #3
Source File: TablePanel.java From CodeGen with MIT License | 6 votes |
public TablePanel(Table table) { $$$setupUI$$$(); rootPanel.setBorder(IdeBorderFactory.createTitledBorder(table.getTableName(), false)); //不可整列移动 fieldTable.getTableHeader().setReorderingAllowed(false); //不可拉动表格 fieldTable.getTableHeader().setResizingAllowed(false); fieldTable.getEmptyText().setText("No Columns"); JPanel panel = ToolbarDecorator.createDecorator(fieldTable) .setAddAction(it -> addAction()) .setRemoveAction(it -> removeAction()) .setEditAction(it -> editAction()) .createPanel(); panel.setPreferredSize(JBUI.size(600, 200)); columnsPanel.setBorder(IdeBorderFactory.createTitledBorder("Columns", false)); columnsPanel.add(panel, BorderLayout.CENTER); mainPanel.add(columnsPanel); modelTextField.setText(table.getModelName()); tableTextField.setText(table.getTableName()); initFields(table.getFields()); this.getRootComponent().registerKeyboardAction(e -> this.getRootComponent().disable(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); }
Example #4
Source File: ProjectSettingsPanel.java From consulo with Apache License 2.0 | 6 votes |
public JComponent getMainComponent() { final JPanel panel = new JPanel(new BorderLayout(0, 10)); final LabeledComponent<JComboBox> component = new LabeledComponent<JComboBox>(); component.setText("Default &project copyright:"); component.setLabelLocation(BorderLayout.WEST); component.setComponent(myProfilesComboBox); panel.add(component, BorderLayout.NORTH); ElementProducer<ScopeSetting> producer = new ElementProducer<ScopeSetting>() { @Override public ScopeSetting createElement() { return new ScopeSetting(DefaultScopesProvider.getAllScope(), myProfilesModel.getAllProfiles().values().iterator().next()); } @Override public boolean canCreateElement() { return !myProfilesModel.getAllProfiles().isEmpty(); } }; ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myScopeMappingTable, producer); panel.add(decorator.createPanel(), BorderLayout.CENTER); panel.add(myScopesLink, BorderLayout.SOUTH); return panel; }
Example #5
Source File: DataSourcesView.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 6 votes |
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); 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; } }
Example #6
Source File: RoutingSettingsForm.java From idea-php-symfony2-plugin with MIT License | 6 votes |
private void addWebDeploymentButton(ToolbarDecorator tablePanel) { tablePanel.addExtraAction(new AnActionButton("Remote", AllIcons.Actions.Download) { @Override public void actionPerformed(AnActionEvent anActionEvent) { UiSettingsUtil.openFileDialogForDefaultWebServerConnection(project, new WebServerFileDialogExtensionCallback("php") { @Override public void success(@NotNull WebServerConfig server, @NotNull WebServerConfig.RemotePath remotePath) { RoutingSettingsForm.this.tableView.getListTableModel().addRow( new RoutingFile("remote://" + org.apache.commons.lang.StringUtils.stripStart(remotePath.path, "/")) ); RoutingSettingsForm.this.changed = true; } }); } }); }
Example #7
Source File: ContainerSettingsForm.java From idea-php-symfony2-plugin with MIT License | 6 votes |
private void addWebDeploymentButton(ToolbarDecorator tablePanel) { tablePanel.addExtraAction(new AnActionButton("Remote", AllIcons.Actions.Download) { @Override public void actionPerformed(AnActionEvent anActionEvent) { UiSettingsUtil.openFileDialogForDefaultWebServerConnection(project, new WebServerFileDialogExtensionCallback("xml") { @Override public void success(@NotNull WebServerConfig server, @NotNull WebServerConfig.RemotePath remotePath) { ContainerSettingsForm.this.tableView.getListTableModel().addRow( new ContainerFile("remote://" + org.apache.commons.lang.StringUtils.stripStart(remotePath.path, "/")) ); ContainerSettingsForm.this.changed = true; } }); } }); }
Example #8
Source File: CommonConfigView.java From easy_javadoc with Apache License 2.0 | 5 votes |
private void createUIComponents() { typeMapList = new JBList<>(new CollectionListModel<>(Lists.newArrayList())); typeMapList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); typeMapList.setCellRenderer(new ListCellRendererWrapper<Entry<String, String>>() { @Override public void customize(JList list, Entry<String, String> value, int index, boolean selected, boolean hasFocus) { setText(value.getKey() + " -> " + value.getValue()); } }); typeMapList.setEmptyText("请添加单词映射"); typeMapList.setSelectedIndex(0); ToolbarDecorator toolbarDecorator = ToolbarDecorator.createDecorator(typeMapList); toolbarDecorator.setAddAction(button -> { WordMapAddView wordMapAddView = new WordMapAddView(); if (wordMapAddView.showAndGet()) { if (config != null) { Entry<String, String> entry = wordMapAddView.getMapping(); config.getWordMap().put(entry.getKey(), entry.getValue()); refreshWordMap(); } } }); toolbarDecorator.setRemoveAction(anActionButton -> { if (config != null) { Map<String, String> typeMap = config.getWordMap(); typeMap.remove(typeMapList.getSelectedValue().getKey()); refreshWordMap(); } }); wordMapPanel = toolbarDecorator.createPanel(); }
Example #9
Source File: DependencyConfigurable.java From consulo with Apache License 2.0 | 5 votes |
private JPanel createRulesPanel(MyTableModel model, TableView<DependencyRule> table) { table.setSurrendersFocusOnKeystroke(true); table.setPreferredScrollableViewportSize(new Dimension(300, 150)); table.setShowGrid(true); table.setRowHeight(new PackageSetChooserCombo(myProject, null).getPreferredSize().height); return ToolbarDecorator.createDecorator(table).createPanel(); }
Example #10
Source File: DocumentationOrderRootTypeUIFactory.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void addToolbarButtons(ToolbarDecorator toolbarDecorator) { AnActionButton specifyUrlButton = new AnActionButton(ProjectBundle.message("sdk.paths.specify.url.button"), IconUtil.getAddLinkIcon()) { @RequiredUIAccess @Override public void actionPerformed(@Nonnull AnActionEvent e) { onSpecifyUrlButtonClicked(); } }; specifyUrlButton.setShortcut(CustomShortcutSet.fromString("alt S")); specifyUrlButton.addCustomUpdater(e -> myEnabled); toolbarDecorator.addExtraAction(specifyUrlButton); }
Example #11
Source File: ServiceArgumentSelectionDialog.java From idea-php-symfony2-plugin with MIT License | 5 votes |
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() ); }
Example #12
Source File: MethodParameterReferenceSettingsForm.java From idea-php-symfony2-plugin with MIT License | 5 votes |
@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; }
Example #13
Source File: MethodSignatureTypeSettingsForm.java From idea-php-symfony2-plugin with MIT License | 5 votes |
@Nullable @Override public JComponent createComponent() { ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<MethodSignatureSetting>() { @Override public MethodSignatureSetting createElement() { //IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true); return null; } @Override public boolean canCreateElement() { return true; } }); tablePanel.setEditAction(anActionButton -> MethodSignatureTypeSettingsForm.this.openTwigPathDialog(MethodSignatureTypeSettingsForm.this.tableView.getSelectedObject()) ); tablePanel.setAddAction(anActionButton -> MethodSignatureTypeSettingsForm.this.openTwigPathDialog(null) ); tablePanel.disableUpAction(); tablePanel.disableDownAction(); this.panelConfigTableView.add(tablePanel.createPanel()); return this.panel1; }
Example #14
Source File: LatteCustomModifierSettingsForm.java From intellij-latte with MIT License | 5 votes |
@Nullable @Override public JComponent createComponent() { ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<LatteFilterSettings>() { @Override public LatteFilterSettings createElement() { //IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true); return null; } @Override public boolean canCreateElement() { return true; } }); tablePanel.setEditAction(anActionButton -> LatteCustomModifierSettingsForm.this.openModifierDialog(LatteCustomModifierSettingsForm.this.tableView.getSelectedObject()) ); tablePanel.setAddAction(anActionButton -> LatteCustomModifierSettingsForm.this.openModifierDialog(null) ); tablePanel.disableUpAction(); tablePanel.disableDownAction(); this.panelConfigTableView.add(tablePanel.createPanel()); return this.panel1; }
Example #15
Source File: PluginSettingForm.java From ycy-intellij-plugin with GNU General Public License v3.0 | 5 votes |
private void createUIComponents() { // place custom component creation code here this.remindTypeOptions = new ComboBox<>(); for (ConfigState.RemindTypeEnum remindType : ConfigState.RemindTypeEnum.values()) { this.remindTypeOptions.addItem(remindType.description); } ConfigState configState = ConfigService.getInstance().getState(); List<String> remindImages = configState.getRemindImages(); this.pluginSettingTable = new PluginSettingTable(remindImages); this.imageUrlList = ToolbarDecorator.createDecorator(pluginSettingTable) /* * at version 1.5 fix a bug: 2020.1 版本 AllIcons.Actions.Reset_to_default 过时问题 * see https://github.com/fantasticmao/ycy-intellij-plugin/issues/27 */ .addExtraAction(new AnActionButton("Reset", AllIcons.Actions.Rollback) { @Override public void actionPerformed(AnActionEvent e) { pluginSettingTable.resetTableList(); } @Override public boolean isDumbAware() { return true; // 使用「后台更新」模式 } }) .createPanel(); }
Example #16
Source File: PatcherDialog.java From patcher with Apache License 2.0 | 5 votes |
private void createUIComponents() { VirtualFile[] data = event.getData(DataKeys.VIRTUAL_FILE_ARRAY); fieldList = new JBList(data); fieldList.setEmptyText("No File Selected!"); ToolbarDecorator decorator = ToolbarDecorator.createDecorator(fieldList); filePanel = decorator.createPanel(); }
Example #17
Source File: LatteCustomFunctionSettingsForm.java From intellij-latte with MIT License | 5 votes |
@Nullable @Override public JComponent createComponent() { ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<LatteFunctionSettings>() { @Override public LatteFunctionSettings createElement() { //IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true); return null; } @Override public boolean canCreateElement() { return true; } }); tablePanel.setEditAction(anActionButton -> LatteCustomFunctionSettingsForm.this.openFunctionDialog(LatteCustomFunctionSettingsForm.this.tableView.getSelectedObject()) ); tablePanel.setAddAction(anActionButton -> LatteCustomFunctionSettingsForm.this.openFunctionDialog(null) ); tablePanel.disableUpAction(); tablePanel.disableDownAction(); this.panelConfigTableView.add(tablePanel.createPanel()); return this.panel1; }
Example #18
Source File: LatteVariableSettingsForm.java From intellij-latte with MIT License | 5 votes |
@Nullable @Override public JComponent createComponent() { ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<LatteVariableSettings>() { @Override public LatteVariableSettings createElement() { //IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true); return null; } @Override public boolean canCreateElement() { return true; } }); tablePanel.setEditAction(anActionButton -> LatteVariableSettingsForm.this.openVariablePathDialog(LatteVariableSettingsForm.this.tableView.getSelectedObject()) ); tablePanel.setAddAction(anActionButton -> LatteVariableSettingsForm.this.openVariablePathDialog(null) ); tablePanel.disableUpAction(); tablePanel.disableDownAction(); this.panelConfigTableView.add(tablePanel.createPanel()); return this.panel1; }
Example #19
Source File: ExportRunConfigurationDialog.java From intellij with Apache License 2.0 | 5 votes |
@Override protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(IdeBorderFactory.createTitledBorder("Run Configurations", false)); panel.add( ToolbarDecorator.createDecorator(table).addExtraAction(new SelectAllButton()).createPanel(), BorderLayout.CENTER); return panel; }
Example #20
Source File: LatteCustomMacroSettingsForm.java From intellij-latte with MIT License | 5 votes |
@Nullable @Override public JComponent createComponent() { ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<LatteTagSettings>() { @Override public LatteTagSettings createElement() { //IdeFocusManager.getInstance(TwigSettingsForm.this.project).requestFocus(TwigNamespaceDialog.getWindows(), true); return null; } @Override public boolean canCreateElement() { return true; } }); tablePanel.setEditAction(anActionButton -> LatteCustomMacroSettingsForm.this.openMacroDialog(LatteCustomMacroSettingsForm.this.tableView.getSelectedObject()) ); tablePanel.setAddAction(anActionButton -> LatteCustomMacroSettingsForm.this.openMacroDialog(null) ); tablePanel.disableUpAction(); tablePanel.disableDownAction(); this.panelConfigTableView.add(tablePanel.createPanel()); return this.panel1; }
Example #21
Source File: UseAliasListForm.java From idea-php-annotation-plugin with MIT License | 4 votes |
@Nullable @Override public JComponent createComponent() { ToolbarDecorator tablePanel = ToolbarDecorator.createDecorator(this.tableView, new ElementProducer<UseAliasOption>() { @Override public UseAliasOption createElement() { return null; } @Override public boolean canCreateElement() { return true; } }); tablePanel.setEditAction(anActionButton -> { UseAliasOption useAliasOption = tableView.getSelectedObject(); if(useAliasOption == null) { return; } UseAliasForm.create(panel1, useAliasOption, option -> { tableView.getTableViewModel().fireTableDataChanged(); changed = true; }); }); tablePanel.setAddAction(anActionButton -> UseAliasForm.create(panel1, option -> { tableView.getListTableModel().addRow(option); changed = true; })); tablePanel.setRemoveAction(anActionButton -> { modelList.removeRow(tableView.getSelectedRow()); tableView.getTableViewModel().fireTableDataChanged(); changed = true; }); tablePanel.disableDownAction(); tablePanel.disableUpAction(); this.panel1.add(tablePanel.createPanel()); return this.panel; }
Example #22
Source File: OnEventChangeSignatureDialog.java From litho with Apache License 2.0 | 4 votes |
@Override protected JPanel createParametersPanel(boolean hasTabsInDialog) { super.createParametersPanel(hasTabsInDialog); return ToolbarDecorator.createDecorator(myParametersList.getTable()).createPanel(); }
Example #23
Source File: ExcludedFilesList.java From consulo with Apache License 2.0 | 4 votes |
public ToolbarDecorator getDecorator() { return myFileListDecorator; }
Example #24
Source File: ExcludedFilesList.java From consulo with Apache License 2.0 | 4 votes |
private void onSelectionChange() { int i = getSelectedIndex(); AnActionButton removeButton = ToolbarDecorator.findRemoveButton(myFileListDecorator.getActionsPanel()); removeButton.setEnabled(i >= 0); }
Example #25
Source File: EditVariableDialog.java From consulo with Apache License 2.0 | 4 votes |
private JComponent createVariablesTable() { final String[] names = { CodeInsightBundle.message("templates.dialog.edit.variables.table.column.name"), CodeInsightBundle.message("templates.dialog.edit.variables.table.column.expression"), CodeInsightBundle.message("templates.dialog.edit.variables.table.column.default.value"), CodeInsightBundle.message("templates.dialog.edit.variables.table.column.skip.if.defined") }; // Create a model of the data. TableModel dataModel = new VariablesModel(names); // Create the table myTable = new JBTable(dataModel); myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myTable.setPreferredScrollableViewportSize(new Dimension(500, myTable.getRowHeight() * 8)); myTable.getColumn(names[0]).setPreferredWidth(120); myTable.getColumn(names[1]).setPreferredWidth(200); myTable.getColumn(names[2]).setPreferredWidth(200); myTable.getColumn(names[3]).setPreferredWidth(100); if (myVariables.size() > 0) { myTable.getSelectionModel().setSelectionInterval(0, 0); } JComboBox comboField = new JComboBox(); Macro[] macros = MacroFactory.getMacros(); Arrays.sort(macros, new Comparator<Macro> () { @Override public int compare(Macro m1, Macro m2) { return m1.getPresentableName().compareTo(m2.getPresentableName()); } }); eachMacro: for (Macro macro : macros) { for (TemplateContextType contextType : myContextTypes) { if (macro.isAcceptableInContext(contextType)) { comboField.addItem(macro.getPresentableName()); continue eachMacro; } } } comboField.setEditable(true); DefaultCellEditor cellEditor = new DefaultCellEditor(comboField); cellEditor.setClickCountToStart(1); myTable.getColumn(names[1]).setCellEditor(cellEditor); myTable.setRowHeight(comboField.getPreferredSize().height); JTextField textField = new JTextField(); /*textField.addMouseListener( new PopupHandler(){ public void invokePopup(Component comp,int x,int y){ showCellPopup((JTextField)comp,x,y); } } );*/ cellEditor = new DefaultCellEditor(textField); cellEditor.setClickCountToStart(1); myTable.setDefaultEditor(String.class, cellEditor); final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTable).disableAddAction().disableRemoveAction(); return decorator.createPanel(); }
Example #26
Source File: VariableUI.java From CodeGen with MIT License | 4 votes |
private void createUIComponents() { // TODO: place custom component creation code here splitPanel = new JPanel(); splitPanel.setPreferredSize(JBUI.size(300, 400)); jSplitPane = new JSplitPane(); jSplitPane.setOrientation(0); jSplitPane.setContinuousLayout(true); jSplitPane.setBorder(BorderFactory.createEmptyBorder()); varPanel = new JPanel(new BorderLayout()); varPanel.setBorder(IdeBorderFactory.createTitledBorder("Predefined Variables", false)); varTable = new JBTable(); varTable.getEmptyText().setText("No Variables"); //不可整列移动 varTable.getTableHeader().setReorderingAllowed(false); //不可拉动表格 varTable.getTableHeader().setResizingAllowed(false); JPanel panel = ToolbarDecorator.createDecorator(varTable) .setAddAction(it -> addAction()) .setRemoveAction(it -> removeAction()) .setEditAction(it -> editAction()).createPanel(); varPanel.add(panel, BorderLayout.CENTER); descPanel = new JPanel(new BorderLayout()); descPanel.setBorder(IdeBorderFactory.createTitledBorder("Default Variables \\& Directives", false)); String inHouseVariables; try { inHouseVariables = FileUtil.loadTextAndClose(VariableUI.class.getResourceAsStream("/variables.md")); } catch (Exception e) { inHouseVariables = "something error"; } descArea = new JTextArea(); descArea.setText(inHouseVariables); descArea.setEditable(false); descPanel.add(ScrollPaneFactory.createScrollPane(descArea), BorderLayout.CENTER); // ignore fields ignorePane = new JPanel(); ignorePane.setBorder(IdeBorderFactory.createTitledBorder("The Ignore Fields", false)); }
Example #27
Source File: BuckSettingsUI.java From buck with Apache License 2.0 | 4 votes |
private JPanel initBuckCellSection() { JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(IdeBorderFactory.createTitledBorder("Cells", true)); cellTableModel = new ListTableModel<>(CELL_NAME_COLUMN, ROOT_COLUMN, BUILD_FILENAME_COLUMN); cellTableModel.setItems(buckCellSettingsProvider.getCells()); TableView<BuckCell> cellTable = new TableView<>(cellTableModel); cellTable.setPreferredScrollableViewportSize( new Dimension( cellTable.getPreferredScrollableViewportSize().width, 8 * cellTable.getRowHeight())); ToolbarDecorator decorator = ToolbarDecorator.createDecorator(cellTable) .setAddAction( (AnActionButton button) -> { final FileChooserDescriptor dirChooser = FileChooserDescriptorFactory.createSingleFolderDescriptor() .withTitle("Select root directory of buck cell"); Project project = buckProjectSettingsProvider.getProject(); FileChooser.chooseFile( dirChooser, project, BuckSettingsUI.this, project.getBaseDir(), file -> { BuckCell buckCell = new BuckCell(); buckCell.setName(file.getName()); buckCell.setRoot(file.getPath()); cellTableModel.addRow(buckCell); }); }) .addExtraAction( new AnActionButton("Automatically discover cells", Actions.Find) { @Override public void actionPerformed(AnActionEvent anActionEvent) { discoverCells(); } }); JBLabel label = new JBLabel("By default, commands take place in the topmost cell"); panel.add(label, BorderLayout.NORTH); panel.add(decorator.createPanel(), BorderLayout.CENTER); return panel; }
Example #28
Source File: DataSourcesView.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 4 votes |
public ToolbarDecorator getDecorator() { return decorator; }
Example #29
Source File: PatternFilterEditor.java From KodeBeagle with Apache License 2.0 | 4 votes |
public PatternFilterEditor(final Project project, final String patternsHelpId) { super(new BorderLayout()); myPatternsHelpId = patternsHelpId; myTable = new JBTable(); myProject = project; final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTable); decorator.addExtraAction(new AnActionButton(getAddPatternButtonText(), getAddPatternButtonIcon()) { @Override public void actionPerformed(final AnActionEvent e) { addPatternFilter(); } }); add(decorator.setRemoveAction(new AnActionButtonRunnable() { @Override public void run(final AnActionButton button) { TableUtil.removeSelectedItems(myTable); } }).setButtonComparator(getAddPatternButtonText(), "Remove") .disableUpDownActions().createPanel(), BorderLayout.CENTER); myTableModel = new FilterTableModel(); myTable.setModel(myTableModel); myTable.setShowGrid(false); myTable.setShowGrid(false); myTable.setIntercellSpacing(new Dimension(0, 0)); myTable.setTableHeader(null); myTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); myTable.setColumnSelectionAllowed(false); myTable.setPreferredScrollableViewportSize(new Dimension(WIDTH, myTable.getRowHeight() * PREFERRED_SCROLLABLE_VIEWPORT_HEIGHT_IN_ROWS)); TableColumnModel columnModel = myTable.getColumnModel(); TableColumn column = columnModel.getColumn(FilterTableModel.CHECK_MARK); TableUtil.setupCheckboxColumn(column); column.setCellRenderer(new EnabledCellRenderer(myTable.getDefaultRenderer(Boolean.class))); columnModel.getColumn(FilterTableModel.FILTER).setCellRenderer(new FilterCellRenderer()); getEmptyText().setText(EMPTY_PATTERNS); }
Example #30
Source File: VariablesPanel.java From intellij-xquery with Apache License 2.0 | 4 votes |
public ToolbarDecorator getToolbarDecorator() { return toolbarDecorator; }