use of org.netbeans.core.windows.TopComponentTracker 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.TopComponentTracker 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.TopComponentTracker in project netbeans-rcp-lite by outersky.
the class DocumentsDlg method getOpenedDocuments.
private static List<TopComponent> getOpenedDocuments() {
WindowManagerImpl wm = WindowManagerImpl.getInstance();
TopComponent[] recentDocuments = wm.getRecentViewList();
List<TopComponent> documents = new ArrayList<TopComponent>(recentDocuments.length);
TopComponentTracker tcTracker = TopComponentTracker.getDefault();
for (TopComponent tc : recentDocuments) {
if (tcTracker.isEditorTopComponent(tc)) {
documents.add(tc);
}
}
return documents;
}
Aggregations