Beispiel #1
0
  /**
   * Updates this window's title to show currently active folder and window number. This method is
   * called by this class and WindowManager.
   */
  public void updateWindowTitle() {
    // Update window title
    String title = activeTable.getFolderPanel().getCurrentFolder().getAbsolutePath();

    // Add the application name to window title on all OSs except MAC
    if (!OsFamily.MAC_OS_X.isCurrent()) title += " - muCommander";

    java.util.List<MainFrame> mainFrames = WindowManager.getMainFrames();
    if (mainFrames.size() > 1) title += " [" + (mainFrames.indexOf(this) + 1) + "]";
    setTitle(title);

    // Use new Window decorations introduced in Mac OS X 10.5 (Leopard)
    if (OsFamily.MAC_OS_X.isCurrent() && OsVersion.MAC_OS_X_10_5.isCurrentOrHigher()) {
      // Displays the document icon in the window title bar, works only for local files
      AbstractFile currentFolder = activeTable.getFolderPanel().getCurrentFolder();
      Object javaIoFile;
      if (currentFolder.getURL().getScheme().equals(FileProtocols.FILE)) {
        // If the current folder is an archive entry, display the archive file, this is the closest
        // we can get
        // with a java.io.File
        if (currentFolder.hasAncestor(AbstractArchiveEntryFile.class))
          javaIoFile = currentFolder.getParentArchive().getUnderlyingFileObject();
        else javaIoFile = currentFolder.getUnderlyingFileObject();
      } else {
        // If the current folder is not a local file, use the special /Network directory which is
        // sort of
        // 'Network Neighborhood'.
        javaIoFile = new java.io.File("/Network");
      }

      // Note that for some strange reason (looks like a bug), setting the property to null won't
      // remove
      // the previous icon.
      getRootPane().putClientProperty("Window.documentFile", javaIoFile);
    }
  }
 @Override
 public Object getUnderlyingFileObject() {
   return file.getUnderlyingFileObject();
 }