org.openide.windows.Mode.getTopComponents()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.openide.windows.Mode.getTopComponents()方法的一些代码示例,展示了Mode.getTopComponents()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mode.getTopComponents()方法的具体详情如下:
包路径:org.openide.windows.Mode
类名称:Mode
方法名:getTopComponents

Mode.getTopComponents介绍

[英]Get all top components currently docked into this mode.
[中]将所有顶级组件当前停靠到此模式。

代码示例

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public Mode findMode(TopComponent tc) {
  for(Iterator it = getModes().iterator(); it.hasNext(); ) {
    Mode m = (Mode)it.next();
    if(Arrays.asList(m.getTopComponents()).contains(tc)) {
      return m;
    }
  }
  
  return null;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public Mode findMode(TopComponent tc) {
  for(Iterator it = getModes().iterator(); it.hasNext(); ) {
    Mode m = (Mode)it.next();
    if(Arrays.asList(m.getTopComponents()).contains(tc)) {
      return m;
    }
  }
  
  return null;
}

代码示例来源:origin: senbox-org/snap-desktop

/**
 * Opens a top component in the given mode.
 *
 * @param topComponent The top component to open.
 * @param modeName     The mode's name.
 * @return {@code true} on success.
 */
public static boolean openInMode(TopComponent topComponent, String modeName) {
  Mode mode = WindowManager.getDefault().findMode(modeName);
  if (mode != null) {
    if (!Arrays.asList(mode.getTopComponents()).contains(topComponent)) {
      if (mode.dockInto(topComponent)) {
        topComponent.open();
        return true;
      }
    } else {
      topComponent.open();
      return true;
    }
  }
  return false;
}

代码示例来源:origin: nl.cloudfarming.client/nbtaskfocus-core

@Override
  public void run() {
    Mode tcMode = WindowManager.getDefault().findMode("editor"); // NOI18N 
    TopComponent[] topComponents = tcMode.getTopComponents();
    TopComponent tcToClose = null;
    for (TopComponent tc : topComponents) {
      Lookup lookup = tc.getLookup();
      FileObject fileObject = getFileObject(lookup);
      if (null != fileObject) {
        String path = fileObject.getPath();
        if (path.equals(filePath)) {
          tcToClose = tc;
          break;
        }
      }
    }
    if (null != tcToClose) {
      tcToClose.close();
    }
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-designer

TopComponent[] tcs = m.getTopComponents();

相关文章