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


Java StateStorageManager类代码示例

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


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

示例1: saveChangedProjectFile

import com.intellij.openapi.components.impl.stores.StateStorageManager; //导入依赖的package包/类
@Override
public void saveChangedProjectFile(@Nonnull VirtualFile file, @Nonnull Project project) {
  StateStorageManager storageManager = ((ProjectEx)project).getStateStore().getStateStorageManager();
  String fileSpec = storageManager.collapseMacros(file.getPath());
  Couple<Collection<FileBasedStorage>> storages = storageManager.getCachedFileStateStorages(Collections.singletonList(fileSpec), Collections.<String>emptyList());
  FileBasedStorage storage = ContainerUtil.getFirstItem(storages.first);
  // if empty, so, storage is not yet loaded, so, we don't have to reload
  if (storage != null) {
    registerProjectToReload(project, file, storage);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:ProjectManagerImpl.java

示例2: ClasspathStorage

import com.intellij.openapi.components.impl.stores.StateStorageManager; //导入依赖的package包/类
public ClasspathStorage(@NotNull final Module module, @NotNull StateStorageManager storageManager) {
  String storageType = module.getOptionValue(JpsProjectLoader.CLASSPATH_ATTRIBUTE);
  if (storageType == null) {
    throw new IllegalStateException("Classpath storage requires non-default storage type");
  }

  ClasspathStorageProvider provider = getProvider(storageType);
  if (provider == null) {
    throw new IllegalStateException("Classpath storage provider not found, please ensure that Eclipse plugin is installed");
  }
  myConverter = provider.createConverter(module);

  myPathMacroSubstitutor = storageManager.getMacroSubstitutor();

  final List<String> paths = myConverter.getFilePaths();
  MessageBusConnection busConnection = module.getMessageBus().connect();
  busConnection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener.Adapter() {
    @Override
    public void after(@NotNull List<? extends VFileEvent> events) {
      for (VFileEvent event : events) {
        if (!event.isFromRefresh() || !(event instanceof VFileContentChangeEvent)) {
          continue;
        }

        for (String path : paths) {
          if (path.equals(event.getPath())) {
            module.getMessageBus().syncPublisher(StateStorageManager.STORAGE_TOPIC).storageFileChanged(event, ClasspathStorage.this, module);
            return;
          }
        }
      }
    }
  });

  busConnection.subscribe(StateStorageManager.STORAGE_TOPIC, new StorageManagerListener() {
    private String fileNameToModuleName(@NotNull String fileName) {
      return fileName.substring(0, fileName.length() - ModuleFileType.DOT_DEFAULT_EXTENSION.length());
    }

    @Override
    public void storageFileChanged(@NotNull VFileEvent event, @NotNull StateStorage storage, @NotNull ComponentManager componentManager) {
      assert componentManager == module;
      if (!(event instanceof VFilePropertyChangeEvent)) {
        return;
      }

      VFilePropertyChangeEvent propertyEvent = (VFilePropertyChangeEvent)event;
      if (propertyEvent.getPropertyName().equals(VirtualFile.PROP_NAME)) {
        String oldFileName = (String)propertyEvent.getOldValue();
        if (oldFileName.endsWith(ModuleFileType.DOT_DEFAULT_EXTENSION)) {
          ClasspathStorageProvider provider = getProvider(ClassPathStorageUtil.getStorageType(module));
          if (provider != null) {
            provider.moduleRenamed(module, fileNameToModuleName(oldFileName), fileNameToModuleName((String)propertyEvent.getNewValue()));
          }
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:60,代码来源:ClasspathStorage.java

示例3: getStateStorageManager

import com.intellij.openapi.components.impl.stores.StateStorageManager; //导入依赖的package包/类
@NotNull
@Override
public StateStorageManager getStateStorageManager() {
  throw new UnsupportedOperationException("Method getStateStorageManager not implemented in " + getClass());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:6,代码来源:MockProjectStore.java

示例4: getStateStorageManager

import com.intellij.openapi.components.impl.stores.StateStorageManager; //导入依赖的package包/类
@Nonnull
@Override
public StateStorageManager getStateStorageManager() {
  throw new UnsupportedOperationException("Method getStateStorageManager not implemented in " + getClass());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:6,代码来源:MockProjectStore.java

示例5: ExternalStorageStreamProvider

import com.intellij.openapi.components.impl.stores.StateStorageManager; //导入依赖的package包/类
public ExternalStorageStreamProvider(ExternalStorage storage, StateStorageManager stateStorageManager) {
  myStorage = storage;
  myStateStorageManager = stateStorageManager;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:ExternalStorageStreamProvider.java

示例6: LoadItem

import com.intellij.openapi.components.impl.stores.StateStorageManager; //导入依赖的package包/类
LoadItem(String fileSpec, RoamingType roamingType, int modCount, StateStorageManager stateStorageManager) {
  myFileSpec = fileSpec;
  myRoamingType = roamingType;
  myModCount = modCount;
  myStateStorageManager = stateStorageManager;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:7,代码来源:ExternalStorageQueue.java

示例7: getExportableComponentsMap

import com.intellij.openapi.components.impl.stores.StateStorageManager; //导入依赖的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

示例8: beforeApplicationLoaded

import com.intellij.openapi.components.impl.stores.StateStorageManager; //导入依赖的package包/类
@Override
public void beforeApplicationLoaded(Application application) {
  ApplicationEx2 applicationEx = (ApplicationEx2)application;

  IApplicationStore stateStore = applicationEx.getStateStore();

  StateStorageManager stateStorageManager = stateStore.getStateStorageManager();

  ExternalStorage storage = new ExternalStorage();

  stateStorageManager.setStreamProvider(new ExternalStorageStreamProvider(storage, stateStorageManager));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:ExternalStorageAppListener.java

示例9: wantLoad

import com.intellij.openapi.components.impl.stores.StateStorageManager; //导入依赖的package包/类
void wantLoad(@Nonnull String fileSpec, @Nonnull RoamingType roamingType, int mod, @Nonnull StateStorageManager stateStorageManager) {
  myLoadTask.cancel(false);

  myLoadItems.add(new LoadItem(fileSpec, roamingType, mod, stateStorageManager));

  myLoadTask = AppExecutorUtil.getAppScheduledExecutorService().schedule(this::executeLoad, 1, TimeUnit.MINUTES);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:ExternalStorageQueue.java


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