當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。