Java 类com.intellij.openapi.components.impl.stores.StoreUtil 实例源码

项目:intellij-ce-playground    文件:ProjectImpl.java   
@Override
public void save() {
  if (ApplicationManagerEx.getApplicationEx().isDoNotSave()) {
    // no need to save
    return;
  }

  if (!mySavingInProgress.compareAndSet(false, true)) {
    return;
  }

  try {
    if (isToSaveProjectName()) {
      try {
        String basePath = getStateStore().getProjectBasePath();
        File baseDir = basePath == null ? null : new File(basePath);
        if (baseDir != null && baseDir.exists()) {
          File ideaDir = new File(baseDir, DIRECTORY_STORE_FOLDER);
          if (ideaDir.exists() && ideaDir.isDirectory()) {
            FileUtil.writeToFile(new File(ideaDir, NAME_FILE), getName());
            myOldName = null;

            RecentProjectsManager.getInstance().clearNameCache();
          }
        }
      }
      catch (Throwable e) {
        LOG.error("Unable to store project name", e);
      }
    }

    StoreUtil.save(ServiceKt.getStateStore(this), this);
  }
  finally {
    mySavingInProgress.set(false);
    ApplicationManager.getApplication().getMessageBus().syncPublisher(ProjectSaved.TOPIC).saved(this);
  }
}
项目:intellij-ce-playground    文件:ApplicationImpl.java   
@Override
public void saveSettings() {
  if (myDoNotSave) return;

  if (mySaveSettingsIsInProgress.compareAndSet(false, true)) {
    try {
      StoreUtil.save(ServiceKt.getStateStore(this), null);
    }
    finally {
      mySaveSettingsIsInProgress.set(false);
    }
  }
}
项目:consulo    文件:ApplicationImpl.java   
public void _saveSettings() {
  if (mySaveSettingsIsInProgress.compareAndSet(false, true)) {
    HeavyProcessLatch.INSTANCE.prioritizeUiActivity();

    try {
      StoreUtil.save(getStateStore(), null);
    }
    finally {
      mySaveSettingsIsInProgress.set(false);
    }
  }
}