11import com .intellij .openapi .actionSystem .AnAction ;
22import com .intellij .openapi .actionSystem .AnActionEvent ;
3- import com .intellij .openapi .actionSystem .DataKeys ;
43import com .intellij .openapi .fileEditor .FileEditorManager ;
54import com .intellij .openapi .fileEditor .OpenFileDescriptor ;
65import com .intellij .openapi .project .Project ;
7- import com .intellij .openapi .ui .Messages ;
86import com .intellij .openapi .vfs .LocalFileSystem ;
97import com .intellij .openapi .vfs .VirtualFile ;
108
@@ -25,7 +23,7 @@ public QuickSwitchAction() {
2523 public void actionPerformed (AnActionEvent event ) {
2624 this .latestEvent = event ;
2725
28- VirtualFile currentFile = DataKeys . VIRTUAL_FILE . getData ( event .getDataContext ());
26+ VirtualFile currentFile = ( VirtualFile ) event .getDataContext (). getData ( "virtualFile" );
2927 if (currentFile == null ) return ;
3028
3129 String currentFilePath = currentFile .getCanonicalPath ();
@@ -79,15 +77,4 @@ private VirtualFile getFileByPath(String path) {
7977 return LocalFileSystem .getInstance ().findFileByPath (path );
8078 }
8179
82- private void showMessage (String message ) {
83- Project project = this .latestEvent .getProject ();
84- if (project == null ) return ;
85- Messages .showMessageDialog (
86- project ,
87- message ,
88- "Info" ,
89- Messages .getInformationIcon ()
90- );
91- }
92-
9380}
0 commit comments