當前位置: 首頁>>代碼示例>>Java>>正文


Java TopComponent.Registry方法代碼示例

本文整理匯總了Java中org.openide.windows.TopComponent.Registry方法的典型用法代碼示例。如果您正苦於以下問題:Java TopComponent.Registry方法的具體用法?Java TopComponent.Registry怎麽用?Java TopComponent.Registry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openide.windows.TopComponent的用法示例。


在下文中一共展示了TopComponent.Registry方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
@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);
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:PaletteSwitch.java

示例2: getContext

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
private JavaSource getContext() {
    FileObject fo = Utilities.actionsGlobalContext().lookup(FileObject.class);
    if (fo == null) {
        final DataObject dobj = Utilities.actionsGlobalContext().lookup(DataObject.class);
        if (dobj != null) {
            fo = dobj.getPrimaryFile();
        }
    }
    if (fo == null) {
        return null;
    }
    TopComponent.Registry regs = WindowManager.getDefault().getRegistry();
    final TopComponent tc = regs.getActivated();
    final MultiViewHandler h = tc == null ?
            null :
            MultiViews.findMultiViewHandler(tc);
    if (h != null && FORM_VIEW_ID.equals(h.getSelectedPerspective().preferredID())) {
        //Form view does not support Members View
        return null;
    }
    return JavaSource.forFileObject(fo);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:ShowMembersAction.java

示例3: Menu

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
/** Creates new instance for menu/popup presenter.
* @param popup true if this should represent popup
* @param arr nodes to work with or null if global one should be used
*/
Menu (boolean popup, Lookup lookup) {
    this.popup = popup;
    this.lookup = lookup;
    
    changeMenuItems (createMenu (popup, lookup));

    if (lookup == null) {
        // listen only when nodes not provided
        TopComponent.Registry r = WindowManager.getDefault ().getRegistry ();

        r.addPropertyChangeListener (
            WeakListeners.propertyChange (this, r)
        );
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:FileSystemAction.java

示例4: DocumentsAction

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
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();
            }
        });
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:DocumentsAction.java

示例5: MaximizeWindowAction

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:MaximizeWindowAction.java

示例6: getCurrentFile

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:CurrentEditorScanningScope.java

示例7: isPaletteMaximized

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:PaletteSwitch.java

示例8: GlobalActionContextImpl

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
public GlobalActionContextImpl (TopComponent.Registry r) {
    this.registry = r;
    if (EventQueue.isDispatchThread()) {
        run();
    } else {
        EventQueue.invokeLater(this);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:GlobalActionContextImpl.java

示例9: fillOpenedDebuggerComponents

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
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));
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:DebuggerManagerListener.java


注:本文中的org.openide.windows.TopComponent.Registry方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。