Skip to content

[Task]: Speed up project change and perspective change #5985

@nadment

Description

@nadment

What needs to happen?

Project change

When changing projects, the Explorer and Metadata perspectives are refreshed as many times as there are tabs open in those views.

To speed up project switching, add a boolean to the HopGuiFileDelegate class to indicate whether the GUI is in the process of closing all files.

 public void closeAllFiles() {
    this.isClosing = true;
    for (IHopPerspective perspective : hopGui.getPerspectiveManager().getPerspectives()) {
      List<TabItemHandler> tabItemHandlers = perspective.getItems();
       for (TabItemHandler tabItemHandler : handlers) {
          IHopFileTypeHandler typeHandler = tabItemHandler.getTypeHandler();
          typeHandler.close();
        }      
    }
    this.isClosing = false;
  }

This way, when each tab is removed, unnecessary refreshing can be avoided.

public boolean remove(IHopFileTypeHandler fileTypeHandler) {
...
     // Avoid refresh in a closing process (when switching project)
     if (!hopGui.fileDelegate.isClosing()) {

            // Refresh tree to remove bold
            this.refresh();

            // Update HopGui menu and toolbar
            this.updateGui();
          }
   ...
}

Perspective change

When you switch from perspective A to perspective B, two events are sent.
In order, the first event indicates the disabled element, and the second indicates the enabled element.
If a perspective is already enabled, ignore the first event that indicates a deactivated item to avoid unnecessary refreshes.

Issue Priority

Priority: 3

Issue Component

Component: Hop Gui

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions