List of usage examples for com.intellij.openapi.ui Messages showInputDialog
@Nullable public static String showInputDialog(String message, @Nls(capitalization = Nls.Capitalization.Title) String title, @Nullable Icon icon, @Nullable String initialValue, @Nullable InputValidator validator)
From source file:com.maddyhome.idea.copyright.ui.CopyrightProfilesPanel.java
License:Apache License
@Nullable private String askForProfileName(String title, String initialName) { return Messages.showInputDialog("New copyright profile name:", title, Messages.getQuestionIcon(), initialName, new InputValidator() { public boolean checkInput(String s) { return !getAllProfiles().containsKey(s) && s.length() > 0; }/* w ww.ja va 2s. c om*/ public boolean canClose(String s) { return checkInput(s); } }); }
From source file:net.andydvorak.intellij.lessc.ui.configurable.LessProfilesPanel.java
License:Apache License
@Nullable private String askForProfileName(String title, String initialName) { final String message = UIBundle.message("action.new.less.profile.prompt.message"); return Messages.showInputDialog(message, title, Messages.getQuestionIcon(), initialName, new InputValidator() { public boolean checkInput(String s) { return !getAllProfiles().containsKey(s) && s.length() > 0; }/*from w w w.j a v a2 s . co m*/ public boolean canClose(String s) { return checkInput(s); } }); }
From source file:net.sf.logsupport.ui.util.Dialogs.java
License:Apache License
public static String askForInput(String title, String initialInput, final Collection<String> excludes) { return Messages.showInputDialog(title, title, Messages.getQuestionIcon(), initialInput, new InputValidator() { public boolean checkInput(String s) { return s.length() > 0 && (excludes == null || !excludes.contains(s)); }/*from w w w .ja v a 2 s . co m*/ public boolean canClose(String s) { return checkInput(s); } }); }
From source file:org.apache.camel.idea.preference.CamelExcludePropertyFileTable.java
License:Apache License
@Override public boolean editCellAt(int row, int column, EventObject e) { if (e == null || (e instanceof MouseEvent && ((MouseEvent) e).getClickCount() == 1)) { return false; }//from w w w .j av a 2 s . c o m final Object at = getModel().getValueAt(row, column); if (!(at instanceof String)) { return false; } String pattern = Messages.showInputDialog("", "Edit filename pattern", null, (String) at, null); if (pattern != null && !pattern.isEmpty()) { getModel().setValueAt(pattern, row, column); return true; } return false; }
From source file:org.apache.camel.idea.preference.CamelIgnorePropertyTable.java
License:Apache License
@Override public boolean editCellAt(int row, int column, EventObject e) { if (e == null || (e instanceof MouseEvent && ((MouseEvent) e).getClickCount() == 1)) { return false; }/*from ww w.j a v a 2s . com*/ final Object at = getModel().getValueAt(row, column); if (!(at instanceof String)) { return false; } String pattern = Messages.showInputDialog("", "Edit property", null, (String) at, null); if (pattern != null && !pattern.isEmpty()) { getModel().setValueAt(pattern, row, column); return true; } return false; }
From source file:org.jetbrains.idea.maven.indices.MavenRepositoriesConfigurable.java
License:Apache License
private void configControls() { myServiceList.setModel(myModel);// ww w . ja v a2 s. co m myServiceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myAddButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final String value = (String) myServiceList.getSelectedValue(); final String text = Messages.showInputDialog("Artifactory or Nexus Service URL", "Add Service URL", Messages.getQuestionIcon(), value == null ? "http://" : value, new URLInputVaslidator()); if (StringUtil.isNotEmpty(text)) { myModel.add(text); myServiceList.setSelectedValue(text, true); } } }); myEditButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final int index = myServiceList.getSelectedIndex(); final String text = Messages.showInputDialog("Artifactory or Nexus Service URL", "Edit Service URL", Messages.getQuestionIcon(), myModel.getElementAt(index), new URLInputVaslidator()); if (StringUtil.isNotEmpty(text)) { myModel.setElementAt(text, index); } } }); ListUtil.addRemoveListener(myRemoveButton, myServiceList); ListUtil.disableWhenNoSelection(myTestButton, myServiceList); ListUtil.disableWhenNoSelection(myEditButton, myServiceList); myTestButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final String value = (String) myServiceList.getSelectedValue(); if (value != null) { testServiceConnection(value); } } }); myUpdateButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doUpdateIndex(); } }); myIndicesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { updateButtonsState(); } }); myIndicesTable.addMouseMotionListener(new MouseMotionListener() { public void mouseDragged(MouseEvent e) { } public void mouseMoved(MouseEvent e) { int row = myIndicesTable.rowAtPoint(e.getPoint()); if (row == -1) return; updateIndexHint(row); } }); myIndicesTable.setDefaultRenderer(Object.class, new MyCellRenderer()); myIndicesTable.setDefaultRenderer(MavenIndicesManager.IndexUpdatingState.class, new MyIconCellRenderer()); myServiceList.getEmptyText().setText("No services"); myIndicesTable.getEmptyText().setText("No remote repositories"); updateButtonsState(); }
From source file:org.jetbrains.plugins.ruby.rails.actions.generators.actions.special.GenerateControllerPanel.java
License:Apache License
public GenerateControllerPanel(@NotNull final String controllersRootPath, @Nullable final String path) { myControllerDir.setText(path == null ? "" : path); myRootPath = controllersRootPath;//from w w w . j a v a 2 s.c om myListModel = new DefaultListModel(); myActionsList.setModel(myListModel); myActionsList.setCellRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { final Component comp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); setIcon(RubyIcons.RUBY_METHOD_NODE); return comp; } }); final MyActionInputValidator validator = new MyActionInputValidator(); myAddButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final String text = Messages.showInputDialog( RBundle.message("dialog.generate.controller.actions.promt"), RBundle.message("dialog.generate.controller.actions.promt.title"), Messages.getQuestionIcon(), TextUtil.EMPTY_STRING, validator); if (!TextUtil.isEmpty(text)) { myListModel.addElement(NamingConventions.toUnderscoreCase(text)); if (myListModel.size() == 1) { myActionsList.setSelectedIndex(0); } } myActionsList.requestFocus(); } }); myRemoveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final Object[] selection = myActionsList.getSelectedValues(); int selectedIndex = -2; for (Object obj : selection) { if (selectedIndex == -2) { selectedIndex = myListModel.indexOf(obj); } myListModel.removeElement(obj); } if (myListModel.size() > 0) { if (selectedIndex < myListModel.size()) { myActionsList.setSelectedIndex(selectedIndex); } else { myActionsList.setSelectedIndex(myListModel.size() - 1); } } myActionsList.requestFocus(); } }); myControllerName.getDocument().addDocumentListener(new DocumentAdapter() { @Override public void textChanged(DocumentEvent event) { updateLocation(); } }); myControllerDir.getDocument().addDocumentListener(new DocumentAdapter() { @Override public void textChanged(DocumentEvent event) { updateLocation(); } }); myControllerName.setText(DOTS); myControllerName.setText(TextUtil.EMPTY_STRING); myContentPanel.doLayout(); }
From source file:ru.scratch.AddScratchAction.java
License:Apache License
private String showInputDialog() { String fileName = Messages.showInputDialog("File name:", "Create New Scratch", Messages.getQuestionIcon(), getDefaultName(), new NonEmptyInputValidator()); return fileName; }