本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
}