@Nullable private FilePath unshelveBinaryFile( final ShelvedBinaryFile file, @NotNull final VirtualFile patchTarget) throws IOException { final Ref<FilePath> result = new Ref<FilePath>(); final Ref<IOException> ex = new Ref<IOException>(); final Ref<VirtualFile> patchedFileRef = new Ref<VirtualFile>(); final File shelvedFile = file.SHELVED_PATH == null ? null : new File(file.SHELVED_PATH); ApplicationManager.getApplication() .runWriteAction( new Runnable() { public void run() { try { result.set(new FilePathImpl(patchTarget)); if (shelvedFile == null) { patchTarget.delete(this); } else { patchTarget.setBinaryContent(FileUtil.loadFileBytes(shelvedFile)); patchedFileRef.set(patchTarget); } } catch (IOException e) { ex.set(e); } } }); if (!ex.isNull()) { throw ex.get(); } return result.get(); }
public void openFiles() { if (mySplittersElement != null) { Ref<EditorWindow> currentWindow = new Ref<EditorWindow>(); final JPanel comp = readExternalPanel(mySplittersElement, getTopPanel(), currentWindow); if (comp != null) { removeAll(); add(comp, BorderLayout.CENTER); mySplittersElement = null; } // clear empty splitters for (EditorWindow window : getWindows()) { if (window.getEditors().length == 0) { for (EditorWindow sibling : window.findSiblings()) { sibling.unsplit(false); } } } if (!currentWindow.isNull()) { setCurrentWindow(currentWindow.get(), true); } } }