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