@PostConstruct public void initialize() { // Initializing the handlers installedHandlers.iterator().forEachRemaining(handler -> handler.init(() -> setActiveHandler(handler))); }
public void setActiveHandler(WorkbenchDocksHandler handler) { if (!isAuthoringActive()) { return; } // If there's an active handler let's check if it should refresh docks if (activeHandler != null) { if (activeHandler.equals(handler) && !activeHandler.shouldRefreshDocks()) { return; } } // setting the new handler as active activeHandler = handler; if (activeHandler.shouldDisableDocks()) { // disable docks uberfireDocks.hide(UberfireDockPosition.EAST, currentPerspectiveIdentifier); } else { // first remove the existing docks if (activeDocks != null) { uberfireDocks.remove(activeDocks); } // getting docks from the handler and refreshing Collection<UberfireDock> docks = activeHandler.provideDocks(currentPerspectiveIdentifier); activeDocks = docks.toArray(new UberfireDock[docks.size()]); uberfireDocks.add(activeDocks); uberfireDocks.show(UberfireDockPosition.EAST, currentPerspectiveIdentifier); } }