correctly retrieve parent directory from injected context
authorMaxim.Mossienko <Maxim.Mossienko@jetbrains.com>
Fri, 26 Feb 2010 18:58:34 +0000 (21:58 +0300)
committerMaxim.Mossienko <Maxim.Mossienko@jetbrains.com>
Fri, 26 Feb 2010 18:58:58 +0000 (21:58 +0300)
plugins/properties/src/com/intellij/lang/properties/LastSelectedPropertiesFileStore.java

index 8559a29cef09938bea8aed214b829dff986a7063..e9e813052ec5becac1509787c3aaa91d4e6cd02e 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.lang.properties;
 
+import com.intellij.injected.editor.VirtualFileWindow;
 import com.intellij.lang.properties.psi.PropertiesFile;
 import com.intellij.openapi.components.PersistentStateComponent;
 import com.intellij.openapi.components.ServiceManager;
@@ -85,6 +86,9 @@ public class LastSelectedPropertiesFileStore implements PersistentStateComponent
 
   public void saveLastSelectedPropertiesFile(PsiFile context, PropertiesFile file) {
     VirtualFile virtualFile = context.getVirtualFile();
+    if (virtualFile instanceof VirtualFileWindow) {
+      virtualFile = ((VirtualFileWindow)virtualFile).getDelegate();
+    }
     assert virtualFile != null;
     String contextUrl = virtualFile.getUrl();
     String url = file.getVirtualFile().getUrl();