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


Java StoragePathMacros类代码示例

本文整理汇总了Java中com.intellij.openapi.components.StoragePathMacros的典型用法代码示例。如果您正苦于以下问题:Java StoragePathMacros类的具体用法?Java StoragePathMacros怎么用?Java StoragePathMacros使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: isProjectOrModuleFile

import com.intellij.openapi.components.StoragePathMacros; //导入依赖的package包/类
public static boolean isProjectOrModuleFile(@Nonnull String fileSpec) {
  return fileSpec.startsWith(StoragePathMacros.PROJECT_CONFIG_DIR);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:4,代码来源:StorageUtil.java

示例2: ApplicationStoreImpl

import com.intellij.openapi.components.StoragePathMacros; //导入依赖的package包/类
@SuppressWarnings({"UnusedDeclaration"})
public ApplicationStoreImpl(final ApplicationEx2 application, PathMacroManager pathMacroManager) {
  myApplication = application;
  myStateStorageManager =
          new StateStorageManagerImpl(pathMacroManager.createTrackingSubstitutor(), ROOT_ELEMENT_NAME, application, application.getPicoContainer()) {
            private boolean myConfigDirectoryRefreshed;

            @Nonnull
            @Override
            protected String getConfigurationMacro(boolean directorySpec) {
              return directorySpec ? StoragePathMacros.ROOT_CONFIG : StoragePathMacros.APP_CONFIG;
            }

            @Override
            protected StorageData createStorageData(@Nonnull String fileSpec, @Nonnull String filePath) {
              return new StorageData(ROOT_ELEMENT_NAME);
            }

            @Override
            protected TrackingPathMacroSubstitutor getMacroSubstitutor(@Nonnull final String fileSpec) {
              if (fileSpec.equals(StoragePathMacros.APP_CONFIG + '/' + PathMacrosImpl.EXT_FILE_NAME + DirectoryStorageData.DEFAULT_EXT)) return null;
              return super.getMacroSubstitutor(fileSpec);
            }

            @Override
            protected boolean isUseXmlProlog() {
              return false;
            }

            @Override
            protected void beforeFileBasedStorageCreate() {
              if (!myConfigDirectoryRefreshed && (application.isUnitTestMode() || application.isDispatchThread())) {
                try {
                  VirtualFile configDir = LocalFileSystem.getInstance().refreshAndFindFileByPath(getConfigPath());
                  if (configDir != null) {
                    VfsUtil.markDirtyAndRefresh(false, true, true, configDir);
                  }
                }
                finally {
                  myConfigDirectoryRefreshed = true;
                }
              }
            }
          };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:46,代码来源:ApplicationStoreImpl.java

示例3: setOptionsPath

import com.intellij.openapi.components.StoragePathMacros; //导入依赖的package包/类
@Override
public void setOptionsPath(@Nonnull String path) {
  myStateStorageManager.addMacro(StoragePathMacros.APP_CONFIG, path);
  myStateStorageManager.addMacro(StoragePathMacros.DEFAULT_FILE, path + "/other" + DirectoryStorageData.DEFAULT_EXT);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:ApplicationStoreImpl.java

示例4: setConfigPath

import com.intellij.openapi.components.StoragePathMacros; //导入依赖的package包/类
@Override
public void setConfigPath(@Nonnull final String configPath) {
  myStateStorageManager.addMacro(StoragePathMacros.ROOT_CONFIG, configPath);
  myConfigPath = configPath;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:ApplicationStoreImpl.java

示例5: getConfigurationMacro

import com.intellij.openapi.components.StoragePathMacros; //导入依赖的package包/类
@Nonnull
@Override
protected String getConfigurationMacro(boolean directorySpec) {
  return StoragePathMacros.PROJECT_CONFIG_DIR;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:ProjectStateStorageManager.java

示例6: getExportableComponentsMap

import com.intellij.openapi.components.StoragePathMacros; //导入依赖的package包/类
@Nonnull
public static MultiMap<File, ExportableItem> getExportableComponentsMap(final boolean onlyExisting) {
  final MultiMap<File, ExportableItem> result = MultiMap.createLinkedSet();

  ApplicationImpl application = (ApplicationImpl)ApplicationManager.getApplication();
  final StateStorageManager storageManager = application.getStateStore().getStateStorageManager();
  ServiceManagerImpl.processAllImplementationClasses(application, (aClass, pluginDescriptor) -> {
    State stateAnnotation = aClass.getAnnotation(State.class);
    if (stateAnnotation != null && !StringUtil.isEmpty(stateAnnotation.name())) {
      int storageIndex;
      Storage[] storages = stateAnnotation.storages();
      if (storages.length == 1) {
        storageIndex = 0;
      }
      else if (storages.length > 1) {
        storageIndex = storages.length - 1;
      }
      else {
        return true;
      }

      Storage storage = storages[storageIndex];
      if (storage.roamingType() != RoamingType.DISABLED) {
        String fileSpec = storageManager.buildFileSpec(storage);

        if (!fileSpec.startsWith(StoragePathMacros.APP_CONFIG)) {
          return true;
        }

        File file = new File(storageManager.expandMacros(fileSpec));

        File additionalExportFile = null;
        if (!StringUtil.isEmpty(stateAnnotation.additionalExportFile())) {
          additionalExportFile = new File(storageManager.expandMacros(stateAnnotation.additionalExportFile()));
          if (onlyExisting && !additionalExportFile.exists()) {
            additionalExportFile = null;
          }
        }

        boolean fileExists = !onlyExisting || file.exists();
        if (fileExists || additionalExportFile != null) {
          File[] files;
          if (additionalExportFile == null) {
            files = new File[]{file};
          }
          else {
            files = fileExists ? new File[]{file, additionalExportFile} : new File[]{additionalExportFile};
          }
          ExportableItem item = new ExportableItem(files, getComponentPresentableName(stateAnnotation, aClass, pluginDescriptor));
          result.putValue(file, item);
          if (additionalExportFile != null) {
            result.putValue(additionalExportFile, item);
          }
        }
      }
    }
    return true;
  });
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:61,代码来源:ExportSettingsAction.java


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