Java 类com.intellij.ui.TextAccessor 实例源码

项目:intellij-ce-playground    文件:TaskCompletionProvider.java   
public TaskCompletionProvider(@NotNull Project project,
                              @NotNull ProjectSystemId externalSystemId,
                              @NotNull TextAccessor workDirectoryField,
                              @NotNull Options options) {
  super(options);
  myProject = project;
  mySystemId = externalSystemId;
  myProjectPathAccessor = workDirectoryField;
}
项目:intellij-ce-playground    文件:ScopedDataBinder.java   
/**
 * Retrieve a value from the given JComponent
 */
@Nullable
protected Object getComponentValue(@NotNull JComponent component) {
  Object newValue = null;
  if (component instanceof JCheckBox) {
    newValue = ((JCheckBox)component).isSelected();
  }
  else if (component instanceof JComboBox) {
    Object selectedObject = ((JComboBox)component).getSelectedItem();
    if (selectedObject instanceof ComboBoxItem) {
      ComboBoxItem selectedItem = (ComboBoxItem)selectedObject;
      newValue = selectedItem.id;
    } else {
      newValue = selectedObject;
    }
  } else if (component instanceof JSlider) {
    newValue = ((JSlider)component).getValue();
  } else if (component instanceof JSpinner) {
    newValue = ((JSpinner)component).getValue();
  } else if (component instanceof ColorPanel) {
    newValue = ((ColorPanel)component).getSelectedColor();
  } else {
    TextAccessor accessor = TextAccessors.getTextAccessor(component);
    if (accessor != null) {
      newValue = accessor.getText();
    }
  }
  return newValue;
}
项目:intellij-ce-playground    文件:ScopedDataBinder.java   
protected void register(@NotNull Key<String> key, @NotNull final TextAccessor field) {
  assert field instanceof JComponent;

  JComponent component = (JComponent)field;
  String value = bindAndGet(key, component, null);
  if (value != null) {
    field.setText(value);
  } else {
    myState.put(key, field.getText());
  }
  component.addFocusListener(this);
}
项目:intellij-ce-playground    文件:TextAccessors.java   
@Nullable
public static TextAccessor getTextAccessor(@NotNull final JComponent component) {
  if (component instanceof TextAccessor) {
    return (TextAccessor)component;
  }
  else if (component instanceof JTextComponent) {
    return new JTextComponentTextAccessor(component);
  }
  else if (component instanceof JLabel) {
    return new JLabelTextAccessor(component);
  }
  else {
    return null;
  }
}
项目:intellij-haskforce    文件:GuiUtil.java   
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");
            }
        }
    };
}
项目:camel-idea-plugin    文件:CamelChosenIconCellRender.java   
CamelChosenIconCellRender(TextAccessor textAccessor) {
    this.textAccessor = textAccessor;
}
项目:intellij-ce-playground    文件:TaskCompletionProvider.java   
public TaskCompletionProvider(@NotNull Project project,
                              @NotNull ProjectSystemId externalSystemId,
                              @NotNull TextAccessor workDirectoryField) {
  this(project, externalSystemId, workDirectoryField, new Options());
}
项目:intellij-ce-playground    文件:CommonProgramParametersPanel.java   
@Nullable
protected String fromTextField(@NotNull TextAccessor textAccessor, @NotNull CommonProgramRunConfigurationParameters configuration) {
  return textAccessor.getText();
}
项目:intellij-ce-playground    文件:BrowseModuleValueActionListener.java   
@Override
public void actionPerformed(final ActionEvent e) {
  final String text = showDialog();
  if (text != null) ((TextAccessor)myField).setText(text);
}
项目:intellij-ce-playground    文件:BrowseModuleValueActionListener.java   
public String getText() {
  return ((TextAccessor)myField).getText();
}
项目:intellij-ce-playground    文件:GradleArgumentsCompletionProvider.java   
public GradleArgumentsCompletionProvider(@NotNull Project project, @NotNull TextAccessor workDirectoryField) {
  super(project, GradleConstants.SYSTEM_ID, workDirectoryField, GradleCommandLineOptionsProvider.getSupportedOptions());
}
项目:intellij-haskforce    文件:GuiUtil.java   
public static void addApplyPathAction(final AbstractButton button, final TextAccessor textField, final String executable) {
    button.addActionListener(createApplyPathAction(textField, executable));
}
项目:intellij-haskforce    文件:HaskellToolsConfigurable.java   
PropertyField(@NotNull String propertyKey, @NotNull TextAccessor field) {
    this(propertyKey, field, "");
}
项目:intellij-haskforce    文件:HaskellToolsConfigurable.java   
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);
}
项目:intellij-haskforce    文件:HaskellToolsConfigurable.java   
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() + "'");
}
项目:intellij-haskforce    文件:HaskellToolsConfigurable.java   
public void validateExecutableIfNonEmpty(String name, TextAccessor field) throws ConfigurationException {
    if (field.getText().isEmpty()) return;
    validateExecutable(name, field);
}
项目:intellij-haskforce    文件:HaskellCompilerConfigurable.java   
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() + "'");
}
项目:intellij-haskforce    文件:HaskellCompilerConfigurable.java   
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() + "'");
}
项目:tools-idea    文件:BrowseModuleValueActionListener.java   
@Override
public void actionPerformed(final ActionEvent e) {
  final String text = showDialog();
  if (text != null) ((TextAccessor)myField).setText(text);
}
项目:tools-idea    文件:BrowseModuleValueActionListener.java   
public String getText() {
  return ((TextAccessor)myField).getText();
}
项目:consulo    文件:CommonProgramParametersPanel.java   
public TextAccessor getWorkingDirectoryAccessor() {
  return myWorkingDirectoryComboBox;
}
项目:consulo    文件:CommonProgramParametersPanel.java   
@Nullable
protected String fromTextField(@Nonnull TextAccessor textAccessor, @Nonnull CommonProgramRunConfigurationParameters configuration) {
  return textAccessor.getText();
}
项目:consulo    文件:BrowseModuleValueActionListener.java   
@Override
public void actionPerformed(final ActionEvent e) {
  final String text = showDialog();
  if (text != null) ((TextAccessor)myField).setText(text);
}
项目:consulo    文件:BrowseModuleValueActionListener.java   
public String getText() {
  return ((TextAccessor)myField).getText();
}