本文整理汇总了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);
}
}
示例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()));
}
}
}
}
});
}
示例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());
}
示例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());
}
示例5: ExternalStorageStreamProvider
import com.intellij.openapi.components.impl.stores.StateStorageManager; //导入依赖的package包/类
public ExternalStorageStreamProvider(ExternalStorage storage, StateStorageManager stateStorageManager) {
myStorage = storage;
myStateStorageManager = stateStorageManager;
}
示例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;
}
示例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;
}
示例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));
}
示例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);
}