com.intellij.problems.WolfTheProblemSolver Java Examples
The following examples show how to use
com.intellij.problems.WolfTheProblemSolver.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ErrorAnnotator.java From reasonml-idea-plugin with MIT License | 6 votes |
@Override public void apply(@NotNull PsiFile file, @NotNull Collection<BsbErrorAnnotation> annotationResult, @NotNull AnnotationHolder holder) { WolfTheProblemSolver problemSolver = WolfTheProblemSolver.getInstance(file.getProject()); Collection<Problem> problems = new ArrayList<>(); for (BsbErrorAnnotation annotation : annotationResult) { if (annotation.isError) { holder.createErrorAnnotation(annotation.range, annotation.message); problems.add(problemSolver.convertToProblem(file.getVirtualFile(), annotation.startPos.line, annotation.startPos.column, new String[]{annotation.message})); } else { holder.createWarningAnnotation(annotation.range, annotation.message); } } problemSolver.reportProblems(file.getVirtualFile(), problems); }
Example #2
Source File: GeneralHighlightingPass.java From consulo with Apache License 2.0 | 6 votes |
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); } }
Example #3
Source File: Switcher.java From consulo with Apache License 2.0 | 6 votes |
@Override protected void customizeCellRenderer(@Nonnull JList<? extends FileInfo> list, FileInfo value, int index, boolean selected, boolean hasFocus) { Project project = mySwitcherPanel.project; VirtualFile virtualFile = value.getFirst(); String renderedName = value.getNameForRendering(); setIcon(VfsIconUtil.getIcon(virtualFile, Iconable.ICON_FLAG_READ_STATUS, project)); FileStatus fileStatus = FileStatusManager.getInstance(project).getStatus(virtualFile); open = FileEditorManager.getInstance(project).isFileOpen(virtualFile); boolean hasProblem = WolfTheProblemSolver.getInstance(project).isProblemFile(virtualFile); TextAttributes attributes = new TextAttributes(fileStatus.getColor(), null, hasProblem ? JBColor.red : null, EffectType.WAVE_UNDERSCORE, Font.PLAIN); append(renderedName, SimpleTextAttributes.fromTextAttributes(attributes)); // calc color the same way editor tabs do this, i.e. including EPs Color color = EditorTabPresentationUtil.getFileBackgroundColor(project, virtualFile); if (!selected && color != null) { setBackground(color); } SpeedSearchUtil.applySpeedSearchHighlighting(mySwitcherPanel, this, false, selected); IdeDocumentHistoryImpl.appendTimestamp(project, this, virtualFile); }
Example #4
Source File: PsiAwareFileEditorManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
public PsiAwareFileEditorManagerImpl(Project project, PsiManager psiManager, Provider<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(); } }); } }); }
Example #5
Source File: KnowledgeViewTreeBuilder.java From netbeans-mmd-plugin with Apache License 2.0 | 5 votes |
public KnowledgeViewTreeBuilder(@Nonnull Project project, @Nonnull JTree tree, @Nonnull DefaultTreeModel treeModel, @Nullable Comparator<NodeDescriptor> comparator, @Nonnull KnowledgeViewPanelTreeStructure treeStructure) { super(project, tree, treeModel, treeStructure, comparator); final MessageBusConnection connection = project.getMessageBus().connect(this); connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() { @Override public void rootsChanged(ModuleRootEvent event) { queueUpdate(); } }); connection.subscribe(BookmarksListener.TOPIC, new MyBookmarksListener()); PsiManager.getInstance(project).addPsiTreeChangeListener(createPsiTreeChangeListener(project), this); FileStatusManager.getInstance(project).addFileStatusListener(new MyFileStatusListener(), this); CopyPasteManager.getInstance().addContentChangedListener(new CopyPasteUtil.DefaultCopyPasteListener(getUpdater()), this); WolfTheProblemSolver.getInstance(project).addProblemListener(new MyProblemListener(), this); setCanYieldUpdate(true); initRootNode(); }
Example #6
Source File: Unity3dConsoleToolWindowService.java From consulo-unity3d with Apache License 2.0 | 5 votes |
private void process(Collection<UnityLogPostHandlerRequest> list) { UIUtil.invokeLaterIfNeeded(() -> { NewErrorTreeViewPanel panel = getOrInitPanel(); WolfTheProblemSolver solver = WolfTheProblemSolver.getInstance(myProject); VirtualFileManager virtualFileManager = VirtualFileManager.getInstance(); for(UnityLogPostHandlerRequest request : list) { DotNetCompilerMessage message = UnityLogParser.extractFileInfo(myProject, request.condition); int value = request.getMessageCategory(); if(message != null) { VirtualFile fileByUrl = message.getFileUrl() == null ? null : virtualFileManager.findFileByUrl(message.getFileUrl()); if(fileByUrl != null && value == MessageCategory.ERROR) { Problem problem = solver.convertToProblem(fileByUrl, message.getLine(), message.getColumn(), new String[]{message.getMessage()}); if(problem != null) { solver.reportProblems(fileByUrl, Collections.singletonList(problem)); } } panel.addMessage(value, new String[]{message.getMessage()}, fileByUrl, message.getLine() - 1, message.getColumn(), null); } else { panel.addMessage(value, new String[]{ request.condition, request.stackTrace }, null, -1, -1, null); } } }); }
Example #7
Source File: ProjectViewNode.java From consulo with Apache License 2.0 | 5 votes |
@Override protected boolean hasProblemFileBeneath() { if (!Registry.is("projectView.showHierarchyErrors")) return false; return WolfTheProblemSolver.getInstance(getProject()).hasProblemFilesBeneath(new Condition<VirtualFile>() { @Override public boolean value(final VirtualFile virtualFile) { return contains(virtualFile) // in case of flattened packages, when package node a.b.c contains error file, node a.b might not. && (getValue() instanceof PsiElement && Comparing.equal(PsiUtilBase.getVirtualFile((PsiElement)getValue()), virtualFile) || someChildContainsFile(virtualFile)); } }); }
Example #8
Source File: WolfHighlightingPass.java From consulo with Apache License 2.0 | 5 votes |
@Override protected void collectInformationWithProgress(@Nonnull final ProgressIndicator progress) { if (!Registry.is("wolf.the.problem.solver", true)) return; final WolfTheProblemSolver solver = WolfTheProblemSolver.getInstance(myProject); if (solver instanceof WolfTheProblemSolverImpl) { ((WolfTheProblemSolverImpl)solver).startCheckingIfVincentSolvedProblemsYet(progress, this); } }
Example #9
Source File: DefaultScopesProvider.java From consulo with Apache License 2.0 | 5 votes |
@Inject public DefaultScopesProvider(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, NamedScopesHolder holder) { return holder.getProject() == myProject && WolfTheProblemSolver.getInstance(myProject).isProblemFile(file); } }); myScopes = Arrays.asList(projectScope, getProblemsScope(), getAllScope(), nonProjectScope, new ScratchesNamedScope()); }
Example #10
Source File: CompilerTask.java From consulo with Apache License 2.0 | 4 votes |
private void informWolf(final CompilerMessage message) { WolfTheProblemSolver wolf = WolfTheProblemSolver.getInstance(myProject); VirtualFile file = getVirtualFile(message); wolf.queue(file); }
Example #11
Source File: WolfChangesFileNameDecorator.java From consulo with Apache License 2.0 | 4 votes |
@Inject public WolfChangesFileNameDecorator(final WolfTheProblemSolver problemSolver) { myProblemSolver = problemSolver; }
Example #12
Source File: MockWolfTheProblemSolver.java From consulo with Apache License 2.0 | 4 votes |
public void setDelegate(final WolfTheProblemSolver delegate) { myDelegate = delegate; }
Example #13
Source File: WolfTheProblemSolverImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override public void addProblemListener(@Nonnull WolfTheProblemSolver.ProblemListener listener, @Nonnull Disposable parentDisposable) { myProject.getMessageBus().connect(parentDisposable).subscribe(com.intellij.problems.ProblemListener.TOPIC, listener); }
Example #14
Source File: NavBarPresentation.java From consulo with Apache License 2.0 | 4 votes |
protected SimpleTextAttributes getTextAttributes(final Object object, final boolean selected) { if (!NavBarModel.isValid(object)) return SimpleTextAttributes.REGULAR_ATTRIBUTES; if (object instanceof PsiElement) { if (!ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() { @Override public Boolean compute() { return ((PsiElement)object).isValid(); } }).booleanValue()) { return SimpleTextAttributes.GRAYED_ATTRIBUTES; } PsiFile psiFile = ((PsiElement)object).getContainingFile(); if (psiFile != null) { final VirtualFile virtualFile = psiFile.getVirtualFile(); return new SimpleTextAttributes(null, selected ? null : FileStatusManager.getInstance(myProject).getStatus(virtualFile).getColor(), JBColor.red, WolfTheProblemSolver.getInstance(myProject).isProblemFile(virtualFile) ? SimpleTextAttributes.STYLE_WAVED : SimpleTextAttributes.STYLE_PLAIN); } else { if (object instanceof PsiDirectory) { VirtualFile vDir = ((PsiDirectory)object).getVirtualFile(); if (vDir.getParent() == null || ProjectRootsUtil.isModuleContentRoot(vDir, myProject)) { return SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES; } } if (wolfHasProblemFilesBeneath((PsiElement)object)) { return WOLFED; } } } else if (object instanceof Module) { if (WolfTheProblemSolver.getInstance(myProject).hasProblemFilesBeneath((Module)object)) { return WOLFED; } } else if (object instanceof Project) { final Project project = (Project)object; final Module[] modules = ApplicationManager.getApplication().runReadAction(new Computable<Module[]>() { @Override public Module[] compute() { return ModuleManager.getInstance(project).getModules(); } }); for (Module module : modules) { if (WolfTheProblemSolver.getInstance(project).hasProblemFilesBeneath(module)) { return WOLFED; } } } return SimpleTextAttributes.REGULAR_ATTRIBUTES; }
Example #15
Source File: WebPsiAwareFileEditorManagerImpl.java From consulo with Apache License 2.0 | 4 votes |
@Inject public WebPsiAwareFileEditorManagerImpl(Project project, PsiManager psiManager, Provider<WolfTheProblemSolver> problemSolver, DockManager dockManager) { super(project, psiManager, problemSolver, dockManager); }
Example #16
Source File: DesktopPsiAwareFileEditorManagerImpl.java From consulo with Apache License 2.0 | 4 votes |
@Inject public DesktopPsiAwareFileEditorManagerImpl(Project project, PsiManager psiManager, Provider<WolfTheProblemSolver> problemSolver, DockManager dockManager) { super(project, psiManager, problemSolver, dockManager); }