Java Code Examples for org.openide.windows.TopComponent#getRegistry()
The following examples show how to use
org.openide.windows.TopComponent#getRegistry() .
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: DocumentsAction.java From netbeans with Apache License 2.0 | 6 votes |
public DocumentsAction() { putValue(Action.NAME, NbBundle.getMessage(DocumentsAction.class, "CTL_DocumentsAction")); propListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if(TopComponent.Registry.PROP_OPENED.equals(evt.getPropertyName())) { updateState(); } } }; TopComponent.Registry registry = TopComponent.getRegistry(); registry.addPropertyChangeListener(WeakListeners.propertyChange(propListener, registry)); // #37529 WindowsAPI to be called from AWT thread only. if(SwingUtilities.isEventDispatchThread()) { updateState(); } else { SwingUtilities.invokeLater(new Runnable() { public void run() { updateState(); } }); } }
Example 2
Source File: MaximizeWindowAction.java From netbeans with Apache License 2.0 | 6 votes |
public MaximizeWindowAction() { String label = NbBundle.getMessage(MaximizeWindowAction.class, "CTL_MaximizeWindowAction"); //NOI18N putValue(Action.NAME, label); propListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { String propName = evt.getPropertyName(); if(WindowManagerImpl.PROP_MAXIMIZED_MODE.equals(propName) || WindowManagerImpl.PROP_EDITOR_AREA_STATE.equals(evt.getPropertyName()) || WindowManager.PROP_MODES.equals(evt.getPropertyName()) || WindowManagerImpl.PROP_ACTIVE_MODE.equals(evt.getPropertyName())) { updateState(); } // #64876: correctly initialize after startup if (TopComponent.Registry.PROP_ACTIVATED.equals(propName)) { updateState(); } } }; TopComponent.Registry registry = TopComponent.getRegistry(); registry.addPropertyChangeListener(WeakListeners.propertyChange(propListener, registry)); WindowManagerImpl wm = WindowManagerImpl.getInstance(); wm.addPropertyChangeListener(WeakListeners.propertyChange(propListener, wm)); updateState(); }
Example 3
Source File: PaletteSwitch.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void run() { if( !SwingUtilities.isEventDispatchThread() ) { SwingUtilities.invokeLater( this ); return; } currentToken = new Object(); TopComponent.Registry registry = TopComponent.getRegistry(); final TopComponent activeTc = registry.getActivated(); final Set<TopComponent> opened = new HashSet<TopComponent>(registry.getOpened()); final PaletteController existingPalette = currentPalette; final boolean isMaximized = isPaletteMaximized(); final Object token = currentToken; RP.post(new Runnable() { @Override public void run() { findNewPalette(existingPalette, activeTc, opened, isMaximized, token); } }); }
Example 4
Source File: CurrentEditorScanningScope.java From netbeans with Apache License 2.0 | 6 votes |
private FileObject getCurrentFile() { TopComponent.Registry registry = TopComponent.getRegistry(); TopComponent activeTc = registry.getActivated(); FileObject newFile = getFileFromTopComponent( activeTc ); ArrayList<FileObject> availableFiles = new ArrayList<FileObject>(3); if( null == newFile ) { Collection<TopComponent> openedTcs = new ArrayList<TopComponent>( registry.getOpened()); for( Iterator i=openedTcs.iterator(); i.hasNext(); ) { TopComponent tc = (TopComponent)i.next(); FileObject file = getFileFromTopComponent( tc ); if( null != file ) { availableFiles.add( file ); } } if( null != currentFile && (availableFiles.contains( currentFile ) ) ) newFile = currentFile; else if( availableFiles.size() > 0 ) newFile = availableFiles.get( 0 ); } return newFile; }
Example 5
Source File: PaletteSwitch.java From netbeans with Apache License 2.0 | 5 votes |
private boolean isPaletteMaximized() { boolean isMaximized = true; TopComponent.Registry registry = TopComponent.getRegistry(); Set openedTcs = registry.getOpened(); for( Iterator i=openedTcs.iterator(); i.hasNext(); ) { TopComponent tc = (TopComponent)i.next(); if( tc.isShowing() && !(tc instanceof PaletteTopComponent) ) { //other window(s) than the Palette are showing isMaximized = false; break; } } return isMaximized; }
Example 6
Source File: DebuggerManagerListener.java From netbeans with Apache License 2.0 | 5 votes |
private void fillOpenedDebuggerComponents(Set<ComponentInitiallyOpened> componentsInitiallyOpened) { // For simplicity, add all opened components. These will not be closed when finishing the debugging session. TopComponent.Registry registry = TopComponent.getRegistry(); synchronized (registry) { for (TopComponent tc : registry.getOpened()) { componentsInitiallyOpened.add(new ComponentInitiallyOpened(tc)); } } }
Example 7
Source File: GlobalActionContextImpl.java From netbeans with Apache License 2.0 | 4 votes |
public GlobalActionContextImpl () { this (TopComponent.getRegistry()); }