标签: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)); } }
标签:lin tor eric pre class ++ bsp [] case
原文地址:http://www.cnblogs.com/liqiking/p/6858487.html