public void run() { Set components = TopComponent.getRegistry().getOpened(); for (Iterator i = components.iterator(); i.hasNext();) { TopComponent tc = (TopComponent) i.next(); if (tc.getClientProperty(ResolveConflictsExecutor.class.getName()) != null) { tc.requestActive(); } } } });
/** * Finds all opened top components in modes of kind "editor" using the given comparator. * * @return The list of opened top components. */ public static List<TopComponent> findOpenEditorWindows(Comparator<TopComponent> comparator) { ArrayList<TopComponent> editorWindows = new ArrayList<>(); Set<TopComponent> openedWindows = WindowManager.getDefault().getRegistry().getOpened(); editorWindows.addAll(openedWindows .stream() .filter(topComponent -> WindowManager.getDefault().isEditorTopComponent(topComponent)) .collect(Collectors.toList())); if (comparator != null) { editorWindows.sort(comparator); } return editorWindows; }
private void captureCurrentState() { TopComponent.Registry registry = WindowManager.getDefault().getRegistry(); Set<TopComponent> topComponents = registry.getOpened(); topComponents.stream() .filter(topComponent -> topComponent instanceof DocumentWindow) .forEach(topComponent -> { DocumentWindow documentWindow = (DocumentWindow) topComponent; openDocumentWindows.add(documentWindow); if (registry.getActivated() == topComponent) { selectedDocumentWindow = documentWindow; } }); }
Set<TopComponent> tcs = TopComponent.getRegistry().getOpened(); for (final TopComponent tc : tcs) { Lookup l = tc.getLookup();
private void perform(final RunDialogPanel runDialogPanel, final boolean isRun) { if (WindowManager.getDefault().getRegistry().getOpened().isEmpty()){
Set tcs = TopComponent.getRegistry().getOpened(); for (Iterator it = tcs.iterator(); it.hasNext(); ) { TopComponent tc = (TopComponent)it.next();
System.out.println("Model support: Inited"); // NOI18N if (TopComponent.getRegistry().getOpened().size() > 0) { if (TRACE_STARTUP) { System.out.println("Model support: Open projects in Init"); // NOI18N
public void actionPerformed(ActionEvent e) { for (TopComponent tc : TopComponent.getRegistry().getOpened()) { if (tc.isVisible()) { SVGDataObject targetDObj = tc.getLookup().lookup(SVGDataObject.class);
/** * Returns files from all opened top components * @return set of opened files */ public static Set<VCSFileProxy> getOpenFiles() { TopComponent[] comps = TopComponent.getRegistry().getOpened().toArray(new TopComponent[0]); Set<VCSFileProxy> openFiles = new HashSet<VCSFileProxy>(comps.length); for (TopComponent tc : comps) { Node[] nodes = tc.getActivatedNodes(); if (nodes == null) { continue; } for (Node node : nodes) { VCSFileProxy file = node.getLookup().lookup(VCSFileProxy.class); if (file == null) { FileObject fo = node.getLookup().lookup(FileObject.class); if (fo != null && fo.isData()) { file = VCSFileProxy.createFileProxy(fo); } } if (file != null) { openFiles.add(file); } } } return openFiles; }
public void run() { Iterator it = TopComponent.getRegistry ().getOpened ().iterator (); while (it.hasNext ()) { TopComponent tc = (TopComponent) it.next (); EditorCookie ec = tc.getLookup ().lookup (EditorCookie.class); if (ec == null) continue; JEditorPane[] eps = ec.getOpenedPanes (); if (eps == null) continue; int i, k = eps.length; for (i = 0; i < k; i++) { if (eps [i].getDocument () == doc) { final JEditorPane ep = eps [i]; if (ep != null) try { ep.scrollRectToVisible (ep.modelToView (offset)); } catch (BadLocationException ex) { ErrorManager.getDefault ().notify (ex); } } } } } });
/** * RequestVisibity for TopComponent */ public static void requestVisibility (DataObjectContext context, String topComponentDisplayName) { Set<TopComponent> topComponents = new HashSet<TopComponent>(TopComponent.getRegistry().getOpened()); for (TopComponent tc : topComponents) { DataEditorView dev = tc.getLookup().lookup(DataEditorView.class); if (dev == null || dev.getContext() != context) continue; MultiViewHandler handler = MultiViews.findMultiViewHandler(tc); for (MultiViewPerspective perspective : handler.getPerspectives()) { if (perspective.getDisplayName().equals(topComponentDisplayName)) { handler.requestVisible(perspective); break; } } } }
/** * Counts the currently opened top components in modes of kind "editor". * * @return The number of currently opened top components in modes of kind "editor" */ public static int countOpenEditorWindows() { int count = 0; WindowManager wm = WindowManager.getDefault(); Set<TopComponent> opened = wm.getRegistry().getOpened(); for (TopComponent openedWindow : opened) { if (wm.isEditorTopComponent(openedWindow)) { count++; } } return count; }
/** * Returns all currently opened issues which aren't new. * * @return issues */ private static Collection<IssueImpl> getOpenIssues() { Set<TopComponent> tcs = TopComponent.getRegistry().getOpened(); List<IssueImpl> issues = new ArrayList<IssueImpl>(); for (TopComponent tc : tcs) { if(tc instanceof IssueTopComponent) { IssueImpl issue = ((IssueTopComponent)tc).getIssue(); if(issue != null && !issue.isNew()) { issues.add(issue); } } } return issues; }
private boolean isOpen(Snapshot s) { File f = FileUtil.toFile(s.getFile()); if (f == null) return false; // #236480 if (s.isHeapDump()) { Set<TopComponent> tcs = WindowManager.getDefault().getRegistry().getOpened(); for (TopComponent tc : tcs) { if (f.equals(tc.getClientProperty(ProfilerTopComponent.RECENT_FILE_KEY))) return true; } } else { LoadedSnapshot ls = ResultsManager.getDefault().findLoadedSnapshot(f); if (ls != null) return true; } return false; }
private static TopComponent findExistingTc(Artifact artifact) { String id = getTcId(artifact); Set<TopComponent> tcs = WindowManager.getDefault().getRegistry().getOpened(); for (TopComponent tc : tcs) { if (id.equals(tc.getClientProperty(MAVEN_TC_PROPERTY))) { return tc; } } return null; }