use of org.jetbrains.android.uipreview.InvalidOptionValueException in project android by JetBrains.
the class CreateResourceFileDialogBase method setupDeviceConfigurationPanel.
protected DeviceConfiguratorPanel setupDeviceConfigurationPanel(final JTextField directoryNameTextField, final TemplateKindCombo resourceTypeCombo, final JBLabel errorLabel) {
return new DeviceConfiguratorPanel() {
@Override
public void applyEditors() {
try {
doApplyEditors();
final FolderConfiguration config = this.getConfiguration();
final CreateTypedResourceFileAction selectedAction = getSelectedAction(resourceTypeCombo);
errorLabel.setText("");
directoryNameTextField.setText("");
if (selectedAction != null) {
final ResourceFolderType resFolderType = selectedAction.getResourceFolderType();
directoryNameTextField.setText(config.getFolderName(resFolderType));
}
} catch (InvalidOptionValueException e) {
errorLabel.setText(new HtmlBuilder().openHtmlBody().coloredText(JBColor.RED, e.getMessage()).closeHtmlBody().getHtml());
directoryNameTextField.setText("");
}
updateOkAction();
}
};
}
use of org.jetbrains.android.uipreview.InvalidOptionValueException in project android by JetBrains.
the class CreateResourceDirectoryDialogBase method setupDeviceConfigurationPanel.
protected DeviceConfiguratorPanel setupDeviceConfigurationPanel(final JComboBox resourceTypeComboBox, final JTextField directoryNameTextField, final JBLabel errorLabel) {
return new DeviceConfiguratorPanel() {
@Override
public void applyEditors() {
try {
doApplyEditors();
final FolderConfiguration config = this.getConfiguration();
final ResourceFolderType selectedResourceType = (ResourceFolderType) resourceTypeComboBox.getSelectedItem();
directoryNameTextField.setText(selectedResourceType != null ? config.getFolderName(selectedResourceType) : "");
errorLabel.setText("");
} catch (InvalidOptionValueException e) {
errorLabel.setText(new HtmlBuilder().openHtmlBody().coloredText(JBColor.RED, e.getMessage()).closeHtmlBody().getHtml());
directoryNameTextField.setText("");
}
setOKActionEnabled(directoryNameTextField.getText().length() > 0);
}
};
}
Aggregations