Java Code Examples for org.openide.windows.WindowManager#findTopComponent()
The following examples show how to use
org.openide.windows.WindowManager#findTopComponent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecentViewList.java From netbeans with Apache License 2.0 | 6 votes |
/** Used to get array for view and for persistence */ public TopComponent [] getTopComponents() { List<TopComponent> tcList = new ArrayList<TopComponent>(tcIdList.size()); WindowManager wm = WindowManager.getDefault(); for (int i = 0; i < tcIdList.size(); i++) { String tcId = tcIdList.get( i ); TopComponent tc = null; Reference<TopComponent> ref = tcCache.get( tcId ); if( null != ref ) { tc = ref.get(); } if( null == tc ) { tc = wm.findTopComponent( tcId ); if( null != tc ) tcCache.put( tcId, new WeakReference<TopComponent>( tc ) ); } if ((tc != null) && tc.isOpened()) { tcList.add(tc); } } return tcList.toArray(new TopComponent[tcList.size()]); }
Example 2
Source File: SnapshotsWindow.java From netbeans with Apache License 2.0 | 6 votes |
private SnapshotsWindowUI getUI(boolean create) { if (ui == null) { WindowManager wm = WindowManager.getDefault(); for (TopComponent tc : TopComponent.getRegistry().getOpened()) if (tc.getClientProperty(SnapshotsWindowUI.ID) != null) ui = (SnapshotsWindowUI)tc; if (ui == null && create) ui = (SnapshotsWindowUI)wm.findTopComponent(SnapshotsWindowUI.ID); if (ui == null && create) ui = new SnapshotsWindowUI(); } return ui; }
Example 3
Source File: LaoutPreviewTopComponent.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
static void showLaoutPreview(JPanel panel, String name) { WindowManager wm = WindowManager.getDefault(); TopComponent topComponent = wm.findTopComponent("LaoutPreviewTopComponent"); // NOI18N if (topComponent == null) { topComponent = new LaoutPreviewTopComponent(); } if (topComponent instanceof LaoutPreviewTopComponent) { if (!topComponent.isOpened()) { Mode mode = wm.findMode("commonpalette"); if (mode != null) { mode.dockInto(topComponent); } topComponent.removeAll(); if (panel != null) { topComponent.add(panel); } topComponent.updateUI(); topComponent.setName("Laout Preview [" + name + "]"); topComponent.setToolTipText("Laout Preview [" + name + "]"); topComponent.open(); } } }
Example 4
Source File: SnapshotsWindow.java From visualvm with GNU General Public License v2.0 | 6 votes |
private SnapshotsWindowUI getUI(boolean create) { if (ui == null) { WindowManager wm = WindowManager.getDefault(); for (TopComponent tc : TopComponent.getRegistry().getOpened()) if (tc.getClientProperty(SnapshotsWindowUI.ID) != null) ui = (SnapshotsWindowUI)tc; if (ui == null && create) ui = (SnapshotsWindowUI)wm.findTopComponent(SnapshotsWindowUI.ID); if (ui == null && create) ui = new SnapshotsWindowUI(); } return ui; }
Example 5
Source File: PaletteTopComponent.java From netbeans with Apache License 2.0 | 5 votes |
static void showPalette() { WindowManager wm = WindowManager.getDefault(); TopComponent palette = wm.findTopComponent("CommonPalette"); // NOI18N if (null == palette) { Logger.getLogger(PaletteSwitch.class.getName()).log(Level.INFO, "Cannot find CommonPalette component."); // NOI18N //for unit-testing palette = getDefault(); } if (!palette.isOpened()) { palette.open(); } }
Example 6
Source File: LaoutPreviewTopComponent.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
static void refresh() { WindowManager wm = WindowManager.getDefault(); TopComponent topComponent = wm.findTopComponent("LaoutPreviewTopComponent"); // NOI18N topComponent.invalidate(); topComponent.repaint(); }
Example 7
Source File: LaoutPreviewTopComponent.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
static void hideLaoutPreview() { WindowManager wm = WindowManager.getDefault(); TopComponent topComponent = wm.findTopComponent("LaoutPreviewTopComponent"); // NOI18N if (null != topComponent) { topComponent.removeAll(); topComponent.close(); } }