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


Java WolfTheProblemSolver类代码示例

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


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

示例1: matchesScope

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
private boolean matchesScope(VirtualFile file, Project project, ProjectFileIndex fileIndex) {
  if (file == null) return false;
  boolean isSource = fileIndex.isInSourceContent(file);
  if (myScope == SCOPE_ANY) {
    return fileIndex.isInContent(file) && FilePatternPackageSet.matchesModule(myModuleGroupPattern, myModulePattern, file, fileIndex);
  }
  if (myScope == SCOPE_SOURCE) {
    return isSource && !fileIndex.isInTestSourceContent(file) && FilePatternPackageSet.matchesModule(myModuleGroupPattern, myModulePattern,
                                                                                                     file, fileIndex);
  }
  if (myScope == SCOPE_LIBRARY) {
    return (fileIndex.isInLibraryClasses(file) || fileIndex.isInLibrarySource(file)) && matchesLibrary(myModulePattern, file, fileIndex);
  }
  if (myScope == SCOPE_TEST) {
    return isSource && fileIndex.isInTestSourceContent(file) && FilePatternPackageSet.matchesModule(myModuleGroupPattern, myModulePattern,
                                                                                                    file, fileIndex);
  }
  if (myScope == SCOPE_PROBLEM) {
    return isSource && WolfTheProblemSolver.getInstance(project).isProblemFile(file) &&
           FilePatternPackageSet.matchesModule(myModuleGroupPattern, myModulePattern, file, fileIndex);
  }
  throw new RuntimeException("Unknown scope: " + myScope);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PatternPackageSet.java

示例2: reportErrorsToWolf

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
private void reportErrorsToWolf() {
  if (!getFile().getViewProvider().isPhysical()) return; // e.g. errors in evaluate expression
  Project project = getFile().getProject();
  if (!PsiManager.getInstance(project).isInProject(getFile())) return; // do not report problems in libraries
  VirtualFile file = getFile().getVirtualFile();
  if (file == null) return;

  List<Problem> problems = convertToProblems(getInfos(), file, myHasErrorElement);
  WolfTheProblemSolver wolf = WolfTheProblemSolver.getInstance(project);

  boolean hasErrors = DaemonCodeAnalyzerEx.hasErrors(project, getDocument());
  if (!hasErrors || isWholeFileHighlighting()) {
    wolf.reportProblems(file, problems);
  }
  else {
    wolf.weHaveGotProblems(file, problems);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GeneralHighlightingPass.java

示例3: projectOpened

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
@Override
public void projectOpened() {
  MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
  connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
    @Override
    public void rootsChanged(ModuleRootEvent event) {
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
          if (myProject.isDisposed()) return;
          VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
        }
      }, ModalityState.NON_MODAL);
    }
  });
  final WolfTheProblemSolver.ProblemListener myProblemListener = new MyProblemListener();
  WolfTheProblemSolver.getInstance(myProject).addProblemListener(myProblemListener,myProject);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:VcsEventWatcher.java

示例4: PsiAwareFileEditorManagerImpl

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
public PsiAwareFileEditorManagerImpl(final Project project,
                                     final PsiManager psiManager,
                                     final WolfTheProblemSolver problemSolver,
                                     DockManager dockManager,
                                     MessageBus messageBus,
                                     EditorHistoryManager editorHistoryManager) {
  super(project, dockManager, editorHistoryManager);
  myPsiManager = psiManager;
  myProblemSolver = problemSolver;
  myPsiTreeChangeListener = new MyPsiTreeChangeListener();
  myProblemListener = new MyProblemListener();
  registerExtraEditorDataProvider(new TextEditorPsiDataProvider(), null);

  // reinit syntax highlighter for Groovy. In power save mode keywords are highlighted by GroovySyntaxHighlighter insteadof
  // GrKeywordAndDeclarationHighlighter. So we need to drop caches for token types attributes in LayeredLexerEditorHighlighter
  messageBus.connect().subscribe(PowerSaveMode.TOPIC, new PowerSaveMode.Listener() {
    @Override
    public void powerSaveStateChanged() {
      for (Editor editor : EditorFactory.getInstance().getAllEditors()) {
        ((EditorEx)editor).reinitSettings();
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PsiAwareFileEditorManagerImpl.java

示例5: DefaultScopesProvider

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
public DefaultScopesProvider(@NotNull Project project) {
  myProject = project;
  final NamedScope projectScope = new ProjectFilesScope();
  final NamedScope nonProjectScope = new NonProjectFilesScope();
  final String text = FilePatternPackageSet.SCOPE_FILE + ":*//*";
  myProblemsScope = new NamedScope(IdeBundle.message("predefined.scope.problems.name"), new AbstractPackageSet(text) {
    @Override
    public boolean contains(VirtualFile file, @NotNull NamedScopesHolder holder) {
      return contains(file, holder.getProject(), holder);
    }

    @Override
    public boolean contains(VirtualFile file, @NotNull Project project, @Nullable NamedScopesHolder holder) {
      return project == myProject
             && WolfTheProblemSolver.getInstance(myProject).isProblemFile(file);
    }
  });
  myScopes = Arrays.asList(projectScope, getProblemsScope(), getAllScope(), nonProjectScope);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DefaultScopesProvider.java

示例6: unsubscribeFrom

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
static void unsubscribeFrom(NavBarPanel panel) {
  final NavBarListener listener = (NavBarListener)panel.getClientProperty(LISTENER);
  panel.putClientProperty(LISTENER, null);
  if (listener != null) {
    final Project project = panel.getProject();
    KeyboardFocusManager.getCurrentKeyboardFocusManager().removePropertyChangeListener(listener);
    FileStatusManager.getInstance(project).removeFileStatusListener(listener);
    PsiManager.getInstance(project).removePsiTreeChangeListener(listener);
    WolfTheProblemSolver.getInstance(project).removeProblemListener(listener);
    ActionManager.getInstance().removeAnActionListener(listener);
    final MessageBusConnection connection = (MessageBusConnection)panel.getClientProperty(BUS);
    panel.putClientProperty(BUS, null);
    if (connection != null) {
      connection.disconnect();
    }
    LafManager.getInstance().removeLafManagerListener(listener);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:NavBarListener.java

示例7: refreshFile

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
private static void refreshFile(@NotNull final StudyState studyState, @NotNull final Project project) {
  final Editor editor = studyState.getEditor();
  final TaskFile taskFile = studyState.getTaskFile();
  if (!resetTaskFile(editor.getDocument(), project, taskFile, studyState.getVirtualFile().getName())) {
    Messages.showInfoMessage("The initial text of task file is unavailable", "Failed to Refresh Task File");
    return;
  }
  WolfTheProblemSolver.getInstance(project).clearProblems(studyState.getVirtualFile());
  taskFile.setHighlightErrors(false);
  StudyUtils.drawAllWindows(editor, taskFile);
  EduAnswerPlaceholderPainter.createGuardedBlocks(editor, taskFile, true);
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      IdeFocusManager.getInstance(project).requestFocus(editor.getContentComponent(), true);
    }
  });

  StudyNavigator.navigateToFirstAnswerPlaceholder(editor, taskFile);
  showBalloon(project, "You can start again now", MessageType.INFO);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:StudyRefreshTaskFileAction.java

示例8: run

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
@Override
public void run() {
  final VirtualFile[] files;
  synchronized (changedFiles) {
    wasRequested = false;
    files = changedFiles.toArray(new VirtualFile[changedFiles.size()]);
    changedFiles.clear();
  }

  final WolfTheProblemSolver problemSolver = WolfTheProblemSolver.getInstance(project);
  for (VirtualFile file : files) {
    if (problemSolver.hasSyntaxErrors(file)) {
      // threat any other file in queue as dependency of this file — don't flush if some of the queued file is invalid
      // Vladimir.Krivosheev AutoTestManager behavior behavior is preserved.
      // LiveEdit version used another strategy (flush all valid files), but now we use AutoTestManager-inspired strategy
      synchronized (changedFiles) {
        Collections.addAll(changedFiles, files);
      }

      return;
    }
  }

  consumer.consume(files);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:DelayedDocumentWatcher.java

示例9: reportErrorsToWolf

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
private void reportErrorsToWolf() {
  if (!myFile.getViewProvider().isPhysical()) return; // e.g. errors in evaluate expression
  Project project = myFile.getProject();
  if (!PsiManager.getInstance(project).isInProject(myFile)) return; // do not report problems in libraries
  VirtualFile file = myFile.getVirtualFile();
  if (file == null) return;

  List<Problem> problems = convertToProblems(getInfos(), file, myHasErrorElement);
  WolfTheProblemSolver wolf = WolfTheProblemSolver.getInstance(project);

  boolean hasErrors = DaemonCodeAnalyzerImpl.hasErrors(project, getDocument());
  if (!hasErrors || isWholeFileHighlighting()) {
    wolf.reportProblems(file, problems);
  }
  else {
    wolf.weHaveGotProblems(file, problems);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:GeneralHighlightingPass.java

示例10: projectOpened

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
@Override
public void projectOpened() {
  MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
  connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
    @Override
    public void rootsChanged(ModuleRootEvent event) {
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
          if (myProject.isDisposed() || !DirectoryIndex.getInstance(myProject).isInitialized()) return;
          VcsDirtyScopeManager.getInstance(myProject).markEverythingDirty();
        }
      }, ModalityState.NON_MODAL);
    }
  });
  final WolfTheProblemSolver.ProblemListener myProblemListener = new MyProblemListener();
  WolfTheProblemSolver.getInstance(myProject).addProblemListener(myProblemListener,myProject);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:VcsEventWatcher.java

示例11: unsubscribeFrom

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
static void unsubscribeFrom(NavBarPanel panel) {
  final NavBarListener listener = (NavBarListener)panel.getClientProperty(LISTENER);
  panel.putClientProperty(LISTENER, null);
  if (listener != null) {
    final Project project = panel.getProject();
    KeyboardFocusManager.getCurrentKeyboardFocusManager().removePropertyChangeListener(listener);
    FileStatusManager.getInstance(project).removeFileStatusListener(listener);
    PsiManager.getInstance(project).removePsiTreeChangeListener(listener);
    WolfTheProblemSolver.getInstance(project).removeProblemListener(listener);
    ActionManager.getInstance().removeAnActionListener(listener);
    final MessageBusConnection connection = (MessageBusConnection)panel.getClientProperty(BUS);
    panel.putClientProperty(BUS, null);
    if (connection != null) {
      connection.disconnect();
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:NavBarListener.java

示例12: reportRelevantCompilationErrors

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
private static void reportRelevantCompilationErrors(RenderLogger logger, HtmlBuilder builder, RenderService renderService) {
  Module module = logger.getModule();
  Project project = module.getProject();
  WolfTheProblemSolver wolfgang = WolfTheProblemSolver.getInstance(project);
  if (wolfgang.hasProblemFilesBeneath(module)) {
    if (logger.seenTagPrefix(TAG_RESOURCES_PREFIX)) {
      // Do we have errors in the res/ files?
      // See if it looks like we have aapt problems
      boolean haveResourceErrors = wolfgang.hasProblemFilesBeneath(new Condition<VirtualFile>() {
        @Override
        public boolean value(VirtualFile virtualFile) {
          return virtualFile.getFileType() == StdFileTypes.XML;
        }
      });
      if (haveResourceErrors) {
        builder.addBold("NOTE: This project contains resource errors, so aapt did not succeed, " +
                        "which can cause rendering failures. Fix resource problems first.");
        builder.newline().newline();
      }
    }
  }
}
 
开发者ID:chrimm,项目名称:cordovastudio,代码行数:23,代码来源:RenderErrorPanel.java

示例13: PsiAwareFileEditorManagerImpl

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
public PsiAwareFileEditorManagerImpl(final Project project,
                                     final PsiManager psiManager,
                                     final WolfTheProblemSolver problemSolver,
                                     DockManager dockManager) {
  super(project, dockManager);

  myPsiManager = psiManager;
  myProblemSolver = problemSolver;
  myPsiTreeChangeListener = new MyPsiTreeChangeListener();
  myProblemListener = new MyProblemListener();
  registerExtraEditorDataProvider(new TextEditorPsiDataProvider(), null);

  // reinit syntax highlighter for Groovy. In power save mode keywords are highlighted by GroovySyntaxHighlighter insteadof
  // GrKeywordAndDeclarationHighlighter. So we need to drop caches for token types attributes in LayeredLexerEditorHighlighter
  project.getMessageBus().connect().subscribe(PowerSaveMode.TOPIC, new PowerSaveMode.Listener() {
    @Override
    public void powerSaveStateChanged() {
      UIUtil.invokeLaterIfNeeded(() -> {
        for (Editor editor : EditorFactory.getInstance().getAllEditors()) {
          ((EditorEx)editor).reinitSettings();
        }
      });
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:PsiAwareFileEditorManagerImpl.java

示例14: refreshFile

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
private static void refreshFile(@NotNull final StudyState studyState, @NotNull final Project project) {
  final Editor editor = studyState.getEditor();
  final TaskFile taskFile = studyState.getTaskFile();
  final Task task = taskFile.getTask();
  if (task instanceof TaskWithSubtasks) {
    for (AnswerPlaceholder placeholder : taskFile.getActivePlaceholders()) {
      StudySubtaskUtils.refreshPlaceholder(editor, placeholder);
    }
  }
  else {
    if (!resetTaskFile(editor.getDocument(), project, taskFile)) {
      Messages.showInfoMessage("The initial text of task file is unavailable", "Failed to Refresh Task File");
      return;
    }
    if (task instanceof ChoiceTask) {
      final StudyToolWindow window = StudyUtils.getStudyToolWindow(project);
      if (window != null) {
        window.setBottomComponent(new StudyChoiceVariantsPanel((ChoiceTask)task));
      }
    }
  }
  WolfTheProblemSolver.getInstance(project).clearProblems(studyState.getVirtualFile());
  taskFile.setHighlightErrors(false);
  StudyUtils.drawAllAnswerPlaceholders(editor, taskFile);
  EduAnswerPlaceholderPainter.createGuardedBlocks(editor, taskFile);
  ApplicationManager.getApplication().invokeLater(
    () -> IdeFocusManager.getInstance(project).requestFocus(editor.getContentComponent(), true));

  StudyNavigator.navigateToFirstAnswerPlaceholder(editor, taskFile);
  showBalloon(project, MessageType.INFO);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:32,代码来源:StudyRefreshTaskFileAction.java

示例15: editorCreated

import com.intellij.problems.WolfTheProblemSolver; //导入依赖的package包/类
@Override
public void editorCreated(@NotNull final EditorFactoryEvent event) {
  final Editor editor = event.getEditor();
  final Project project = editor.getProject();
  if (project == null) {
    return;
  }

  final Document document = editor.getDocument();
  final VirtualFile openedFile = FileDocumentManager.getInstance().getFile(document);
  if (openedFile != null) {
    final TaskFile taskFile = StudyUtils.getTaskFile(project, openedFile);
    if (taskFile != null) {
      WolfTheProblemSolver.getInstance(project).clearProblems(openedFile);
      final ToolWindow studyToolWindow = ToolWindowManager.getInstance(project).getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW);
      if (studyToolWindow != null) {
        StudyUtils.updateToolWindows(project);
        studyToolWindow.show(null);
      }
      Course course = StudyTaskManager.getInstance(project).getCourse();
      if (course == null) {
        return;
      }

      StudyEditor.addDocumentListener(document, new EduDocumentListener(taskFile, true));

      if (!taskFile.getAnswerPlaceholders().isEmpty()) {
        StudyNavigator.navigateToFirstAnswerPlaceholder(editor, taskFile);
        boolean isStudyProject = EduNames.STUDY.equals(course.getCourseMode());
        StudyUtils.drawAllAnswerPlaceholders(editor, taskFile);
        if (isStudyProject) {
          editor.addEditorMouseListener(new WindowSelectionListener(taskFile));
        }
      }
    }
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:38,代码来源:StudyEditorFactoryListener.java


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