本文整理汇总了Java中org.openide.windows.TopComponent.getRegistry方法的典型用法代码示例。如果您正苦于以下问题:Java TopComponent.getRegistry方法的具体用法?Java TopComponent.getRegistry怎么用?Java TopComponent.getRegistry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.windows.TopComponent
的用法示例。
在下文中一共展示了TopComponent.getRegistry方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
});
}
}
示例3: 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();
}
示例4: 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;
}
示例5: 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;
}
示例6: 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));
}
}
}
示例7: GlobalActionContextImpl
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
public GlobalActionContextImpl () {
this (TopComponent.getRegistry());
}