• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DocumentReferenceManager类的典型用法和代码示例

java 1次浏览

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

DocumentReferenceManager类属于com.intellij.openapi.command.undo包,在下文中一共展示了DocumentReferenceManager类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createWorkingDocument

点赞 3

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
@Override
public Document createWorkingDocument(final Project project) {
  //TODO[ik]: do we really need to create copy here?
  final Document workingDocument = myDocument; //DocumentUtil.createCopy(myDocument, project);
  //LOG.assertTrue(workingDocument != myDocument);
  workingDocument.setReadOnly(false);
  final DocumentReference ref = DocumentReferenceManager.getInstance().create(workingDocument);
  myTextBeforeMerge = myDocument.getText();
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      setDocumentText(workingDocument, myOriginalText, DiffBundle.message("merge.init.merge.content.command.name"), project);
      if (project != null) {
        final UndoManager undoManager = UndoManager.getInstance(project);
        if (undoManager != null) { //idea.sh merge command
          undoManager.nonundoableActionPerformed(ref, false);
        }
      }
    }
  });
  return workingDocument;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:23,
代码来源:MergeVersion.java

示例2: runExecuteAction

点赞 3

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
public void runExecuteAction(@NotNull LanguageConsoleView consoleView) {
  if (!myUseProcessStdIn) {
    beforeExecution(consoleView);
  }

  String text = ((LanguageConsoleImpl)consoleView).prepareExecuteAction(myAddToHistory && !myUseProcessStdIn,
                                                                                   myPreserveMarkup, true);
  ((UndoManagerImpl)UndoManager.getInstance(consoleView.getProject())).invalidateActionsFor(DocumentReferenceManager.getInstance().create(
    consoleView.getCurrentEditor().getDocument()));

  if (myUseProcessStdIn) {
    consoleView.print(text, ConsoleViewContentType.USER_INPUT);
    consoleView.print("\n", ConsoleViewContentType.USER_INPUT);
  }
  else {
    addToCommandHistoryAndExecute(consoleView, text);
  }
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:19,
代码来源:ConsoleExecuteAction.java

示例3: renameElement

点赞 3

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
@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);
    }
  }
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:24,
代码来源:AndroidResourceRenameResourceProcessor.java

示例4: markUnshelvedFilesNonUndoable

点赞 3

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
@CalledInAwt
private static void markUnshelvedFilesNonUndoable(@NotNull final Project project,
                                                  @NotNull List<ShelvedChange> changes) {
  final UndoManagerImpl undoManager = (UndoManagerImpl)UndoManager.getInstance(project);
  if (undoManager != null && !changes.isEmpty()) {
    ContainerUtil.process(changes, new Processor<ShelvedChange>() {
      @Override
      public boolean process(ShelvedChange change) {
        final VirtualFile vfUnderProject = VfsUtil.findFileByIoFile(new File(project.getBasePath(), change.getAfterPath()), false);
        if (vfUnderProject != null) {
          final DocumentReference documentReference = DocumentReferenceManager.getInstance().create(vfUnderProject);
          undoManager.nonundoableActionPerformed(documentReference, false);
          undoManager.invalidateActionsFor(documentReference);
        }
        return true;
      }
    });
  }
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:20,
代码来源:GitShelveUtils.java

示例5: doMoveRename

点赞 3

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
private boolean doMoveRename(final VirtualFile file, final VirtualFile newParent, final String newName) throws IOException {
  if (!CvsUtil.fileIsUnderCvs(file)) return false;
  if (newParent == null) return false;
  final File newFile = new File(newParent.getPath(), newName);
  myComponent.getDeleteHandler().addDeletedRoot(file);
  if (!file.isDirectory()) {
    myComponent.getAddHandler().addFile(newFile);
    return false;
  }
  newFile.mkdir();
  copyDirectoryStructure(file, newFile);
  myComponent.getAddHandler().addFile(newFile);
  final DocumentReference ref = DocumentReferenceManager.getInstance().create(file);
  UndoManager.getInstance(myProject).nonundoableActionPerformed(ref, false);
  return true;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:17,
代码来源:CvsFileOperationsHandler.java

示例6: createWorkingDocument

点赞 3

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
public Document createWorkingDocument(final Project project) {
  //TODO[ik]: do we really need to create copy here?
  final Document workingDocument = myDocument; //DocumentUtil.createCopy(myDocument, project);
  //LOG.assertTrue(workingDocument != myDocument);
  workingDocument.setReadOnly(false);
  final DocumentReference ref = DocumentReferenceManager.getInstance().create(workingDocument);
  myTextBeforeMerge = myDocument.getText();
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    public void run() {
      setDocumentText(workingDocument, myOriginalText, DiffBundle.message("merge.init.merge.content.command.name"), project);
      if (project != null) {
        final UndoManager undoManager = UndoManager.getInstance(project);
        if (undoManager != null) { //idea.sh merge command
          undoManager.nonundoableActionPerformed(ref, false);
        }
      }
    }
  });
  return workingDocument;
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:21,
代码来源:MergeVersion.java

示例7: runExecuteAction

点赞 3

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
public void runExecuteAction(LanguageConsoleImpl languageConsole) {

    // Process input and add to history
    final Document document = languageConsole.getCurrentEditor().getDocument();
    final String text = document.getText();
    final TextRange range = new TextRange(0, document.getTextLength());

    languageConsole.getCurrentEditor().getSelectionModel().setSelection(range.getStartOffset(), range.getEndOffset());
    if (myAddCurrentToHistory) {
      languageConsole.addCurrentToHistory(range, false, myPreserveMarkup);
    }

    languageConsole.setInputText("");

    final UndoManager manager = languageConsole.getProject() == null ? UndoManager.getGlobalInstance() : UndoManager.getInstance(
      languageConsole.getProject());

    ((UndoManagerImpl)manager).invalidateActionsFor(DocumentReferenceManager.getInstance().create(document));

    myConsoleHistoryModel.addToHistory(text);
    // Send to interpreter / server

    processLine(text);
  }
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:25,
代码来源:ConsoleExecuteActionHandler.java

示例8: runExecuteAction

点赞 3

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
public void runExecuteAction(@Nonnull LanguageConsoleView consoleView) {
  if (!myUseProcessStdIn) {
    beforeExecution(consoleView);
  }

  String text = ((LanguageConsoleImpl)consoleView).prepareExecuteAction(myAddToHistory && !myUseProcessStdIn,
                                                                        myPreserveMarkup, true);
  ((UndoManagerImpl)UndoManager.getInstance(consoleView.getProject())).invalidateActionsFor(DocumentReferenceManager.getInstance().create(
          consoleView.getCurrentEditor().getDocument()));

  if (myUseProcessStdIn) {
    consoleView.print(text, ConsoleViewContentType.USER_INPUT);
    consoleView.print("\n", ConsoleViewContentType.USER_INPUT);
  }
  else {
    addToCommandHistoryAndExecute(consoleView, text);
  }
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:19,
代码来源:ConsoleExecuteAction.java

示例9: finish

点赞 2

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
public static void finish(final Project project, final Editor editor, @Nullable final StartMarkAction startAction) {
  if (startAction == null) return;
  CommandProcessor.getInstance().executeCommand(project, new Runnable() {
    public void run() {
      DocumentReference reference = DocumentReferenceManager.getInstance().create(editor.getDocument());
      UndoManager.getInstance(project).undoableActionPerformed(new FinishMarkAction(reference, startAction));
      StartMarkAction.markFinished(project);
    }
  }, "finish", null);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:11,
代码来源:FinishMarkAction.java

示例10: putNonundoableOperation

点赞 2

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
public static void putNonundoableOperation(@Nullable Project project, @Nonnull Document document) {
  UndoManager undoManager = project != null ? UndoManager.getInstance(project) : UndoManager.getGlobalInstance();
  if (undoManager != null) {
    DocumentReference ref = DocumentReferenceManager.getInstance().create(document);
    undoManager.nonundoableActionPerformed(ref, false);
  }
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:8,
代码来源:DiffUtil.java

示例11: isUndoable

点赞 2

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
private boolean isUndoable(Document document) {
  DocumentReference ref = DocumentReferenceManager.getInstance().create(document);
  VirtualFile file = ref.getFile();

  // Allow undo even from refresh if requested
  if (file != null && file.getUserData(UndoConstants.FORCE_RECORD_UNDO) == Boolean.TRUE) {
    return true;
  }
  return !UndoManagerImpl.isRefresh() || getUndoManager().isUndoOrRedoAvailable(ref);
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:11,
代码来源:DocumentUndoProvider.java

示例12: switchStep

点赞 2

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
/***
 * @param toSubtaskIndex from 0 to subtaskNum - 1
 */
public static void switchStep(@NotNull Project project, @NotNull TaskWithSubtasks task, int toSubtaskIndex, boolean navigateToTask) {
  if (toSubtaskIndex == task.getActiveSubtaskIndex()) {
    return;
  }
  VirtualFile taskDir = task.getTaskDir(project);
  if (taskDir == null) {
    return;
  }
  VirtualFile srcDir = taskDir.findChild(EduNames.SRC);
  if (srcDir != null) {
    taskDir = srcDir;
  }
  int fromSubtaskIndex = task.getActiveSubtaskIndex();
  for (Map.Entry<String, TaskFile> entry : task.getTaskFiles().entrySet()) {
    String name = entry.getKey();
    VirtualFile virtualFile = taskDir.findFileByRelativePath(name);
    if (virtualFile == null) {
      continue;
    }
    TaskFile taskFile = entry.getValue();
    Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
    if (document == null) {
      continue;
    }
    EduDocumentListener listener = null;
    if (!FileEditorManager.getInstance(project).isFileOpen(virtualFile)) {
      listener = new EduDocumentListener(taskFile, true);
      document.addDocumentListener(listener);
    }
    updatePlaceholderTexts(document, taskFile, fromSubtaskIndex, toSubtaskIndex);
    if (listener != null) {
      document.removeDocumentListener(listener);
    }
    UndoManager.getInstance(project).nonundoableActionPerformed(DocumentReferenceManager.getInstance().create(document), false);
    EditorNotifications.getInstance(project).updateNotifications(virtualFile);
    if (StudyUtils.isStudentProject(project)) {
      WolfTheProblemSolver.getInstance(project).clearProblems(virtualFile);
      taskFile.setHighlightErrors(false);
    }
  }
  transformTestFile(project, toSubtaskIndex, taskDir);
  task.setActiveSubtaskIndex(toSubtaskIndex);
  updateUI(project, task, !CCUtils.isCourseCreator(project) && navigateToTask);
  if (CCUtils.isCourseCreator(project)) {
    updateOpenedTestFiles(project, taskDir, fromSubtaskIndex, toSubtaskIndex);
  }
}
 

开发者ID:medvector,
项目名称:educational-plugin,
代码行数:51,
代码来源:StudySubtaskUtils.java

示例13: clear

点赞 2

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
@Override
public void clear() {
    documentReference = DocumentReferenceManager.getInstance().create(fileEditor.getVirtualFile());
    ((UndoManagerImpl) undoManager).invalidateActionsFor(documentReference);
    init();
}
 

开发者ID:hajdam,
项目名称:deltahex-intellij-plugin,
代码行数:7,
代码来源:HexUndoIntelliJHandler.java

示例14: registerNonUndoableAction

点赞 2

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
private void registerNonUndoableAction(final Document document) {
  DocumentReference ref = DocumentReferenceManager.getInstance().create(document);
  getUndoManager().nonundoableActionPerformed(ref, false);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:5,
代码来源:DocumentUndoProvider.java

示例15: isUndoable

点赞 2

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
private boolean isUndoable(Document document) {
  if (!UndoManagerImpl.isRefresh()) return true;

  return getUndoManager().isUndoOrRedoAvailable(DocumentReferenceManager.getInstance().create(document));
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:6,
代码来源:DocumentUndoProvider.java

示例16: StartMarkAction

点赞 2

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
private StartMarkAction(Editor editor, String commandName) {
  super(DocumentReferenceManager.getInstance().create(editor.getDocument()));
  myCommandName = commandName;
  myDocument = editor.getDocument();
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:6,
代码来源:StartMarkAction.java

示例17: collectLocalAffectedDocuments

点赞 2

import com.intellij.openapi.command.undo.DocumentReferenceManager; //导入依赖的package包/类
private void collectLocalAffectedDocuments(@NotNull Collection<DocumentReference> result) {
  result.addAll(myDocumentStacks.keySet());
  for (Document each : myDocumentsWithStacks) {
    result.add(DocumentReferenceManager.getInstance().create(each));
  }
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:7,
代码来源:UndoRedoStacksHolder.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)