com.intellij.ui.TextAccessor Java Examples

The following examples show how to use com.intellij.ui.TextAccessor. 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: GuiUtil.java    From intellij-haskforce with Apache License 2.0 5 votes vote down vote up
public static ActionListener createApplyPathAction(final TextAccessor textField, final String executable) {
    return new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String guessedPath = ExecUtil.locateExecutableByGuessing(executable);
            if (guessedPath != null) {
                textField.setText(guessedPath);
            } else {
                Messages.showErrorDialog("Could not find '" + executable + "'.", "HaskForce");
            }
        }
    };
}
 
Example #2
Source File: GuiUtil.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
public static void addApplyPathAction(final AbstractButton button, final TextAccessor textField, final String executable) {
    button.addActionListener(createApplyPathAction(textField, executable));
}
 
Example #3
Source File: HaskellToolsConfigurable.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
PropertyField(@NotNull String propertyKey, @NotNull TextAccessor field) {
    this(propertyKey, field, "");
}
 
Example #4
Source File: HaskellToolsConfigurable.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
PropertyField(@NotNull String propertyKey, @NotNull TextAccessor field, @NotNull String defaultValue) {
    this.propertyKey = propertyKey;
    this.field = field;
    this.oldValue = propertiesComponent.getValue(propertyKey, defaultValue);
    field.setText(oldValue);
}
 
Example #5
Source File: HaskellToolsConfigurable.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
public void validateExecutable(String name, TextAccessor field) throws ConfigurationException {
    if (new File(field.getText()).canExecute()) return;
    throw new ConfigurationException("Not a valid '" + name + "' executable: '" + field.getText() + "'");
}
 
Example #6
Source File: HaskellToolsConfigurable.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
public void validateExecutableIfNonEmpty(String name, TextAccessor field) throws ConfigurationException {
    if (field.getText().isEmpty()) return;
    validateExecutable(name, field);
}
 
Example #7
Source File: HaskellCompilerConfigurable.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
private void validateExecutable(String name, TextAccessor field) throws ConfigurationException {
    if (new File(field.getText()).canExecute() || new File(myProject.getBasePath(), field.getText()).exists()) return;
    throw new ConfigurationException("Not a valid '" + name + "' executable: '" + field.getText() + "'");
}
 
Example #8
Source File: HaskellCompilerConfigurable.java    From intellij-haskforce with Apache License 2.0 4 votes vote down vote up
private void validateFileExists(String name, TextAccessor field) throws ConfigurationException {
    if (new File(field.getText()).exists() || new File(myProject.getBasePath(), field.getText()).exists()) return;
    throw new ConfigurationException("'" + name + "' file does not exist: '" + field.getText() + "'");
}
 
Example #9
Source File: CommonProgramParametersPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
public TextAccessor getWorkingDirectoryAccessor() {
  return myWorkingDirectoryComboBox;
}
 
Example #10
Source File: CommonProgramParametersPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
protected String fromTextField(@Nonnull TextAccessor textAccessor, @Nonnull CommonProgramRunConfigurationParameters configuration) {
  return textAccessor.getText();
}
 
Example #11
Source File: BrowseModuleValueActionListener.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void actionPerformed(final ActionEvent e) {
  final String text = showDialog();
  if (text != null) ((TextAccessor)myField).setText(text);
}
 
Example #12
Source File: BrowseModuleValueActionListener.java    From consulo with Apache License 2.0 4 votes vote down vote up
public String getText() {
  return ((TextAccessor)myField).getText();
}