use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class MoveWindowWithinModeAction method updateEnabled.
private void updateEnabled() {
if (null == tc) {
return;
}
ModeImpl mode = (ModeImpl) WindowManagerImpl.getInstance().findMode(tc);
if (null == mode)
return;
int position = mode.getTopComponentTabPosition(tc);
if (0 == position && moveLeft) {
setEnabled(false);
return;
}
if (position == mode.getOpenedTopComponents().size() - 1 && !moveLeft) {
setEnabled(false);
return;
}
if (EditorOnlyDisplayer.getInstance().isActive()) {
setEnabled(false);
return;
}
setEnabled(true);
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class RecentViewListAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent evt) {
boolean editors = true;
boolean views = !documentsOnly;
if ("immediately".equals(evt.getActionCommand())) {
TopComponent activeTc = TopComponent.getRegistry().getActivated();
if (null != activeTc) {
if (TopComponentTracker.getDefault().isEditorTopComponent(activeTc)) {
// switching in a document, go to some other document
views = false;
} else {
// switching in a view, go to some other view
editors = false;
views = true;
}
}
}
TopComponent[] documents = getRecentWindows(editors, views);
if (documents.length < 2) {
return;
}
if (// NOI18N
!"immediately".equals(evt.getActionCommand()) && !(evt.getSource() instanceof javax.swing.JMenuItem)) {
// #46800: fetch key directly from action command
KeyStroke keyStroke = Utilities.stringToKey(evt.getActionCommand());
if (keyStroke != null) {
int triggerKey = keyStroke.getKeyCode();
int reverseKey = KeyEvent.VK_SHIFT;
int releaseKey = 0;
int modifiers = keyStroke.getModifiers();
if ((InputEvent.CTRL_MASK & modifiers) != 0) {
releaseKey = KeyEvent.VK_CONTROL;
} else if ((InputEvent.ALT_MASK & modifiers) != 0) {
releaseKey = KeyEvent.VK_ALT;
} else if ((InputEvent.META_MASK & modifiers) != 0) {
releaseKey = KeyEvent.VK_META;
}
if (releaseKey != 0) {
if (!KeyboardPopupSwitcher.isShown()) {
KeyboardPopupSwitcher.showPopup(documentsOnly, releaseKey, triggerKey, (evt.getModifiers() & KeyEvent.SHIFT_MASK) == 0);
}
return;
}
}
}
int documentIndex = (evt.getModifiers() & KeyEvent.SHIFT_MASK) == 0 ? 1 : documents.length - 1;
TopComponent tc = documents[documentIndex];
// #37226 Unmaximized the other mode if needed.
WindowManagerImpl wm = WindowManagerImpl.getInstance();
ModeImpl mode = (ModeImpl) wm.findMode(tc);
if (mode != null && mode != wm.getCurrentMaximizedMode()) {
wm.switchMaximizedMode(null);
}
tc.requestActive();
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class CloneDocumentAction method actionPerformed.
/**
* Perform the action. Sets/unsets maximzed mode.
*/
@Override
public void actionPerformed(java.awt.event.ActionEvent ev) {
TopComponent tc = TopComponent.getRegistry().getActivated();
if (tc == null || !(tc instanceof TopComponent.Cloneable)) {
return;
}
ModeImpl mode = (ModeImpl) WindowManagerImpl.getInstance().findMode(tc);
if (mode == null) {
return;
}
if (mode.getKind() == Constants.MODE_KIND_EDITOR) {
ActionUtils.cloneWindow(tc);
}
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class CloneDocumentAction method updateEnabled.
private void updateEnabled() {
TopComponent tc = TopComponent.getRegistry().getActivated();
if (tc != null) {
ModeImpl mode = (ModeImpl) WindowManagerImpl.getInstance().findMode(tc);
setEnabled(tc instanceof TopComponent.Cloneable && mode != null && mode.getKind() == Constants.MODE_KIND_EDITOR);
}
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class DockModeAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
WindowManagerImpl wmi = WindowManagerImpl.getInstance();
ModeImpl contextMode = getMode2WorkWith();
if (null == contextMode)
// just being paranoid
return;
if (null != slidingMode) {
WindowManagerImpl.getInstance().userRestoredMode(slidingMode, contextMode);
} else {
boolean isDocked = contextMode.getState() == Constants.MODE_STATE_JOINED;
if (!isDocked) {
wmi.userDockedMode(contextMode);
}
}
}
Aggregations