Skip to content

Commit

Permalink
Merge pull request #13 from leewyatt/fix-12
Browse files Browse the repository at this point in the history
#12 fix 2023.2+ version error info.
  • Loading branch information
lutzyt authored Sep 28, 2023
2 parents 96d1af0 + 711d22d commit a7d949b
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 19 deletions.
15 changes: 8 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
plugins {
id 'java'
// https://github.com/JetBrains/gradle-intellij-plugin
id 'org.jetbrains.intellij' version '0.7.3'
id 'org.jetbrains.intellij' version '1.10.1'
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
runIde {
jvmArgs '--add-exports', 'java.base/jdk.internal.vm=ALL-UNNAMED'
Expand Down Expand Up @@ -40,14 +40,15 @@ dependencies {

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version "203.6682.168"
pluginName 'Notebook'
updateSinceUntilBuild false
setVersion "2023.2.2"
setType "IU"
setPluginName 'Notebook'
setUpdateSinceUntilBuild false
// plugins = ["com.intellij.java", "org.jetbrains.kotlin", "Dart:203.5981.155","org.intellij.plugins.markdown"]
plugins = ["com.intellij.java", "org.jetbrains.kotlin"]
}
patchPluginXml {
sinceBuild "203.6682.168"
setSinceBuild "203.*"
}

//patchPluginXml {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void actionPerformed(AnActionEvent e) {
Project eventProject = ActivateToolWindowAction.getEventProject(e);
ToolWindow toolWindow = ToolWindowManager.getInstance(eventProject).getToolWindow(PluginConstant.TOOLWINDOW_ID);

NotebooksUIManager uiManager = ServiceManager.getService(eventProject, NotebooksUIManager.class);
NotebooksUIManager uiManager = e.getProject().getService(NotebooksUIManager.class);
MainPanel mainPanel = uiManager.getMainPanel();

// 如果Notebook已经处于打开状态,则不自动展开①笔记选择栏和②笔记描述栏
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void elementChosen(ChooseByNamePopup chooseByNamePopup, Object o) {
SearchRecord searchRecord = NoteChooseByname.records.parallelStream()
.filter(p -> p.toString().equals(chosenElement.getValue())).findFirst().get();

NotebooksUIManager uiManager = (NotebooksUIManager) ServiceManager.getService(e.getProject(), NotebooksUIManager.class);
NotebooksUIManager uiManager = e.getProject().getService(NotebooksUIManager.class);
MainPanel mainPanel = uiManager.getMainPanel();
// 通过搜索框打开Notebook自动收缩笔记选择栏
JComponent northPanel = mainPanel.getDetailPanel().getNorthPanel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@

import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.startup.StartupActivity;
import com.intellij.openapi.startup.ProjectActivity;
import com.itcodebox.notebooks.utils.ImportUtil;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class StartUpWork implements StartupActivity{

public class StartUpWork implements ProjectActivity {

@Nullable
@Override
public void runActivity(@NotNull Project project) {
public Object execute(@NotNull Project project, @NotNull Continuation<? super Unit> continuation) {
@NotNull Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
if (openProjects.length == 1) {
ImportUtil.publishReadOnlyMode(project,false);
}
return continuation;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.Separator;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
Expand Down Expand Up @@ -59,7 +60,7 @@ public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindo
NotebooksUIManager uiManger = project.getService(NotebooksUIManager.class);
uiManger.setMainPanel(mainPanel);
// 获取内容工厂的实例
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
ContentFactory contentFactory = ContentFactory.getInstance();
// 获取用于toolWindow显示的内容
Content content = contentFactory.createContent(mainPanel, "", false);
//给toolWindow设置内容
Expand All @@ -73,7 +74,7 @@ public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindo
// 强制转换
ToolWindowEx tw = (ToolWindowEx) toolWindow;
//齿轮上添加 动作按钮
SimpleActionGroup gearActions = new SimpleActionGroup();
DefaultActionGroup gearActions = new DefaultActionGroup();
gearActions.add(initActionExportJson());
gearActions.add(initActionImportJson());
gearActions.add(new Separator());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.itcodebox.notebooks.ui.notify;

import com.intellij.notification.*;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.EmptyAction;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
Expand All @@ -25,7 +27,7 @@ public class NotifyUtil {

public static void showNotification(Project project, String displayId, String title, String content, NotificationType type) {
Notification notification = new Notification(PluginConstant.DEFAULT_NOTIFICATION_GROUP_ID,title, content, type);
notification.setListener(URL_OPENING_LISTENER);
notification.addAction(new EmptyAction());
Notifications.Bus.notify(notification, project);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public AbstractRecordTable(Project project) {
// 单元格的间隙为0
setIntercellSpacing(new Dimension(0, 0));
//让TableView可以搜索
tableSpeedSearch = new TableSpeedSearch(this);
tableSpeedSearch = TableSpeedSearch.installOn(this);
//让表格支持拖动
setDragEnabled(true);
// 设置表格拖动模式为插入行(实现位置的交换)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public ImageTable(Project project) {
// 单元格的间隙为0
setIntercellSpacing(new Dimension(0, 0));
//让TableView可以搜索
tableSpeedSearch = new TableSpeedSearch(this);
tableSpeedSearch = TableSpeedSearch.installOn(this);
//让表格支持拖动
setDragEnabled(true);
// 设置表格拖动模式为插入行(实现位置的交换)
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<!-- 当ToolWindow处于打开状态时, 这个 postStartupActivity居然比ToolWindow还晚启动 ;
public class StartUpWork implements StartupActivity
-->
<postStartupActivity implementation="com.itcodebox.notebooks.projectservice.StartUpWork"/>
<postStartupActivity implementation="com.itcodebox.notebooks.projectservice.StartUpWork" id="postStartupActivity"/>
<!-- APP级别的数据库相关的服务 -->
<applicationService serviceImplementation="com.itcodebox.notebooks.service.DatabaseBasicService"/>
<applicationService serviceImplementation="com.itcodebox.notebooks.service.impl.NotebookServiceImpl"/>
Expand All @@ -119,6 +119,7 @@
icon="PluginIcons.ToolWindowBlue"/>
<applicationConfigurable parentId="tools"
instance="com.itcodebox.notebooks.ui.toolsettings.AppSettingsConfigurable"
key="settingPage.name"
id="com.itcodebox.notebooks.ui.toolsettings.AppSettingsConfigurable"/>

<!-- 状态栏添加小组件, 显示光标目前的offset_start和offset_end -->
Expand Down

0 comments on commit a7d949b

Please sign in to comment.