本文整理匯總了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();
}