use of org.openide.windows.TopComponent in project Universal-G-Code-Sender by winder.
the class EditGcodeFile method closeOpenFile.
private void closeOpenFile() {
updateListener(false);
Collection<TopComponent> editors = getCurrentlyOpenedEditors();
for (TopComponent editor : editors) {
editor.close();
}
}
use of org.openide.windows.TopComponent in project Universal-G-Code-Sender by winder.
the class EditGcodeFile method getCurrentlyOpenedEditors.
/**
* Get all the windows in the "Editor" mode, then filter to just editors.
*/
private Collection<TopComponent> getCurrentlyOpenedEditors() {
final ArrayList<TopComponent> result = new ArrayList<>();
Collection<TopComponent> comps = TopComponent.getRegistry().getOpened();
for (TopComponent tc : comps) {
Node[] arr = tc.getActivatedNodes();
for (int j = 0; arr != null && j < arr.length; j++) {
EditorCookie ec = arr[j].getCookie(EditorCookie.class);
if (ec != null) {
result.add(tc);
}
}
}
return result;
}
Aggregations