Java Code Examples for com.intellij.ui.ToolbarDecorator#createPanel()
The following examples show how to use
com.intellij.ui.ToolbarDecorator#createPanel() .
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: 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 2
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 3
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 4
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(); }