com.intellij.ide.errorTreeView.NewErrorTreeViewPanel Java Examples

The following examples show how to use com.intellij.ide.errorTreeView.NewErrorTreeViewPanel. 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: ShowAllProblemsInProjectAction.java    From CppTools with Apache License 2.0 6 votes vote down vote up
public void addMessage(final MessageType type, final int start, final int end, final String message, Fix... fixes) {
  if (type == MessageType.Intention || type == MessageType.Info) return;

  final VirtualFile analizedFile = currentFile;
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      view.addMessage(
        type == MessageType.Error ? MessageCategory.ERROR : type == MessageType.Warning ? MessageCategory.WARNING: MessageCategory.INFORMATION,
        new String[] { message },
        analizedFile.getPresentableUrl(),
        new OpenFileDescriptor(project, analizedFile,start),
        NewErrorTreeViewPanel.createExportPrefix(start),
        NewErrorTreeViewPanel.createRendererPrefix(start,end),
        analizedFile
      );
    }
  });
}
 
Example #2
Source File: Unity3dConsoleToolWindowService.java    From consulo-unity3d with Apache License 2.0 5 votes vote down vote up
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 #3
Source File: Unity3dConsoleToolWindowService.java    From consulo-unity3d with Apache License 2.0 4 votes vote down vote up
@RequiredUIAccess
@Nonnull
private NewErrorTreeViewPanel getOrInitPanel()
{
	if(myErrorPanel != null)
	{
		return myErrorPanel;
	}

	if(myToolwindowInit.compareAndSet(false, true))
	{
		MessageView messageView = MessageView.SERVICE.getInstance(myProject);
		messageView.runWhenInitialized(() ->
		{
			final ContentManager contentManager = messageView.getContentManager();
			Content[] contents = contentManager.getContents();
			Content content = ContainerUtil.find(contents, content1 -> content1.getUserData(ourViewKey) != null);

			MyErrorPanel errorTreeViewPanel = null;
			if(content == null)
			{
				errorTreeViewPanel = new MyErrorPanel(myProject);

				content = ContentFactory.getInstance().createContent(errorTreeViewPanel, "Editor", false);
				content.putUserData(ourViewKey, Boolean.TRUE);

				contentManager.addContent(content);
			}
			else
			{
				errorTreeViewPanel = (MyErrorPanel) content.getComponent();
			}

			contentManager.setSelectedContent(content, true);

			myErrorPanel = errorTreeViewPanel;
		});
	}

	return myErrorPanel;
}
 
Example #4
Source File: ExcludeFromCompileAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
public ExcludeFromCompileAction(Project project, NewErrorTreeViewPanel errorTreeView) {
  super(CompilerBundle.message("actions.exclude.from.compile.text"));
  myProject = project;
  myErrorTreeView = errorTreeView;
}
 
Example #5
Source File: TestNewErrorViewAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected ErrorTreeView createView(Project project) {
  return new NewErrorTreeViewPanel(project, null);
}
 
Example #6
Source File: CodeSmellDetectorImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void showCodeSmellErrors(@Nonnull final List<CodeSmellInfo> smellList) {
  Collections.sort(smellList, new Comparator<CodeSmellInfo>() {
    @Override
    public int compare(final CodeSmellInfo o1, final CodeSmellInfo o2) {
      return o1.getTextRange().getStartOffset() - o2.getTextRange().getStartOffset();
    }
  });

  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      if (myProject.isDisposed()) return;
      if (smellList.isEmpty()) {
        return;
      }

      final VcsErrorViewPanel errorTreeView = new VcsErrorViewPanel(myProject);
      AbstractVcsHelperImpl helper = (AbstractVcsHelperImpl)AbstractVcsHelper.getInstance(myProject);
      helper.openMessagesView(errorTreeView, VcsBundle.message("code.smells.error.messages.tab.name"));

      FileDocumentManager fileManager = FileDocumentManager.getInstance();

      for (CodeSmellInfo smellInfo : smellList) {
        final VirtualFile file = fileManager.getFile(smellInfo.getDocument());
        final OpenFileDescriptor navigatable =
                new OpenFileDescriptor(myProject, file, smellInfo.getStartLine(), smellInfo.getStartColumn());
        final String exportPrefix = NewErrorTreeViewPanel.createExportPrefix(smellInfo.getStartLine() + 1);
        final String rendererPrefix =
                NewErrorTreeViewPanel.createRendererPrefix(smellInfo.getStartLine() + 1, smellInfo.getStartColumn() + 1);
        if (smellInfo.getSeverity() == HighlightSeverity.ERROR) {
          errorTreeView.addMessage(MessageCategory.ERROR, new String[]{smellInfo.getDescription()}, file.getPresentableUrl(), navigatable,
                                   exportPrefix, rendererPrefix, null);
        }
        else {//if (smellInfo.getSeverity() == HighlightSeverity.WARNING) {
          errorTreeView.addMessage(MessageCategory.WARNING, new String[]{smellInfo.getDescription()}, file.getPresentableUrl(),
                                   navigatable, exportPrefix, rendererPrefix, null);
        }

      }
    }
  });

}