use of com.intellij.openapi.command.undo.DocumentReference in project intellij-community by JetBrains.
the class DiffUtil method putNonundoableOperation.
public static void putNonundoableOperation(@Nullable Project project, @NotNull Document document) {
UndoManager undoManager = project != null ? UndoManager.getInstance(project) : UndoManager.getGlobalInstance();
if (undoManager != null) {
DocumentReference ref = DocumentReferenceManager.getInstance().create(document);
undoManager.nonundoableActionPerformed(ref, false);
}
}
use of com.intellij.openapi.command.undo.DocumentReference in project android by JetBrains.
the class AndroidResourceRenameResourceProcessor method renameElement.
@Override
public void renameElement(PsiElement element, final String newName, UsageInfo[] usages, @Nullable RefactoringElementListener listener) throws IncorrectOperationException {
if (element instanceof PsiField) {
new RenameJavaVariableProcessor().renameElement(element, newName, usages, listener);
} else {
if (element instanceof PsiNamedElement) {
super.renameElement(element, newName, usages, listener);
if (element instanceof PsiFile) {
VirtualFile virtualFile = ((PsiFile) element).getVirtualFile();
if (virtualFile != null && !LocalHistory.getInstance().isUnderControl(virtualFile)) {
DocumentReference ref = DocumentReferenceManager.getInstance().create(virtualFile);
UndoManager.getInstance(element.getProject()).nonundoableActionPerformed(ref, false);
}
}
} else if (element instanceof XmlAttributeValue) {
new RenameXmlAttributeProcessor().renameElement(element, newName, usages, listener);
}
}
}
use of com.intellij.openapi.command.undo.DocumentReference in project intellij-community by JetBrains.
the class CommandMerger method flushCurrentCommand.
void flushCurrentCommand() {
if (hasActions()) {
if (!myAdditionalAffectedDocuments.isEmpty()) {
DocumentReference[] refs = myAdditionalAffectedDocuments.toArray(new DocumentReference[myAdditionalAffectedDocuments.size()]);
myCurrentActions.add(new BasicUndoableAction(refs) {
@Override
public void undo() {
}
@Override
public void redo() {
}
});
}
myManager.getUndoStacksHolder().addToStacks(new UndoableGroup(myCommandName, isGlobal(), myManager, myStateBefore, myStateAfter, myCurrentActions, myUndoConfirmationPolicy, isTransparent(), myValid));
}
reset();
}
use of com.intellij.openapi.command.undo.DocumentReference in project intellij-community by JetBrains.
the class CommandMerger method affectsMultiplePhysicalDocs.
private boolean affectsMultiplePhysicalDocs() {
Set<VirtualFile> affectedFiles = new HashSet<>();
for (DocumentReference each : myAllAffectedDocuments) {
VirtualFile file = each.getFile();
if (isVirtualDocumentChange(file))
continue;
affectedFiles.add(file);
if (affectedFiles.size() > 1)
return true;
}
return false;
}
use of com.intellij.openapi.command.undo.DocumentReference in project intellij-community by JetBrains.
the class DocumentReferenceManagerImpl method createFromDocument.
@NotNull
private DocumentReference createFromDocument(@NotNull final Document document) {
DocumentReference result = myDocToRef.get(document);
if (result == null) {
result = new DocumentReferenceByDocument(document);
myDocToRef.put(document, result);
}
return result;
}
Aggregations