本文整理匯總了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);
}
示例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;
}
}
}
};
}
示例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);
}
示例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;
}
示例5: getConfigurationMacro
import com.intellij.openapi.components.StoragePathMacros; //導入依賴的package包/類
@Nonnull
@Override
protected String getConfigurationMacro(boolean directorySpec) {
return StoragePathMacros.PROJECT_CONFIG_DIR;
}
示例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;
}