本文整理汇总了Java中org.openide.windows.TopComponent.getPersistenceType方法的典型用法代码示例。如果您正苦于以下问题:Java TopComponent.getPersistenceType方法的具体用法?Java TopComponent.getPersistenceType怎么用?Java TopComponent.getPersistenceType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.windows.TopComponent
的用法示例。
在下文中一共展示了TopComponent.getPersistenceType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
/**
* Track the given window
* @param tc TopComponent
* @param mode Mode the window is docked to
*/
void add( TopComponent tc, ModeImpl mode ) {
if( tc.getPersistenceType() == TopComponent.PERSISTENCE_NEVER )
return;
String tcId = WindowManagerImpl.getInstance().findTopComponentID( tc );
if( null == tcId )
return;
if( viewIds.contains( tcId ) || editorIds.contains( tcId ) )
return;
if( mode.getKind() != Constants.MODE_KIND_EDITOR ) {
if( editors.contains( tc ) ) {
editorIds.add( tcId );
} else {
viewIds.add( tcId );
}
} else {
editors.add( tc );
}
}
示例2: assertPersistence
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
private void assertPersistence(String msg, int pt, TopComponent cmv) {
CharSequence log = Log.enable("org.netbeans.core.multiview", Level.WARNING);
int res = cmv.getPersistenceType();
if (log.length() > 0) {
fail("There should be no warnings to compute getPersistenceType():\n" + log);
}
assertEquals(msg, pt, res);
}
示例3: run
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
@Override
public void run() {
for (TopComponent tc : TopComponent.getRegistry().getOpened()) {
if (TopComponent.PERSISTENCE_NEVER == tc.getPersistenceType()) {
addFile(tc);
}
}
}
示例4: isViewTopComponent
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
/**
* Check whether the given TopComponent is an editor window or a view window.
* @param tc
* @return True if the given TopComponent has persistence type <code>PERSISTENCE_ALWAYS</code>
* or <code>PERSISTENCE_ONLY_OPENED</code> and was initially opened in a view or
* sliding mode. Also returns true if the given TopComponent has peristence type
* <code>PERSISTENCE_NEVER</code> and is docked in non-editor mode.
* Returns false in all other cases.
*/
public boolean isViewTopComponent( TopComponent tc ) {
if( tc.getPersistenceType() == TopComponent.PERSISTENCE_NEVER ) {
ModeImpl mode = ( ModeImpl ) WindowManagerImpl.getInstance().findMode( tc );
return null != mode && mode.getKind() != Constants.MODE_KIND_EDITOR;
}
String id = WindowManagerImpl.getInstance().findTopComponentID( tc );
return id != null && viewIds.contains( id );
}
示例5: persistenceType
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
/** Just a method to wrap up all calls to TopComponent.getPersistenceType(),
* so we can do some tricks with the return value in future.
*
* @param tc top component to find persistence type for
* @return the type
*/
private static int persistenceType(TopComponent tc) {
return tc.getPersistenceType();
}