diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java index b817a1c5ea74..58342c628f2d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectImpl.java @@ -331,50 +331,51 @@ public class ProjectImpl extends ComponentManagerImpl implements ProjectEx { public void save() { if (ApplicationManagerEx.getApplicationEx().isDoNotSave()) return; //no need to save - if (mySavingInProgress.compareAndSet(false, true)) { - try { - if (isToSaveProjectName()) { - final IProjectStore stateStore = getStateStore(); - final VirtualFile baseDir = stateStore.getProjectBaseDir(); - if (baseDir != null && baseDir.isValid()) { - final VirtualFile ideaDir = baseDir.findChild(DIRECTORY_STORE_FOLDER); - if (ideaDir != null && ideaDir.isValid() && ideaDir.isDirectory()) { - final File nameFile = new File(ideaDir.getPath(), ".name"); - try { - FileUtil.writeToFile(nameFile, getName().getBytes("UTF-8"), false); - myOldName = null; - } - catch (IOException e) { - LOG.info("Unable to store project name to: " + nameFile.getPath()); - } + if (!mySavingInProgress.compareAndSet(false, true)) { + return; + } + try { + if (isToSaveProjectName()) { + final IProjectStore stateStore = getStateStore(); + final VirtualFile baseDir = stateStore.getProjectBaseDir(); + if (baseDir != null && baseDir.isValid()) { + final VirtualFile ideaDir = baseDir.findChild(DIRECTORY_STORE_FOLDER); + if (ideaDir != null && ideaDir.isValid() && ideaDir.isDirectory()) { + final File nameFile = new File(ideaDir.getPath(), ".name"); + try { + FileUtil.writeToFile(nameFile, getName().getBytes("UTF-8"), false); + myOldName = null; + } + catch (IOException e) { + LOG.info("Unable to store project name to: " + nameFile.getPath()); } } } + } - StoreUtil.doSave(getStateStore()); - } - catch (IComponentStore.SaveCancelledException e) { - LOG.info(e); - } - catch (PluginException e) { - PluginManager.disablePlugin(e.getPluginId().getIdString()); - Notification notification = new Notification( - PLUGIN_SETTINGS_ERROR, - "Unable to save plugin settings!", - "

The plugin " + e.getPluginId() + " failed to save settings and has been disabled. Please restart" + - ApplicationNamesInfo.getInstance().getFullProductName() + "

" + - (ApplicationManagerEx.getApplicationEx().isInternal() ? "

" + StringUtil.getThrowableText(e) + "

" : ""), - NotificationType.ERROR); - Notifications.Bus.notify(notification, this); - LOG.info("Unable to save plugin settings",e); - } - catch (IOException e) { - MessagesEx.error(this, ProjectBundle.message("project.save.error", e.getMessage())).showLater(); - LOG.info("Error saving project", e); - } finally { - mySavingInProgress.set(false); - ApplicationManager.getApplication().getMessageBus().syncPublisher(ProjectSaved.TOPIC).saved(this); - } + StoreUtil.doSave(getStateStore()); + } + catch (IComponentStore.SaveCancelledException e) { + LOG.info(e); + } + catch (PluginException e) { + PluginManager.disablePlugin(e.getPluginId().getIdString()); + Notification notification = new Notification( + PLUGIN_SETTINGS_ERROR, + "Unable to save plugin settings!", + "

The plugin " + e.getPluginId() + " failed to save settings and has been disabled. Please restart" + + ApplicationNamesInfo.getInstance().getFullProductName() + "

" + + (ApplicationManagerEx.getApplicationEx().isInternal() ? "

" + StringUtil.getThrowableText(e) + "

" : ""), + NotificationType.ERROR); + Notifications.Bus.notify(notification, this); + LOG.info("Unable to save plugin settings",e); + } + catch (IOException e) { + MessagesEx.error(this, ProjectBundle.message("project.save.error", e.getMessage())).showLater(); + LOG.info("Error saving project", e); + } finally { + mySavingInProgress.set(false); + ApplicationManager.getApplication().getMessageBus().syncPublisher(ProjectSaved.TOPIC).saved(this); } } diff --git a/plugins/git4idea/tests/git4idea/test/GitMockProject.groovy b/plugins/git4idea/tests/git4idea/test/GitMockProject.groovy index d9455e20852d..2a042bdae16d 100644 --- a/plugins/git4idea/tests/git4idea/test/GitMockProject.groovy +++ b/plugins/git4idea/tests/git4idea/test/GitMockProject.groovy @@ -23,6 +23,7 @@ import com.intellij.util.messages.MessageBus import com.intellij.openapi.extensions.ExtensionPointName import com.intellij.openapi.util.Condition import com.intellij.openapi.util.Key +import org.jetbrains.annotations.NotNull /** * @@ -36,6 +37,7 @@ class GitMockProject implements Project { myProjectDir = projectDir } + @NotNull @Override String getName() { throw new UnsupportedOperationException() @@ -56,6 +58,7 @@ class GitMockProject implements Project { throw new UnsupportedOperationException() } + @NotNull @Override String getProjectFilePath() { throw new UnsupportedOperationException() @@ -71,6 +74,7 @@ class GitMockProject implements Project { throw new UnsupportedOperationException() } + @NotNull @Override String getLocationHash() { throw new UnsupportedOperationException()