Java Code Examples for com.intellij.ide.projectView.ProjectViewNode#getProject()

The following examples show how to use com.intellij.ide.projectView.ProjectViewNode#getProject() . 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: BlazeCoverageProjectViewClassDecorator.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Override
public void decorate(@SuppressWarnings("rawtypes") ProjectViewNode node, PresentationData data) {
  CoverageDataManager manager = getCoverageDataManager();
  CoverageSuitesBundle currentSuite = manager.getCurrentSuitesBundle();

  Project project = node.getProject();
  BlazeCoverageAnnotator annotator = getAnnotator(project, currentSuite);
  if (annotator == null) {
    return;
  }
  PsiFile file = getPsiFileForJavaClass(getPsiElement(node));
  if (file == null) {
    return;
  }
  String string = annotator.getFileCoverageInformationString(file, currentSuite, manager);
  if (string != null) {
    data.setLocationString(string);
  }
}
 
Example 2
Source File: SyncStatusNodeDecorator.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("rawtypes")
public void decorate(ProjectViewNode node, PresentationData data) {
  Project project = node.getProject();
  if (project == null) {
    return;
  }
  BlazeProjectData projectData =
      BlazeProjectDataManager.getInstance(project).getBlazeProjectData();
  if (projectData == null) {
    return;
  }
  PsiFileAndName fileAndName = toPsiFile(projectData, node);
  if (fileAndName == null) {
    return;
  }
  VirtualFile vf = fileAndName.psiFile.getVirtualFile();
  SyncStatus status =
      vf == null ? null : SyncStatusContributor.getSyncStatus(project, projectData, vf);
  if (status == SyncStatus.UNSYNCED) {
    data.clearText();
    data.addText(fileAndName.name, SimpleTextAttributes.GRAY_ATTRIBUTES);
    data.addText(" (unsynced)", SimpleTextAttributes.GRAY_ATTRIBUTES);
    return;
  }
  if (status == SyncStatus.IN_PROGRESS) {
    data.clearText();
    data.addText(fileAndName.name, SimpleTextAttributes.REGULAR_ATTRIBUTES);
    data.addText(" (syncing...)", SimpleTextAttributes.GRAY_ATTRIBUTES);
  }
}
 
Example 3
Source File: Unity3dProjectViewNodeDecorator.java    From consulo-unity3d with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void decorate(ProjectViewNode node, PresentationData data)
{
	Project project = node.getProject();
	if(project == null)
	{
		return;
	}

	VirtualFile virtualFile = node.getVirtualFile();
	if(virtualFile == null || virtualFile.getFileType() != Unity3dMetaFileType.INSTANCE)
	{
		return;
	}

	Unity3dRootModuleExtension rootModuleExtension = Unity3dModuleExtensionUtil.getRootModuleExtension(project);
	if(rootModuleExtension == null)
	{
		return;
	}

	if(Unity3dMetaFileProjectViewProvider.haveOwnerFile(virtualFile))
	{
		return;
	}

	data.clearText();
	data.addText(virtualFile.getName(), SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
	String nameWithoutExtension = virtualFile.getNameWithoutExtension();
	data.setTooltip("File(directory) '" + nameWithoutExtension + "' is not exists, meta file can be deleted.");
}
 
Example 4
Source File: ProjectViewDecorator.java    From GitToolBox with Apache License 2.0 5 votes vote down vote up
private boolean shouldDecorate(ProjectViewNode<?> projectViewNode) {
  Project project = projectViewNode.getProject();
  boolean result = project != null && AppConfig.get().getShowProjectViewStatus();
  if (!result && log.isDebugEnabled()) {
    log.debug("No project for node ", projectViewNode.getClass().getSimpleName(),
        " title=", projectViewNode.getTitle());
  }
  return result;
}
 
Example 5
Source File: SvnProjectViewNodeDecorator.java    From SVNToolBox with Apache License 2.0 5 votes vote down vote up
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
    if (node != null) {
        Project project = node.getProject();
        if (project != null) {
            SvnToolBoxProjectState config = SvnToolBoxProjectState.getInstance(project);
            if (config.showingAnyDecorations()) {
                SvnToolBoxApp svnToolBox = SvnToolBoxApp.getInstance();
                SvnToolBoxProject svnToolBoxProject = SvnToolBoxProject.getInstance(project);

              LogStopwatch watch = LogStopwatch.debugStopwatch(svnToolBoxProject.sequence(),
                  () -> "Decorator").start();
                NodeDecoration decoration = svnToolBox.decorationFor(node);                    
                watch.tick("Decoration selected {0}", decoration);
                
                if (LOG.isDebugEnabled()) {
                    final int seq = svnToolBoxProject.sequence().get();
                  LOG.debug("[", seq, "] Node: ", decoration.getClass().getName(), " ",
                      node, " ", node.getClass().getName());
                }
                if (decoration.getType() == NodeDecorationType.Module) {
                    if (config.showProjectViewModuleDecoration) {                            
                        decoration.decorate(node, data);
                        watch.tick("Module decoration");
                    }
                } else if (config.showProjectViewSwitchedDecoration) {                        
                    decoration.decorate(node, data);
                    watch.tick("Switched decoration");                        
                }
                watch.stop();
            }
        }

    }
}