码迷,mamicode.com
首页 > 其他好文 > 详细

how to

时间:2017-05-15 22:45:42      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:lin   tor   eric   pre   class   ++   bsp   []   case   

打开一个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

标签:lin   tor   eric   pre   class   ++   bsp   []   case   

原文地址:http://www.cnblogs.com/liqiking/p/6858487.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!