use of com.intellij.openapi.command.impl.UndoManagerImpl in project intellij-community by JetBrains.
the class ResourceBundleEditor method updateEditorsFromProperties.
void updateEditorsFromProperties(final boolean checkIsUnderUndoRedoAction) {
String propertyName = getSelectedPropertyName();
((CardLayout) myValuesPanel.getLayout()).show(myValuesPanel, propertyName == null ? NO_PROPERTY_SELECTED : VALUES);
if (propertyName == null)
return;
final UndoManagerImpl undoManager = (UndoManagerImpl) UndoManager.getInstance(myProject);
for (final PropertiesFile propertiesFile : myResourceBundle.getPropertiesFiles()) {
final EditorEx editor = myEditors.get(propertiesFile.getVirtualFile());
if (editor == null)
continue;
final IProperty property = propertiesFile.findPropertyByKey(propertyName);
final Document document = editor.getDocument();
CommandProcessor.getInstance().executeCommand(null, () -> ApplicationManager.getApplication().runWriteAction(() -> {
if (!checkIsUnderUndoRedoAction || !undoManager.isActive() || !(undoManager.isRedoInProgress() || undoManager.isUndoInProgress())) {
updateDocumentFromPropertyValue(getPropertyEditorValue(property), document, propertiesFile.getVirtualFile());
}
}), "", this);
JPanel titledPanel = myTitledPanels.get(propertiesFile.getVirtualFile());
((TitledBorder) titledPanel.getBorder()).setTitleColor(property == null ? JBColor.RED : UIUtil.getLabelTextForeground());
titledPanel.repaint();
}
}
Aggregations