From f8699ec3f3db0f9a31b8202e345d60341c5b723b Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Mon, 12 Nov 2012 13:55:01 +0400 Subject: [PATCH] IDEA-94645 Save Project As Template: ipr-based project are saved incorrectly --- .../templates/SaveProjectAsTemplateAction.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/java/idea-ui/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java b/java/idea-ui/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java index f1d813c8a764..2c35a4cacf2e 100644 --- a/java/idea-ui/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java +++ b/java/idea-ui/src/com/intellij/platform/templates/SaveProjectAsTemplateAction.java @@ -15,11 +15,14 @@ */ package com.intellij.platform.templates; +import com.intellij.CommonBundle; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.components.StorageScheme; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; import com.intellij.openapi.project.Project; +import com.intellij.openapi.project.ex.ProjectEx; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.StreamUtil; @@ -45,6 +48,13 @@ public class SaveProjectAsTemplateAction extends AnAction { public void actionPerformed(AnActionEvent e) { Project project = getEventProject(e); assert project != null; + StorageScheme scheme = ((ProjectEx)project).getStateStore().getStorageScheme(); + if (scheme != StorageScheme.DIRECTORY_BASED) { + Messages.showErrorDialog(project, "Project templates do not support old .ipr (file-based) format.\n" + + "Please convert your project via File->Save as Directory-Based format.", CommonBundle.getErrorTitle()); + return; + } + VirtualFile descriptionFile = VfsUtil.findRelativeFile(project.getBaseDir(), ArchivedProjectTemplate.DESCRIPTION_PATH.split("/")); SaveProjectAsTemplateDialog dialog = new SaveProjectAsTemplateDialog(project, descriptionFile); if (dialog.showAndGet()) {