本文整理汇总了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);
}
});
}
示例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);
}
示例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)
);
}
}
示例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();
}
});
}
}
示例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();
}
示例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;
}
示例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;
}
示例8: GlobalActionContextImpl
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
public GlobalActionContextImpl (TopComponent.Registry r) {
this.registry = r;
if (EventQueue.isDispatchThread()) {
run();
} else {
EventQueue.invokeLater(this);
}
}
示例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));
}
}
}