当前位置: 首页>>代码示例>>Java>>正文


Java UndoManager.isUndoAvailable方法代码示例

本文整理汇总了Java中com.intellij.openapi.command.undo.UndoManager.isUndoAvailable方法的典型用法代码示例。如果您正苦于以下问题:Java UndoManager.isUndoAvailable方法的具体用法?Java UndoManager.isUndoAvailable怎么用?Java UndoManager.isUndoAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.command.undo.UndoManager的用法示例。


在下文中一共展示了UndoManager.isUndoAvailable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import com.intellij.openapi.command.undo.UndoManager; //导入方法依赖的package包/类
@Override
public void run() {
  FORMATTING_CANCELLED_FLAG.set(true);
  VirtualFile file = myFile.get();
  Document document = myDocument.get();
  if (file == null || document == null || myDocumentModificationStampBefore < 0) {
    return;
  }
  FileEditor editor = FileEditorManager.getInstance(myProject).getSelectedEditor(file);
  if (editor == null) {
    return;
  }

  UndoManager manager = UndoManager.getInstance(myProject);
  while (manager.isUndoAvailable(editor) && document.getModificationStamp() != myDocumentModificationStampBefore) {
    manager.undo(editor);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:FormattingProgressTask.java

示例2: finishCommand

import com.intellij.openapi.command.undo.UndoManager; //导入方法依赖的package包/类
@Override
public void finishCommand(final Project project, final Object command, final Throwable throwable) {
  if (myCurrentCommand != command) return;
  final boolean failed;
  try {
    if (throwable instanceof AbnormalCommandTerminationException) {
      final AbnormalCommandTerminationException rollback = (AbnormalCommandTerminationException)throwable;
      if (ApplicationManager.getApplication().isUnitTestMode()) {
        throw new RuntimeException(rollback);
      }
      failed = true;
    }
    else if (throwable != null) {
      failed = true;
      if (throwable instanceof Error) {
        throw (Error)throwable;
      }
      else if (throwable instanceof RuntimeException) throw (RuntimeException)throwable;
      CommandLog.LOG.error(throwable);
    }
    else {
      failed = false;
    }
  }
  finally {
    super.finishCommand(project, command, throwable);
  }
  if (failed) {
    if (project != null) {
      FileEditor editor = new FocusBasedCurrentEditorProvider().getCurrentEditor();
      final UndoManager undoManager = UndoManager.getInstance(project);
      if (undoManager.isUndoAvailable(editor)) {
        undoManager.undo(editor);
      }
    }
    Messages.showErrorDialog(project, "Cannot perform operation. Too complex, sorry.", "Failed to Perform Operation");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:CommandProcessorImpl.java

示例3: finishCommand

import com.intellij.openapi.command.undo.UndoManager; //导入方法依赖的package包/类
@Override
public void finishCommand(final Project project, final Object command, final Throwable throwable) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  CommandLog.LOG.assertTrue(myCurrentCommand != null, "no current command in progress");
  if (myCurrentCommand != command) return;
  final boolean failed;
  try {
    if (throwable instanceof AbnormalCommandTerminationException) {
      final AbnormalCommandTerminationException rollback = (AbnormalCommandTerminationException)throwable;
      if (ApplicationManager.getApplication().isUnitTestMode()) {
        throw new RuntimeException(rollback);
      }
      failed = true;
    }
    else if (throwable != null) {
      failed = true;
      if (throwable instanceof Error) {
        throw (Error)throwable;
      }
      else if (throwable instanceof RuntimeException) throw (RuntimeException)throwable;
      CommandLog.LOG.error(throwable);
    }
    else {
      failed = false;
    }
  }
  finally {
    fireCommandFinished();
  }
  if (failed) {
    if (project != null) {
      FileEditor editor = new FocusBasedCurrentEditorProvider().getCurrentEditor();
      final UndoManager undoManager = UndoManager.getInstance(project);
      if (undoManager.isUndoAvailable(editor)) {
        undoManager.undo(editor);
      }
    }
    Messages.showErrorDialog(project, "Cannot perform operation. Too complex, sorry.", "Failed to Perform Operation");
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:41,代码来源:CommandProcessorImpl.java

示例4: isAvailable

import com.intellij.openapi.command.undo.UndoManager; //导入方法依赖的package包/类
@Override
protected boolean isAvailable(FileEditor editor, UndoManager undoManager) {
  return undoManager.isUndoAvailable(editor);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:UndoAction.java

示例5: finishCommand

import com.intellij.openapi.command.undo.UndoManager; //导入方法依赖的package包/类
@Override
public void finishCommand(final Project project, final Object command, final Throwable throwable) {
  if (myCurrentCommand != command) return;
  final boolean failed;
  try {
    if (throwable instanceof AbnormalCommandTerminationException) {
      final AbnormalCommandTerminationException rollback = (AbnormalCommandTerminationException)throwable;
      if (ApplicationManager.getApplication().isUnitTestMode()) {
        throw new RuntimeException(rollback);
      }
      failed = true;
    }
    else if (throwable != null) {
      failed = true;
      ExceptionUtil.rethrowUnchecked(throwable);
      CommandLog.LOG.error(throwable);
    }
    else {
      failed = false;
    }
  }
  finally {
    try {
      super.finishCommand(project, command, throwable);
    }
    catch (Throwable e) {
      if (throwable != null) {
        e.addSuppressed(throwable);
      }
      throw e;
    }
  }
  if (failed) {
    if (project != null) {
      FileEditor editor = new FocusBasedCurrentEditorProvider().getCurrentEditor();
      final UndoManager undoManager = UndoManager.getInstance(project);
      if (undoManager.isUndoAvailable(editor)) {
        undoManager.undo(editor);
      }
    }
    Messages.showErrorDialog(project, "Cannot perform operation. Too complex, sorry.", "Failed to Perform Operation");
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:44,代码来源:CommandProcessorImpl.java


注:本文中的com.intellij.openapi.command.undo.UndoManager.isUndoAvailable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。