兼容低版本IDEA

This commit is contained in:
makejava 2022-10-13 12:14:01 +08:00
parent af853461d8
commit 7328e16d6d
1 changed files with 3 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package com.sjhy.plugin.service;
import com.intellij.database.psi.DbTable;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.sjhy.plugin.dto.TableInfoSettingsDTO;
import com.sjhy.plugin.entity.TableInfo;
@ -24,7 +25,7 @@ public interface TableInfoSettingsService extends PersistentStateComponent<Table
*/
static TableInfoSettingsService getInstance() {
try {
return ProjectUtils.getCurrProject().getService(TableInfoSettingsServiceImpl.class);
return ServiceManager.getService(ProjectUtils.getCurrProject(), TableInfoSettingsServiceImpl.class);
} catch (AssertionError e) {
// 出现配置文件被错误修改或不兼容时直接删除配置文件
VirtualFile workspaceFile = ProjectUtils.getCurrProject().getWorkspaceFile();
@ -41,7 +42,7 @@ public interface TableInfoSettingsService extends PersistentStateComponent<Table
}
}
// 重新获取配置
return ProjectUtils.getCurrProject().getService(TableInfoSettingsServiceImpl.class);
return ServiceManager.getService(ProjectUtils.getCurrProject(), TableInfoSettingsServiceImpl.class);
}
}