当前位置: 首页>>代码示例>>Java>>正文


Java StorageUtil.loadDocument方法代码示例

本文整理汇总了Java中com.intellij.openapi.components.impl.stores.StorageUtil.loadDocument方法的典型用法代码示例。如果您正苦于以下问题:Java StorageUtil.loadDocument方法的具体用法?Java StorageUtil.loadDocument怎么用?Java StorageUtil.loadDocument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.components.impl.stores.StorageUtil的用法示例。


在下文中一共展示了StorageUtil.loadDocument方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readDeletedSchemeNames

import com.intellij.openapi.components.impl.stores.StorageUtil; //导入方法依赖的package包/类
private Collection<String> readDeletedSchemeNames() {
  Collection<String> result = new HashSet<String>();
  for (StreamProvider provider : getEnabledProviders()) {
    try {
      Document deletedNameDoc = StorageUtil.loadDocument(provider.loadContent(getFileFullPath(DELETED_XML), myRoamingType));
      if (deletedNameDoc != null) {
        for (Object child : deletedNameDoc.getRootElement().getChildren()) {
          String deletedSchemeName = ((Element)child).getAttributeValue("name");
          if (deletedSchemeName != null) {
            result.add(deletedSchemeName);
          }
        }
      }
    }
    catch (Exception e) {
      LOG.debug(e);
    }
  }

  return result;

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:SchemesManagerImpl.java

示例2: loadGlobalScheme

import com.intellij.openapi.components.impl.stores.StorageUtil; //导入方法依赖的package包/类
@Nullable
private static Document loadGlobalScheme(final String schemePath) throws IOException {
  final StreamProvider[] providers = ((ApplicationImpl)ApplicationManager.getApplication()).getStateStore().getStateStorageManager()
      .getStreamProviders(RoamingType.GLOBAL);
  for (StreamProvider provider : providers) {
    if (provider.isEnabled()) {
      Document document = StorageUtil.loadDocument(provider.loadContent(schemePath, RoamingType.GLOBAL));
      if (document != null) return document;
    }
  }

  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:SchemesManagerImpl.java

示例3: readSchemesFromProviders

import com.intellij.openapi.components.impl.stores.StorageUtil; //导入方法依赖的package包/类
private Collection<E> readSchemesFromProviders() {
  Collection<E> result = new ArrayList<E>();
  for (StreamProvider provider : getEnabledProviders()) {
    String[] paths = provider.listSubFiles(myFileSpec);
    for (String subpath : paths) {
      if (!subpath.equals(DELETED_XML)) {
        try {
          final Document subDocument = StorageUtil.loadDocument(provider.loadContent(getFileFullPath(subpath), myRoamingType));
          if (subDocument != null) {
            E scheme = readScheme(subDocument);
            boolean fileRenamed = false;
            T existing = findSchemeByName(scheme.getName());
            if (existing != null && existing instanceof ExternalizableScheme) {
              String currentFileName = ((ExternalizableScheme)existing).getExternalInfo().getCurrentFileName();
              if (currentFileName != null && !currentFileName.equals(subpath)) {
                deleteServerFiles(subpath);
                subpath = currentFileName;
                fileRenamed = true;
              }

            }
            String fileName = checkFileNameIsFree(subpath, scheme.getName());

            if (!fileRenamed && !fileName.equals(subpath)) {
              deleteServerFiles(subpath);
            }

            if (scheme != null) {
              loadScheme(scheme, false, fileName);
              result.add(scheme);
            }

          }
        }
        catch (Exception e) {
          LOG.info("Cannot load data from IDEAServer: " + e.getLocalizedMessage());
        }
      }
    }
  }
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:43,代码来源:SchemesManagerImpl.java

示例4: loadSharedSchemes

import com.intellij.openapi.components.impl.stores.StorageUtil; //导入方法依赖的package包/类
@NotNull
public Collection<SharedScheme<E>> loadSharedSchemes(Collection<T> currentSchemeList) {
  Collection<String> names = new HashSet<String>(getAllSchemeNames(currentSchemeList));

  final StreamProvider[] providers = ((ApplicationImpl)ApplicationManager.getApplication()).getStateStore().getStateStorageManager()
      .getStreamProviders(RoamingType.GLOBAL);
  final HashMap<String, SharedScheme<E>> result = new HashMap<String, SharedScheme<E>>();
  if (providers != null) {
    for (StreamProvider provider : providers) {
      if (provider.isEnabled()) {
        String[] paths = provider.listSubFiles(myFileSpec);
        for (String subpath : paths) {
          try {
            final Document subDocument = StorageUtil.loadDocument(provider.loadContent(getFileFullPath(subpath), RoamingType.GLOBAL));
            if (subDocument != null) {
              SharedSchemeData original = unwrap(subDocument);
              final E scheme = myProcessor.readScheme(original.original);
              if (!alreadyShared(subpath, currentSchemeList)) {
                String schemeName = original.name;
                String uniqueName = UniqueNameGenerator.generateUniqueName("[shared] " + schemeName, names);
                renameScheme(scheme, uniqueName);
                schemeName = uniqueName;
                scheme.getExternalInfo().setOriginalPath(getFileFullPath(subpath));
                scheme.getExternalInfo().setIsImported(true);
                result.put(schemeName,
                           new SharedScheme<E>(original.user == null ? "unknown" : original.user, original.description, scheme));
              }
            }
          }
          catch (Exception e) {
            LOG.debug("Cannot load data from IDEAServer: " + e.getLocalizedMessage());
          }
        }
      }
    }
  }

  for (SharedScheme<E> t : result.values()) {
    myProcessor.initScheme(t.getScheme());
  }

  return result.values();

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:45,代码来源:SchemesManagerImpl.java


注:本文中的com.intellij.openapi.components.impl.stores.StorageUtil.loadDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。