Skip to content

Commit

Permalink
Suggested fix for issue vsch#59 - Serial tool window exception
Browse files Browse the repository at this point in the history
Used this commit from another plugin to suggest a fix for this one:
antlr/intellij-plugin-v4@097170b
Note - untested and Java is not my main language.
  • Loading branch information
Basirk authored May 31, 2022
1 parent 3c1e787 commit 24ff842
Showing 1 changed file with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,22 @@ public class SerialMonitorToolWindow {

public SerialMonitorToolWindow(Project project) {
this.project = project;
toolWindow = ToolWindowManager.getInstance(project).registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.BOTTOM, project, true);
toolWindow.setIcon(PluginIcons.serial_port_tool);

//JPanel mainPanel = new JPanel(new BorderLayout());
//mainPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
SimpleToolWindowPanel mainPanel = new SimpleToolWindowPanel(false, true);

mySerialMonitorPanel = new SerialMonitorPanel(project);
mainPanel.add(mySerialMonitorPanel.getComponent());

ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Content content = contentFactory.createContent(mainPanel, Bundle.message("toolwindow.serial-monitor.title"), false);
myToolWindowContentMap.put(SERIAL_MONITOR_ID, content);
toolWindow.getContentManager().addContent(content);
toolWindowManager.invokeLater(() -> {
toolWindow = ToolWindowManager.getInstance(project).registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.BOTTOM, project, true);
toolWindow.setIcon(PluginIcons.serial_port_tool);

//JPanel mainPanel = new JPanel(new BorderLayout());
//mainPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
SimpleToolWindowPanel mainPanel = new SimpleToolWindowPanel(false, true);

mySerialMonitorPanel = new SerialMonitorPanel(project);
mainPanel.add(mySerialMonitorPanel.getComponent());

ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Content content = contentFactory.createContent(mainPanel, Bundle.message("toolwindow.serial-monitor.title"), false);
myToolWindowContentMap.put(SERIAL_MONITOR_ID, content);
toolWindow.getContentManager().addContent(content);
});
}

public void unregisterToolWindow() {
Expand Down

0 comments on commit 24ff842

Please sign in to comment.