Пример #1
0
  private JPanel createPreviewPanel() {
    JPanel panel;
    YBoxPanel headerPanel;
    JScrollPane scroll;

    panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createTitledBorder(Translator.get("preview")));

    headerPanel = new YBoxPanel();
    headerPanel.add(new JLabel(Translator.get("run_dialog.run_command_description") + ":"));
    headerPanel.add(historyPreview = new EditableComboBox(new JTextField("mucommander -v")));
    historyPreview.addItem("mucommander -v");
    historyPreview.addItem("java -version");

    headerPanel.addSpace(10);
    headerPanel.add(new JLabel(Translator.get("run_dialog.command_output") + ":"));

    panel.add(headerPanel, BorderLayout.NORTH);

    shellPreview = new JTextArea(15, 15);
    panel.add(
        scroll =
            new JScrollPane(
                shellPreview,
                JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED),
        BorderLayout.CENTER);
    scroll.getViewport().setPreferredSize(shellPreview.getPreferredSize());
    shellPreview.append(RuntimeConstants.APP_STRING);
    shellPreview.append("\nCopyright (C) ");
    shellPreview.append(RuntimeConstants.COPYRIGHT);
    shellPreview.append(
        " Maxence Bernard\nThis is free software, distributed under the terms of the GNU General Public License.");
    //        shellPreview.setLineWrap(true);
    shellPreview.setCaretPosition(0);

    setForegroundColors();
    setBackgroundColors();

    return panel;
  }
Пример #2
0
  /**
   * Creates the dialog's main panel.
   *
   * @return the dialog's main panel.
   */
  private JPanel createMainPanel() {
    YBoxPanel mainPanel;
    JPanel okPanel;

    mainPanel = new YBoxPanel();
    mainPanel.add(new JLabel(Translator.get("setup.intro")));
    mainPanel.addSpace(10);
    mainPanel.add(createThemePanel());
    mainPanel.addSpace(10);
    mainPanel.add(createLookAndFeelPanel());
    mainPanel.addSpace(10);

    okPanel = new JPanel();
    okPanel.setLayout(new FlowLayout(FlowLayout.TRAILING));
    okPanel.add(okButton = new JButton(Translator.get("ok")));
    okButton.addActionListener(this);

    mainPanel.add(okPanel);

    return mainPanel;
  }
Пример #3
0
  private JComponent createConfigurationPanel(
      int fontId,
      int foregroundId,
      int backgroundId,
      int selectedForegroundId,
      int selectedBackgroundId,
      JComponent fontListener) {
    YBoxPanel mainPanel;
    ProportionalGridPanel colorPanel;
    JPanel flowPanel;
    FontChooser fontChooser;

    mainPanel = new YBoxPanel();

    fontChooser = createFontChooser(fontId);
    mainPanel.add(fontChooser);
    mainPanel.addSpace(10);
    addFontChooserListener(fontChooser, fontListener);

    colorPanel = new ProportionalGridPanel(3);
    addLabelRow(colorPanel, false);

    addColorButtons(colorPanel, fontChooser, "theme_editor.normal", foregroundId, backgroundId)
        .addPropertyChangeListener(this);
    addColorButtons(
            colorPanel,
            fontChooser,
            "theme_editor.selected",
            selectedForegroundId,
            selectedBackgroundId)
        .addPropertyChangeListener(this);

    flowPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    flowPanel.add(colorPanel);
    flowPanel.setBorder(BorderFactory.createTitledBorder(Translator.get("theme_editor.colors")));

    mainPanel.add(flowPanel);

    return createScrollPane(mainPanel);
  }
  public ChangePermissionsDialog(MainFrame mainFrame, FileSet files) {
    super(
        mainFrame,
        ActionProperties.getActionLabel(ChangePermissionsAction.Descriptor.ACTION_ID),
        files);

    YBoxPanel mainPanel = new YBoxPanel();

    mainPanel.add(
        new JLabel(
            ActionProperties.getActionLabel(ChangePermissionsAction.Descriptor.ACTION_ID) + " :"));
    mainPanel.addSpace(10);

    JPanel gridPanel = new JPanel(new GridLayout(4, 4));
    permCheckBoxes = new JCheckBox[5][5];
    JCheckBox permCheckBox;

    AbstractFile firstFile = files.elementAt(0);
    int permSetMask = firstFile.getChangeablePermissions().getIntValue();
    boolean canSetPermission = permSetMask != 0;
    int defaultPerms = firstFile.getPermissions().getIntValue();

    gridPanel.add(new JLabel());
    gridPanel.add(new JLabel(Translator.get("permissions.read")));
    gridPanel.add(new JLabel(Translator.get("permissions.write")));
    gridPanel.add(new JLabel(Translator.get("permissions.executable")));

    for (int a = USER_ACCESS; a >= OTHER_ACCESS; a--) {
      gridPanel.add(
          new JLabel(
              Translator.get(
                  a == USER_ACCESS
                      ? "permissions.user"
                      : a == GROUP_ACCESS ? "permissions.group" : "permissions.other")));

      for (int p = READ_PERMISSION; p >= EXECUTE_PERMISSION; p = p >> 1) {
        permCheckBox = new JCheckBox();
        permCheckBox.setSelected((defaultPerms & (p << a * 3)) != 0);

        // Enable the checkbox only if the permission can be set in the destination
        if ((permSetMask & (p << a * 3)) == 0) permCheckBox.setEnabled(false);
        else permCheckBox.addItemListener(this);

        gridPanel.add(permCheckBox);
        permCheckBoxes[a][p] = permCheckBox;
      }
    }

    mainPanel.add(gridPanel);

    octalPermTextField = new JTextField(3);
    // Constrains text field to 3 digits, from 0 to 7 (octal base)
    Document doc =
        new SizeConstrainedDocument(3) {
          @Override
          public void insertString(int offset, String str, AttributeSet attributeSet)
              throws BadLocationException {
            int strLen = str.length();
            char c;
            for (int i = 0; i < strLen; i++) {
              c = str.charAt(i);
              if (c < '0' || c > '7') return;
            }

            super.insertString(offset, str, attributeSet);
          }
        };
    octalPermTextField.setDocument(doc);
    // Initializes the field's value
    updateOctalPermTextField();

    if (canSetPermission) {
      doc.addDocumentListener(this);
    }
    // Disable text field if no permission bit can be set
    else {
      octalPermTextField.setEnabled(false);
    }

    mainPanel.addSpace(10);
    JPanel tempPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    tempPanel.add(new JLabel(Translator.get("permissions.octal_notation")));
    tempPanel.add(octalPermTextField);
    mainPanel.add(tempPanel);

    mainPanel.addSpace(15);

    recurseDirCheckBox = new JCheckBox(Translator.get("recurse_directories"));
    // Disable check box if no permission bit can be set
    recurseDirCheckBox.setEnabled(
        canSetPermission && (files.size() > 1 || files.elementAt(0).isDirectory()));
    mainPanel.add(recurseDirCheckBox);

    // Create file details button and OK/cancel buttons and lay them out a single row
    JPanel fileDetailsPanel = createFileDetailsPanel();

    okButton = new JButton(Translator.get("change"));
    cancelButton = new JButton(Translator.get("cancel"));

    mainPanel.add(
        createButtonsPanel(
            createFileDetailsButton(fileDetailsPanel),
            DialogToolkit.createOKCancelPanel(okButton, cancelButton, getRootPane(), this)));
    mainPanel.add(fileDetailsPanel);

    getContentPane().add(mainPanel, BorderLayout.NORTH);

    if (!canSetPermission) {
      // Disable OK button if no permission bit can be set
      okButton.setEnabled(false);
    }

    getRootPane().setDefaultButton(canSetPermission ? okButton : cancelButton);
    setResizable(false);
  }
Пример #5
0
  public MailPanel(PreferencesDialog parent) {
    super(parent, Translator.get("prefs_dialog.mail_tab"));

    setLayout(new BorderLayout());

    YBoxPanel mainPanel = new YBoxPanel(5);
    mainPanel.setBorder(
        BorderFactory.createTitledBorder(Translator.get("prefs_dialog.mail_settings")));

    // Text fields panel
    XAlignedComponentPanel compPanel = new XAlignedComponentPanel();

    // Name field
    nameField =
        new PrefTextField(
            MuConfigurations.getPreferences().getVariable(MuPreference.MAIL_SENDER_NAME, "")) {
          public boolean hasChanged() {
            return !nameField
                .getText()
                .equals(
                    MuConfigurations.getPreferences()
                        .getVariable(MuPreference.MAIL_SENDER_NAME, ""));
          }
        };
    compPanel.addRow(Translator.get("prefs_dialog.mail_name"), nameField, 10);

    // Email field
    emailField =
        new PrefTextField(
            MuConfigurations.getPreferences().getVariable(MuPreference.MAIL_SENDER_ADDRESS, "")) {
          public boolean hasChanged() {
            return !emailField
                .getText()
                .equals(
                    MuConfigurations.getPreferences()
                        .getVariable(MuPreference.MAIL_SENDER_ADDRESS, ""));
          }
        };
    compPanel.addRow(Translator.get("prefs_dialog.mail_address"), emailField, 10);

    // SMTP field
    smtpField =
        new PrefTextField(
            MuConfigurations.getPreferences().getVariable(MuPreference.SMTP_SERVER, "")) {
          public boolean hasChanged() {
            return !smtpField
                .getText()
                .equals(
                    MuConfigurations.getPreferences().getVariable(MuPreference.SMTP_SERVER, ""));
          }
        };
    compPanel.addRow(Translator.get("prefs_dialog.mail_server"), smtpField, 10);

    // SMTP port field
    portField =
        new PrefTextField(
            ""
                + MuConfigurations.getPreferences()
                    .getVariable(MuPreference.SMTP_PORT, MuPreferences.DEFAULT_SMTP_PORT)) {
          public boolean hasChanged() {
            return !portField
                .getText()
                .equals(
                    String.valueOf(
                        MuConfigurations.getPreferences()
                            .getVariable(MuPreference.SMTP_PORT, MuPreferences.DEFAULT_SMTP_PORT)));
          }
        };
    compPanel.addRow(Translator.get("server_connect_dialog.port"), portField, 10);

    mainPanel.add(compPanel, BorderLayout.NORTH);
    add(mainPanel, BorderLayout.NORTH);

    nameField.addDialogListener(parent);
    emailField.addDialogListener(parent);
    smtpField.addDialogListener(parent);
    portField.addDialogListener(parent);
  }
Пример #6
0
  public FoldersPanel(PreferencesDialog parent) {
    super(parent, Translator.get("prefs_dialog.folders_tab"));

    setLayout(new BorderLayout());

    // Startup folders panel
    YBoxPanel startupFolderPanel = new YBoxPanel();
    startupFolderPanel.setBorder(
        BorderFactory.createTitledBorder(Translator.get("prefs_dialog.startup_folders")));

    // Last folders or custom folders selections
    lastFoldersRadioButton =
        new PrefRadioButton(Translator.get("prefs_dialog.last_folder")) {
          public boolean hasChanged() {
            return !(isSelected()
                    ? MuPreferences.STARTUP_FOLDERS_LAST
                    : MuPreferences.STARTUP_FOLDERS_CUSTOM)
                .equals(
                    MuConfigurations.getPreferences().getVariable(MuPreference.STARTUP_FOLDERS));
          }
        };
    customFoldersRadioButton =
        new PrefRadioButton(Translator.get("prefs_dialog.custom_folder")) {
          public boolean hasChanged() {
            return !(isSelected()
                    ? MuPreferences.STARTUP_FOLDERS_CUSTOM
                    : MuPreferences.STARTUP_FOLDERS_LAST)
                .equals(
                    MuConfigurations.getPreferences().getVariable(MuPreference.STARTUP_FOLDERS));
          }
        };
    startupFolderPanel.add(lastFoldersRadioButton);
    startupFolderPanel.addSpace(5);
    startupFolderPanel.add(customFoldersRadioButton);

    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(lastFoldersRadioButton);
    buttonGroup.add(customFoldersRadioButton);

    customFoldersRadioButton.addItemListener(this);

    // Custom folders specification
    JLabel leftFolderLabel = new JLabel(Translator.get("prefs_dialog.left_folder"));
    leftFolderLabel.setAlignmentX(LEFT_ALIGNMENT);

    JLabel rightFolderLabel = new JLabel(Translator.get("prefs_dialog.right_folder"));
    rightFolderLabel.setAlignmentX(LEFT_ALIGNMENT);

    // Panel that contains the text field and button for specifying custom left folder
    XBoxPanel leftCustomFolderSpecifyingPanel = new XBoxPanel(5);
    leftCustomFolderSpecifyingPanel.setAlignmentX(LEFT_ALIGNMENT);

    // Create a path field with auto-completion capabilities
    leftCustomFolderTextField = new PrefFilePathFieldWithDefaultValue(true);
    leftCustomFolderTextField.addKeyListener(this);
    leftCustomFolderSpecifyingPanel.add(leftCustomFolderTextField);

    leftCustomFolderButton = new JButton("...");
    leftCustomFolderButton.addActionListener(this);
    leftCustomFolderSpecifyingPanel.add(leftCustomFolderButton);

    // Panel that contains the text field and button for specifying custom right folder
    XBoxPanel rightCustomFolderSpecifyingPanel = new XBoxPanel(5);
    rightCustomFolderSpecifyingPanel.setAlignmentX(LEFT_ALIGNMENT);

    // Create a path field with auto-completion capabilities
    rightCustomFolderTextField = new PrefFilePathFieldWithDefaultValue(false);
    rightCustomFolderTextField.addKeyListener(this);
    rightCustomFolderSpecifyingPanel.add(rightCustomFolderTextField);

    rightCustomFolderButton = new JButton("...");
    rightCustomFolderButton.addActionListener(this);
    rightCustomFolderSpecifyingPanel.add(rightCustomFolderButton);

    JPanel container = new JPanel(new SpringLayout());
    container.add(leftFolderLabel);
    container.add(leftCustomFolderSpecifyingPanel);
    container.add(rightFolderLabel);
    container.add(rightCustomFolderSpecifyingPanel);

    // Lay out the panel.
    SpringUtilities.makeCompactGrid(
        container, 2, 2, // rows, cols
        20, 6, // initX, initY
        6, 6); // xPad, yPad

    startupFolderPanel.add(container);

    if (MuConfigurations.getPreferences()
        .getVariable(MuPreference.STARTUP_FOLDERS, "")
        .equals(MuPreferences.STARTUP_FOLDERS_LAST)) {
      lastFoldersRadioButton.setSelected(true);
      setCustomFolderComponentsEnabled(false);
    } else customFoldersRadioButton.setSelected(true);

    // --------------------------------------------------------------------------------------------------------------

    YBoxPanel northPanel = new YBoxPanel();
    northPanel.add(startupFolderPanel);
    northPanel.addSpace(5);

    showHiddenFilesCheckBox =
        new PrefCheckBox(Translator.get("prefs_dialog.show_hidden_files")) {
          public boolean hasChanged() {
            return isSelected()
                != MuConfigurations.getPreferences()
                    .getVariable(
                        MuPreference.SHOW_HIDDEN_FILES, MuPreferences.DEFAULT_SHOW_HIDDEN_FILES);
          }
        };
    showHiddenFilesCheckBox.setSelected(
        MuConfigurations.getPreferences()
            .getVariable(MuPreference.SHOW_HIDDEN_FILES, MuPreferences.DEFAULT_SHOW_HIDDEN_FILES));
    northPanel.add(showHiddenFilesCheckBox);

    // Mac OS X-only options
    if (OsFamily.MAC_OS_X.isCurrent()) {
      // Monitor showHiddenFilesCheckBox state to disable 'show .DS_Store files' option
      // when 'Show hidden files' is disabled, as .DS_Store files are hidden files
      showHiddenFilesCheckBox.addItemListener(this);

      showDSStoreFilesCheckBox =
          new PrefCheckBox(Translator.get("prefs_dialog.show_ds_store_files")) {
            public boolean hasChanged() {
              return isSelected()
                  != MuConfigurations.getPreferences()
                      .getVariable(
                          MuPreference.SHOW_DS_STORE_FILES,
                          MuPreferences.DEFAULT_SHOW_DS_STORE_FILES);
            }
          };
      showDSStoreFilesCheckBox.setSelected(
          MuConfigurations.getPreferences()
              .getVariable(
                  MuPreference.SHOW_DS_STORE_FILES, MuPreferences.DEFAULT_SHOW_DS_STORE_FILES));
      showDSStoreFilesCheckBox.setEnabled(showHiddenFilesCheckBox.isSelected());
      // Shift the check box to the right to indicate that it is a sub-option
      northPanel.add(showDSStoreFilesCheckBox, 20);
    }

    if (OsFamily.MAC_OS_X.isCurrent() || OsFamily.WINDOWS.isCurrent()) {
      showSystemFoldersCheckBox =
          new PrefCheckBox(Translator.get("prefs_dialog.show_system_folders")) {
            public boolean hasChanged() {
              return isSelected()
                  != MuConfigurations.getPreferences()
                      .getVariable(
                          MuPreference.SHOW_SYSTEM_FOLDERS,
                          MuPreferences.DEFAULT_SHOW_SYSTEM_FOLDERS);
            }
          };
      showSystemFoldersCheckBox.setSelected(
          MuConfigurations.getPreferences()
              .getVariable(
                  MuPreference.SHOW_SYSTEM_FOLDERS, MuPreferences.DEFAULT_SHOW_SYSTEM_FOLDERS));
      northPanel.add(showSystemFoldersCheckBox);
    }

    compactSizeCheckBox =
        new PrefCheckBox(Translator.get("prefs_dialog.compact_file_size")) {
          public boolean hasChanged() {
            return isSelected()
                != MuConfigurations.getPreferences()
                    .getVariable(
                        MuPreference.DISPLAY_COMPACT_FILE_SIZE,
                        MuPreferences.DEFAULT_DISPLAY_COMPACT_FILE_SIZE);
          }
        };
    compactSizeCheckBox.setSelected(
        MuConfigurations.getPreferences()
            .getVariable(
                MuPreference.DISPLAY_COMPACT_FILE_SIZE,
                MuPreferences.DEFAULT_DISPLAY_COMPACT_FILE_SIZE));
    northPanel.add(compactSizeCheckBox);

    followSymlinksCheckBox =
        new PrefCheckBox(Translator.get("prefs_dialog.follow_symlinks_when_cd")) {
          public boolean hasChanged() {
            return isSelected()
                != MuConfigurations.getPreferences()
                    .getVariable(
                        MuPreference.CD_FOLLOWS_SYMLINKS,
                        MuPreferences.DEFAULT_CD_FOLLOWS_SYMLINKS);
          }
        };
    followSymlinksCheckBox.setSelected(
        MuConfigurations.getPreferences()
            .getVariable(
                MuPreference.CD_FOLLOWS_SYMLINKS, MuPreferences.DEFAULT_CD_FOLLOWS_SYMLINKS));
    northPanel.add(followSymlinksCheckBox);

    showTabHeaderCheckBox =
        new PrefCheckBox(Translator.get("prefs_dialog.show_tab_header")) {
          public boolean hasChanged() {
            return isSelected()
                != MuConfigurations.getPreferences()
                    .getVariable(
                        MuPreference.SHOW_TAB_HEADER, MuPreferences.DEFAULT_SHOW_TAB_HEADER);
          }
        };
    showTabHeaderCheckBox.setSelected(
        MuConfigurations.getPreferences()
            .getVariable(MuPreference.SHOW_TAB_HEADER, MuPreferences.DEFAULT_SHOW_TAB_HEADER));
    northPanel.add(showTabHeaderCheckBox);

    add(northPanel, BorderLayout.NORTH);

    lastFoldersRadioButton.addDialogListener(parent);
    customFoldersRadioButton.addDialogListener(parent);
    rightCustomFolderTextField.addDialogListener(parent);
    leftCustomFolderTextField.addDialogListener(parent);
    showHiddenFilesCheckBox.addDialogListener(parent);
    compactSizeCheckBox.addDialogListener(parent);
    followSymlinksCheckBox.addDialogListener(parent);
    showTabHeaderCheckBox.addDialogListener(parent);
    if (OsFamily.MAC_OS_X.isCurrent()) {
      showDSStoreFilesCheckBox.addDialogListener(parent);
    }
    if (OsFamily.MAC_OS_X.isCurrent() || OsFamily.WINDOWS.isCurrent()) {
      showSystemFoldersCheckBox.addDialogListener(parent);
    }
  }
Пример #7
0
  private void init(FolderPanel leftFolderPanel, FolderPanel rightFolderPanel) {
    // Set the window icon
    setWindowIcon();

    if (OsFamily.MAC_OS_X.isCurrent()) {
      // Lion Fullscreen support
      FullScreenUtilities.setWindowCanFullScreen(this, true);
    }

    // Enable window resize
    setResizable(true);

    // The toolbar should have no inset, this is why it is left out of the insetsPane
    JPanel contentPane = new JPanel(new BorderLayout());
    setContentPane(contentPane);

    // Initializes the folder panels and file tables.
    this.leftFolderPanel = leftFolderPanel;
    this.rightFolderPanel = rightFolderPanel;
    leftTable = leftFolderPanel.getFileTable();
    rightTable = rightFolderPanel.getFileTable();
    activeTable = leftTable;

    // Create the toolbar and corresponding panel wrapping it, and show it only if it hasn't been
    // disabled in the
    // preferences.
    // Note: Toolbar.setVisible() has to be called no matter if Toolbar is visible or not, in order
    // for it to be
    // properly initialized
    this.toolbar = new ToolBar(this);
    this.toolbarPanel = ToolbarMoreButton.wrapToolBar(toolbar);
    this.toolbarPanel.setVisible(
        MuConfigurations.getPreferences()
            .getVariable(MuPreference.TOOLBAR_VISIBLE, MuPreferences.DEFAULT_TOOLBAR_VISIBLE));
    contentPane.add(toolbarPanel, BorderLayout.NORTH);

    JPanel insetsPane =
        new JPanel(new BorderLayout()) {
          // Add an x=3,y=3 gap around content pane
          @Override
          public Insets getInsets() {
            return new Insets(0, 3, 3, 3); // No top inset
          }
        };

    // Below the toolbar there is the pane with insets
    contentPane.add(insetsPane, BorderLayout.CENTER);

    // Listen to location change events to display the current folder in the window's title
    leftFolderPanel.getLocationManager().addLocationListener(this);
    rightFolderPanel.getLocationManager().addLocationListener(this);

    // Create menu bar (has to be created after toolbar)
    MainMenuBar menuBar = new MainMenuBar(this);
    setJMenuBar(menuBar);

    // Create the split pane that separates folder panels and allows to resize how much space is
    // allocated to the
    // both of them. The split orientation is loaded from and saved to the preferences.
    // Note: the vertical/horizontal terminology used in muCommander is just the opposite of the one
    // used
    // in JSplitPane which is anti-natural / confusing.
    splitPane =
        new ProportionalSplitPane(
            this,
            MuConfigurations.getSnapshot()
                    .getVariable(
                        MuSnapshot.getSplitOrientation(0), MuSnapshot.DEFAULT_SPLIT_ORIENTATION)
                    .equals(MuSnapshot.VERTICAL_SPLIT_ORIENTATION)
                ? JSplitPane.HORIZONTAL_SPLIT
                : JSplitPane.VERTICAL_SPLIT,
            false,
            MainFrame.this.leftFolderPanel,
            MainFrame.this.rightFolderPanel) {
          // We don't want any extra space around split pane
          @Override
          public Insets getInsets() {
            return new Insets(0, 0, 0, 0);
          }
        };

    // Remove any default border the split pane has
    splitPane.setBorder(null);

    // Adds buttons that allow to collapse and expand the split pane in both directions
    splitPane.setOneTouchExpandable(true);

    // Disable all the JSPlitPane accessibility shortcuts that are registered by default, as some of
    // them
    // conflict with default mucommander action shortcuts (e.g. F6 and F8)
    splitPane.disableAccessibilityShortcuts();

    // Split pane will be given any extra space
    insetsPane.add(splitPane, BorderLayout.CENTER);

    // Add a 2-pixel gap between the file table and status bar
    YBoxPanel southPanel = new YBoxPanel();
    southPanel.addSpace(2);

    // Add status bar
    this.statusBar = new StatusBar(this);
    southPanel.add(statusBar);

    // Show command bar only if it hasn't been disabled in the preferences
    this.commandBar = new CommandBar(this);
    // Note: CommandBar.setVisible() has to be called no matter if CommandBar is visible or not, in
    // order for it to be properly initialized
    this.commandBar.setVisible(
        MuConfigurations.getPreferences()
            .getVariable(
                MuPreference.COMMAND_BAR_VISIBLE, MuPreferences.DEFAULT_COMMAND_BAR_VISIBLE));
    southPanel.add(commandBar);
    insetsPane.add(southPanel, BorderLayout.SOUTH);

    // Perform CloseAction when the user asked the window to close
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            ActionManager.performAction(CloseWindowAction.Descriptor.ACTION_ID, MainFrame.this);
          }
        });

    ActionKeymap.registerActions(this);

    // Fire table change events on registered ActivePanelListener instances, to notify of the intial
    // active table.
    fireActivePanelChanged(activeTable.getFolderPanel());

    // Set the custom FocusTraversalPolicy that manages focus for both FolderPanel and their
    // subcomponents.
    setFocusTraversalPolicy(new CustomFocusTraversalPolicy());
  }