use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class MoveWindowWithinModeAction method actionPerformed.
@Override
public void actionPerformed(java.awt.event.ActionEvent ev) {
if (EditorOnlyDisplayer.getInstance().isActive()) {
return;
}
TopComponent contextTc = null == tc ? TopComponent.getRegistry().getActivated() : tc;
if (null == contextTc)
return;
ModeImpl mode = (ModeImpl) WindowManagerImpl.getInstance().findMode(contextTc);
if (null == mode)
return;
int position = mode.getTopComponentTabPosition(contextTc);
if (moveLeft)
position--;
else
position++;
if (position >= 0 && position < mode.getOpenedTopComponents().size())
mode.addOpenedTopComponent(contextTc, position);
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class NextTabAction method actionPerformed.
public void actionPerformed(ActionEvent evt) {
TopComponent tc = TopComponent.getRegistry().getActivated();
if (tc == null) {
return;
}
ModeImpl mode = (ModeImpl) WindowManagerImpl.getInstance().findMode(tc);
List openedTcs = mode.getOpenedTopComponents();
int index = openedTcs.indexOf(tc);
if (index == -1) {
return;
}
// Next tab.
index++;
if (index >= openedTcs.size()) {
index = 0;
}
TopComponent select = (TopComponent) openedTcs.get(index);
if (select == null) {
return;
}
mode.setSelectedTopComponent(select);
select.requestActive();
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class RecentViewListAction method getRecentWindows.
private static TopComponent[] getRecentWindows(boolean editors, boolean views) {
WindowManagerImpl wm = WindowManagerImpl.getInstance();
TopComponent[] documents = wm.getRecentViewList();
TopComponentTracker tcTracker = TopComponentTracker.getDefault();
List<TopComponent> docsList = new ArrayList<TopComponent>();
for (int i = 0; i < documents.length; i++) {
TopComponent tc = documents[i];
if (tc == null) {
continue;
}
ModeImpl mode = (ModeImpl) wm.findMode(tc);
if (mode == null) {
continue;
}
if ((editors && tcTracker.isEditorTopComponent(tc)) || (views && tcTracker.isViewTopComponent(tc))) {
docsList.add(tc);
}
}
return docsList.toArray(new TopComponent[0]);
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class CloseAllDocumentsAction method isEnabled.
@Override
public boolean isEnabled() {
if (!Switches.isEditorTopComponentClosingEnabled())
return false;
WindowManagerImpl wmi = WindowManagerImpl.getInstance();
if (isContext) {
TopComponent activeTC = TopComponent.getRegistry().getActivated();
ModeImpl mode = (ModeImpl) wmi.findMode(activeTC);
return mode != null && mode.getKind() == Constants.MODE_KIND_EDITOR && !mode.getOpenedTopComponents().isEmpty();
} else {
return wmi.getEditorTopComponents().length > 0;
}
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class DockModeAction method isEnabled.
@Override
public boolean isEnabled() {
ModeImpl contextMode = getMode2WorkWith();
if (null == contextMode)
return false;
if (null != slidingMode)
return true;
boolean docked = contextMode.getState() == Constants.MODE_STATE_JOINED;
if (docked)
return false;
if (contextMode.getKind() == Constants.MODE_KIND_EDITOR)
return Switches.isEditorModeUndockingEnabled();
return contextMode.getKind() == Constants.MODE_KIND_VIEW && Switches.isViewModeUndockingEnabled();
}
Aggregations