兼容低版本IDEA

This commit is contained in:
makejava 2022-10-13 12:12:17 +08:00
parent fc843d0ee6
commit b01738c9c8
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.database.psi.DbTable;
import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.components.PersistentStateComponent; import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiClass; import com.intellij.psi.PsiClass;
import com.sjhy.plugin.dto.TableInfoSettingsDTO; import com.sjhy.plugin.dto.TableInfoSettingsDTO;
@ -25,7 +26,7 @@ public interface TableInfoSettingsService extends PersistentStateComponent<Table
*/ */
static TableInfoSettingsService getInstance() { static TableInfoSettingsService getInstance() {
try { try {
return ProjectUtils.getCurrProject().getService(TableInfoSettingsServiceImpl.class); return ServiceManager.getService(ProjectUtils.getCurrProject(), TableInfoSettingsServiceImpl.class);
} catch (AssertionError e) { } catch (AssertionError e) {
// 出现配置文件被错误修改或不兼容时直接删除配置文件 // 出现配置文件被错误修改或不兼容时直接删除配置文件
VirtualFile workspaceFile = ProjectUtils.getCurrProject().getWorkspaceFile(); VirtualFile workspaceFile = ProjectUtils.getCurrProject().getWorkspaceFile();
@ -42,7 +43,7 @@ public interface TableInfoSettingsService extends PersistentStateComponent<Table
} }
} }
// 重新获取配置 // 重新获取配置
return ProjectUtils.getCurrProject().getService(TableInfoSettingsServiceImpl.class); return ServiceManager.getService(ProjectUtils.getCurrProject(), TableInfoSettingsServiceImpl.class);
} }
} }