兼容至IDEA171版本

This commit is contained in:
makejava 2021-08-30 15:24:46 +08:00
parent 5437558e8f
commit 1aeb7555da
4 changed files with 21 additions and 8 deletions

View File

@ -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;
}

View File

@ -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官网地址<a href='http://www.shujuhaiyang.com'>www.shujuhaiyang.com</a>");
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官网地址<a href='http://www.shujuhaiyang.com'>www.shujuhaiyang.com</a>");
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
// 兼容旧版本
Messages.showInputDialog(ProjectUtils.getCurrProject(), result, GlobalDict.TITLE_INFO, AllIcons.General.InformationDialog, token, new NonEmptyInputValidator(), null);
}
}
}

View File

@ -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(),

View File

@ -69,6 +69,11 @@ public class EditorComponent<T extends AbstractEditorItem> {
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) {