Пример #1
0
  /**
   * Returns the currently selected package. The current package is the one that is currently
   * selected by the user interface. It can return null if there is no currently open package.
   *
   * @return The currentPackage value
   */
  public BPackage getCurrentPackage() {
    if (!myWrapper.isValid()) throw new ExtensionUnloadedException();

    // This is here and NOT into a BProject since it depends on user interface.

    PkgMgrFrame pmf = PkgMgrFrame.getMostRecent();
    // If there is nothing at all open there is no Frame open...
    if (pmf == null) return null;

    Package pkg = pmf.getPackage();
    // The frame may be there BUT have no package.
    if (pkg == null) return null;

    return pkg.getBPackage();
  }