how to

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了how to相关的知识,希望对你有一定的参考价值。

打开一个virtualfile

VirtualFile file;
Project project;

OpenFileDescriptior descriptor = new OpenFileDescriptior(file);.navigate()
FileEditorManager.getInstance(project).openTextEditor(descriptor, true);

 

Project project= ProjectManager.getInstance().getDefaultProject();
FileEditorManager manager=FileEditorManager.getInstance(project);
Editor editor=manager.getSelectedTextEditor();

final Project project = e.getProject();
        if (project == null) {
            return;
        }
        final Editor edit = e.getRequiredData(CommonDataKeys.EDITOR);
        System.out.println("Edit=======>>>>>>>>>>>>>>>>>>>>" + edit.getDocument());

        String MANIFEST_PATH = project.toString() + "androidManifest.xml";

        System.out.println("project Path=>>>>>>" + project.toString());

        Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();

        FileEditor editors[] = FileEditorManager.getInstance(project).getAllEditors();
        if (editor == null) {
            return;
        }
        System.out.println("editor Path=>>>>>>" + editor.toString());
        for (int index = 0; index < editors.length; index++) {
            System.out.println("editors Path=>>>>>>" + editors[index].toString());
        }

        final Document document = editor.getDocument();
        System.out.println("document Path=>>>>>>" + document.toString());
        VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(document);
        if (virtualFile == null) {
            return;
        }
        System.out.println("Virtual Path=>>>>>>" + virtualFile.toString());

  

if (element instanceof PsiDocComment) {
            PsiDocComment literalExpression = (PsiDocComment) element;
            ImageIcon icon =new ImageIcon("mytest/bug.png");
            if (literalExpression.getText().toLowerCase().contains("hello")) {




                    NavigationGutterIconBuilder<PsiElement> builder =
                            NavigationGutterIconBuilder.create(icon).setTarget(element);
                    result.add(builder.createLineMarkerInfo(element));

            }
        }

  

 



以上是关于how to的主要内容,如果未能解决你的问题,请参考以下文章

什么是 android studio 中的片段活动?

如何 debug nodeJS 代码? how to inspect NodeJS code?

Yii2 HOW-TO:最佳实践

[How to] 使用HBase协处理器---Endpoint客户端代码的实现

How to Make Fibonacci Confusing

Yii2 HOW-TO:PDO连接数据库错误