use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class MaximizeWindowAction method doUpdateState.
/**
* Updates state and text of this action.
*/
private void doUpdateState() {
WindowManagerImpl wm = WindowManagerImpl.getInstance();
TopComponent active = getTCToWorkWith();
boolean maximize;
ModeImpl activeMode = (ModeImpl) wm.findMode(active);
if (activeMode == null || !Switches.isTopComponentMaximizationEnabled() || !Switches.isMaximizationEnabled(active) || (!wm.isDocked(active) && !wm.isEditorMode(activeMode))) {
getMenuPresenter().setSelected(false);
getPopupPresenter().setSelected(false);
setEnabled(false);
return;
}
if (wm.isDocked(active)) {
maximize = wm.getCurrentMaximizedMode() != activeMode;
} else {
maximize = activeMode.getFrameState() == Frame.NORMAL;
}
if (activeMode != null && activeMode.getKind() == Constants.MODE_KIND_SLIDING) {
maximize = null != active && !wm.isTopComponentMaximizedWhenSlidedIn(wm.findTopComponentID(active));
}
state = !maximize;
getMenuPresenter().setSelected(state);
getPopupPresenter().setSelected(state);
setEnabled(activeMode != null);
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class MoveWindowAction method updateEnabled.
private void updateEnabled() {
TopComponent contextTc = getTCToWorkWith();
if (null == contextTc) {
setEnabled(false);
return;
}
ModeImpl mode = (ModeImpl) WindowManagerImpl.getInstance().findMode(contextTc);
if (null == mode || // || mode.getKind() == Constants.MODE_KIND_EDITOR
WindowManagerImpl.getInstance().getCurrentMaximizedMode() != null) {
setEnabled(false);
return;
}
setEnabled(true);
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class NewTabGroupAction method isEnabled.
@Override
public boolean isEnabled() {
TopComponent context = getTC2WorkWith();
boolean res = null != context;
if (res) {
WindowManagerImpl wm = WindowManagerImpl.getInstance();
ModeImpl mode = (ModeImpl) wm.findMode(context);
res &= null != mode;
if (res) {
res &= mode.getKind() == Constants.MODE_KIND_EDITOR;
res &= mode.getOpenedTopComponents().size() > 1;
res &= wm.isDocked(context);
}
}
return res;
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class NewTabGroupAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
// contextTC shound never be null thanks to isEnabled impl
WindowManagerImpl wmi = WindowManagerImpl.getInstance();
TopComponent contextTC = getTC2WorkWith();
if (null == contextTC)
// just being paranoid
return;
ModeImpl currentMode = (ModeImpl) wmi.findMode(contextTC);
if (null == currentMode || currentMode.getKind() != Constants.MODE_KIND_EDITOR || !wmi.isDocked(contextTC))
return;
wmi.newTabGroup(contextTC);
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class ModesSubModel method createSlidingModeSnapshots.
public Set<ModeStructureSnapshot.SlidingModeSnapshot> createSlidingModeSnapshots() {
Set<ModeStructureSnapshot.SlidingModeSnapshot> result = new HashSet<ModeStructureSnapshot.SlidingModeSnapshot>();
for (Map.Entry<ModeImpl, String> curEntry : slidingModes2Sides.entrySet()) {
final ModeImpl key = curEntry.getKey();
AbstractMap<TopComponent, Integer> lazy = new AbstractMap<TopComponent, Integer>() {
Map<TopComponent, Integer> delegate;
@Override
public Set<Entry<TopComponent, Integer>> entrySet() {
if (delegate == null) {
delegate = getSlideInSizes(key);
}
return delegate.entrySet();
}
};
result.add(new ModeStructureSnapshot.SlidingModeSnapshot(curEntry.getKey(), curEntry.getValue(), lazy));
}
return result;
}
Aggregations