Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested fix for issue #59 - Serial tool window exception #61

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(() -> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it this way and it worked.

Suggested change
toolWindowManager.invokeLater(() -> {
ToolWindowManager.getInstance(project).invokeLater(() -> {

eiryu@a7c5854

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

toolWindow = ToolWindowManager.getInstance(project).registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.BOTTOM, project, true);
Comment on lines +50 to +51
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

introduce local variable

Suggested change
toolWindowManager.invokeLater(() -> {
toolWindow = ToolWindowManager.getInstance(project).registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.BOTTOM, project, true);
ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
toolWindowManager.invokeLater(() -> {
toolWindow = toolWindowManager.registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.BOTTOM, project, true);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you to come up with this fix!
Uhm.. Where/how can I change an installed CLion Plugin? I can just find the CLionArduinoPlugin binary File..

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you create a zip or jar, you may be able to install it. (I have not tried it.)
https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this not added 😠

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you create a zip or jar, you may be able to install it. (I have not tried it.) https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk

Gives me: Fail to load plugin descriptor from file CLionArduinoPlugin-patch-1.zip

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