use of com.intellij.ui.TextAccessor in project intellij-community by JetBrains.
the class ProjectSpecificSettingsStep method configureMappingField.
/**
* Enables or disables "remote path" based on interpreter.
*/
private void configureMappingField(@NotNull final PythonRemoteInterpreterManager remoteInterpreterManager) {
if (myRemotePathField == null) {
return;
}
final JPanel mainPanel = myRemotePathField.getMainPanel();
final PyProjectSynchronizer synchronizer = getSynchronizer(remoteInterpreterManager);
if (synchronizer != null) {
final String defaultRemotePath = synchronizer.getDefaultRemotePath();
final boolean mappingRequired = defaultRemotePath != null;
mainPanel.setVisible(mappingRequired);
final TextAccessor textField = myRemotePathField.getTextField();
if (mappingRequired && StringUtil.isEmpty(textField.getText())) {
textField.setText(defaultRemotePath);
}
myRemotePathRequired = mappingRequired;
} else {
mainPanel.setVisible(false);
myRemotePathRequired = false;
}
}
use of com.intellij.ui.TextAccessor in project android by JetBrains.
the class FileChooserActionListener method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
if (myFilePathProperty == null) {
return;
}
final FileChooserDescriptor descriptor = MockupFileHelper.getFileChooserDescriptor();
VirtualFile selectedFile = myFilePathProperty.getValue() != null ? VfsUtil.findFileByIoFile(new File(FileUtil.toSystemIndependentName(myFilePathProperty.getValue())), false) : ourLastOpenedFile;
FileChooser.chooseFile(descriptor, null, null, selectedFile, (virtualFile) -> {
ourLastOpenedFile = virtualFile;
if (myComponent != null && myComponent.isRoot()) {
openDeviceChoiceDialog(virtualFile, myFilePathProperty, myCropProperty);
} else {
saveMockupFile(virtualFile, myFilePathProperty, myCropProperty);
if (e == null) {
return;
}
final TextAccessor textAccessor = e.getSource() instanceof TextAccessor ? ((TextAccessor) e.getSource()) : null;
if (textAccessor != null) {
textAccessor.setText(virtualFile.getPath());
}
}
});
}
Aggregations