Search in sources :

Example 1 with SlideController

use of org.netbeans.core.windows.view.ui.slides.SlideController in project netbeans-rcp-lite by outersky.

the class ActionUtils method createMinimizeWindowAction.

static Action createMinimizeWindowAction(TopComponent tc) {
    SlideController slideController = (SlideController) SwingUtilities.getAncestorOfClass(SlideController.class, tc);
    ModeImpl mode = findMode(tc);
    int tabIndex = null == mode ? -1 : mode.getOpenedTopComponents().indexOf(tc);
    boolean initialState = WindowManagerImpl.getInstance().isTopComponentMinimized(tc);
    Action res = new AutoHideWindowAction(slideController, tabIndex, initialState);
    res.setEnabled(null != mode && mode.getState() == Constants.MODE_STATE_JOINED);
    return res;
}
Also used : SlideController(org.netbeans.core.windows.view.ui.slides.SlideController)

Example 2 with SlideController

use of org.netbeans.core.windows.view.ui.slides.SlideController in project netbeans-rcp-lite by outersky.

the class MinimizeWindowAction method checkEnabled.

private boolean checkEnabled() {
    TopComponent context = TopComponent.getRegistry().getActivated();
    if (null == context) {
        return false;
    }
    SlideController slideController = (SlideController) SwingUtilities.getAncestorOfClass(SlideController.class, context);
    if (null == slideController)
        return false;
    ModeImpl mode = (ModeImpl) WindowManagerImpl.getInstance().findMode(context);
    if (null == mode)
        return false;
    if (WindowManagerImpl.getInstance().isTopComponentMinimized(context))
        return false;
    if (mode.getState() != Constants.MODE_STATE_JOINED)
        return false;
    if (mode.getKind() != Constants.MODE_KIND_VIEW)
        return false;
    return Switches.isTopComponentSlidingEnabled() && Switches.isSlidingEnabled(context);
}
Also used : ModeImpl(org.netbeans.core.windows.ModeImpl) SlideController(org.netbeans.core.windows.view.ui.slides.SlideController) TopComponent(org.openide.windows.TopComponent)

Aggregations

SlideController (org.netbeans.core.windows.view.ui.slides.SlideController)2 ModeImpl (org.netbeans.core.windows.ModeImpl)1 TopComponent (org.openide.windows.TopComponent)1