Пример #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();
  }
Пример #2
0
  /**
   * Returns the current frame being displayed. Can be used (e.g.) as a "parent" frame for
   * positioning modal dialogs. If there is a package currently open, it's probably better to use
   * its <code>getFrame()</code> method to provide better placement.
   *
   * @return The currentFrame value
   */
  public Frame getCurrentFrame() {
    if (!myWrapper.isValid()) throw new ExtensionUnloadedException();

    return PkgMgrFrame.getMostRecent();
  }