How to reopen closed tab in custom intellij plugin?

Hi,

  I have developed a  custom intellij plugin and set  canCloseContents="true" so that the user will be able to close the tab.

But once closed,i am not able to reopen it.Is there a way to reopen the tab?

 

 

0
5 comments
Avatar
Permanently deleted user

No, you should manage reopening by yourself as in most cases closing means "release resources to avoid memory leaks".

1
Avatar
Permanently deleted user

Is there any way to open and close only one tab of the toolwindow in intellij custom plugin?

0
Avatar
Permanently deleted user

Sure, please use methods of ContentManager to manage tabs (you can get it via ToolWindow.getContentManager())

0
Avatar
Permanently deleted user

I have tried adding:-

public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
this.toolWindow = toolWindow;
this.project = project;
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Content content = contentFactory.createContent(windowContent, DEVICES_WINDOW_ID, false);
toolWindow.getComponent().putClientProperty(ToolWindowContentUi.HIDE_ID_LABEL, "true");
toolWindow.getContentManager().addContent(content);
content.setCloseable(true);
content.setShouldDisposeContent(true);
content.shouldDisposeContent();
content.isCloseable();
}


But still the tab is not closeable.
0
Avatar
Permanently deleted user

Are you sure you specify <toolWindow canCloseContents="true"... in plugin.xml for this certain toolwindow?

Content is closable by default but ContentManager has its own flag for all contents and this flag comes from plugin.xml

Also setShouldDisposeContent(true) is useless in your example as this property it true by default

0

Please sign in to leave a comment.