Error creating an editor window

I'm trying to create an EditorWindow for data that is remote (comes from a web service). I did create a VirtualFile object, a VirtualFileSystem that loads the data into the VirtualFile and an Editor form and an FileEditor class as well as a FileEditorProvided that links the form to the editor. Now when I call

getInstance().getProtocol() + "://" + componentInfo.getType() + "/" + componentInfo.getName();
final VirtualFile componentVFile = ComponentVFS.getInstance().findFileByPath(vComponentUrl);
final FileEditorManager fileEditorManager = FileEditorManager.getInstance(project);

fileEditorManager.openFile(componentVFile, true, true);


I get a nice Editor window with all I want, but also this stack trace

[  38071]  ERROR - tor.impl.FileEditorManagerImpl - Assertion failed:  
java.lang.Throwable
     at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:98)
     at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:105)
     at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl4(FileEditorManagerImpl.java:742)
     at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl3(FileEditorManagerImpl.java:688)
     at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl$9.run(FileEditorManagerImpl.java:667)
     at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:122)
     at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:97)
     at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:83)
     at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileImpl2(FileEditorManagerImpl.java:665)
     at com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl.openFileWithProviders(FileEditorManagerImpl.java:622)
     at com.intellij.openapi.fileEditor.ex.FileEditorManagerEx.openFile(FileEditorManagerEx.java:135)
     at com.blackducksoftware.integration.codecenter.intellij.component.ComponentAction.actionPerformed(ComponentAction.java:35)
     at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter$1.run(ActionMenuItem.java:255)
     at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:892)
     at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:114)
     at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:226)
     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
     at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:100)
     at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
     at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
     at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:291)
     at javax.swing.AbstractButton.doClick(AbstractButton.java:389)
     at com.apple.laf.ScreenMenuItemCheckbox.itemStateChanged(ScreenMenuItemCheckbox.java:178)
     at java.awt.CheckboxMenuItem.processItemEvent(CheckboxMenuItem.java:372)
     at java.awt.CheckboxMenuItem.processEvent(CheckboxMenuItem.java:340)
     at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:343)
     at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:331)
     at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:720)
     at java.awt.EventQueue.access$400(EventQueue.java:82)
     at java.awt.EventQueue$2.run(EventQueue.java:676)
     at java.awt.EventQueue$2.run(EventQueue.java:674)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
     at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:97)
     at java.awt.EventQueue$3.run(EventQueue.java:690)
     at java.awt.EventQueue$3.run(EventQueue.java:688)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:687)
     at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:673)
     at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:498)
     at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:333)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
[  38080]  ERROR - tor.impl.FileEditorManagerImpl - IntelliJ IDEA 12.0.4  Build #IC-123.169
[  38080]  ERROR - tor.impl.FileEditorManagerImpl - JDK: 1.6.0_65
[  38080]  ERROR - tor.impl.FileEditorManagerImpl - VM: Java HotSpot(TM) 64-Bit Server VM
[  38080]  ERROR - tor.impl.FileEditorManagerImpl - Vendor: Apple Inc.
[  38080]  ERROR - tor.impl.FileEditorManagerImpl - OS: Mac OS X
[  38080]  ERROR - tor.impl.FileEditorManagerImpl - Last Action: Myplugin.Textboxes
[  38081]  ERROR - tor.impl.FileEditorManagerImpl - Current Command:  


Any idea what causes this stack trace?

P.S.: The Myplugin.Textboxes is a simpel menu action to trigger the editor open.

4 comments
Comment actions Permalink

Looks like your FileEditor instance reports that it is not valid right after it has been created by your FileEditorProvider instance. You can check yourself by debugging FileEditorManagerImpl.openFileImpl4 method.

0
Comment actions Permalink

Dmitry, you are my hero. That is it! Thanks.

Unfortunately, IntelliJ did nto let me set any break points in the FileEditorManager. And it was obviously off by several lines between the source and actual code execued, that made it really difficult to debug.

Many thanks again.

P.S.: How should i determin if an editor is "valid?"

0
Comment actions Permalink

An editor is valid if the contents displayed in it still exists. For example, an editor which dsplays the contents of a file stops being valid after the file is deleted.

0
Comment actions Permalink

As for the issues with debugging, you probably have them because you haven't attached IDEA source code to your IDEA SDK in settings. Check here how to do this - https://confluence.jetbrains.com/display/IDEADEV/Getting+Started+with+Plugin+Development. And here's the information about getting source code - http://www.jetbrains.org/display/IJOS/Download.

0

Please sign in to leave a comment.