use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class PreviousTabAction 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;
}
// Previous tab.
index--;
if (index < 0) {
index = openedTcs.size() - 1;
}
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 ResetWindowsAction method collectEditors.
private TopComponent[] collectEditors() {
TopComponentTracker tcTracker = TopComponentTracker.getDefault();
ArrayList<TopComponent> editors = new ArrayList<TopComponent>(TopComponent.getRegistry().getOpened().size());
// collect from the main editor mode first
ModeImpl editorMode = (ModeImpl) WindowManagerImpl.getInstance().findMode("editor");
if (null != editorMode) {
for (TopComponent tc : editorMode.getOpenedTopComponents()) {
if (tcTracker.isViewTopComponent(tc))
continue;
editors.add(tc);
}
}
for (ModeImpl m : WindowManagerImpl.getInstance().getModes()) {
if ("editor".equals(m.getName()))
continue;
for (TopComponent tc : m.getOpenedTopComponents()) {
if (tcTracker.isViewTopComponent(tc))
continue;
editors.add(tc);
}
}
return editors.toArray(new TopComponent[editors.size()]);
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class ResizeModeAction method actionPerformed.
@Override
public void actionPerformed(java.awt.event.ActionEvent ev) {
updateEnabled();
if (!isEnabled())
return;
ModeImpl contextMode = getModeToWorkWith();
Component c = contextMode.getSelectedTopComponent();
MultiSplitPane splitPane = (MultiSplitPane) SwingUtilities.getAncestorOfClass(MultiSplitPane.class, c);
splitPane.startResizing(c);
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class DockWindowAction 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;
if (wmi.isTopComponentMinimized(contextTC)) {
// restore from minimized state
wmi.setTopComponentMinimized(contextTC, false);
} else {
// dock floating window
boolean isDocked = wmi.isDocked(contextTC);
ModeImpl mode = (ModeImpl) wmi.findMode(contextTC);
if (!isDocked) {
wmi.userDockedTopComponent(contextTC, mode);
}
}
}
use of org.netbeans.core.windows.ModeImpl in project netbeans-rcp-lite by outersky.
the class MoveModeAction method actionPerformed.
@Override
public void actionPerformed(java.awt.event.ActionEvent ev) {
updateEnabled();
if (!isEnabled())
return;
ModeImpl contextMode = getModeToWorkWith();
if (null == contextMode)
return;
WindowManagerImpl.getInstance().userStartedKeyboardDragAndDrop(new TopComponentDraggable(contextMode));
}
Aggregations