X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fgui%2FFileManager.java;h=953e05dc894ee4e6f5c67510ba4d0b6cda743243;hb=a5fcf3cbb126fe4115ff32d5adc0026f2fcf9e7f;hp=f84d5b73c912787b871975d8f91268c0f098cf41;hpb=c63257e8cc0ba1a5aca9364b22171abe7279d479;p=jSite2.git diff --git a/src/net/pterodactylus/jsite/gui/FileManager.java b/src/net/pterodactylus/jsite/gui/FileManager.java index f84d5b7..953e05d 100644 --- a/src/net/pterodactylus/jsite/gui/FileManager.java +++ b/src/net/pterodactylus/jsite/gui/FileManager.java @@ -59,9 +59,11 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JSeparator; +import javax.swing.JSplitPane; import javax.swing.JTextField; import javax.swing.JTree; import javax.swing.SwingConstants; +import javax.swing.border.EmptyBorder; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; import javax.swing.event.TreeSelectionEvent; @@ -254,16 +256,19 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe public void actionPerformed(ActionEvent e) { String defaultFile = project.getDefaultFile(); if ((defaultFile == null) || (defaultFile.length() == 0)) { - /* TODO - i18n */ - JOptionPane.showMessageDialog(FileManager.this, I18n.get(""), I18n.get(""), JOptionPane.ERROR_MESSAGE); - return; - } - ProjectFile projectFile = project.getFile(defaultFile); - if (projectFile == null) { - JOptionPane.showMessageDialog(FileManager.this, I18n.get(""), I18n.get(""), JOptionPane.ERROR_MESSAGE); - return; + int selectedOption = JOptionPane.showOptionDialog(FileManager.this, I18n.get("fileManager.dialog.noDefaultFileSet.message"), I18n.get("fileManager.dialog.noDefaultFileSet.title"), 0, JOptionPane.WARNING_MESSAGE, null, new String[] { I18n.get("general.button.continue.name"), I18n.get("general.button.cancel.name") }, I18n.get("general.button.cancel.name")); + if (selectedOption == 1) { + return; + } + } else { + ProjectFile projectFile = project.getFile(defaultFile); + if (projectFile == null) { + /* TODO - i18n */ + JOptionPane.showMessageDialog(FileManager.this, I18n.get(""), I18n.get(""), JOptionPane.ERROR_MESSAGE); + return; + } + setVisible(false); } - setVisible(false); } }; rescanAction = new I18nAction("fileManager.button.rescan") { @@ -360,6 +365,8 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe project.removeFileOverride(projectFile); } } + fileTree.setShowsRootHandles(false); + fileTree.repaint(); } }; overrideInsertDefaultAction.setEnabled(false); @@ -473,11 +480,13 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe * @return The mail panel */ private Component createFileManagerPanel() { - JPanel fileManagerPanel = new JPanel(new BorderLayout(12, 12)); + JSplitPane fileManagerPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true); + fileManagerPanel.setBorder(null); /* file tree panel */ JPanel fileTreePanel = new JPanel(new BorderLayout(12, 12)); - fileManagerPanel.add(fileTreePanel, BorderLayout.LINE_START); + fileTreePanel.setBorder(new EmptyBorder(0, 0, 0, 12)); + fileManagerPanel.setLeftComponent(fileTreePanel); fileTree = new JTree(fileTreeModel); fileTree.setShowsRootHandles(false); @@ -494,7 +503,8 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe /* the right panel */ JPanel rightPanel = new JPanel(new BorderLayout(12, 12)); - fileManagerPanel.add(rightPanel, BorderLayout.CENTER); + rightPanel.setBorder(new EmptyBorder(0, 12, 0, 0)); + fileManagerPanel.setRightComponent(rightPanel); /* properties panel */ JPanel propertiesPanel = new JPanel(new GridBagLayout());