diff --git a/src/main/java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java b/src/main/java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java index 05398f1..82c76a5 100644 --- a/src/main/java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java +++ b/src/main/java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java @@ -36,7 +36,7 @@ public class TableInfoSettingsDTO { builder.insert(0, "."); } builder.insert(0, name); - element = element.getParent(); + element = (DbElement) element.getParent(); if (element == null) { break; } diff --git a/src/main/java/com/sjhy/plugin/service/impl/NetworkExportImportSettingsServiceImpl.java b/src/main/java/com/sjhy/plugin/service/impl/NetworkExportImportSettingsServiceImpl.java index 4986a68..a2a09c9 100644 --- a/src/main/java/com/sjhy/plugin/service/impl/NetworkExportImportSettingsServiceImpl.java +++ b/src/main/java/com/sjhy/plugin/service/impl/NetworkExportImportSettingsServiceImpl.java @@ -1,9 +1,11 @@ package com.sjhy.plugin.service.impl; import com.intellij.icons.AllIcons; +import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.InputValidator; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.NonEmptyInputValidator; +import com.intellij.openapi.util.TextRange; import com.sjhy.plugin.dict.GlobalDict; import com.sjhy.plugin.dto.SettingsStorageDTO; import com.sjhy.plugin.service.ExportImportSettingsService; @@ -12,6 +14,9 @@ import com.sjhy.plugin.tool.JSON; import com.sjhy.plugin.tool.ProjectUtils; import com.sjhy.plugin.tool.StringUtils; +import javax.swing.*; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -43,7 +48,13 @@ public class NetworkExportImportSettingsServiceImpl implements ExportImportSetti token = matcher.group(); } // 显示token - Messages.showInputDialog(ProjectUtils.getCurrProject(), result, GlobalDict.TITLE_INFO, AllIcons.General.InformationDialog, token, new NonEmptyInputValidator(), null, "Easy Code官网地址:www.shujuhaiyang.com"); + try { + Method method = Messages.class.getMethod("showInputDialog", Project.class, String.class, String.class, Icon.class, String.class, InputValidator.class, TextRange.class, String.class); + method.invoke(null, ProjectUtils.getCurrProject(), result, GlobalDict.TITLE_INFO, AllIcons.General.InformationDialog, token, new NonEmptyInputValidator(), null, "Easy Code官网地址:www.shujuhaiyang.com"); + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + // 兼容旧版本 + Messages.showInputDialog(ProjectUtils.getCurrProject(), result, GlobalDict.TITLE_INFO, AllIcons.General.InformationDialog, token, new NonEmptyInputValidator(), null); + } } } diff --git a/src/main/java/com/sjhy/plugin/ui/MainSettingForm.java b/src/main/java/com/sjhy/plugin/ui/MainSettingForm.java index db99a5e..8d9d277 100644 --- a/src/main/java/com/sjhy/plugin/ui/MainSettingForm.java +++ b/src/main/java/com/sjhy/plugin/ui/MainSettingForm.java @@ -1,15 +1,12 @@ package com.sjhy.plugin.ui; -import com.intellij.icons.AllIcons; import com.intellij.openapi.options.Configurable; import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.ui.MessageUtil; -import com.sjhy.plugin.dict.GlobalDict; import com.sjhy.plugin.dto.SettingsStorageDTO; import com.sjhy.plugin.service.impl.ClipboardExportImportSettingsServiceImpl; import com.sjhy.plugin.service.impl.LocalFileExportImportSettingsServiceImpl; import com.sjhy.plugin.service.impl.NetworkExportImportSettingsServiceImpl; -import com.sjhy.plugin.tool.ProjectUtils; +import com.sjhy.plugin.tool.MessageDialogUtils; import com.sjhy.plugin.tool.StringUtils; import com.sjhy.plugin.ui.component.ExportImportComponent; import org.jetbrains.annotations.NotNull; @@ -54,7 +51,7 @@ public class MainSettingForm implements Configurable, Configurable.Composite, Ba private void initEvent() { this.resetBtn.addActionListener(e -> { - boolean result = MessageUtil.showOkNoDialog(GlobalDict.TITLE_INFO, "确认恢复默认设置,所有Default分组配置将被重置,并且已删除的默认分组将被还原。确认继续?", ProjectUtils.getCurrProject(), "Ok", "No", AllIcons.General.Warning); + boolean result = MessageDialogUtils.yesNo("确认恢复默认设置,所有Default分组配置将被重置,并且已删除的默认分组将被还原。确认继续?"); if (result) { // 重置默认值后重新加载配置 getSettingsStorage().resetDefaultVal(); @@ -87,7 +84,7 @@ public class MainSettingForm implements Configurable, Configurable.Composite, Ba } @Override - public Configurable @NotNull [] getConfigurables() { + public @NotNull Configurable[] getConfigurables() { this.childConfigurableArray = new Configurable[]{ new TypeMapperSettingForm(), new TemplateSettingForm(), diff --git a/src/main/java/com/sjhy/plugin/ui/component/EditorComponent.java b/src/main/java/com/sjhy/plugin/ui/component/EditorComponent.java index 28f611e..2d69de8 100644 --- a/src/main/java/com/sjhy/plugin/ui/component/EditorComponent.java +++ b/src/main/java/com/sjhy/plugin/ui/component/EditorComponent.java @@ -69,6 +69,11 @@ public class EditorComponent { EditorSettingsInit.init(this.editor); // 添加监控事件 this.editor.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void beforeDocumentChange(DocumentEvent event) { + + } + @Override public void documentChanged(@NotNull DocumentEvent event) { if (file != null) {