Skip to content

Commit

Permalink
Remove refreshInlayPresentationDisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaopengjun authored and myoss committed Oct 12, 2024
1 parent aefc039 commit 7d7d360
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.zhongan.devpilot.util.ConfigChangeUtils;
import com.zhongan.devpilot.util.ConfigurableUtils;
import com.zhongan.devpilot.util.DevPilotMessageBundle;
import com.zhongan.devpilot.util.EditorUtils;

import javax.swing.JComponent;

Expand Down Expand Up @@ -72,10 +71,6 @@ public void apply() throws ConfigurationException {

var chatShortcutSettings = ChatShortcutSettingState.getInstance();
var methodInlayPresentationDisplayIndex = settingsComponent.getMethodInlayPresentationDisplayIndex();
// if inlay presentation display mode changed, refresh editor
if (!methodInlayPresentationDisplayIndex.equals(chatShortcutSettings.getDisplayIndex())) {
EditorUtils.refreshInlayPresentationDisplay(methodInlayPresentationDisplayIndex);
}
chatShortcutSettings.setDisplayIndex(methodInlayPresentationDisplayIndex);

PopupMenuEditorActionGroupUtil.refreshActions(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import org.apache.commons.lang3.math.NumberUtils;
import org.jetbrains.annotations.NotNull;

import static com.zhongan.devpilot.util.EditorUtils.refreshInlayPresentationDisplay;

public class StatusBarActions {

public static DefaultActionGroup buildStatusBarActionsGroup() {
Expand Down Expand Up @@ -74,7 +72,6 @@ private static DumbAwareAction createChatShortcutSwitchAction() {
event -> {
ChatShortcutSettingState.getInstance().setEnable(false);
ChatShortcutSettingState.getInstance().setDisplayIndex(NumberUtils.INTEGER_ZERO);

}
);
} else {
Expand All @@ -83,7 +80,6 @@ private static DumbAwareAction createChatShortcutSwitchAction() {
event -> {
ChatShortcutSettingState.getInstance().setEnable(true);
ChatShortcutSettingState.getInstance().setDisplayIndex(NumberUtils.INTEGER_ONE);
refreshInlayPresentationDisplay(NumberUtils.INTEGER_ONE);
}
);
}
Expand Down
14 changes: 0 additions & 14 deletions src/main/java/com/zhongan/devpilot/util/EditorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.editor.ScrollingModel;
import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -86,14 +82,4 @@ public static void openFileByRelativePath(String repo, @NotNull Project project,
FileEditorManager.getInstance(project).openTextEditor(new OpenFileDescriptor(project, file), true);
}

public static void refreshInlayPresentationDisplay(Integer methodInlayPresentationDisplayIndex) {
var projects = ProjectManager.getInstance().getOpenProjects();

Arrays.stream(projects).sequential().forEach(project ->
Optional.ofNullable(FileEditorManager.getInstance(project))
.flatMap(fileEditorManager -> Optional.ofNullable(fileEditorManager.getSelectedTextEditor()))
.flatMap(editor -> Optional.ofNullable(FileDocumentManager.getInstance().getFile(editor.getDocument())))
.ifPresent(virtualFile -> FileEditorManager.getInstance(project).updateFilePresentation(virtualFile))
);
}
}

0 comments on commit 7d7d360

Please sign in to comment.