Search in sources :

Example 1 with PartStackStateChangedEvent

use of org.eclipse.che.ide.api.parts.PartStackStateChangedEvent in project che by eclipse.

the class PartStackPresenter method setActivePart.

/** {@inheritDoc} */
@Override
public void setActivePart(@NotNull PartPresenter part) {
    TabItem tab = getTabByPart(part);
    if (tab == null) {
        return;
    }
    activePart = part;
    activeTab = tab;
    if (state == State.MINIMIZED) {
        state = State.NORMAL;
        if (currentSize < MIN_PART_SIZE) {
            currentSize = DEFAULT_PART_SIZE;
        }
        workBenchPartController.setSize(currentSize);
        workBenchPartController.setMinSize(MIN_PART_SIZE);
        workBenchPartController.setHidden(false);
    } else if (state == State.COLLAPSED) {
        // Ask the delegate to restore part stacks.
        if (delegate != null) {
            delegate.onRestore(this);
        }
    } else if (state == State.NORMAL) {
        if (workBenchPartController.getSize() < MIN_PART_SIZE) {
            workBenchPartController.setMinSize(MIN_PART_SIZE);
            workBenchPartController.setSize(DEFAULT_PART_SIZE);
        }
        workBenchPartController.setHidden(false);
    }
    // Notify the part stack state has been changed.
    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {

        @Override
        public void execute() {
            eventBus.fireEvent(new PartStackStateChangedEvent(PartStackPresenter.this));
        }
    });
    selectActiveTab(tab);
}
Also used : TabItem(org.eclipse.che.ide.api.parts.PartStackView.TabItem) Scheduler(com.google.gwt.core.client.Scheduler) PartStackStateChangedEvent(org.eclipse.che.ide.api.parts.PartStackStateChangedEvent)

Aggregations

Scheduler (com.google.gwt.core.client.Scheduler)1 PartStackStateChangedEvent (org.eclipse.che.ide.api.parts.PartStackStateChangedEvent)1 TabItem (org.eclipse.che.ide.api.parts.PartStackView.TabItem)1