X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjsite%2Fgui%2FFileManager.java;h=f84d5b73c912787b871975d8f91268c0f098cf41;hb=c63257e8cc0ba1a5aca9364b22171abe7279d479;hp=b919bb627c4d27a58a34e4f75fb2604b10845797;hpb=dc37f1e959fe36099d157e6d09b5790d4e06897c;p=jSite2.git
diff --git a/src/net/pterodactylus/jsite/gui/FileManager.java b/src/net/pterodactylus/jsite/gui/FileManager.java
index b919bb6..f84d5b7 100644
--- a/src/net/pterodactylus/jsite/gui/FileManager.java
+++ b/src/net/pterodactylus/jsite/gui/FileManager.java
@@ -84,7 +84,7 @@ import net.pterodactylus.util.swing.SwingUtils;
/**
* Manages physical and virtual files in a project.
- *
+ *
* @author David âBombeâ Roden <bombe@freenetproject.org>
*/
public class FileManager extends JDialog implements I18nable, TreeSelectionListener, MouseListener {
@@ -202,7 +202,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Creates a new file manager.
- *
+ *
* @param swingInterface
* The Swing interface
* @param project
@@ -399,7 +399,11 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
fileOverride = new FileOverride();
project.addFileOverride(projectFile, fileOverride);
}
- fileOverride.setContentType(MimeTypes.getMimeType(getFileExtension(projectFile.getName())));
+ String projectFileName = projectFile.getName();
+ String mimeType = MimeTypes.getMimeType(getFileExtension(projectFileName));
+ fileOverride.setContentType(mimeType);
+ fillComboBox(projectFileName);
+ contentTypeOverrideComboBox.setSelectedItem(mimeType);
} else {
fileOverride.setContentType(null);
if (fileOverride.isEmpty()) {
@@ -408,6 +412,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
}
}
};
+ overrideContentTypeDefaultAction.setEnabled(false);
contentTypeOverrideAction = new AbstractAction() {
/**
@@ -464,7 +469,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Creates the main panel with the file tree and the file properties.
- *
+ *
* @return The mail panel
*/
private Component createFileManagerPanel() {
@@ -568,7 +573,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Creates the button panel.
- *
+ *
* @return The button panel
*/
private Component createButtonPanel() {
@@ -610,7 +615,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Checks whether the given mouse event is a popup trigger and occured over
* a file. If so, the context menu is shown.
- *
+ *
* @param mouseEvent
* The mouse event to check
*/
@@ -640,7 +645,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Finds whether the {@link ProjectFile} given by
* projectFileWrapper
is hidden.
- *
+ *
* @param projectFileWrapper
* The wrapped project file
* @return true
if the file is hidden and should not be
@@ -726,7 +731,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Returns all currently selected {@link ProjectFileWrapper}s.
- *
+ *
* @param filesOnly
* true
to return only selected files,
* false
to include directories
@@ -750,7 +755,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Sets the given actionâs enabled state to the given enabled state if the
* actionâs current enabled state is not the given enabled state.
- *
+ *
* @param action
* The action to set the enabled state on
* @param enabled
@@ -765,7 +770,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Sets the given buttonâs selected state to the given selected state if the
* buttonâs current selected state is not the given selected state.
- *
+ *
* @param button
* The button to set the selected state on
* @param selected
@@ -781,7 +786,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
* Returns the extension of the given filename. If the file name does not
* have an extension, the name of the file (without any path components) is
* returned.
- *
+ *
* @param fileName
* The name of the file
* @return The extension of the file
@@ -794,7 +799,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Repopulates the content type combo box with all content types, putting
* the most probably ones to the front of the list.
- *
+ *
* @param fileName
* The name of the file
*/
@@ -845,7 +850,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
boolean overrideInsertSelected = false;
boolean insertOverrideEnabled = false;
boolean insertOverrideSelected = false;
- String defaultContentType = MimeTypes.DEFAULT_CONTENT_TYPE;
+ String defaultContentType = "";
boolean overrideContentTypeEnabled = false;
boolean overrideContentTypeSelected = false;
boolean contentTypeOverrideEnabled = false;
@@ -940,7 +945,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Tree cell renderer that takes care of certain display properties for
* project-specific stuff.
- *
+ *
* @author David âBombeâ Roden <bombe@freenetproject.org>
*/
private class FileCellRenderer extends DefaultTreeCellRenderer {
@@ -1009,7 +1014,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* TreeModel that is based on {@link Project#getBaseFile()}.
- *
+ *
* @author David âBombeâ Roden <bombe@freenetproject.org>
*/
private class ProjectFileTreeModel implements TreeModel, PropertyChangeListener {
@@ -1053,7 +1058,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Notifies all listeners that a node has changed.
- *
+ *
* @param changedProjectFileWrapper
* The wrapper around the changed project file
*/
@@ -1075,7 +1080,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Notifies all listeners that the tree structure has changed
* significantly.
- *
+ *
* @see TreeModelListener#treeStructureChanged(TreeModelEvent)
* @param newRootNode
*/
@@ -1091,7 +1096,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Sets the new base project file. This causes the model to reload.
- *
+ *
* @param baseProjectFile
* The new base project file
*/
@@ -1112,7 +1117,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Creates {@link ProjectFileWrapper}s for all files below the given
* project file.
- *
+ *
* @param projectFile
* The base project file for all project files to create
* wrappers for
@@ -1240,7 +1245,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Wrapper around a {@link ProjectFile} that overwrites
* {@link Object#toString()} to return the project fileâs name.
- *
+ *
* @author David âBombeâ Roden <bombe@freenetproject.org>
*/
private static class ProjectFileWrapper {
@@ -1253,7 +1258,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Creates a new wrapper around a project file.
- *
+ *
* @param projectFile
* The project file to wrap
*/
@@ -1263,7 +1268,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Returns the wrapped project file.
- *
+ *
* @return The wrapped project file
*/
public ProjectFile getProjectFile() {
@@ -1273,7 +1278,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* Sets the name override. If the name override is not null
* it will be shown insted of the project fileâs name.
- *
+ *
* @param nameOverride
* The name override
*/
@@ -1294,7 +1299,7 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
/**
* A cell renderer for combo boxes that converts the string â--â to a
* separator.
- *
+ *
* @author David âBombeâ Roden <bombe@freenetproject.org>
*/
private class MimeTypeComboBoxRenderer extends DefaultListCellRenderer {