protected JComponent createEditorContent() { JPanel result = new JPanel(new BorderLayout()); Splitter p; result.add(BorderLayout.CENTER, p = new Splitter(true, 0.5f)); p.setFirstComponent(super.createEditorContent()); replaceCriteriaEdit = createEditor(searchContext, mySavedEditorText != null ? mySavedEditorText : ""); JPanel replace = new JPanel(new BorderLayout()); replace.add(BorderLayout.NORTH, new JLabel(SSRBundle.message("replacement.template.label"))); replace.add(BorderLayout.CENTER, replaceCriteriaEdit.getComponent()); replaceCriteriaEdit.getComponent().setMinimumSize(new Dimension(150, 100)); p.setSecondComponent(replace); return result; }
protected void buildOptions(JPanel searchOptions) { super.buildOptions(searchOptions); searchOptions.add( UIUtil.createOptionLine( shortenFQN = new JCheckBox(SSRBundle.message("shorten.fully.qualified.names.checkbox"), true))); searchOptions.add( UIUtil.createOptionLine( formatAccordingToStyle = new JCheckBox( CodeInsightBundle.message( "dialog.edit.template.checkbox.reformat.according.to.style"), true))); searchOptions.add( UIUtil.createOptionLine( useStaticImport = new JCheckBox( CodeInsightBundle.message("dialog.edit.template.checkbox.use.static.import"), true))); }
public JPanel getComponent() { JPanel panel = new JPanel(new BorderLayout()); panel.add(new JLabel(SSRBundle.message("SSRInspection.selected.templates"))); panel.add( ToolbarDecorator.createDecorator(myTemplatesList) .setAddAction( new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { final AnAction[] children = new AnAction[] { new AnAction( SSRBundle.message("SSRInspection.add.search.template.button")) { @Override public void actionPerformed(AnActionEvent e) { addTemplate( new SearchDialogFactory() { public SearchDialog createDialog(SearchContext searchContext) { return new SearchDialog(searchContext, false, false); } }); } }, new AnAction( SSRBundle.message("SSRInspection.add.replace.template.button")) { @Override public void actionPerformed(AnActionEvent e) { addTemplate( new SearchDialogFactory() { public SearchDialog createDialog(SearchContext searchContext) { return new ReplaceDialog(searchContext, false, false); } }); } } }; JBPopupFactory.getInstance() .createActionGroupPopup( null, new DefaultActionGroup(children), DataManager.getInstance().getDataContext(button.getContextComponent()), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true) .show(button.getPreferredPopupPoint()); } }) .setEditAction( new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { performEditAction(); } }) .setRemoveAction( new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { Object[] selected = myTemplatesList.getSelectedValues(); for (Object o : selected) { Configuration configuration = (Configuration) o; Iterator<Configuration> iterator = myConfigurations.iterator(); while (iterator.hasNext()) { Configuration configuration1 = iterator.next(); if (configuration1.getName().equals(configuration.getName())) { iterator.remove(); } } } configurationsChanged(createSearchContext()); } }) .setMoveUpAction( new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { performMoveUpDown(false); } }) .setMoveDownAction( new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { performMoveUpDown(true); } }) .createPanel()); new DoubleClickListener() { @Override protected boolean onDoubleClick(MouseEvent e) { performEditAction(); return true; } }.installOn(myTemplatesList); return panel; }
protected String getDefaultTitle() { return SSRBundle.message("structural.replace.title"); }